Skip to content
Sign in Create account

Billing Redeem License

POST /api/billing/redeem-license

Redeems an eligible license code and adds its credit to the authenticated account balance. Requires an authenticated user. Bearer access tokens need the billing.write ability, and the associated account needs the billing.change permission. The * wildcard also satisfies the bearer ability check. Browser session authentication uses the account permission check without a token-ability check. API-key credentials are not accepted. A bearer token missing its ability receives a 403 JSON body with error: "token_ability_missing", required: ["billing.write"], and have.

Authenticate with a portal session token.

Request body

application/json object

  • code string required
    Length: 1 to 64 characters

Generated sample

{
  "code": "string"
}

Responses

200 The code was redeemed and the account balance was updated.

application/json object

  • balance_cents integer required
  • balance_dollars number required
  • credit_cents integer required
  • credit_dollars number required
  • balance_micros integer required

    Exact wallet balance in USD micro-dollars after redemption.

Generated sample

{
  "balance_cents": 0,
  "balance_dollars": 0,
  "credit_cents": 0,
  "credit_dollars": 0,
  "balance_micros": 0
}
401 Authentication is missing or invalid.

application/json object

  • error object required
    • code string required
      Value: "unauthenticated"
    • message string required
403 The bearer token lacks the required ability or the authenticated account lacks the required permission.

application/json any

Any of

  • object
    • error string required
      Value: "token_ability_missing"
    • have array of string required
    • message string required
    • required array of string required
  • object
    • message string required
409 The Idempotency-Key cannot be used for this request because it conflicts with another request (idempotency_key_conflict), is still in progress (idempotency_request_in_progress), or its response was not retained (idempotency_response_not_retained).

application/json IdempotencyError

  • error object required
    • code string required
      One of: "idempotency_key_conflict", "idempotency_request_in_progress", "idempotency_response_not_retained"
    • message string required
    • type string required
      Value: "idempotency_error"
410 The code is expired, exhausted, or has already been redeemed by this account.

application/json object

  • error object required
    • code string required
      One of: "expired", "exhausted", "already_redeemed"
    • message string required
422 The code is missing, invalid, or failed validation.

application/json object

  • error any required

    One of

    • string
    • object
      • code string
      • fields object

        Other keys: array of string

      • message string
    • object
      • code string
      • message string
429 The limit of 10 redemption requests per minute was exceeded.

Response headers

  • Retry-After integer header

    Seconds to wait before retrying.

  • X-RateLimit-Scope string header

application/json object

  • error object required
    • code string required
      Value: "too_many_attempts"
    • message string required
    • retry_after_s integer required
      Range: at least 1
    • scope string required
      Value: "route"

text/html string

500 Error response.

application/json GenericError

  • error any

    One of

    • string
    • object

      Any keys are accepted.

  • error_code string
  • code string
  • message string
  • detail string
  • status any

    One of

    • string
    • integer
  • errors object

    Any keys are accepted.