Errors and API limits
The API reports a failure in one of two places. A request Owlie cannot accept at all, because the
credential is bad or the body is too large, answers with an HTTP error status. A request Owlie
accepts and then refuses, because of a missing permission or invalid input, answers status 200 with
an errors array. A client has to check both.
Failures before the operation runs
| Status | Body | Cause |
|---|---|---|
401 | { "message": "Not Authorized" } | No API key, an unknown, revoked or expired key, a key from another organization, or a disabled service account. |
413 | { "errors": [{ "message": "...", "extensions": { "code": "PAYLOAD_TOO_LARGE", "status": 413 } }] } | The request body is larger than 6 MB. |
Neither is worth retrying unchanged. For a 401, check the key and the host name:
How to use the API lists what Owlie checks.
Errors in the response
A refused operation adds an entry to errors:
{
"errors": [
{
"message": "Not authorized for identity.read",
"extensions": { "code": "OwlieError", "status": 403 }
}
],
"data": null
}
| Field | Holds |
|---|---|
message | What failed, written for the caller. Show or log it, but don't match on its text. |
extensions.status | The HTTP status the failure stands for. Branch on this first. |
extensions.code | The kind of error. Specific failures have their own code, and the rest carry a general one. |
extensions.retryable | Present on some errors: true when sending the same operation again can succeed. |
extensions.context | Present on some errors: details a client can act on, such as the list of validation issues. |
Owlie never puts internal details in an error. A failure it did not expect answers
"message": "Internal Error" with "code": "INTERNAL_SERVER_ERROR" and "status": 500.
Common errors
status | code | Meaning | What to do |
|---|---|---|---|
| 400 | ValidationError | An argument or input is invalid. extensions.context.issues lists each problem with code, message and path when there are several. | Fix the input. Sending it again unchanged fails again. |
| 400 | OPERATION_TOO_COMPLEX | The document exceeds a shape limit. extensions.measure, limit and actual say which one. | Select fewer fields or a smaller page (limits). |
| 403 | OwlieError | The service account lacks a permission. The message names it: Not authorized for resource.read. | Assign a role that grants it, or stop calling the field. |
| 404 | NotFoundError | The object an operation acts on does not exist in this organization. | Check the identifier. |
| 409 | LimitExceededError | The change would pass a usage limit. extensions.context holds the limit's key, the current usage and the limit. | See usage and limits. |
| 409 | AMBIGUOUS_IDENTITY_EMAIL | An identity lookup by email matched more than one identity. | Look the identity up by id. |
| 409 | CANCELLATION_TOO_LATE | A provisioning operation had already started when you tried to cancel it. | Read the operation to see its outcome. |
| 429 | varies | The operation limits how often it can run, and you passed that rate. | Wait, then retry. |
| 500 | INTERNAL_SERVER_ERROR | Owlie failed while running the operation. | Retry a query. For a mutation, read the object first to see whether the change was made. |
Some operations are reserved for a signed-in person, billing among them. An API key gets a 403 for
those whatever roles its service account has.
A lookup of one object that does not exist, or that the caller may not see, often answers null
with no error: identity(id: ...) returns null for an unknown id. Check for null before reading
the result.
Errors from GraphQL itself
A document that does not parse, selects a field that does not exist, or passes a variable of the
wrong type fails before any field runs. Those errors carry the GraphQL message, the position in the
document and a GraphQL code (GRAPHQL_PARSE_FAILED or GRAPHQL_VALIDATION_FAILED), and no
extensions.status. Sending query { myProfile { displayName } } answers:
{
"errors": [
{
"message": "Cannot query field \"displayName\" on type \"Identity\". Did you mean \"display_name\" or \"middle_name\"?",
"locations": [{ "line": 1, "column": 21 }],
"extensions": { "code": "GRAPHQL_VALIDATION_FAILED" }
}
]
}
Depending on the Accept header you send, the HTTP status for these is 200 or 400. The body is
the same either way, so read errors.
Partial results
GraphQL can return data and errors together: a field that fails becomes null, and the fields
around it still return. When a field the schema marks as required fails, the null moves up to the
nearest field that may be empty, which can be data itself. Use each error's path to see which
field it belongs to.
What to retry
- Retry when
extensions.retryableistrue, or whenextensions.statusis 429 or 500 and above. Wait between attempts, and longer each time. - Retry a network failure or a timeout for a query. For a mutation, you don't know whether Owlie applied it: read the object before sending the mutation again.
- Don't retry 400, 401, 403 or 404. The same request gets the same answer.
- A 409 means the object's state does not allow the operation. Read it again and decide. Don't loop.
Submitting work is different from the work finishing. createRequest returning a request number
means the request exists, and createBulkJob returning a job means the job is queued. Read the
request or the job to learn what happened.
Page-size limits
| Limit | Value |
|---|---|
Default page, when you send neither first nor last | 50 items |
Largest first or last | 500. A larger value is refused with a ValidationError. |
resourceAssignments, requestableCatalog | At most 100 items a page. A larger first returns 100. |
first together with last, or after with before | Refused. |
A connection never reports a total. Count without paging names the fields that count.
Document limits
Owlie measures each operation before running it and refuses one that exceeds a limit with
OPERATION_TOO_COMPLEX:
| Measure | Limit | Counts |
|---|---|---|
depth | 12 | How deep the selection nests. A root field is depth 1. |
aliases | 32 | Aliased fields. |
selections | 2,000 | Fields and fragment spreads, with every fragment expanded where it is used. |
cost | 500,000 | Each field costs 1, multiplied by the page sizes of the lists it sits inside. |
For cost, a list with a page-size argument multiplies everything under it by that size (50 when you
send none), and a list without one multiplies by 2. So this document costs 501: identities is 1,
data and id are 100 each, and groups and its id are 100 and 200.
query {
identities(first: 100) {
data {
id
groups {
id
}
}
}
}
Nesting one page inside another multiplies quickly: two nested pages of 500 already cost 250,000 a field. Ask for nested lists in separate requests, or with smaller pages.
Other limits
| Limit | Value |
|---|---|
| Request body | 6 MB |
| Identities in one bulk job run | 25,000 (bulk updates) |
| Form data on one requested resource | 128 KB |
Plan limits on the number of identities, API keys and other objects are separate from these: usage and limits describes them.
In the TypeScript SDK
The TypeScript SDK turns every failure into one OwlieSDKError, so you branch on
error.code instead of reading the response:
code | Raised for |
|---|---|
AUTHENTICATION_ERROR | Status 401 |
AUTHORIZATION_ERROR | Status 403 |
VALIDATION_ERROR | Status 400 or 422 |
NOT_FOUND_ERROR | Status 404 |
RATE_LIMIT_ERROR | Status 429 |
LIMIT_EXCEEDED | An error whose code is LimitExceededError |
CANCELLATION_TOO_LATE | The error of the same code |
AMBIGUOUS_IDENTITY_EMAIL | The error of the same code |
NETWORK_ERROR | The request did not complete. retryable is true. |
GRAPHQL_ERROR | A GraphQL error with no status, such as a document that does not validate |
UNKNOWN_ERROR | Anything else, including a 500 |
The SDK reads the status from extensions.status, so a refusal that arrives with HTTP 200 still
becomes AUTHORIZATION_ERROR. The error also carries status, operation, requestId, retryable
and raw (the original errors). retryable follows extensions.retryable when Owlie sends it, and
otherwise is true for statuses 408, 409, 425, 429 and 500 and above. The SDK does not retry for you.
SDK paging has its own limits, separate from the API's:
page_sizedefaults to 100.- A value above 500 is lowered to 500.
- A value that is not a positive whole number throws before any request.