Skip to content
API status
API reference

Drain queued commands

POST
/api/v1/management/servers/{serverId}/commands/drain
curl --request POST \
--url https://api.koneth.com/api/v1/management/servers/6be9a699-2f28-402e-b64e-93ba6bdafe1b/commands/drain \
--header 'Authorization: <Authorization>' \
--header 'Content-Type: application/json' \
--header 'X-Request-Id: onboarding-client-1042' \
--data '{ "maxPolls": 20 }'

Polls the server for queued commands immediately, up to maxPolls times, and stops early when a poll finds nothing. Requires accounts:create. Use this right after creating accounts in bulk so the server starts the work without waiting for its scheduled poll. It returns how many polls it took and how many commands were leased; it does not wait for those commands to finish. Track each command with GET /api/v1/management/commands/{commandId}.

serverId
required
string format: uuid

UUID of a trading server owned by your organization.

Example
6be9a699-2f28-402e-b64e-93ba6bdafe1b
X-Request-Id
string

Optional correlation ID used for API request billing and logs.

Example
onboarding-client-1042
Media typeapplication/json
object
maxPolls

Maximum number of polls to perform before returning.

integer
default: 20 >= 1 <= 50

Command drain completed.

Media typeapplication/json
object
polls
required

Number of polls performed.

integer
leased
required

Number of commands the server leased.

integer
Example
{
"polls": 3,
"leased": 12
}

Invalid request.

Media typeapplication/json
object
error
required
string
issues

Validation issue details when the request fails schema validation.

Array<object>
object
key
additional properties
any
Examplegenerated
{
"error": "example",
"issues": [
{}
]
}

Management API authentication is missing or invalid.

Media typeapplication/json
object
error
required
string
issues

Validation issue details when the request fails schema validation.

Array<object>
object
key
additional properties
any
Example
{
"error": "Management API authentication required"
}

The organization cannot cover the active API request price.

Media typeapplication/json
object
error
required
string
issues

Validation issue details when the request fails schema validation.

Array<object>
object
key
additional properties
any
Example
{
"error": "Insufficient API credits"
}

The key lacks the required scope or server access.

Media typeapplication/json
object
error
required
string
issues

Validation issue details when the request fails schema validation.

Array<object>
object
key
additional properties
any
Example
{
"error": "Missing API scope: accounts:read"
}

Unexpected server error.

Media typeapplication/json
object
error
required
string
issues

Validation issue details when the request fails schema validation.

Array<object>
object
key
additional properties
any
Example
{
"error": "Internal server error"
}