UsageRail API#

    UsageRail manages API keys, per-customer rate limits and quotas, and handles usage-based billing for APIs through your own Stripe account. This reference covers its two HTTP APIs:
    HTTP check (POST /v1/check) for APIs written in a language without an SDK (Go, PHP, Ruby, Java, .NET and others). Your server calls it at the start of each request; it checks the key, the rate limit and the quota, and counts the request if it's allowed.
    Server API (/v1/consumers, /v1/keys) for your backend to create customers, issue and revoke their keys, read usage, change plans, open checkout and sign customers in to the portal.
    Both are for calls from your server, never from a browser. Errors are JSON with an error field. Any server API call can return 401 invalid_management_key for a wrong server API key, 429 rate_limited after repeated wrong keys from the same address, or 410 app_deleted once the app is being deleted. Endpoints that look up a customer or key return 404 not_found when it isn't in this app.
    Setup guides, the Node.js and Python SDKs, and the behavior behind each field are in the UsageRail docs.

    Endpoints#

    EndpointWhat it does
    POST /v1/checkCheck a request from a language without an SDK
    POST /v1/consumersCreate a customer
    GET /v1/consumers/{id}Get a customer
    POST /v1/consumers/{id}/claimAttach an email or your own user ID to a customer
    GET /v1/consumers/{id}/usageDaily usage and the busiest routes
    POST /v1/consumers/{id}/keysCreate an API key for a customer
    DELETE /v1/keys/{key_id}Revoke a key
    POST /v1/consumers/{id}/planChange a customer's plan
    POST /v1/consumers/{id}/checkoutOpen Stripe Checkout for a plan or a credit pack
    POST /v1/consumers/{id}/credits/adjustAdd or remove prepaid credits by hand
    POST /v1/consumers/{id}/portal-linkCreate a one-time portal sign-in link
    Built with