Errors

The one shape every error comes in, and the codes any endpoint can return.

Errors come in one shape:

{"error": {"code": "event-ended", "message": "This event has ended."}}

There's one exception, which only happens when calling sekaibeyond.com/api directly. A body sent as application/json that isn't a JSON object or array never reaches the API: Google's servers turn it away with a bare HTML 400. That covers malformed JSON and bare strings, numbers or null. Through api.sekaibeyond.com, the relay catches it first and answers 400 invalid-request in the usual shape.

Branch on code. message is for people, and its wording may change. Each endpoint's page lists its own errors.

Every endpoint

Every endpoint can also return these:

StatusCodeWhen
401missing-api-keyThere's no Authorization: Bearer header.
401invalid-api-keyThe key isn't one of ours, or has been revoked.
401api-key-expiredThe key has expired.
403missing-scopeThe key lacks the scope the endpoint needs.
404not-foundNo such endpoint.
405method-not-allowedWrong method. The Allow header names the right one.
429rate-limitedOver 120 calls a minute. Retry-After says how many seconds to wait.
500internalSomething went wrong on our side. Try again.

From the relay

The relay adds these of its own, in the same shape:

StatusCodeWhen
400invalid-requestA body sent as application/json isn't a JSON object or array.
413payload-too-largeThe request body is over 64 KiB.
502upstream-unavailableThe API couldn't be reached.
504upstream-timeoutThe API took over 30 seconds.

On this page