Every API here is available over the APIs.io API and to AI agents over MCP.
MCP server
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
Tools for apis
7 MCP tools reach this
find_apisBrowse and filter every API in the catalog.
get_api_artifactsOne API's artifacts, grouped by type.
get_openapiThe primary OpenAPI for this API.
find_similar_apisAPIs that look like this one.
apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
resolveTurn a domain, URL or GitHub org into the provider it belongs to.
find_cohortsEvery scored population of providers in the catalog.
All 92 tools →
Call it yourself
curl for this page
This API
curl "https://apis.io/api/v1/apis/codai-ro:codai-ro-agents-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Codai Ro Agents API
version: '1'
description: 'Operations tagged Agents across 2 of this provider''s published API definitions: codai-ro-gateway-openapi.json, codai-ro-gateway-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://ai.codai.ro
description: Production
security:
- bearerAuth: []
tags:
- name: Agents
description: 'Task-oriented agent API: submit a goal and the gateway runs the whole agent loop server-side (routing, gateway
tools, sub-agents, memory). `POST /v1/agents/run` blocks until the answer; `POST /v1/agents/runs` returns a run
id immediately and persists the run so it can be polled, streamed and cancelled. Requires a tier with sub-agents
and tools (Pro or above).'
paths:
/v1/agents/run:
post:
operationId: runAgentSync
tags:
- Agents
summary: Run an agent task synchronously
description: 'Submits a goal and blocks until the agent loop finishes, returning the final answer in one response. The
`task` becomes the user turn (with `context` appended under a `## Context` heading), `system` optionally
prepends a system message, and the agent-mode scaffold (tool guidance, stop conditions) is injected on top.
Requires a key whose tier supports sub-agents and tools, otherwise 403. Bills exactly like an agent-mode chat
turn: every call is a fresh task, so the task-cap chain applies and an exhausted quota is a 429
`quota_exceeded`. `max_steps` is validated but currently ignored — the loop depth is the tier''s agent-mode
depth. Nothing is persisted; if the connection drops the result is lost.'
parameters:
- $ref: '#/components/parameters/RequestId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AgentRunRequest'
responses:
'200':
description: The completed run.
headers:
x-codai-upstream-model:
description: Concrete upstream model that produced the final turn.
schema:
type: string
x-codai-event-id:
description: Usage event id for feedback correlation; absent when no usage row was written.
schema:
type: string
format: uuid
content:
application/json:
schema:
$ref: '#/components/schemas/AgentSyncResult'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'402':
$ref: '#/components/responses/PaymentRequired'
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
'502':
$ref: '#/components/responses/UpstreamError'
servers:
- url: https://ai.codai.ro
description: Production
/v1/agents/runs:
post:
operationId: createAgentRun
tags:
- Agents
summary: Create an asynchronous agent run
description: 'Persists a run in the `queued` state and returns its id immediately (202); execution starts on the same
instance right away and a sweeper resumes it if the instance dies mid-run. Requires a tier with sub-agents
(403 otherwise) and a real codai account key — legacy compatibility keys cannot own a persisted run (403).
`client_request_id` makes the call idempotent per user: a repeat with the same value returns the existing
run id, again with 202. `max_steps` (stored, default 12) and `budget_seconds` (stored, default 300) are
accepted but NOT enforced yet. Async runs bypass the task-cap chain: no 429 is raised at submit time and the
run executes with a task count of 0.'
parameters:
- $ref: '#/components/parameters/RequestId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AgentRunCreateRequest'
responses:
'202':
description: Run accepted and queued.
content:
application/json:
schema:
$ref: '#/components/schemas/AgentRunAccepted'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'402':
$ref: '#/components/responses/PaymentRequired'
'403':
$ref: '#/components/responses/Forbidden'
servers:
- url: https://ai.codai.ro
description: Production
/v1/agents/runs/stats:
get:
operationId: getAgentRunStats
tags:
- Agents
summary: Aggregate statistics over your agent runs
description: 'Counts and averages over the runs created by the calling user in the last `days` days (default 7, clamped
to 1–90). `avg_latency_ms` is computed from `started_at` to `finished_at` over finished runs only. Legacy
compatibility keys own no persisted runs and receive only `window_days` and `total: 0`. A non-numeric `days`
is not validated and results in a server error.'
parameters:
- $ref: '#/components/parameters/RequestId'
- name: days
in: query
required: false
description: Window length in days, clamped to 1–90.
schema:
type: integer
minimum: 1
maximum: 90
default: 7
responses:
'200':
description: Aggregates for the window.
content:
application/json:
schema:
$ref: '#/components/schemas/AgentRunStats'
'401':
$ref: '#/components/responses/Unauthorized'
'402':
$ref: '#/components/responses/PaymentRequired'
servers:
- url: https://ai.codai.ro
description: Production
/v1/agents/runs/{id}:
get:
operationId: getAgentRun
tags:
- Agents
summary: Poll an agent run
description: 'Returns the current state of one of your runs: status, result or error, step count, token usage and
timestamps. A run owned by another account is a 404. `result` is set only when `status` is `completed`,
`error` only when it is `failed`. Poll this or subscribe to `/stream` — both read the same row.'
parameters:
- $ref: '#/components/parameters/RequestId'
- name: id
in: path
required: true
description: Agent run UUID returned by `POST /v1/agents/runs`.
schema:
type: string
format: uuid
responses:
'200':
description: The run.
content:
application/json:
schema:
$ref: '#/components/schemas/AgentRun'
'401':
$ref: '#/components/responses/Unauthorized'
'402':
$ref: '#/components/responses/PaymentRequired'
'404':
$ref: '#/components/responses/NotFound'
servers:
- url: https://ai.codai.ro
description: Production
/v1/agents/runs/{id}/steps:
get:
operationId: listAgentRunSteps
tags:
- Agents
summary: List the persisted steps of a run
description: 'Returns the step trace of one of your runs, newest first (`seq` descending). Step rows are returned as
stored, with camelCase keys (`runId`, `latencyMs`, `createdAt`). Today the executor persists exactly ONE
step per run — a `seq: 0` `answer` step written when the run completes, with the answer clipped to 2000
chars — so the array is empty while the run is in flight and has one element after success; failed and
cancelled runs have none. A run owned by another account is a 404.'
parameters:
- $ref: '#/components/parameters/RequestId'
- name: id
in: path
required: true
description: Agent run UUID returned by `POST /v1/agents/runs`.
schema:
type: string
format: uuid
responses:
'200':
description: The step trace.
content:
application/json:
schema:
type: object
required:
- id
- steps
properties:
id:
type: string
format: uuid
description: The run id.
steps:
type: array
items:
$ref: '#/components/schemas/AgentRunStep'
'401':
$ref: '#/components/responses/Unauthorized'
'402':
$ref: '#/components/responses/PaymentRequired'
'404':
$ref: '#/components/responses/NotFound'
servers:
- url: https://ai.codai.ro
description: Production
/v1/agents/runs/{id}/stream:
get:
operationId: streamAgentRun
tags:
- Agents
summary: Stream a run's progress over SSE
description: 'Server-Sent Events view of one of your runs. The gateway polls the run every second and emits:
- `event: step` — `{ "seq": number, "kind": "plan"|"tool_call"|"observation"|"answer", "summary": string|null }`
for every step with a `seq` greater than the last one sent (in practice one `answer` step on completion).
- `event: done` — `{ "status": "completed"|"failed"|"cancelled", "result": string|null, "error": string|null,
"step_count": number }` when the run reaches a terminal state; the stream then closes.
- `event: timeout` — `{}` after 30 minutes on a single connection; the stream closes and you reconnect.
There are NO heartbeats or comment lines between polls, NO `id:` lines, and `Last-Event-ID` is never read:
a reconnect is a full replay from `seq` 0. The response is `text/event-stream` with `Cache-Control: no-cache`
and `x-accel-buffering: no`. A run owned by another account is a 404 before the stream starts.'
parameters:
- $ref: '#/components/parameters/RequestId'
- name: id
in: path
required: true
description: Agent run UUID returned by `POST /v1/agents/runs`.
schema:
type: string
format: uuid
responses:
'200':
description: SSE stream; see the description for event names and payloads.
content:
text/event-stream:
schema:
type: string
'401':
$ref: '#/components/responses/Unauthorized'
'402':
$ref: '#/components/responses/PaymentRequired'
'404':
$ref: '#/components/responses/NotFound'
servers:
- url: https://ai.codai.ro
description: Production
/v1/agents/runs/{id}/cancel:
post:
operationId: cancelAgentRun
tags:
- Agents
summary: Cancel a queued or running run
description: 'Marks one of your runs `cancelled`, sets `finished_at` and releases the resume lease. Only `queued` and
`running` runs can be cancelled; a terminal run, an unknown id or another account''s run all answer 404
("not found or not cancellable"). Cancellation is a status flip: an execution already in flight keeps running
on the instance until the model loop ends, but its result is discarded because the completion update only
applies to a run still in `running`. Tokens consumed until then are still billed.'
parameters:
- $ref: '#/components/parameters/RequestId'
- name: id
in: path
required: true
description: Agent run UUID returned by `POST /v1/agents/runs`.
schema:
type: string
format: uuid
responses:
'200':
description: The run is now cancelled.
content:
application/json:
schema:
type: object
required:
- id
- status
properties:
id:
type: string
format: uuid
status:
type: string
enum:
- cancelled
'401':
$ref: '#/components/responses/Unauthorized'
'402':
$ref: '#/components/responses/PaymentRequired'
'404':
$ref: '#/components/responses/NotFound'
servers:
- url: https://ai.codai.ro
description: Production
components:
responses:
Unauthorized:
description: Missing, malformed, revoked or paused API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Forbidden:
description: The key is valid but not allowed to perform this action (model allow-list, role, ownership).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
PaymentRequired:
description: The subscription behind this key is inactive.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
NotFound:
description: No such resource, or it belongs to another account.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
RateLimited:
description: Per-key RPM/RPH, token-per-minute budget, spend cap (`rate_limit_exceeded`) or task quota (`quota_exceeded`). Read `Retry-After`.
headers:
Retry-After:
description: Seconds to wait before retrying.
schema:
type: integer
minimum: 1
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
BadRequest:
description: Malformed body or query; `details` holds the flattened field errors.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
UpstreamError:
description: Every upstream lane failed (or returned an empty completion) after failover.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
AgentUsage:
type: object
title: Token usage
description: Aggregate token counts for the whole run.
required:
- prompt_tokens
- completion_tokens
properties:
prompt_tokens:
type: integer
minimum: 0
completion_tokens:
type: integer
minimum: 0
AgentRunAccepted:
type: object
title: Run accepted
description: Response of `POST /v1/agents/runs` (HTTP 202).
required:
- id
- status
- poll
properties:
id:
type: string
format: uuid
examples:
- 3f9d2c1e-7b4a-4e0f-9a1d-2c5b6e7f8a90
status:
type: string
enum:
- queued
description: Always `queued` at submit time, even when an idempotent repeat hits a run that has since progressed.
poll:
type: string
description: Relative URL of the poll endpoint for this run.
examples:
- /v1/agents/runs/3f9d2c1e-7b4a-4e0f-9a1d-2c5b6e7f8a90
AgentRunStats:
type: object
title: Agent run statistics
description: 'Aggregates over your runs in the window. Only `window_days` and `total` are guaranteed; the remaining
fields are absent for legacy compatibility keys that cannot own persisted runs.
'
required:
- window_days
- total
properties:
window_days:
type: integer
minimum: 1
maximum: 90
total:
type: integer
minimum: 0
completed:
type: integer
minimum: 0
failed:
type: integer
minimum: 0
cancelled:
type: integer
minimum: 0
in_flight:
type: integer
minimum: 0
description: Runs currently `queued` or `running`.
prompt_tokens:
type: integer
minimum: 0
completion_tokens:
type: integer
minimum: 0
avg_steps:
type: integer
minimum: 0
description: Rounded average of `step_count`.
avg_latency_ms:
type: integer
minimum: 0
description: Rounded average of `finished_at - started_at` over finished runs.
AgentSyncResult:
type: object
title: Synchronous run result
description: Response of `POST /v1/agents/run`.
required:
- result
- status
- usage
- model
- event_id
properties:
result:
type: string
description: The final assistant answer (empty string when the model produced no content).
status:
type: string
enum:
- completed
usage:
$ref: '#/components/schemas/AgentUsage'
model:
type: string
description: Concrete upstream model that served the final turn.
event_id:
type:
- string
- 'null'
format: uuid
description: Usage event id for feedback correlation; `null` when none was written.
Error:
type: object
required:
- error
properties:
error:
type: object
required:
- message
- type
- code
properties:
message:
type: string
description: Human-readable, provider names redacted.
type:
type: string
enum:
- invalid_request_error
- subscription_required
- rate_limit_error
- upstream_error
- server_error
code:
type: string
enum:
- bad_request
- invalid_api_key
- subscription_inactive
- forbidden
- not_found
- payload_too_large
- rate_limit_exceeded
- quota_exceeded
- upstream_error
- internal_error
- not_a_member
- lease_held
- seq_conflict
- host_offline
- host_timeout
- rules_refused
- search_unavailable
- task_not_confirmable
- slug_taken
- project_has_environments
- already_has_env
- not_enrollable
- not_byo
- invalid_transition
- already_member
- vm_per_dev_single_member
- last_owner
- insufficient_balance
- key_scope_forbidden
- assets_unavailable
- asset_not_found
- too_many_renders
- renders_unavailable
- timeline_too_long
- not_a_timeline
- invalid_cursor
- templates_unavailable
- url_blocked
- invalid_tokens
- unsupported_media
- kind_mismatch
- node_not_found
- invalid_pick
- duplicate_key
- unknown_var
- invalid_var_value
- unsupported_kind
- too_long
- stale
- not_supported_for_kind
- unsupported_format
- too_large
- not_implemented
- version_conflict
- settings_unavailable
- ai_label_required
- sandbox_concurrency_limit
- sandbox_busy
- sandbox_daily_limit
- invalid_ttl
- workspace_too_large
- sandbox_paused_limit
- sandbox_capacity
details:
description: Present on `bad_request` (flattened Zod field errors), `invalid_tokens` (`issues`) and `rules_refused` (`tool`, `rule_id`, `decision`). Other codes never forward details over HTTP.
type: object
additionalProperties: true
examples:
- error:
message: Invalid or missing API key.
type: invalid_request_error
code: invalid_api_key
AgentRunStep:
type: object
title: Agent run step
description: One persisted step, as stored (camelCase keys).
required:
- id
- runId
- seq
- kind
- summary
- detail
- latencyMs
- createdAt
properties:
id:
type: string
format: uuid
runId:
type: string
format: uuid
seq:
type: integer
minimum: 0
description: Monotonic step index within the run.
kind:
type: string
enum:
- plan
- tool_call
- observation
- answer
summary:
type:
- string
- 'null'
description: Assistant content, tool name or observation summary (redacted, ≤ 2000 chars).
detail:
description: Structured detail (tool args/result, redacted). Always `null` for steps written by the current executor.
nullable: true
latencyMs:
type:
- integer
- 'null'
createdAt:
type: string
format: date-time
AgentRunCreateRequest:
allOf:
- $ref: '#/components/schemas/AgentRunRequest'
- type: object
title: Async agent run request
description: Body of `POST /v1/agents/runs`; extends the synchronous request.
properties:
budget_seconds:
type: integer
minimum: 10
maximum: 1800
description: Requested wall-clock budget. Stored (default 300) but not enforced.
client_request_id:
type: string
maxLength: 200
description: Idempotency key scoped to your user — a repeat returns the existing run id.
examples:
- ci-build-8812-step-3
AgentRunStatus:
type: string
description: Run lifecycle — `queued` → `running` → one of `completed`, `failed`, `cancelled`.
enum:
- queued
- running
- completed
- failed
- cancelled
AgentRunRequest:
type: object
title: Agent run request
description: Body of `POST /v1/agents/run`.
required:
- task
properties:
task:
type: string
minLength: 1
maxLength: 64000
description: The goal, in natural language. Becomes the user turn.
examples:
- Find the three most recent BNR EUR/RON rates and summarise the trend.
context:
type: string
maxLength: 256000
description: Optional supporting material, appended to the task under a `## Context` heading.
system:
type: string
maxLength: 32000
description: Optional system-prompt override, sent as the first message before the agent scaffold.
model:
type: string
maxLength: 128
default: codai
description: Model alias to route through.
examples:
- codai
max_steps:
type: integer
minimum: 1
maximum: 16
description: Requested agent-loop depth cap. Validated but not enforced — the tier's agent-mode depth applies.
AgentRun:
type: object
title: Agent run
description: Poll view of a persisted run (`GET /v1/agents/runs/{id}`).
required:
- id
- status
- task
- model
- result
- error
- step_count
- usage
- created_at
- started_at
- finished_at
properties:
id:
type: string
format: uuid
status:
$ref: '#/components/schemas/AgentRunStatus'
task:
type: string
description: The submitted goal, verbatim.
model:
type:
- string
- 'null'
description: Requested model alias (`codai` when omitted at submit).
result:
type:
- string
- 'null'
description: Final answer; set only once `status` is `completed`.
error:
type:
- string
- 'null'
description: Failure message (≤ 2000 chars); set only when `status` is `failed`.
step_count:
type: integer
minimum: 0
description: Loop steps executed so far. Not incremented by the current executor.
usage:
$ref: '#/components/schemas/AgentUsage'
created_at:
type: string
format: date-time
started_at:
type:
- string
- 'null'
format: date-time
description: When execution was claimed; `null` while `queued`.
finished_at:
type:
- string
- 'null'
format: date-time
description: Set on `completed`, `failed` and `cancelled`.
parameters:
RequestId:
name: x-request-id
in: header
required: false
description: Client correlation id; echoed back as `x-codai-trace-id` and persisted on the usage row.
schema:
type: string
maxLength: 128
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: codai_…
description: 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-refined-from:
- codai-ro-gateway-openapi.json
- codai-ro-gateway-openapi.yml