Error responses are documentation. Terania designs its errors the way it designs everything else: similar situations answer alike so that nothing leaks, and every body carries what you need to fix the call. Learn the six codes once and debugging becomes routine.
A 401 means the request needs a valid key, and it deliberately says nothing more. Missing header, malformed header, unknown key, revoked key, expired key, suspended maker, removed maker, inactive organisation: all answer the same unauthorized. The answer does not tell you which. This uniformity is a security decision. An attacker probing keys learns nothing from the difference between wrong and revoked. You, the legitimate holder, check your side instead: is the header exactly the Authorization Bearer form, was the key sent as a query parameter by mistake, what state does the keys list show. A 401 on a key that worked yesterday means it expired, was revoked or rotated, or its maker was suspended or removed. Check the state. Do not guess.
A 403 comes in two flavours. Write forbidden means the key has no write scope for the change, or the person who made it no longer holds it. Make a new key from a role that holds the permission. Forbidden on a collection read means the key may not make that read. A 403 after a role change means the maker lost a permission. Ask an owner to make a new key from a role that holds it. The fix is never to retry. Retrying a permission error is asking the same locked door to open.
A 404 looks identical three ways: the ID does not exist, it belongs to another organisation, or it is refused. These look identical on purpose. Distinguishing them would let a key holder probe which IDs exist in other organisations. Treat every 404 the same: check the ID, check the organisation, and accept that the answer will not tell you which was wrong. Reads use allowlists, and private or money-sensitive fields never cross the API, so a field you expect but never receive is likely one the API does not expose rather than a bug in your code.
A 400 means the request itself is wrong: an unknown field or a body that is not a JSON object. The unknown-field refusal names the field, so the fix is mechanical. Remove it or correct the spelling. Validate payloads against the documented fields before sending and these vanish.
A 429 means slow down. Wait the retry seconds, then continue at a lower pace. The limit is one hundred a minute per key. Clients that read the rate limit headers rarely see this. Clients that burst on a schedule see it often. A 429 is not an error in the API. It is the API keeping its promise to everyone else.
Every error body has an error, a code and, when available, a request ID. Quote the request ID if you ask for help. It lets support find your exact call in the logs instead of guessing from timestamps. Log error bodies with the same care you log successes. An integration whose logs show the request IDs of its failures is easier to help.
Teach your integration to react per code: refresh nothing on 401 but alert someone, remake keys on 403, check IDs on 404, fix payloads on 400, wait on 429. Five reactions, each automatic. Errors become handling, and handling becomes reliability.
Two details save time. First, the keys list shows when each key was last used, updated at most once a minute, so a key that never shows use was never sent correctly. Second, idempotent creates add a 409: the same key with a different body means someone reused a key they should have generated fresh. Log bodies with request IDs, react per code without human help, and escalate to a person only the patterns you have not seen.



