Skip to content
Nuveki
Try it free

Runs

A run is one request to an agent or a team. Every run gets an id and is kept, with its outcome, usage and cost, for as long as its conversation is kept (30 days after its last message by default; an admin can change it per key). You can wait for the answer, or start the run and read it later.

The examples use curl with your key in NUVEKI_API_KEY. Each one was run against Nuveki with the quick.assistant agent; the answers are trimmed.

Terminal window
curl https://api.nuveki.ai/api/v0/runs \
-H "Authorization: Bearer $NUVEKI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"agent":"quick.assistant","input":"Name three primary colors."}'
{
"id": "cmw7hfs4i01swdq7d2hub3omn",
"object": "run",
"status": "completed",
"conversationId": "cmw7hfs5b01sxdq7dbjrvmhcq",
"output": { "text": "Red, yellow, and blue." },
"error": null,
"usage": {
"inputTokens": 10782,
"outputTokens": 11,
"totalTokens": 10793,
"costUsd": 0.000174
},
"createdAt": "2026-11-08T06:59:57.858Z",
"finishedAt": "2026-11-08T07:00:01.574Z",
"durationMs": 3716
}

The answer comes when the run ends: often tens of seconds, at most 10 minutes. If your HTTP client or a proxy between you and Nuveki would give up sooner, run it in the background instead.

Send "wait": false. Nuveki checks every limit first, so a refusal still comes back at once; then it answers 202 Accepted as soon as the run has started, with the run’s address in Location.

Terminal window
curl -i https://api.nuveki.ai/api/v0/runs \
-H "Authorization: Bearer $NUVEKI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"agent":"quick.assistant","input":"Write a haiku about lighthouses.","wait":false}'
HTTP/1.1 202 Accepted
Location: /api/v0/runs/cmw7hfv0h01t5dq7d0rotj4v5
{"id":"cmw7hfv0h01t5dq7d0rotj4v5","object":"run","status":"running", …}

Read it with GET /api/v0/runs/{id} every few seconds until status is no longer queued or running:

Terminal window
curl https://api.nuveki.ai/api/v0/runs/cmw7hfv0h01t5dq7d0rotj4v5 \
-H "Authorization: Bearer $NUVEKI_API_KEY"
{
"id": "cmw7hfv0h01t5dq7d0rotj4v5",
"status": "completed",
"output": {
"text": "White tower keeps watch\nA beam sweeps the restless dark\nShips find home by dawn"
},
"durationMs": 2710
}

A run ends in one of these states:

status What happened
completed The agent answered.
no_answer The agent wrote nothing; notice says why.
blocked Nuveki’s security check declined the input before any agent ran.
refused A limit or a rule refused it before it started; error says which.
failed It stopped after it started (a provider outage, the 10-minute limit); error.
cancelled You cancelled it, or the caller that was waiting hung up.

A network error does not tell you whether your run started. Send your own unique value as Idempotency-Key (or idempotencyKey in the body), and send the same value again when you retry. Nuveki answers the repeat with the run the first request started, marked Idempotent-Replayed: true, and runs nothing new.

Terminal window
curl -i https://api.nuveki.ai/api/v0/runs \
-H "Authorization: Bearer $NUVEKI_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-1042" \
-d '{"agent":"quick.assistant","input":"Reply with: done"}'
  • If that run is still going, a caller that waits gets 409 with code IDEMPOTENCY_KEY_IN_USE and the run’s runId; read it there, or retry later.
  • If it was refused (a rate limit, say), failed, or you hung up before it ended, the value is free: the retry runs.
  • If you cancelled it, the repeat is answered with that cancel (409 RUN_CANCELLED).
  • The same value with a different request is refused with 422 IDEMPOTENCY_KEY_REUSED.
Terminal window
curl -X POST https://api.nuveki.ai/api/v0/runs/cmw7hg2jg01tndq7dwznfsafp/cancel \
-H "Authorization: Bearer $NUVEKI_API_KEY"
{
"id": "cmw7hg2jg01tndq7dwznfsafp",
"status": "cancelled",
"error": {
"statusCode": 409,
"code": "RUN_CANCELLED",
"message": "The run was cancelled by its API key’s holder."
}
}

The run stops wherever it is. Its conversation keeps what it wrote, and what it spent stays spent. A caller still waiting on it gets 409 RUN_CANCELLED. A run that already ended can’t be cancelled: 409 RUN_ALREADY_FINISHED.

GET /api/v0/runs lists this key’s runs, newest first, refused ones included. Filter by status, conversationId, batchId or scheduleId, and page with before set to the last id you got:

Terminal window
curl "https://api.nuveki.ai/api/v0/runs?limit=2&status=completed" \
-H "Authorization: Bearer $NUVEKI_API_KEY"
{
"object": "list",
"data": [{ "id": "cmw7hfzph01tedq7ds9r1wbrd", "status": "completed", … }, { … }],
"hasMore": true
}

To run the same kind of request over a list (classify 20 tickets, summarize 10 files), send them together to POST /api/v0/runs/batch: up to 20 runs, each the body you would send to POST /api/v0/runs, without wait. Nuveki records every run and answers at once with 202 Accepted, one item per run, in the order you sent them:

Terminal window
curl -i https://api.nuveki.ai/api/v0/runs/batch \
-H "Authorization: Bearer $NUVEKI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"runs":[
{"agent":"quick.assistant","input":"Classify this ticket as billing, bug or question: I was charged twice.","metadata":{"ticket":"SUP-1042"},"idempotencyKey":"classify-SUP-1042"},
{"agent":"quick.assistant","input":"Classify this ticket as billing, bug or question: The export button does nothing.","metadata":{"ticket":"SUP-1043"},"idempotencyKey":"classify-SUP-1043"}
]}'
HTTP/1.1 202 Accepted
Location: /api/v0/runs?batchId=rgvn6on0sl14uw0zx0r2tt0t
{
"id": "rgvn6on0sl14uw0zx0r2tt0t",
"object": "batch",
"data": [
{ "run": { "id": "cmw82d58a01s10e7dy73zfzzc", "status": "queued", "batchId": "rgvn6on0sl14uw0zx0r2tt0t", … }, "replayed": false, "error": null },
{ "run": { "id": "cmw82d58i01s20e7dkwkzwzgx", "status": "queued", "batchId": "rgvn6on0sl14uw0zx0r2tt0t", … }, "replayed": false, "error": null }
]
}

The runs then start in order, as many at a time as the key may have running together; runs that continue one conversationId run one after another, each seeing the answer before it. Read them by the batch’s id, at the Location it gave, until none is queued or running:

Terminal window
curl "https://api.nuveki.ai/api/v0/runs?batchId=rgvn6on0sl14uw0zx0r2tt0t" \
-H "Authorization: Bearer $NUVEKI_API_KEY"
{
"object": "list",
"data": [
{ "id": "cmw82d58i01s20e7dkwkzwzgx", "status": "completed", "output": { "text": "Bug" }, "metadata": { "ticket": "SUP-1043" }, … },
{ "id": "cmw82d58a01s10e7dy73zfzzc", "status": "completed", "output": { "text": "Billing" }, "metadata": { "ticket": "SUP-1042" }, … }
],
"hasMore": false
}

Each run of a batch is billed and limited as a single run is:

  • Every run starts within 10 minutes of the batch, or ends refused with RUN_NOT_STARTED and can be sent again.
  • A run held back by the key’s runs in progress or its runs per minute waits for room inside those 10 minutes; it is not refused.
  • A limit that will not lift in that time (the key’s daily or monthly spend cap, your organization’s budget) ends that run and every run after it with the same error.
  • Anything else wrong with one run (an agent this key may not run, say) ends that run only; the rest go on.
  • You can cancel a run of a batch before it starts. It then never starts.

A batch’s runs count as requests: a key may send 120 runs a minute in batches, and an address 600. A batch past that is refused with 429 RATE_LIMITED.

A batch is refused with 429 KEY_QUEUE_FULL when the server it reaches already holds as much of your batches as it may: 100 of the key’s runs waiting or running, or 32 MiB of your organization’s run requests (pictures and documents included). It is also refused when that server holds as many batched requests as it can. Send it again after retryAfter seconds.

Neither refusal records any run.

Give each run its own idempotencyKey, as above: if you are not sure the batch was received, send it again, and each item comes back as the run its key started, with "replayed": true. (An Idempotency-Key header on a batch is refused, since it would name every run at once.) A run whose idempotencyKey was already used for a different request is answered in its item’s error, with no run.

To ask the same thing every weekday morning, or once at a set time, make a schedule with POST /api/v0/schedules. It takes what a run takes (agent or team, input, metadata, mentions), plus when:

  • cron, a 5-field cron such as 30 8 * * 1-5, to repeat at most every 15 minutes;
  • or at, a local time such as 2026-11-20T09:00, to run once;
  • and timezone, the IANA time zone both are read in, such as America/New_York.

Each time it comes due, the schedule starts one of the key’s runs, held to every limit a run is. Its runs never wait: read them with GET /api/v0/runs?scheduleId= and the schedule’s id. The answer also estimates what its runs cost over the next 30 days (estimate), from the agent or team’s recent turns.

A key holds at most 25 schedules (409 SCHEDULE_LIMIT_REACHED), and each counts as one of your organization’s workflows. List them with GET /api/v0/schedules, pause or resume one with PATCH /api/v0/schedules/{id} (enabled), and delete one with DELETE /api/v0/schedules/{id}; the runs it made stay readable. While the key’s project is archived, its schedules make no runs.

usage says what the run’s model, embedding and tool calls used and cost. costUsd is what they were billed, in US dollars to the micro-dollar: what your organization is charged, and what the key’s spend caps count. A run on a cheap model reads what it cost rather than 0, though an agent that runs on its owner’s own model endpoint is billed nothing for those calls. While a run is going, it is what has been booked so far.

Paid web search is not in it: it is counted on the key’s daily usage, which admins see in Settings → API keys.

Each run’s answer states how many more runs the key may start this minute:

X-RateLimit-Limit-runs: 30
X-RateLimit-Remaining-runs: 29
X-RateLimit-Reset-runs: 29

X-RateLimit-Reset-runs is the number of seconds until the minute resets. The unsuffixed X-RateLimit-* headers (and …-ip-global) count requests, not runs.

GET /api/v0/key answers the key’s limits and what it has spent against them. The spend caps are set in whole US cents; what the key has spent and has left reads in US dollars:

Terminal window
curl https://api.nuveki.ai/api/v0/key \
-H "Authorization: Bearer $NUVEKI_API_KEY"
{
"object": "api_key",
"name": "Docs examples",
"limits": {
"dailySpendLimitCents": 500,
"monthlySpendLimitCents": null,
"runsPerMinute": 30,
"retentionDays": 30
},
"spend": {
"todayUsd": 0.004213,
"thisMonthUsd": 0.004213,
"remainingTodayUsd": 4.995787,
"remainingThisMonthUsd": null,
"runsToday": 4,
"requestsToday": 9
}
}

Every answer carries X-Request-Id. Send your own (up to 128 letters, digits and ._:-) and Nuveki uses it; otherwise it makes one. A refused run’s answer also carries its runId, so you can read it later. Quote either when you contact support.