Errors
A v2 error answers an HTTP status and a google.rpc.Status body. The body’s code is a
gRPC status code, not the HTTP status, and message says what went wrong. Branch on the
HTTP status, and log message for anything you don’t handle automatically. v1 errors use
different bodies and a few different status meanings; see the aside at the end.
The v2 body
Section titled “The v2 body”{ "code": 7, "message": "missing required scope \"inventory:self\"", "details": []}codeis an integer gRPC code. The table below maps each one to its HTTP status.messageis a human-readable string. Don’t match on its exact wording.detailsis an array of typed objects, each carrying an@type. It is often empty.
Status codes
Section titled “Status codes”| HTTP | code |
When |
|---|---|---|
400 |
3 |
An argument failed validation, such as a malformed timestamp or a cursor the route can’t read. |
401 |
16 |
The request carried no token. |
403 |
7 |
The token is valid but lacks the scope the service needs, or it is not bound to an integration. |
404 |
5 |
The thing addressed, or the route itself, does not exist. |
429 |
8 |
Resource exhausted, such as a rate limit. See Throttle limits. |
500 |
13 |
An unhandled error on our side. Code 2 (unknown) also answers 500. |
503 |
14 |
A service the call depends on is unavailable. Transient. |
Scope failures are the common 403. The scoped services name the missing scope in
message, as in the example above. See Scopes. The rarer cause —
a token that resolves but isn’t bound to any integration — is the one place worth reading
message for: it says so explicitly, and no other field tells the two apart.
What to retry
Section titled “What to retry”- Retry with backoff:
429and503. Both are transient. - Do not retry unchanged:
400,401,403and404. The request or the credential has to change first. - Retry once, then escalate:
500. If it repeats, send us the time, the route and themessage.
API changelog · Built 0c509dd3