Errors
We use standard HTTP status codes. A 2xx code means the request worked. A 4xx code means
the request needs to change before you retry it. A 5xx code usually means something failed on our
side.
Error format
Section titled “Error format”An error from an endpoint is JSON with a message, and sometimes an error_code:
{ "message": "validation failed: field 'emails' is required", "error_code": "emails_required"}| Field | Description |
|---|---|
message |
What went wrong, in plain English. Show it to a person or log it. The wording can change. |
error_code |
A stable code for the cause. Only some errors have one. Use it, not the message, when your code needs to react to a specific cause. |
Some errors are returned before a request reaches an endpoint, and they look different:
| Status | Cause | Body |
|---|---|---|
401 |
A failed authentication check | JSON with an error field: {"error": "Invalid API key for this organization"} |
429 |
A rate limit | JSON with an error field: {"error": "Rate limit exceeded. Try again later."} |
404 |
A path that does not exist | Plain text: 404 page not found |
405 |
A path that exists, called with the wrong method | Plain text: 405 method not allowed |
Status codes
Section titled “Status codes”| Status | Meaning | What to do |
|---|---|---|
207 |
Adding users failed for at least one email address, possibly all of them. | Read the result for each address in the response. |
301 |
The endpoint has moved. Only the deprecated use cases endpoint returns this. | Call the endpoint named in the Location header. |
400 |
The request is not valid: a missing or wrong field, a bad ID, or a value outside its limits. | Fix the request. |
401 |
The API key is missing or not valid for this organization. | Check the key and the organization ID. |
403 |
The request refers to something outside your organization, or asks for something a key may not do. | Check the IDs in the request. |
404 |
The thing you asked for does not exist, or the path is wrong. | Check the ID and the path. |
405 |
The path does not accept this method. | Check the method in the API reference. |
409 |
The request conflicts with what already exists, such as a duplicate name. | Change the value, or use the existing item. |
413 |
The request body is too large. | Send less text. The endpoint lists its limits. |
429 |
The key has sent too many requests. | Wait for the Retry-After time, then retry. |
500 |
Something failed while handling the request. | See below. |
Each endpoint in the API reference lists the status codes it can return and what causes them.
When you get a 500
Section titled “When you get a 500”Most 500 responses are temporary: try again a little later, and contact Uneeq support if it keeps
happening.
A few are caused by the request itself, and retrying will not help. On some endpoints, a body that is
not valid JSON returns 500, not 400. Each endpoint’s 500 description in the API reference says
when the request can cause it, so check there before you retry.
Validation messages
Section titled “Validation messages”How much a 400 tells you depends on the endpoint.
When you add users, or create or update a training scenario, the message names the field and the
rule it broke, and comes with an error_code:
| Message | Meaning |
|---|---|
validation failed: field 'emails' is required |
The field is missing or null. |
validation failed: field 'scenario_type' must be one of [ROLE_PLAY, PRACTICE] |
The value is not one of the allowed values. |
validation failed: field 'roles' contains an invalid role — allowed values: … |
A role in the list is not a role ID. |
validation failed: field 'learning_domain_id' must be a valid UUID |
The value is not a UUID. |
Only the first problem is reported. Fix it and send the request again to see the next one.
The other endpoints return a general message without a field name:
{ "message": "invalid request"}Check the request against the endpoint’s fields in the API reference.
Requests that change several things
Section titled “Requests that change several things”Some endpoints act on a list, such as adding several users at once. Check each endpoint in the API reference: some apply the whole list or nothing, and others report a result for each item.

