1. HTTP check
UsageRail API
  • HTTP check
    • Check a request
      POST
  • Customers
    • Create a customer
      POST
    • Get a customer
      GET
    • Claim an email or external ID
      POST
    • Get a customer's usage
      GET
  • Keys
    • Create a key
      POST
    • Revoke a key
      DELETE
  • Billing
    • Change a customer's plan
      POST
    • Open Stripe Checkout
      POST
    • Adjust a prepaid balance
      POST
  • Portal
    • Create a portal sign-in link
      POST
  • Schemas
    • Error
    • CheckRequest
    • CheckResult
    • Consumer
    • Usage
  1. HTTP check

Check a request

POST
/v1/check
Call this at the start of each request your API receives. Send exactly one of key or consumer. An allowed check counts its units right away. The check never sees your API's response, so those units still count if the request later fails. Refused checks (allowed: false) are excluded from billable usage.
Set a timeout (500 ms is a reasonable start) and don't retry a check that timed out: each call is a new check, and if the retry is allowed too, both count.

Request

Authorization
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
or
Body Params application/jsonRequired

Examples

Responses

🟒200
application/json
The check completed. Read allowed to see whether to handle the request, then use code to choose the response you send your customer.
Bodyapplication/json

🟠400
🟠401
🟠409
🟠410
🟠429
πŸ”΄503
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://api.usagerail.com/v1/check' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "key": "acme_live_...",
    "method": "GET",
    "route": "/v1/items/{id}"
}'
Response Response Example
200 - ζˆεŠŸη€ΊδΎ‹
{
    "allowed": true,
    "code": "ok",
    "limit": 1000,
    "remaining": 412,
    "retry_after": null
}
Modified atΒ 2026-11-21 14:07:45
Next
Create a customer
Built with