Skip to content

Product API (v1) ​

The product API lets your server run a Pangura product — for example ethics-advisor — with nothing but an API key, read the result, and download evidence you can check yourself, offline. It is server to server: browsers cannot call it directly (responses carry no CORS headers), so keep the key on your server.

The machine-readable description is at GET /v1/openapi.json (OpenAPI 3.1; it needs the key like every /v1 path).

Keys ​

A key looks like pk_test_ab12cd34_… or pk_live_ab12cd34_…. It is shown once, when it is created; Pangura keeps only a hash of it. The eight characters after pk_test_ / pk_live_ are its prefix, the only part shown again (in your usage statement and in support conversations).

  • Test keys run a free stub engine: the full contract, the same formats and evidence, no model calls and no charge. Use them to build and test your integration.
  • Live keys run the product's chain and are metered.

A test key and a live key are kept apart, even within one application: a thread, a run or its evidence made with one is not_found with the other, and the same Idempotency-Key names one run under each. Threads made with a test key are stored separately from live ones and never reach a reviewer.

Send the key as a bearer token:

bash
curl -H "Authorization: Bearer $PANGURA_API_KEY" https://api.pangura.ai/v1/products

A revoked key stops working within 60 seconds. If a key leaks, ask us to revoke it and issue a new one.

Errors ​

Every error has the same shape:

json
{ "error": "not_found", "message": "run not found" }

When the fault is on our side, message is a sentence you can show to your user as it is, and the answer carries a reference. Quote the reference to us and we find the cause in our logs; the answer itself never describes it.

json
{ "error": "engine_unavailable", "message": "The service is temporarily unavailable. Please try again later.", "reference": "ref_3f9a2c1e" }
StatuserrorMeaning
400bad_inputThe request does not match the format (details lists the problems)
401unauthorizedMissing, invalid or revoked key
402quotaYour monthly run or cost limit is reached
403rightsYour organisation's settings with us (your model policy or data rights) do not allow this run; trying again will not help. Carries a reference
404not_foundNo such resource for you — another client's runs, threads and evidence are always "not found"
409conflictA reply is still being prepared on this thread, the run already finished, or the evidence was recorded before 11 November 2026 in an earlier format
429too_many_runsToo many runs in progress for this end user or for you, or too many per minute for this key
500engine_unavailableAn unexpected fault on our side. Carries a reference
503busy, engine_unavailablebusy: try again shortly. engine_unavailable: a fault on our side, with a reference; try again later

Runs ​

Start a run of a product. A new thread takes a description of the situation:

bash
curl -X POST https://api.pangura.ai/v1/products/ethics-advisor/runs \
  -H "Authorization: Bearer $PANGURA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 7f9c2e1a-request-1" \
  -H "X-End-User: user-4711" \
  -d '{ "input": { "description": "A business contact sent two bottles of wine to my home before the holidays." } }'

The answer is 202 with the run while it is being prepared. Poll GET /v1/runs/{id} until status is no longer queued or running; or add ?wait=true to wait up to ten minutes and get 200 with the finished run.

A follow-up on the same thread passes the thread id and a question:

json
{ "thread": "a1b2-c3d4", "input": { "question": "And if he insists that I keep it?" } }

Only one reply is prepared at a time on a thread (409 otherwise).

statusMeaning
queued, runningBeing prepared
succeededFinished; output, state, evidence and usage are present
failedFinished without a reply; error.code says why
interruptedThe service restarted while it ran; start it again
cancelledCancelled with POST /v1/runs/{id}/cancel; the reply is discarded, the work done is still metered

A run whose thread you deleted keeps its status and carries threadDeletedAt; its output and evidence are gone.

A finished run carries:

  • output — the product's output format, ready to display (GET /v1/products returns each product's input and output schemas);
  • state — green (every check passed), amber (shown with a caution), held (not answered; the end user is pointed to human help), no_basis (no reference material applied);
  • evidence — recordCid (the run's evidence record), chainHead (the thread's chain), ledgerCid (your usage ledger row);
  • product — id, version and the chain hash of the published version that ran;
  • usage — time, number of model calls and cost.

Idempotency. Send an Idempotency-Key (up to 128 visible ASCII characters) and a retry of the same request returns the same run instead of starting another. Two requests with the same key that arrive together also answer with one run. A test key and a live key keep separate idempotency keys.

End users. X-End-User is your identifier for the person the run is for (at most 256 bytes; any UTF-8). We store only a salted hash of it. Threads are kept per end user; without the header, runs belong to your application.

Threads and actions ​

RequestWhat it does
GET /v1/threadsThe end user's threads
GET /v1/threads/{id}A thread with every reply, its state and its evidence record
DELETE /v1/threads/{id}Deletes the thread and its records, and answers { "deleted": "<id>", "at": "<time>" }. Each run of the thread keeps its row and from then on carries threadDeletedAt
POST /v1/threads/{id}/actions/feedback{ "exchangeId": "x1", "useful": true, "note": "…" }
POST /v1/threads/{id}/actions/reflection{ "note": "…" } — the end user's own note
POST /v1/threads/{id}/actions/escalate{ "reason": "…" } — returns the help routes to show

Evidence ​

GET /v1/evidence/{recordCid} returns the evidence record of a run; GET /v1/evidence/{recordCid}/packet returns the evidence packet: the inputs, the record and every earlier record of the thread, the output, the product version with its chain hash, and your usage ledger row. Reference material you hold no rights to, and our own generation configuration (models, parameters, the drafting service's receipt), appear only by their content ids (CIDs), listed under withheld. The record names each of them by CID, so the record's own CID still recomputes from exactly what you receive.

Check a packet with Node.js alone — no Pangura code or package — using verify-evidence-packet.mjs (available from us with your key):

bash
curl -H "Authorization: Bearer $PANGURA_API_KEY" -o packet.json \
  https://api.pangura.ai/v1/evidence/sha256:…/packet
node verify-evidence-packet.mjs packet.json      # prints OK, or one line per problem

It recomputes every content id (SHA-256 over UTF-8 text or over RFC 8785 canonical JSON), checks that the record names your input and the output you received, that the thread's records chain from the first to this one, and that your ledger row names this record.

Usage and limits ​

GET /v1/usage?month=2026-11 returns your metered runs for a month and the check of your usage ledger (a hash chain: each row names the previous one); &format=csv returns the same as CSV. Costs are in US dollars, the currency the model providers charge in; a run whose model calls include one without a published price is marked priced: false.

Limits are agreed per client: runs in progress per end user and per client, runs per minute per key, and a monthly run or cost limit. At 80 % of a monthly limit the response to a new run carries a warnings line; at 100 % new runs answer 402 quota unless overage was agreed. The limits hold when requests arrive together: every request over a limit gets that limit's refusal (429 or 402), none slips through. Runs still in progress count toward the monthly run limit.

Verifiable intelligence for the decisions that demand scrutiny.