Trading accounts
Get a close-all run
Progress and outcome of one close-all run. Poll every few seconds while status is running.
accounts lists only the accounts where something was closed or cancelled. failures lists accounts that could not be confirmed, with a code: ENGINE_UNAVAILABLE (the request for the account did not go through), NO_RESULT (no outcome was reported for the account), CLOSE_FAILED (closing a position was refused; working orders may still have been cancelled) or INTERNAL_ERROR. Start a new run, for example with those accountIds, to retry them.
Requires view permission on traders.
curl "https://api.hyperprop.com/platform/v1/organization/flatten-runs/3f2a9c1e-8b7d-4e6f-a5c4-1d2e3f4a5b6c" \
-H "X-API-Key: hp_live_your_key_here"
GET
/
v1
/
organization
/
flatten-runs
/
{runId}
Get a close-all run
curl --request GET \
--url https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"runId": "3f2a9c1e-8b7d-4e6f-a5c4-1d2e3f4a5b6c",
"scope": "all",
"status": "completed",
"reason": "Market data outage",
"requestedBy": "ops@yourfirm.com",
"total": 7180,
"processed": 7180,
"accountsFlattened": 412,
"positionsClosed": 530,
"ordersCancelled": 244,
"failed": 0,
"createdAt": "2026-10-17T14:02:11.000Z",
"lastProgressAt": "2026-10-17T14:04:52.000Z",
"completedAt": "2026-10-17T14:04:52.000Z",
"accounts": [
{
"accountId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"accountNumber": "ACME-50K-000123",
"positionsClosed": 1,
"ordersCancelled": 2
}
],
"failures": [
{
"accountId": "9b2e1f4c-3d5a-4b6c-8e7f-0a1b2c3d4e5f",
"code": "ENGINE_UNAVAILABLE",
"message": "The trading engine did not confirm this account; run again to retry it"
}
],
"failuresTruncated": false
}
}{
"success": false,
"statusCode": 401,
"error": "Unauthorized",
"message": "Authentication required",
"code": "UNAUTHORIZED"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "Your role does not have write access to \"Traders & accounts\"",
"code": "INSUFFICIENT_PERMISSIONS"
}{
"success": false,
"statusCode": 404,
"error": "Not Found",
"message": "Close-all run not found",
"code": "FLATTEN_RUN_NOT_FOUND"
}{
"success": false,
"statusCode": 500,
"error": "Internal Server Error",
"message": "An unexpected error occurred",
"code": "INTERNAL_ERROR"
}{
"statusCode": 504,
"error": "Gateway Timeout",
"message": "The request did not complete within 25 seconds. Try again, or narrow it (for example a shorter date range).",
"code": "REQUEST_TIMEOUT"
}⌘I
Get a close-all run
curl --request GET \
--url https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperprop.com/platform/v1/organization/flatten-runs/{runId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"runId": "3f2a9c1e-8b7d-4e6f-a5c4-1d2e3f4a5b6c",
"scope": "all",
"status": "completed",
"reason": "Market data outage",
"requestedBy": "ops@yourfirm.com",
"total": 7180,
"processed": 7180,
"accountsFlattened": 412,
"positionsClosed": 530,
"ordersCancelled": 244,
"failed": 0,
"createdAt": "2026-10-17T14:02:11.000Z",
"lastProgressAt": "2026-10-17T14:04:52.000Z",
"completedAt": "2026-10-17T14:04:52.000Z",
"accounts": [
{
"accountId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"accountNumber": "ACME-50K-000123",
"positionsClosed": 1,
"ordersCancelled": 2
}
],
"failures": [
{
"accountId": "9b2e1f4c-3d5a-4b6c-8e7f-0a1b2c3d4e5f",
"code": "ENGINE_UNAVAILABLE",
"message": "The trading engine did not confirm this account; run again to retry it"
}
],
"failuresTruncated": false
}
}{
"success": false,
"statusCode": 401,
"error": "Unauthorized",
"message": "Authentication required",
"code": "UNAUTHORIZED"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "Your role does not have write access to \"Traders & accounts\"",
"code": "INSUFFICIENT_PERMISSIONS"
}{
"success": false,
"statusCode": 404,
"error": "Not Found",
"message": "Close-all run not found",
"code": "FLATTEN_RUN_NOT_FOUND"
}{
"success": false,
"statusCode": 500,
"error": "Internal Server Error",
"message": "An unexpected error occurred",
"code": "INTERNAL_ERROR"
}{
"statusCode": 504,
"error": "Gateway Timeout",
"message": "The request did not complete within 25 seconds. Try again, or narrow it (for example a shorter date range).",
"code": "REQUEST_TIMEOUT"
}