Conventions
The shape of every answer and error, paging through lists, limits and versions.
Requests
Every operation's address starts with /v1 on your Heuristic app's address. Send request bodies as JSON with
Content-Type: application/json; a body is at most 64 KB, except for sending feedback with
send_feedback, which takes up to 4 MB for long transcripts. A larger body answers 413 with the code
payload_too_large. Ids are uuids, in any case.
Answers
A successful answer is JSON with the result under data and facts about it under meta:
{ "data": { "id": "…", "name": "Acme" }, "meta": {} }Errors
An error answers with an HTTP status and a body with a stable code to act on, a message for people, and, for some
errors, details:
{ "error": { "code": "validation_error", "message": "…", "details": { } } }| Status | Code | Meaning |
|---|---|---|
| 400 | validation_error | A parameter or the body is not valid; details says which. |
| 401 | unauthorized | No usable access token or API key. |
| 401 | invalid_key | The feedback endpoint key is wrong or revoked. |
| 403 | forbidden | The person's role doesn't allow this. |
| 403 | read_only_key | The API key is read only, so it can't make changes. |
| 403 | api_key_not_allowed | API keys, or organization keys, can't do this; use the Heuristic web app. |
| 404 | not_found | There is nothing at this address, or the person can't open it. |
| 409 | conflict | The data changed or the request clashes with it; read again and retry. |
| 413 | payload_too_large | The body is over 64 KB (4 MB for send_feedback). |
| 429 | rate_limited | A limit is reached; try again after Retry-After seconds. |
| 503 | database_unavailable | Heuristic is briefly unavailable; try again after Retry-After seconds. |
| 503 | service_unavailable | Heuristic is briefly unavailable, for example while it restarts for an update; try again after Retry-After seconds. |
| 500 | internal_error | Something went wrong on Heuristic's side. |
Some operations have codes of their own; each operation's page lists its answers.
Lists and paging
Lists come a page at a time. limit says how many items to return; each list's page gives its range and what you get
when you leave it out. When there are more, the answer's meta.nextCursor is set: send it as cursor to get the next
page, and stop when it is missing. Each list says its order on its page.
Limits
Calls with an access token are limited per person, across all their apps: 120 calls a minute and 10,000 a UTC day.
Calls that start AI work or knowledge base reads (creating an organization, starting a knowledge base read,
rebuilding categories, retrying topics or rechecking) are also limited to 10 a minute and 200 a UTC day. Each feedback
endpoint takes 120 calls a minute and 5,000 a UTC day, and so does each person sending feedback to a product with
their access token, across all their apps, on top of their limit on all calls. A personal API key's calls count
toward its person's limits as one more app; each organization key has limits of its own, with the same numbers. A key
that sends feedback falls under the feedback limits too. Over a limit, a call answers 429 with the code rate_limited
and a Retry-After header in seconds (also in details.retryAfter for the limits on a person's calls,
details.retryAfterSeconds for the feedback limits, with a key or an access token), and changes nothing. While Heuristic is briefly unavailable,
calls answer 503 with the code database_unavailable or service_unavailable and Retry-After; try again after that many seconds.
Versions
The version is in the path (/v1). Within v1 Heuristic may add operations, optional fields and error codes, so ignore
fields and codes you don't recognise. It doesn't remove or rename them, or change what they mean, without a new
version.