Tasks
Outcome billing: list the tasks your requests opened and confirm or reject their result.
A task is opened by the first request of a piece of work and settled by its outcome. Confirmation needs the owner's own key — there is no act-as path. Money fields are micro-EUR integers. How tasks and spend interact: tasks & spend.
Agents read tasks through the MCP server tools tasks_list (status, limit), tasks_get (id) and tasks_stats (since). There is no confirm tool: settling a task is billing and stays with a human.
bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
outcome?stringOnly tasks with this outcome.
"pass""fail""error""unconfirmed""confirmed""cancelled""open"limit?integerPage size.
1 <= value <= 20050cursor?stringISO 8601 timestamp with offset — the next_cursor of the previous page.
date-timex-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128One page of tasks.
application/json- response
tasks*array<>next_cursor*|Pass as cursor to fetch the next page; null when there is none.
date-timecurl -X GET 'https://ai.codai.ro/v1/tasks'{ "tasks": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "surface": "proxy", "session_key": "string", "client_task_id": "string", "title": "string", "outcome": "pass", "evidence_kind": "exec_verdict", "evidence_ref": "string", "requests": 0, "cost_micro_usd": 0, "charged_micro_eur": 0, "billed_success": true, "billable_at": "2019-08-24T14:15:22Z", "confirm_deadline_at": "2019-08-24T14:15:22Z", "opened_at": "2019-08-24T14:15:22Z", "last_activity_at": "2019-08-24T14:15:22Z", "closed_at": "2019-08-24T14:15:22Z", "note": "string" } ], "next_cursor": "2019-08-24T14:15:22Z"}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Tasks pending confirmation.
application/json- response
tasks*array<>items <= 100curl -X GET 'https://ai.codai.ro/v1/tasks/pending'{ "tasks": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "surface": "proxy", "session_key": "string", "client_task_id": "string", "title": "string", "outcome": "pass", "evidence_kind": "exec_verdict", "evidence_ref": "string", "requests": 0, "cost_micro_usd": 0, "charged_micro_eur": 0, "billed_success": true, "billable_at": "2019-08-24T14:15:22Z", "confirm_deadline_at": "2019-08-24T14:15:22Z", "opened_at": "2019-08-24T14:15:22Z", "last_activity_at": "2019-08-24T14:15:22Z", "closed_at": "2019-08-24T14:15:22Z", "note": "string" } ]}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
since?stringLower bound on opened_at (inclusive). Defaults to now minus 30 days.
date-timex-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Counts for the window.
application/json- response
Counts over tasks opened at or after since.
since*stringThe effective lower bound, normalised to ISO 8601 UTC.
date-timeopened*integer0 <= valueconfirmed*integer0 <= valuepass*integer0 <= valueunconfirmed*integer0 <= valuebilled*integerTasks with billed_success set.
0 <= valuecurl -X GET 'https://ai.codai.ro/v1/tasks/stats'{ "since": "2019-08-24T14:15:22Z", "opened": 0, "confirmed": 0, "pass": 0, "unconfirmed": 0, "billed": 0}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringTask UUID.
uuidx-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128The task.
application/json- response
Wire view of a task. Money is integer micros (USD for cost, EUR for charges); dates are ISO 8601.
id*stringuuidsurface*TaskSurfaceClient surface that opened the task.
"proxy""desktop""cli""resolve""sandbox""mobile""hub"session_key*|Derived session key or the client x-codai-task-id that groups the task's requests.
client_task_id*|Your x-codai-task-id, verbatim, when one was sent.
title*|First user message, ≤ 200 chars.
outcome*TaskOutcomeTask outcome. open while running; pass/fail/error from an exec verdict; unconfirmed after the idle
close; confirmed after your confirmation; cancelled when withdrawn.
"pass""fail""error""unconfirmed""confirmed""cancelled""open"evidence_kind*TaskEvidenceKindWhat closed the task — a machine verdict, a re-execution, your confirmation, or nothing yet.
"exec_verdict""reexec""user_confirmed""none"evidence_ref*|Verdict request id, resolve job id, usage event id, or the x-request-id of the confirm call.
requests*integerNumber of requests attributed to the task.
0 <= valuecost_micro_usd*integerReal upstream cost in USD micros.
0 <= valuecharged_micro_eur*integerToken cost debited from the prepaid wallet so far, in EUR micros.
0 <= valuebilled_success*booleanTrue once the task was billed as one success (task_succeeded meter event).
billable_at*|When outcome and evidence first agreed on a billable success.
date-timeconfirm_deadline_at*|Until when POST /v1/tasks/{id}/confirm still converts an unconfirmed task.
date-timeopened_at*stringdate-timelast_activity_at*stringdate-timeclosed_at*|date-timenote*|Your note from the confirm call, when given.
curl -X GET 'https://ai.codai.ro/v1/tasks/497f6eca-6276-4993-bfeb-53cbbbba6f08'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "surface": "proxy", "session_key": "string", "client_task_id": "string", "title": "string", "outcome": "pass", "evidence_kind": "exec_verdict", "evidence_ref": "string", "requests": 0, "cost_micro_usd": 0, "charged_micro_eur": 0, "billed_success": true, "billable_at": "2019-08-24T14:15:22Z", "confirm_deadline_at": "2019-08-24T14:15:22Z", "opened_at": "2019-08-24T14:15:22Z", "last_activity_at": "2019-08-24T14:15:22Z", "closed_at": "2019-08-24T14:15:22Z", "note": "string"}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringTask UUID.
uuidx-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128application/json- body
Body of POST /v1/tasks/{id}/confirm.
outcome*stringconfirmed = codai solved it (billable); fail = it did not (never billed).
"confirmed""fail"note?stringOptional free-text note (trimmed), stored on the task.
length <= 500The task is closed with the chosen outcome.
application/json- response
Outcome of the confirmation. Keys are camelCase, unlike the Task object.
taskId*stringuuidoutcome*stringThe outcome you sent.
"confirmed""fail"billed*booleanTrue when this confirmation emitted a task_succeeded meter event.
refundedMicroEur*integerToken cost returned to the prepaid wallet on conversion to a flat success charge, in EUR micros.
0 <= valuecurl -X POST 'https://ai.codai.ro/v1/tasks/497f6eca-6276-4993-bfeb-53cbbbba6f08/confirm' \ -H 'Content-Type: application/json' \ -d '{ "outcome": "confirmed"}'{ "taskId": "e6e9d88a-9b63-468a-aec3-b7a11de27af8", "outcome": "confirmed", "billed": true, "refundedMicroEur": 0}Last updated: