6 min read
2026-03-07
A common mistake is to return 200 OK with body `{ "error": "..." }`. Use the appropriate error codes.
401 — user is not authenticated (no token)
403 — the user is authenticated, but does not have rights
A POST request creating a new resource must return 201 Created with a Location header.
DELETE and PUT requests without a response body must return 204 No Content.
Implement exponential backoff when receiving 429 Too Many Requests.
Distinguish between 400 (incorrect syntax) and 422 (correct syntax, but invalid data).
If the service is temporarily unavailable, indicate how many seconds later the request will be repeated.
Each API endpoint must have documentation with all possible response codes.
See also: JWT Decoder, MIME Types, Cron generator