Errors
What each status code from the platform API means, and what to change before you try again.
Errors from these endpoints come back as JSON, never as an HTML error page, so your code can read the reason rather than guess it from the status code alone. Read the message and show it — the wording is written to tell somebody what to do next.
Authorization header, then check the key is still active under Settings → API Keys.
errors object, fix the fields it names and send the request again.
The two 401 messages
They are worth telling apart, because they need different fixes.
Missing API key. Send it as an "Authorization: Bearer" header.— nothing arrived. Your header is absent or misspelled.Invalid or revoked API key.— something arrived and it is not a working key. Either it was mistyped, or somebody revoked it. Revoking takes effect on the very next request, so a key that worked a minute ago can return this.
Requests that never get that far
A request missing a required value, or carrying one outside the range the endpoint allows, is refused before anything is read or changed. Nothing is half-done — fix the value and send it again.
These come back as 422, and that body has a different shape from the others: a message, plus an errors object keyed by field name, and no success flag at all. Write your parser to expect both shapes.
The commonest cases are a month or year left off keywords, a per_page above 100 on articles, and a site_url that is not a full address on connect.