1. Billing
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. Billing

Change a customer's plan

POST
/v1/consumers/{id}/plan
Without a subscription, only free plans work and the change is immediate; a plan with a price returns 409 paid_plan_needs_checkout, because customers move onto paid plans by paying through checkout. For a subscription created by UsageRail, the change follows the portal rules listed under Changing plans in the UsageRail docs; read change.status for the result, and send {"keep": true} to drop the change that's waiting. A subscription you manage directly in Stripe returns 409 subscription_managed_in_stripe: change it in Stripe.

Request

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

Header Params

Body Params application/jsonRequired

Examples

Responses

🟢200
application/json
The customer, and for a customer whose subscription was created by UsageRail a change whose status is changed, payment_required (with payment_url), scheduled (with effective_at) or kept.
Bodyapplication/json

🟠400Error
🟠404Error
🟠409Error
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://api.usagerail.com/v1/consumers//plan' \
--header 'Idempotency-Key;' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "plan_id": "string",
    "interval": "month",
    "keep": true
}'
Response Response Example
200 - Example 1
{
    "consumer": {
        "id": "cons_7Qm2xR9s",
        "email": "ada@example.com",
        "external_id": "4f9c1d0e7b6a...",
        "status": "active",
        "email_verified": false,
        "created_at": "2026-10-21T09:14:03.120Z",
        "plan": {
            "id": "plan_free",
            "name": "Free",
            "version": 1
        },
        "quota": {
            "behavior": "stop",
            "limit": "1000"
        },
        "rate_limits": {
            "per_second": 2,
            "per_minute": null
        },
        "current_period": {
            "period_start": "2026-10-01T00:00:00.000Z",
            "period_end": "2026-11-01T00:00:00.000Z",
            "billable_requests": "37",
            "billable_units": "37"
        },
        "balance": null,
        "active_keys": 1,
        "subscription": null
    },
    "change": {
        "status": "changed",
        "payment_url": "string",
        "effective_at": "2019-08-24T14:15:22.123Z"
    }
}
Modified at 2026-11-21 14:07:45
Previous
Revoke a key
Next
Open Stripe Checkout
Built with