Close every open position
const url = 'https://api.koneth.com/api/v1/management/servers/6be9a699-2f28-402e-b64e-93ba6bdafe1b/accounts/7001042/positions/close-all';const options = { method: 'POST', headers: { 'Idempotency-Key': 'account-create-client-1042', 'X-Request-Id': 'onboarding-client-1042', Authorization: '<Authorization>', 'Content-Type': 'application/json' }, body: '{"side":"ALL","requestId":"close-all-client-1042"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.koneth.com/api/v1/management/servers/6be9a699-2f28-402e-b64e-93ba6bdafe1b/accounts/7001042/positions/close-all \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: account-create-client-1042' \ --header 'X-Request-Id: onboarding-client-1042' \ --data '{ "side": "ALL", "requestId": "close-all-client-1042" }'Closes all open positions on an account, or only the BUY or SELL side.
Each position closes at its own authoritative quote, and the response
result reports how many closed and which positions failed. Requires
positions:write.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”UUID of a trading server owned by your organization.
Example
6be9a699-2f28-402e-b64e-93ba6bdafe1bTrading account number.
Example
7001042Header Parameters
Section titled “Header Parameters”Unique key for this logical mutation. Reuse it only when retrying the same operation. Maximum 100 characters.
Example
account-create-client-1042Optional correlation ID used for API request billing and logs.
Example
onboarding-client-1042Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
{ "side": "ALL", "requestId": "close-all-client-1042"}Responses
Section titled “Responses”An earlier command was returned for the idempotency key.
object
object
object
Example
{ "command": { "operation": "account.create", "status": "queued" }}Operation queued.
object
object
object
Example
{ "command": { "operation": "account.create", "status": "queued" }}Invalid request.
object
Validation issue details when the request fails schema validation.
object
Examplegenerated
{ "error": "example", "issues": [ {} ]}Management API authentication is missing or invalid.
object
Validation issue details when the request fails schema validation.
object
Example
{ "error": "Management API authentication required"}The organization cannot cover the active API request price.
object
Validation issue details when the request fails schema validation.
object
Example
{ "error": "Insufficient API credits"}The key lacks the required scope or server access.
object
Validation issue details when the request fails schema validation.
object
Example
{ "error": "Missing API scope: accounts:read"}The requested resource was not found.
object
Validation issue details when the request fails schema validation.
object
Examplegenerated
{ "error": "example", "issues": [ {} ]}The request conflicts with the current resource state.
object
Validation issue details when the request fails schema validation.
object
Examplegenerated
{ "error": "example", "issues": [ {} ]}Unexpected server error.
object
Validation issue details when the request fails schema validation.
object
Example
{ "error": "Internal server error"}