Skip to main content

Execute Command Async

POST /execute_async

Queue Python code or a shell command in your session's VM and return at once with HTTP 202 and a task_id. The request body is the same as POST /execute: without session_id a new session is created, and the session's VM is started if it has none. Read the result with GET /v1/executions/{item_id}, using task_id as the id: is_complete turns true when it has finished.

Authentication​

Requires authentication via: OAuth2PasswordBearer.

Parameters​

NameInTypeRequiredDescriptionConstraints
X-API-Keyheaderstring | nullNonullable

Request Body​

Required: Yes

application/json​

Resolved schema:

{
"properties": {
"command": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Command"
},
"code": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Code"
},
"api_key": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Api Key"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Session Id"
},
"language": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Language",
"default": "python"
},
"timeout": {
"type": "integer",
"maximum": 600,
"minimum": 1,
"title": "Timeout",
"default": 60
},
"vault_ids": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Vault Ids"
}
},
"type": "object",
"title": "CommandRequest"
}

Field details:

FieldTypeRequiredDescriptionConstraints
commandstring | nullNonullable
codestring | nullNonullable
api_keystring | nullNonullable
session_idstring | nullNonullable
languagestring | nullNonullable
timeoutintegerNodefault=60, min=1, max=600
vault_idsarray<string> | nullNonullable
vault_ids[]stringNo

Responses​

200​

Successful Response

application/json​

Resolved schema:

{}

400​

session_id is not a valid UUID, or vault_ids could not be validated.

No response body.

401​

No credentials, or the Bearer token / X-API-Key is invalid.

No response body.

402​

Your account cannot run commands: no usable subscription or credits remain; detail says why.

No response body.

403​

The account is disabled, or a guest token was used; or the session belongs to another account; a vault_ids entry is not yours; the API key sent belongs to another account or is inactive; or the session needs a new VM and your account may not start VMs yet (see detail.code).

No response body.

404​

Session not found, or the API key sent is not a known key.

No response body.

409​

The session's VM is being killed, or vault_ids differ from the session's or were sent after its VM was assigned.

No response body.

422​

Validation Error

application/json​

Resolved schema:

{
"properties": {
"detail": {
"items": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
}

Field details:

FieldTypeRequiredDescriptionConstraints
detailarray<object>No
detail[]objectNo
detail[].locarray<string | integer>No
detail[].loc[]string | integerNo
detail[].msgstringNo
detail[].typestringNo

429​

Your plan's per-minute request limit, concurrent VM limit or VM start rate is reached.

No response body.

503​

No capacity is available, the VM is unreachable or still being recovered, or a backend is briefly unavailable. Retry, after Retry-After when given.

No response body.