Error shape
Every error response from the API and Relay has the same JSON body: anerror object with a type and a message.
typeis a stable, machine-readable category from the table below. Branch on it.messageis a human-readable sentence. It can change at any time, so show it to people but never match on it.- Some types add context fields next to
typeandmessage. They are listed below.
error, message or success keys. Any 2xx status means the request worked.
Error types
A request body that cannot be parsed at all returns
invalid_request with the status the parser reported, which is usually 400.
Private posts, drafts and team posts you cannot see return
404, not 403, so the response never confirms that something you have no access to exists.Context fields
Request IDs
Every response, success or error, carries arequest-id header with a unique ID for that request.
request-id so it can be traced.
Partial upload failures
POST /upload and POST /posts/{code}/files accept several files at once, and each file succeeds or fails on its own.
When at least one file is stored, the response is 200. Files that failed are listed in failed, each with its zero-based position in the request and an error object shaped exactly like a top-level error:
- A request with one file returns that file’s error as the top-level error. The status is
413forfile_too_large,500forinternal, and400for everything else. - A request with several files returns
400with typeupload_failedand the fullfailedarray.
file_too_large, unsupported_type, quota_exceeded, invalid_request (a corrupt or unplayable video) and internal.
Handling errors
1
Check the status
Any
2xx is success. Anything else has an error object.2
Branch on the type
Use
error.type to decide what to do, and show error.message to people.3
Retry only what can succeed
Retry
rate_limited after Retry-After, and internal or unavailable with backoff. Retrying any other type sends the same request into the same error.