Reference
Errors and limits
What each error code means, which requests to retry, and the limits the API works within.
Errors
A refused request comes back with an HTTP status and a body that names the problem:
{ "error": { "code": "PROJECT_BUSY", "message": "This project is already building in chat <chat_id>. Send this again once that build finishes." } }Branch on code, which stays the same. message is written for people and can change.
A failed build is not an HTTP error. Its task reads 200 with the status failed and a reason. See task statuses.
Retrying
- 429, and the 409 and 503 errors that send
Retry-After, clear with time. Wait the secondsRetry-Afternames, then send the same request again. - The 503 errors without
Retry-Aftermean Ragnar could not serve the request just then. Wait a little longer each time, and retry. - Retry writes as the same request with the same
Idempotency-Key, so Ragnar returns the first result instead of doing the work twice. See retries and idempotency. - Other 4xx errors repeat until something changes. Most mean the request needs fixing.
PROJECT_BUSYsends noRetry-After: a pending or working build ends by itself, but a paused one waits for an answer, or for someone to continue or stop it in Ragnar.
Error codes
- 400
INVALID_REQUESTINVALID_JSONINVALID_CURSOR - Fix the request; the message names the field. This also covers a malformed
Idempotency-Key, an id in a body or query that is empty or over 128 characters, more than one id inreply_to,/exportwithreply_to, and a file name twice in one message. Start a list again without its cursor. - 400
PROMPT_TOO_LARGEINPUT_ANSWER_TOO_LARGEINPUT_ANSWER_TEXT_REQUIRED - The message is too long with its file references, the answer is too long for its questions, or the answer has no words of its own.
- 400
UPLOAD_REFUSEDREQUEST_REJECTED - Ragnar refused the request; read the message. A code not listed on this page is also a 400.
- 401
INVALID_TOKENUNAUTHENTICATED - Send a valid, unexpired API key of an active account. Comes with
WWW-Authenticate. - 402
API_KEY_CREDIT_LIMIT_REACHEDINSUFFICIENT_CREDITSLOW_CREDIT_CONCURRENT_OPERATION - The key's monthly limit or the credits are used up, or low credits allow one build at a time. Reads and downloads still work.
- 403
INSUFFICIENT_SCOPE - A Read only key sent a
POST. Use a Read and build key. - 403
FORBIDDEN - You are a viewer of the project, so you can read it but not change it.
- 403
ULTRA_REQUIRES_PRO - In a personal project,
highandxhigheffort need Pro. This holds for/exporttoo, so send it withouteffort. - 404
NOT_FOUNDFILE_UNAVAILABLEINPUT_UNAVAILABLEEXPORT_ACCESS_DENIED - An id that names nothing you can open, a workspace you are not a member of, a chat that is not on the project's main design, a file in
filesthat left the folder, a path the API does not have, or a file whose bytes are gone. - 405
- The path does not take this method. The body is empty.
- 408
- The request body was still arriving after 5 minutes. The body is empty and the connection closes.
- 409
PROJECT_BUSYREAD_ONLY_IN_PROGRESS - The project's main design is already working, in this or another of its chats. A pending or working build ends by itself: wait, then send again. A paused build waits for someone: answer its question when it asked you, or continue or stop it in Ragnar. The message says which.
- 409
WORK_STILL_SAVINGROOM_CLEANUP_PENDINGROOM_RECOVERY_PENDING - Comes with
Retry-After: 5. The last build is still saving its work or releasing its machines. - 409
QUESTION_UNAVAILABLE reply_tonames a message that is not an open question asked of you, or the question's build moved. Read the chat again.- 409
UPLOAD_NOT_READY - A file in
filesis not ready yet, such as one still being added in Ragnar. Wait, then send the message again. - 409
IDEMPOTENCY_CONFLICT - This
Idempotency-Keycame with a different request, or another request with it is still storing a file. Retry the first request as it was, or use a new key for a new request. - 410
UPLOAD_EXPIRED - A file retried with its key after its first try expired. Send it again with a new
Idempotency-Key. - 413
REQUEST_TOO_LARGEFILE_TOO_LARGE - A JSON body takes at most 512 KiB, and a file at most 500 MiB.
- 415
UNSUPPORTED_MEDIA_TYPE - Send JSON with
Content-Type: application/json. Send a file as the raw body: not asmultipart/form-dataand not with aContent-Encoding. - 429
RATE_LIMITEDUPLOAD_BUSY - Wait the seconds
Retry-Afternames, then send the request again. - 500
INTERNAL_ERROR - Something unexpected. Retry a write with the same
Idempotency-Key. - 503
SERVICE_UNAVAILABLE - Ragnar could not serve the request just then. Comes with
Retry-After: 5. Retry a write with the sameIdempotency-Key. - 503
AUTH_UNAVAILABLEUPLOAD_FAILEDNOT_CONFIGURED - The key could not be checked, the file could not be stored, or the API is not available here. These send no
Retry-After: wait a little longer each time.
Limits
- Messages that start work
- 120 per hour for your account, shared with the app and all your keys. Every new message counts,
/exportincluded, and so does an answer that continues its build. The hour starts at the first one. Over the limit, an answer is still kept, but its build stayspausedwith the reasonrate_limited: continue it in Ragnar. - Requests from one address
- 50 per 10 seconds from one IPv4 address or IPv6 /64. Every request with a Ragnar key counts, a refused key included. The 10 seconds start at the first request.
- Uploads at once
- 4 per server. More get
429 UPLOAD_BUSYwithRetry-After: 5. - JSON body
- 512 KiB.
- File
- 500 MiB. Ragnar cuts a body still arriving after 5 minutes, so the largest file needs 14 Mbit/s or more.
- Message
- 100,000 characters with its file references, and up to 64 files.
- Page
- Up to 100 files, or up to 30 messages. 20 by default.
- Ids
- 1 to 128 characters.
Idempotency-Key- 16 to 128 characters of letters, digits,
.,_,:and-. A UUID works. - Polling
- Read a task about every 5 seconds. Each read is one request.