Errors
Every error type and code the OpenCourt API returns, what each one means, and what to do about it.
Every error has the same envelope, with the HTTP status on the response:
{
"error": {
"type": "permission_error",
"code": "insufficient_scope",
"message": "This API key lacks the orders:read scope this endpoint requires.",
"request_id": "req_…",
"doc_url": "https://www.getopencourt.com/developers/errors/insufficient_scope"
}
}| Field | Meaning |
|---|---|
type | The kind of error. Branch on it for general handling (retry, fix the request, ask for access). |
code | The exact case. Stable: a code is never renamed or reused. Branch on it for specific handling. |
message | A sentence for a developer. It can change at any time: never parse it. |
param | The parameter or header that caused it, when there is one. |
request_id | The id of this request. Send it to support with any question about the error. |
doc_url | This page, at the section for code. |
New codes can be added. Handle an unknown code by its type.
Types
| Status | type | Meaning | What to do |
|---|---|---|---|
| 400 | invalid_request_error | The request is wrong. | Fix it. Do not retry it unchanged. |
| 401 | authentication_error | No valid API key. | Send a valid key. |
| 403 | permission_error | The key or the club may not do this. | Get a key with the right scope, or ask the club. |
| 404 | not_found_error | The resource does not exist in your club. | Check the id. |
| 409 | conflict_error | The request conflicts with the current state. | Read the resource again, then retry. |
| 429 | rate_limit_error | Too many requests. | Wait Retry-After seconds, then retry with backoff. |
| 500, 503 | api_error | A problem on our side. | Retry with backoff. If it persists, contact support with the request_id. |
Codes
parameter_invalid
400 invalid_request_error. A parameter is missing or invalid. param names it and message says what is
wrong. Fix the value and send the request again.
invalid_api_version
400 invalid_request_error. The OpenCourt-Version header names no supported version. Send a version from the
changelog, or leave the header out to use your key's version.
api_version_retired
400 invalid_request_error. The version you asked for, or the version your key is pinned to, is retired. Upgrade
the key to a supported version (Versioning).
unauthorized
401 authentication_error. The API key is missing, malformed or revoked. Send the whole key as a Bearer token:
Authorization: Bearer oc_live_…. The response does not say which of these it is, on purpose.
api_key_expired
401 authentication_error. The API key passed its expiry date. The message names the date. An expired key does
not work again: ask the club for a new key. You get this code only when you send the whole key; anything else gets
unauthorized. If your integration created webhook endpoints with the old key, they stopped too: create them again
with the new key.
insufficient_scope
403 permission_error. The key does not have the scope this endpoint needs. The message names the scope. Create
a key that has it (Scopes).
api_not_enabled
403 permission_error. API access is not enabled for this club. OpenCourt turns it on: the club asks
support@getopencourt.com. The club's admins cannot turn it on themselves.
club_unavailable
403 permission_error. The club is no longer available on OpenCourt (for example, it was archived). A club that is
still in setup can use the API.
not_found
404 not_found_error. The resource does not exist in your club. An id from another club is never found.
endpoint_conflict
409 conflict_error. The webhook endpoint was changed by another request at the same time. Read it again, then
send your change again.
endpoint_pending
409 conflict_error. The webhook endpoint has no signing secret yet. Either it is not connected to the delivery
service yet, or the delivery service did not answer. The message says which. Retry in a few seconds.
rate_limited
429 rate_limit_error. The key sent too many requests. Wait the number of seconds in the Retry-After header,
then retry with exponential backoff and jitter (Rate limits).
internal_error
500 api_error. Something went wrong on our side. Retry with backoff. If it persists, contact support with the
request_id.
api_version_unavailable
503 api_error. Part of the response was written by a newer OpenCourt release that is still rolling out. Retry in
a few seconds (Retry-After).