Docs navigation
Files

Create Folder

Create Folder

POST/v2/tasks/{task_id}/files/folders

**Admission responses.** This endpoint answers four ways when the task has no usable machine. The three 409s are told apart by `detail.code`; a billing refusal is told apart by its HTTP status: - `machine_not_ready` (409, with `Retry-After`) — provisioning is in progress. Retry. - `task_run_busy` (409, with `Retry-After`) — the task holds an active run lease. Retry. - `task_terminal_no_machine` (409, **no** `Retry-After`) — nothing will ever provision this task. Do not retry. - 402 or 429 — the payer was refused by the credit gate. Do not retry; surface the billing error. What `detail` holds on a refusal is described below. `Retry-After` is present on the two retryable 409s and absent on the terminal one, so it is the quick check; `detail.code` is the precise one. Retrying a terminal answer will never succeed. On a credit refusal this endpoint returns the upstream entitlement body under `detail` — its `error` field carries the upstream code, for example `CREDITS_EXHAUSTED` — and the task is marked terminal.

Path Parameters

task_idstring · uuidrequired

Request Body

pathstringrequired
modestringoptional
Request
curl --request POST \
  --url https://api.brainbaselabs.com/v2/tasks/{task_id}/files/folders \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "path": "string",
  "mode": "755"
}'
Response
json
{
  "name": "string",
  "path": "string",
  "is_dir": true,
  "size": 0,
  "mod_time": "string",
  "mode": "string",
  "permissions": "string",
  "owner": "string",
  "group": "string"
}