Check a rate limit
const url = 'https://example.com/v1/limit';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"algorithm":"sliding_window","key":"example","limit":1,"namespace":"example","window_ms":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/limit \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "algorithm": "sliding_window", "key": "example", "limit": 1, "namespace": "example", "window_ms": 1 }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
sliding_windowResponses
Section titled “Responses”object
Examplegenerated
{ "allowed": true, "limit": 1, "remaining": 1, "reset_ms": 1}Malformed request
The JSON body returned for every error response: { "error": "<message>" },
optionally with a stable machine code ({ "error": ..., "code": ... }).
The code lets clients map an error to their own localized copy instead of
showing the English error string; it is present only for errors we’ve
assigned a stable code, and omitted otherwise.
object
Stable machine-readable error code for client-side localization, when one
is defined for this error (e.g. key_not_found, algorithm_not_on_plan).
Human-readable error message. Never contains internal/driver detail.
Examplegenerated
{ "code": "example", "error": "example"}Missing or invalid API key
The JSON body returned for every error response: { "error": "<message>" },
optionally with a stable machine code ({ "error": ..., "code": ... }).
The code lets clients map an error to their own localized copy instead of
showing the English error string; it is present only for errors we’ve
assigned a stable code, and omitted otherwise.
object
Stable machine-readable error code for client-side localization, when one
is defined for this error (e.g. key_not_found, algorithm_not_on_plan).
Human-readable error message. Never contains internal/driver detail.
Examplegenerated
{ "code": "example", "error": "example"}Algorithm not available on the caller’s plan (§4.3)
The JSON body returned for every error response: { "error": "<message>" },
optionally with a stable machine code ({ "error": ..., "code": ... }).
The code lets clients map an error to their own localized copy instead of
showing the English error string; it is present only for errors we’ve
assigned a stable code, and omitted otherwise.
object
Stable machine-readable error code for client-side localization, when one
is defined for this error (e.g. key_not_found, algorithm_not_on_plan).
Human-readable error message. Never contains internal/driver detail.
Examplegenerated
{ "code": "example", "error": "example"}Monthly hard ceiling exceeded (§4.2 anti-abuse cap)
The JSON body returned for every error response: { "error": "<message>" },
optionally with a stable machine code ({ "error": ..., "code": ... }).
The code lets clients map an error to their own localized copy instead of
showing the English error string; it is present only for errors we’ve
assigned a stable code, and omitted otherwise.
object
Stable machine-readable error code for client-side localization, when one
is defined for this error (e.g. key_not_found, algorithm_not_on_plan).
Human-readable error message. Never contains internal/driver detail.
Examplegenerated
{ "code": "example", "error": "example"}