Skip to content

When send or download fails

HTTP status and error field on the public /v1 API.

3 min read

When GET /v1/me, POST /v1/messages/send, or GET /v1/files/:id fails, the response is usually JSON with an error field (snake_case). A successful file download returns raw bytes, not JSON.

Authentication & keys

HTTPerrorMeaningWhat to do
401invalid_api_keyMissing, wrong, or revoked BearerCopy a fresh knk_live_… from dashboard → Developer → API keys; use Authorization: Bearer …
403scope_requiredKey lacks messages:sendCreate a key with send scope, or do not call send with a read-only key

GET /v1/me and GET /v1/files/:id do not require the messages:send scope.

Quota & rate limits

HTTPerrorMeaningWhat to do
429api_quota_exceededAPI send quota exhausted (billing)Check dashboard → Billing; wait for reset or upgrade
429rate_limitedToo many requests in a short windowWait, backoff, reduce parallelism

Send message (POST /v1/messages/send)

HTTPerrorMeaningWhat to do
400bad_requestInvalid JSON, forbidden fields (id, sender_id, …), bad to/group_id, url mixed with cards, bad username formatSee Send a message; flat body, no body wrapper
402ai_budget_insufficient@ai + AI mention but insufficient token budgetShorten text or add AI budget on dashboard
403forbiddenNot connected, blocked, not a member, deleted room, channel (owner/admin send only), mute/banEnsure the integration account can chat to the same target in the app
404user_not_foundUnknown username in toCheck spelling (lowercase)
409idempotency_replaySame Idempotency-Key within 1 hour after a successful sendNew key for a different message; reuse only to retry the same request — Idempotency
413too_largeURL attachment too largeSmaller file or CDN with size limits
502upstream_fetch_failedServer could not fetch attachment urlPublic HTTPS URL, valid MIME/size, not blocked by SSRF rules
500internal_errorTemporary server faultRetry; idempotency key is released when send fails

Form (type: form)

HTTPerrorMeaning
400form_fields_forbiddenBody still has inline fields — use form_id only
403form_forbiddenform_id is not owned by the key holder
404form_not_foundForm ULID does not exist

Define forms under dashboard → Forms. Sending: Forms.

Download file (GET /v1/files/:id)

HTTPerrorMeaningWhat to do
401invalid_api_keySame as above
403forbiddenNot in that file’s chat, or view-onceView-once never appears on webhooks and cannot be downloaded
404not_foundWrong file_idUse attachment.file_id from the webhook
410gonePast 7-day retentionCannot be recovered
503unavailableAttachment service not ready (some dev setups)Ensure API + storage are running

200 = file stream. If-None-Match with ETag = file id → 304 with no body.

See also