API calls return 401, 403, 404 or 429
Most errors from the API are JSON with "ok": false and a sentence in error, together with the status code. Start with the status.
401 Unauthorized
{"ok": false, "error": "Unauthorized"}
The call carried no valid credential. Check that:
- the
Authorizationheader readsBearerfollowed by the whole key, with no quotes or spaces; - the key has not been revoked and has not expired (Settings, Auditor API lists the live ones);
- a script that uses your browser session is still signed in.
A call without a credential gets 401 for any organisation slug, whether it exists or not.
403 Forbidden
{"ok": false, "error": "Forbidden"} or a sentence that names the reason.
You are known, but this call is not allowed for you:
- The wrong organisation. The slug in the address is not the organisation your key or sign-in belongs to. Use your own slug, as in your Valystrum page addresses.
- A write with a key. Auditor API keys only read. Writes need a signed-in person with a role that may make the change.
- Your role. Some reads and every write need a higher role, such as admin.
- Your plan. A module your plan does not include is refused.
404 Not found
{"ok": false, "error": "Risk not found"}
The record does not exist in your organisation: the id is wrong, or the record was deleted. Ids from another organisation are never found. A path that is not an API route at all answers a web page, not JSON; check the path against the reference.
400 Bad request
The call is missing something the endpoint needs, and the sentence says what, for example "subjectType and subjectId are required". Add the named query keys.
Some answers say only "Validation failed". When the answer carries details, it names the field; otherwise check each value you sent against the reference.
429 Too many requests
You sent more requests in a minute than your plan allows for one key or person. The answer has a Retry-After header with the number of seconds to wait. Wait that long, then send again; spread a big read over more time, and use limit=100 to read fewer, larger pages.
500 Server error
Something failed on Valystrum's side. Try again later. If it repeats with the same call, check that page and limit are whole numbers and that sort names a field the records carry: a list answers 500, sometimes with an empty body, instead of 400 when they are not. Then contact support with the time of the call and the address you called (leave the key out).