curl -sS -X POST "$BMA_BASE_URL/v1/machines" \
-H "x-api-key: $BMA_API_KEY" \
-H "bma-workspace-id: $BMA_PROJECT_ID" \
-H "Idempotency-Key: $(uuidgen)" \
-H "content-type: application/json" \
-d '{}'{
"type": "machine",
"id": "<string>",
"org_id": "<string>",
"source_kind": "byo",
"agent_ids": [
"<string>"
],
"machine_pool_id": "<string>",
"display_name": "<string>",
"description": "<string>",
"provider": "<string>",
"lifecycle_state": "provisioning",
"connection_state": "online",
"connection_state_reason": "<string>",
"power_state": "running",
"last_observed_at": "2023-11-07T05:31:56Z",
"cwd": "<string>",
"env": {},
"secret_env": {},
"lifecycle_reason_code": "<string>",
"lifecycle_reason_message": "<string>",
"failure_report": {
"stage": "startup_script",
"output_tail": "<string>",
"output_truncated": true,
"reported_at": "2023-11-07T05:31:56Z",
"exit_status": 123,
"daemon_version": "<string>",
"target_version": "<string>"
},
"next_reconcile_after": "2023-11-07T05:31:56Z",
"provision_attempts": 123,
"delete_attempts": 123,
"metadata": {},
"deleted_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"kind": "persistent",
"machine_pool_name": "<string>",
"cpu": 2,
"memory_mb": 2,
"agent_id": "<string>",
"capabilities": {
"machine_id": "<string>",
"terminal": {
"supported": true,
"reason": "<string>"
},
"session_files": {
"declared": true
},
"desktop": {
"supported": true,
"webrtc": true,
"rfb": true,
"livekit": true,
"control": true,
"native_webrtc": true,
"reason": "<string>"
},
"permissions": {
"terminal": true,
"desktop_watch": true,
"desktop_control": true
},
"protocol_versions": {
"terminal": 123,
"desktop": 123
},
"harnesses": [
"<string>"
]
},
"token": "<string>",
"token_record": {
"id": "<string>",
"org_id": "<string>",
"machine_id": "<string>",
"name": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"revoke_reason": "<string>"
},
"project_grants": [
{
"id": "<string>",
"org_id": "<string>",
"project_id": "<string>",
"machine_id": "<string>",
"source_kind": "explicit",
"description": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"project_machine_pool_grant_id": "<string>"
}
]
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>"
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>"
},
"request_id": "<string>"
}Create a machine
persistent: true + machine_pool_id (+ template, display_name, agent_ids) creates a persistent machine owned by the workspace (createWorkspacePersistentMachine): the pool starts its sandbox, no agent is needed, the sessions of agent_ids (every agent of the workspace when empty) may use it and the workspace deletes it; source: byo connects a BYO machine (connectBYOMachine) and returns the one-time token; otherwise createMachine. Deprecated: agent_id + persistent: true creates an agent persistent machine (createAgentPersistentMachine).
curl -sS -X POST "$BMA_BASE_URL/v1/machines" \
-H "x-api-key: $BMA_API_KEY" \
-H "bma-workspace-id: $BMA_PROJECT_ID" \
-H "Idempotency-Key: $(uuidgen)" \
-H "content-type: application/json" \
-d '{}'{
"type": "machine",
"id": "<string>",
"org_id": "<string>",
"source_kind": "byo",
"agent_ids": [
"<string>"
],
"machine_pool_id": "<string>",
"display_name": "<string>",
"description": "<string>",
"provider": "<string>",
"lifecycle_state": "provisioning",
"connection_state": "online",
"connection_state_reason": "<string>",
"power_state": "running",
"last_observed_at": "2023-11-07T05:31:56Z",
"cwd": "<string>",
"env": {},
"secret_env": {},
"lifecycle_reason_code": "<string>",
"lifecycle_reason_message": "<string>",
"failure_report": {
"stage": "startup_script",
"output_tail": "<string>",
"output_truncated": true,
"reported_at": "2023-11-07T05:31:56Z",
"exit_status": 123,
"daemon_version": "<string>",
"target_version": "<string>"
},
"next_reconcile_after": "2023-11-07T05:31:56Z",
"provision_attempts": 123,
"delete_attempts": 123,
"metadata": {},
"deleted_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"kind": "persistent",
"machine_pool_name": "<string>",
"cpu": 2,
"memory_mb": 2,
"agent_id": "<string>",
"capabilities": {
"machine_id": "<string>",
"terminal": {
"supported": true,
"reason": "<string>"
},
"session_files": {
"declared": true
},
"desktop": {
"supported": true,
"webrtc": true,
"rfb": true,
"livekit": true,
"control": true,
"native_webrtc": true,
"reason": "<string>"
},
"permissions": {
"terminal": true,
"desktop_watch": true,
"desktop_control": true
},
"protocol_versions": {
"terminal": 123,
"desktop": 123
},
"harnesses": [
"<string>"
]
},
"token": "<string>",
"token_record": {
"id": "<string>",
"org_id": "<string>",
"machine_id": "<string>",
"name": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"revoke_reason": "<string>"
},
"project_grants": [
{
"id": "<string>",
"org_id": "<string>",
"project_id": "<string>",
"machine_id": "<string>",
"source_kind": "explicit",
"description": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"project_machine_pool_grant_id": "<string>"
}
]
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>"
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>"
},
"request_id": "<string>"
}请求头
请求体
Workspace persistent machine (persistent true, machine_pool_id, template, display_name), BYO connect (source byo, display_name, ...) or org machine (display_name, ...); the native request of that family. agent_id is deprecated.
The agents bound to a persistent machine (an agent may be bound to several). On a persistent pool machine they are also the only agents whose sessions may use it; empty, every agent of the owning workspace may. Each must be an agent of that workspace (404 otherwise). Replaced as a whole; only a persistent pool machine accepts a non-empty list.
100^aprf_[a-z2-7]{26}$响应
Success.
A machine (a workspace persistent machine, an org machine or a connected BYO machine with its one-time token) or a deprecated agent machine (kind, machine_pool_name, cpu, memory_mb, agent_id); the fields of the other families are absent.
Compute state of a pool machine. paused keeps the disk (and memory when the provider supports it) without compute; resuming means a resume or restore is in flight; archived means the machine image is stored durably and is restored on the next access.
running, pausing, paused, resuming, archiving, archived