{"openapi":"3.1.0","info":{"title":"SleetPay API","version":"1.0.0","description":"Create checkouts, read customers, orders and subscriptions, ingest usage events, manage seats and validate license keys. Authenticate with an organization access token (`Authorization: Bearer sk_live_...`) created in Dashboard > API keys, or an OAuth access token. Each key carries scopes; an endpoint needing a scope the key lacks answers 403. Amounts are integers in the currency's minor unit (cents for USD). Lists return `{ items, pagination }` and take `page` and `limit` (max 100)."},"servers":[{"url":"https://app.sleetpay.com"}],"tags":[{"name":"Checkouts"},{"name":"Products"},{"name":"Customers"},{"name":"Orders"},{"name":"Subscriptions"},{"name":"Seats"},{"name":"License keys"},{"name":"Usage"},{"name":"Credits"},{"name":"Customer sessions"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Organization access token or OAuth access token. Scopes: products:read (List products and prices); checkouts:read (Read checkout sessions); checkouts:write (Create checkout sessions); customers:read (Read customers); customers:write (Create and update customers); orders:read (Read orders); subscriptions:read (Read subscriptions); subscriptions:write (Cancel and resume subscriptions); license_keys:read (Read license keys and activations); customer_sessions:write (Mint customer portal sessions); events:write (Ingest usage events); meters:read (Read meters); balance:read (Read customer credit balances); credits:write (Transfer prepaid credits between customers); seats:read (Read seat assignments); seats:write (Assign and revoke seats)."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string","description":"A human-readable message."}},"required":["error"]},"Price":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","description":"standard | free | credit_pack | metered"},"amount":{"type":"integer"},"currency":{"type":"string"},"is_archived":{"type":"boolean"}}},"Product":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"is_recurring":{"type":"boolean"},"recurring_interval":{"type":["string","null"],"description":"month | year"},"recurring_interval_count":{"type":["integer","null"],"description":"Bills every N intervals: 1, or 3 / 6 with month"},"seat_based":{"type":"boolean"},"min_seats":{"type":["integer","null"]},"max_seats":{"type":["integer","null"]},"is_archived":{"type":"boolean"},"review_status":{"type":"string"},"organization_id":{"type":"string"},"prices":{"type":"array","items":{"$ref":"#/components/schemas/Price"}},"created_at":{"type":"string","format":"date-time"}}},"Customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":["string","null"]},"external_id":{"type":["string","null"],"description":"Your own user id."},"country":{"type":["string","null"]},"tax_id":{"type":["string","null"]},"organization_id":{"type":"string"},"created_at":{"type":"string","format":"date-time"}}},"Checkout":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","description":"Send the buyer here."},"status":{"type":"string"},"expires_at":{"type":"string","format":"date-time"},"success_url":{"type":["string","null"]},"metadata":{"type":"object","additionalProperties":{"type":["string","number","boolean"]},"description":"Up to 20 flat keys. Echoed in webhooks."}},"required":["id","url"]},"Order":{"type":"object","properties":{"id":{"type":"string"},"invoice_number":{"type":["string","null"]},"status":{"type":"string","description":"paid | refunded"},"kind":{"type":"string"},"amount":{"type":"integer"},"discount_amount":{"type":"integer"},"tax_amount":{"type":"integer"},"tax_rate_bp":{"type":"integer"},"seats":{"type":"integer"},"currency":{"type":"string"},"customer_id":{"type":"string"},"product_id":{"type":"string"},"created_at":{"type":"string","format":"date-time"}}},"Subscription":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","description":"active | past_due | paused | canceled | incomplete"},"customer_id":{"type":"string"},"product_id":{"type":"string"},"seats":{"type":"integer"},"cancel_at_period_end":{"type":"boolean"},"pause_at_period_end":{"type":"boolean","description":"Billing stops when the paid period ends."},"paused_at":{"type":["string","null"],"format":"date-time"},"current_period_start":{"type":"string","format":"date-time"},"current_period_end":{"type":"string","format":"date-time"},"started_at":{"type":"string","format":"date-time"},"ended_at":{"type":["string","null"],"format":"date-time"}}},"Seat":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"status":{"type":"string"},"subscription_id":{"type":["string","null"]},"order_id":{"type":["string","null"]}}},"CustomerState":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"external_id":{"type":["string","null"]},"active_subscriptions":{"type":"array","items":{"$ref":"#/components/schemas/Subscription"}},"granted_benefits":{"type":"array","items":{"type":"object"}},"credit_balances":{"type":"array","items":{"type":"object"}},"meters":{"type":"array","items":{"type":"object"}}}},"License":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","description":"granted | revoked | disabled"},"limit_activations":{"type":["integer","null"]},"activations_count":{"type":"integer"},"expires_at":{"type":["string","null"],"format":"date-time"}}},"UsageEvent":{"type":"object","properties":{"name":{"type":"string","description":"Event name a meter watches, e.g. llm.call."},"externalCustomerId":{"type":"string","description":"Your own user id."},"customerEmail":{"type":["string","null"],"format":"email"},"properties":{"type":"object","additionalProperties":{"type":"number"},"description":"Up to 50 numeric properties."},"timestamp":{"type":"string","description":"ISO 8601 with offset. Defaults to now.","format":"date-time"},"idempotencyKey":{"type":"string","description":"Resending the same key never double-counts."}}}}},"paths":{"/api/v1/checkouts":{"post":{"summary":"Create a checkout","description":"Returns a hosted checkout `url`; redirect the buyer there. After payment they land on `success_url?checkout_id=<id>`. Sessions expire after 24 hours.","tags":["Checkouts"],"security":[{"bearerAuth":["checkouts:write"]}],"x-required-scope":"checkouts:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"product_id":{"type":"string"},"price_id":{"type":"string","description":"Defaults to the product's first active price."},"currency":{"type":"string","description":"Picks the product's price in this currency."},"seats":{"type":"integer","minimum":1},"amount":{"type":"integer","description":"Pay-what-you-want amount in minor units."},"discount_id":{"type":["string","null"]},"allow_discount_codes":{"type":"boolean"},"affiliate_code":{"type":"string"},"customer_email":{"type":["string","null"],"format":"email"},"customer_name":{"type":["string","null"]},"external_customer_id":{"type":["string","null"],"description":"Your own user id; becomes the customer's external_id."},"success_url":{"type":["string","null"],"format":"uri"},"metadata":{"type":"object","additionalProperties":{"type":["string","number","boolean"]},"description":"Up to 20 flat keys. Echoed in webhooks."}},"required":["product_id"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Checkout"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/checkouts/{id}":{"get":{"summary":"Get a checkout","tags":["Checkouts"],"security":[{"bearerAuth":["checkouts:read"]}],"x-required-scope":"checkouts:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Checkout id"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Checkout"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/products":{"get":{"summary":"List products","tags":["Products"],"security":[{"bearerAuth":["products:read"]}],"x-required-scope":"products:read","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"description":"Page size (max 100)."},{"name":"include_archived","in":"query","schema":{"type":"boolean"},"description":"Include archived and unapproved products."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"pagination":{"type":"object","properties":{"total_count":{"type":"integer"},"max_page":{"type":"integer"}}}},"required":["items","pagination"]}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/customers":{"get":{"summary":"List customers","tags":["Customers"],"security":[{"bearerAuth":["customers:read"]}],"x-required-scope":"customers:read","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"description":"Page size (max 100)."},{"name":"email","in":"query","schema":{"type":"string"},"description":"Filter by exact email."},{"name":"external_id","in":"query","schema":{"type":"string"},"description":"Filter by your own user id."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"pagination":{"type":"object","properties":{"total_count":{"type":"integer"},"max_page":{"type":"integer"}}}},"required":["items","pagination"]}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a customer","tags":["Customers"],"security":[{"bearerAuth":["customers:write"]}],"x-required-scope":"customers:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"name":{"type":["string","null"]},"external_id":{"type":["string","null"]}},"required":["email"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/customers/{id}":{"get":{"summary":"Get a customer","tags":["Customers"],"security":[{"bearerAuth":["customers:read"]}],"x-required-scope":"customers:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Customer id"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/customers/{id}/state":{"get":{"summary":"Get a customer's entitlements","description":"Active and past-due subscriptions, granted benefits, credit balances and metered usage in one read.","tags":["Customers"],"security":[{"bearerAuth":["customers:read"]}],"x-required-scope":"customers:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Customer id"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerState"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/customers/external/{externalId}":{"get":{"summary":"Get a customer by your own user id","tags":["Customers"],"security":[{"bearerAuth":["customers:read"]}],"x-required-scope":"customers:read","parameters":[{"name":"externalId","in":"path","required":true,"schema":{"type":"string"},"description":"Your own user id"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/customers/external/{externalId}/state":{"get":{"summary":"Get entitlements by your own user id","tags":["Customers"],"security":[{"bearerAuth":["customers:read"]}],"x-required-scope":"customers:read","parameters":[{"name":"externalId","in":"path","required":true,"schema":{"type":"string"},"description":"Your own user id"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerState"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/orders":{"get":{"summary":"List orders","tags":["Orders"],"security":[{"bearerAuth":["orders:read"]}],"x-required-scope":"orders:read","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"description":"Page size (max 100)."},{"name":"customer_id","in":"query","schema":{"type":"string"},"description":"Only this customer's orders."},{"name":"product_id","in":"query","schema":{"type":"string"},"description":"Only orders of this product."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Order"}},"pagination":{"type":"object","properties":{"total_count":{"type":"integer"},"max_page":{"type":"integer"}}}},"required":["items","pagination"]}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/subscriptions":{"get":{"summary":"List subscriptions","tags":["Subscriptions"],"security":[{"bearerAuth":["subscriptions:read"]}],"x-required-scope":"subscriptions:read","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"description":"Page size (max 100)."},{"name":"customer_id","in":"query","schema":{"type":"string"},"description":"Only this customer's subscriptions."},{"name":"status","in":"query","schema":{"type":"string"},"description":"Filter by status."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Subscription"}},"pagination":{"type":"object","properties":{"total_count":{"type":"integer"},"max_page":{"type":"integer"}}}},"required":["items","pagination"]}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/subscriptions/{id}":{"get":{"summary":"Get a subscription","tags":["Subscriptions"],"security":[{"bearerAuth":["subscriptions:read"]}],"x-required-scope":"subscriptions:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscription id"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Cancel at period end, resume, pause, or change seats","tags":["Subscriptions"],"security":[{"bearerAuth":["subscriptions:write"]}],"x-required-scope":"subscriptions:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscription id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"cancel_at_period_end":{"type":"boolean"},"seats":{"type":"integer","minimum":1},"pause":{"type":"boolean","description":"true pauses billing at the end of the paid period; false undoes the pause, or restarts billing today if already paused."},"proration":{"type":"string","enum":["prorated_immediately","do_not_bill"],"description":"How added seats are billed."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"Revoke a subscription now","tags":["Subscriptions"],"security":[{"bearerAuth":["subscriptions:write"]}],"x-required-scope":"subscriptions:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Subscription id"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/seats":{"get":{"summary":"List seats","description":"Pass `subscription_id`, `order_id` or `email`. By email it returns every seat that person holds on a live subscription or paid order.","tags":["Seats"],"security":[{"bearerAuth":["seats:read"]}],"x-required-scope":"seats:read","parameters":[{"name":"subscription_id","in":"query","schema":{"type":"string"},"description":"Subscription to list seats of."},{"name":"order_id","in":"query","schema":{"type":"string"},"description":"Order to list seats of."},{"name":"email","in":"query","schema":{"type":"string"},"description":"Seats this person holds."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Seat"}}}}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Assign a seat","description":"Idempotent per email. 409 when every paid seat is taken.","tags":["Seats"],"security":[{"bearerAuth":["seats:write"]}],"x-required-scope":"seats:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subscription_id":{"type":"string"},"order_id":{"type":"string"},"email":{"type":"string","format":"email"}},"required":["email"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Seat"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/seats/{id}":{"delete":{"summary":"Revoke a seat","tags":["Seats"],"security":[{"bearerAuth":["seats:write"]}],"x-required-scope":"seats:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Seat id"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Seat"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/license-keys":{"get":{"summary":"List license keys","tags":["License keys"],"security":[{"bearerAuth":["license_keys:read"]}],"x-required-scope":"license_keys:read","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"description":"Page size (max 100)."},{"name":"customer_id","in":"query","schema":{"type":"string"},"description":"Only this customer's keys."},{"name":"benefit_id","in":"query","schema":{"type":"string"},"description":"Only keys of this benefit."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/License"}},"pagination":{"type":"object","properties":{"total_count":{"type":"integer"},"max_page":{"type":"integer"}}}},"required":["items","pagination"]}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/license-keys/validate":{"post":{"summary":"Validate a license key","description":"Public: call it from your customers' software. `organization_id` plus the secret `key` are the credentials.","tags":["License keys"],"security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organization_id":{"type":"string"},"key":{"type":"string"},"activation_id":{"type":"string"},"benefit_id":{"type":"string"}},"required":["organization_id","key"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/License"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/license-keys/activate":{"post":{"summary":"Activate a license key","description":"Idempotent per `label`. 403 once the activation limit is reached or the key is revoked or expired.","tags":["License keys"],"security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organization_id":{"type":"string"},"key":{"type":"string"},"label":{"type":"string"},"meta":{"type":"object","additionalProperties":{"type":["string","number","boolean"]},"description":"Up to 20 flat keys. Echoed in webhooks."}},"required":["organization_id","key","label"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/License"}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/license-keys/deactivate":{"post":{"summary":"Deactivate a license key","tags":["License keys"],"security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organization_id":{"type":"string"},"key":{"type":"string"},"activation_id":{"type":"string"}},"required":["organization_id","key","activation_id"]}}}},"responses":{"204":{"description":"Deactivated."},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/events":{"post":{"summary":"Ingest usage events","description":"Send one event or `{ events: [...] }` (1 to 500). Safe to retry: the `idempotencyKey` never double-counts. 402 when a prepaid customer has too few credits.","tags":["Usage"],"security":[{"bearerAuth":["events:write"]}],"x-required-scope":"events:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/UsageEvent"},{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/UsageEvent"},"minItems":1,"maxItems":500}},"required":["events"]}]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"idempotencyKey":{"type":"string"},"status":{"type":"string"}}}}}}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Insufficient credits.","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object"}}}}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/meters":{"get":{"summary":"List meters","tags":["Usage"],"security":[{"bearerAuth":["meters:read"]}],"x-required-scope":"meters:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/balance":{"get":{"summary":"Get a customer's credit balances","tags":["Credits"],"security":[{"bearerAuth":["balance:read"]}],"x-required-scope":"balance:read","parameters":[{"name":"externalCustomerId","in":"query","schema":{"type":"string"},"description":"Your own user id.","required":true}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"balances":{"type":"array","items":{"type":"object","properties":{"unitLabel":{"type":"string"},"units":{"type":"integer"}}}}}}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/credits/transfer":{"post":{"summary":"Transfer credits between customers","description":"Atomic, never overdraws (402 with `available`), safe to retry with the same `idempotency_key`.","tags":["Credits"],"security":[{"bearerAuth":["credits:write"]}],"x-required-scope":"credits:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"from_external_customer_id":{"type":"string"},"to_external_customer_id":{"type":"string"},"units":{"type":"integer","minimum":1},"unit_label":{"type":"string","default":"tokens"},"idempotency_key":{"type":"string"}},"required":["from_external_customer_id","to_external_customer_id","units","idempotency_key"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"units":{"type":"integer"},"from_balance":{"type":"integer"},"to_balance":{"type":"integer"},"duplicate":{"type":"boolean"}}}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/customer-sessions":{"post":{"summary":"Create a customer portal session","description":"Pass exactly one of `customer_id`, `external_customer_id`, `customer_email`. Send the customer to `customer_portal_url`.","tags":["Customer sessions"],"security":[{"bearerAuth":["customer_sessions:write"]}],"x-required-scope":"customer_sessions:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{"type":"string"},"external_customer_id":{"type":"string"},"customer_email":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"expires_at":{"type":"string","format":"date-time"},"customer_portal_url":{"type":"string"}}}}}},"400":{"description":"The request body or parameters are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, expired or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key does not carry the scope this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Retry after the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}