Every error the API answers, what causes it, and what to do.
Errors are JSON with a stable code, a sentence for people, and sometimes details:
{ "error": { "code": "plan_limit", "message": "your plan allows 20 sources; remove one or ask for more", "details": { "limit": 20, "used": 20, "plan": "free" } }}
Branch on code, never on message. The SDK throws a BriefkastenError with the same code; the CLI prints the message and exits with a non-zero status.
Requests
Code
Status
Cause
invalid_input
400
The input failed its schema. details.issues names each field and what is wrong.
invalid_json
400
The body is not valid JSON.
invalid_body
403
The body is JSON, but not an object.
body_too_large
413
The request is over 64 KiB.
rate_limited
429
Too many requests. Wait for the retry-after header's seconds.
not_found
404
No such endpoint, project, source, event or token.
internal
500
A fault on our side; it is logged. Try again.
Signing in
Code
Status
Cause
invalid_email
400
Not an email address.
code_invalid
400
The sign-in code is wrong, used or replaced. details.attemptsLeft says how many tries are left.
code_expired
400
The code is older than ten minutes. Ask for a new one.
too_many_attempts
429
Five wrong codes: ask for a new one.
terms_not_accepted
400
The code would create an account, and the request didn't say accept_terms: true. details has terms_url, privacy_url, terms_version and privacy_version. The code stays valid: show the documents, ask, and send the same code again with accept_terms: true.
terms_version_mismatch
400
The terms or privacy versions sent are not the current ones. details as above.
mfa_code_invalid
400
The second-factor code is wrong.
mfa_token_invalid, mfa_token_expired
400
The second-factor step timed out. Sign in again.
device_code_unknown
400
No pending device sign-in has that code.
session_required
400
Signing out needs a session; revoke an API token instead.