> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unprice.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# debit capacity for a long-lived process to spend locally

> Debit capacity against every hard limit before it is spent, for a long-lived process to authorize, settle, and charge in its own memory. Near a limit less than asked for is granted; when nothing fits, 402. Report usage to /v1/budgets/report before expiresAt, or the whole grant counts as used. A retry with the same lease key, amount, and ttlMs returns the same lease. A budget past its closesAt returns 409.



## OpenAPI

````yaml /openapi.json post /v1/budgets/lease
openapi: 3.0.3
info:
  title: Unprice API
  version: 1.0.0
servers:
  - url: https://api.unprice.dev
    description: Production
  - url: http://localhost:8787
    description: Development
  - url: https://preview-api.unprice.dev
    description: Preview
security:
  - bearerAuth: []
paths:
  /v1/budgets/lease:
    post:
      tags:
        - budgets
      summary: debit capacity for a long-lived process to spend locally
      description: >-
        Debit capacity against every hard limit before it is spent, for a
        long-lived process to authorize, settle, and charge in its own memory.
        Near a limit less than asked for is granted; when nothing fits, 402.
        Report usage to /v1/budgets/report before expiresAt, or the whole grant
        counts as used. A retry with the same lease key, amount, and ttlMs
        returns the same lease. A budget past its closesAt returns 409.
      operationId: budgets.lease
      requestBody:
        description: The lease request
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                key:
                  type: string
                  pattern: ^[A-Za-z0-9][A-Za-z0-9:/_.@-]{0,127}$
                  description: >-
                    The budget's key, chosen by you and unique within the
                    project. Up to 128 letters, digits, and `: / _ . @ -`,
                    starting with a letter or digit.
                  example: customer:acme
                leaseKey:
                  type: string
                  minLength: 1
                  maxLength: 256
                  description: >-
                    Up to 256 characters, one per lease, chosen by the client.
                    Retrying a grant with the same key, amount, and ttlMs
                    replays it; another amount or ttlMs returns 409. Lease keys
                    and idempotency keys are separate.
                  example: lease_01J9Z3
                amount:
                  type: string
                  pattern: ^\d{1,19}(\.\d{1,8})?$
                  description: >-
                    Capacity to debit now against every hard limit and spend
                    locally. Near a limit less is granted; when nothing fits,
                    402.
                  example: '0.05'
                ttlMs:
                  type: integer
                  minimum: 0
                  exclusiveMinimum: true
                  description: >-
                    How long the lease lives without a report, in milliseconds:
                    at least 1000 and at most the budget's holds.maxTtlMs. A
                    report renews it once less than half remains. A lease still
                    open at expiry counts its whole grant as used until the
                    window resets.
                  example: 60000
              required:
                - key
                - leaseKey
                - amount
                - ttlMs
              additionalProperties: false
      responses:
        '200':
          description: The lease
          content:
            application/json:
              schema:
                type: object
                properties:
                  lease:
                    type: object
                    properties:
                      leaseKey:
                        type: string
                      seq:
                        type: integer
                        minimum: 0
                        description: The last report applied; 0 before the first
                      granted:
                        type: string
                        description: >-
                          Debited for this lease so far: the grant plus every
                          extension
                      captured:
                        type: string
                        description: Usage reported so far
                      expiresAt:
                        type: integer
                        description: >-
                          When the lease expires without a report, in epoch
                          milliseconds. At expiry its whole grant counts as
                          used.
                      status:
                        type: string
                        enum:
                          - open
                          - closed
                          - expired
                    required:
                      - leaseKey
                      - seq
                      - granted
                      - captured
                      - expiresAt
                      - status
                  terms:
                    type: object
                    properties:
                      holds:
                        type: object
                        properties:
                          defaultTtlMs:
                            type: integer
                          maxTtlMs:
                            type: integer
                        required:
                          - defaultTtlMs
                          - maxTtlMs
                      closesAt:
                        type: integer
                        nullable: true
                    required:
                      - holds
                      - closesAt
                    description: >-
                      The budget's hold TTL bounds and close time, so holds
                      spent locally follow them
                  replayed:
                    type: boolean
                    description: >-
                      True when this answer replays an earlier request instead
                      of applying it again
                  balance:
                    type: object
                    properties:
                      remaining:
                        type: string
                        nullable: true
                        description: >-
                          The least remaining over hard limits; null when the
                          budget has no hard limit
                      held:
                        type: string
                        description: >-
                          The sum of open holds and the unreported part of open
                          leases
                      limits:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            window:
                              type: string
                              enum:
                                - hour
                                - day
                                - week
                                - month
                                - never
                              description: >-
                                The period a limit counts over. hour, day, week
                                (ISO, from Monday), and month are UTC calendar
                                periods unless anchored; never counts for the
                                life of the budget.
                              example: month
                            enforce:
                              type: string
                              enum:
                                - hard
                                - soft
                              description: >-
                                hard denies authorize and charge that would
                                exceed the limit; soft never denies. Either kind
                                is reported in `crossed` once usage passes it,
                                and only a record can pass a hard limit.
                              example: hard
                            amount:
                              type: string
                              description: The limit
                            consumed:
                              type: string
                              description: Used in the current period
                            held:
                              type: string
                              description: Held by open holds and leases
                            remaining:
                              type: string
                              description: >-
                                amount - consumed - held; negative for a soft
                                limit, or a hard limit a record passed
                            resetsAt:
                              type: integer
                              nullable: true
                              description: >-
                                When the limit's current period ends, in epoch
                                milliseconds; null for never
                          required:
                            - id
                            - window
                            - enforce
                            - amount
                            - consumed
                            - held
                            - remaining
                            - resetsAt
                      asOf:
                        type: integer
                        description: When this balance was computed, in epoch milliseconds
                    required:
                      - remaining
                      - held
                      - limits
                      - asOf
                required:
                  - lease
                  - terms
                  - replayed
                  - balance
        '400':
          description: >-
            The server cannot or will not process the request due to something
            that is perceived to be a client error (e.g., malformed request
            syntax, invalid request message framing, or deceptive request
            routing).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrBadRequest'
        '401':
          description: >-
            Although the HTTP standard specifies "unauthorized", semantically
            this response means "unauthenticated". That is, the client must
            authenticate itself to get the requested response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrUnauthorized'
        '402':
          description: >-
            The request does not fit the budget. `details.blocked` names the
            limit that blocked it and the remedy that would let it through.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrBudgetExceeded'
        '403':
          description: >-
            The client does not have access rights to the content; that is, it
            is unauthorized, so the server is refusing to give the requested
            resource. Unlike 401 Unauthorized, the client's identity is known to
            the server.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrForbidden'
        '404':
          description: >-
            The server cannot find the requested resource. In the browser, this
            means the URL is not recognized. In an API, this can also mean that
            the endpoint is valid but the resource itself does not exist.
            Servers may also send this response instead of 403 Forbidden to hide
            the existence of a resource from an unauthorized client. This
            response code is probably the most well known due to its frequent
            occurrence on the web.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrNotFound'
        '409':
          description: >-
            This response is sent when a request conflicts with the current
            state of the server.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrConflict'
        '412':
          description: >-
            The requested operation cannot be completed because certain
            conditions were not met. This typically occurs when a required
            resource state or version check fails.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrPreconditionFailed'
        '413':
          description: The request payload is larger than the server is willing to process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrPayloadTooLarge'
        '429':
          description: >-
            The user has sent too many requests in a given amount of time ("rate
            limiting")
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrTooManyRequests'
        '500':
          description: >-
            The server has encountered a situation it does not know how to
            handle.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrInternalServerError'
components:
  schemas:
    ErrBadRequest:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - BAD_REQUEST
              description: A machine readable error code.
              example: BAD_REQUEST
            docs:
              type: string
              description: >-
                A link to our documentation with more details about this error
                code
              example: https://docs.unprice.dev/api-reference/errors/code/BAD_REQUEST
            message:
              type: string
              description: A human readable explanation of what went wrong
            requestId:
              type: string
              description: Please always include the requestId in your error report
              example: req_1234
            details:
              oneOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - invalid_config
                        - slug_conflict
                        - unresolved_reference
                      description: What kind of failure this is
                      example: invalid_config
                    issues:
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            description: JSON path into the submitted document
                            example: config.plans[0].version.features[1].featureSlug
                          message:
                            type: string
                        required:
                          - path
                          - message
                      description: Per-location detail, when the failure has locations
                  required:
                    - kind
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_exceeded
                    blocked:
                      type: object
                      properties:
                        limitId:
                          type: string
                        window:
                          type: string
                          enum:
                            - hour
                            - day
                            - week
                            - month
                            - never
                          description: >-
                            The period a limit counts over. hour, day, week
                            (ISO, from Monday), and month are UTC calendar
                            periods unless anchored; never counts for the life
                            of the budget.
                          example: month
                        remaining:
                          type: string
                          description: A decimal amount in the budget's unit
                        held:
                          type: string
                          description: A decimal amount in the budget's unit
                        resetsAt:
                          type: integer
                          nullable: true
                          description: >-
                            When the limit's current period ends, in epoch
                            milliseconds; null for never
                        remedy:
                          type: string
                          enum:
                            - release_holds
                            - wait_for_reset
                            - raise_limit
                          description: >-
                            release_holds: releasing holds makes the request fit
                            all failing limits. wait_for_reset: resetting the
                            failing windows makes the request fit with holds
                            unchanged. raise_limit: neither action alone is
                            sufficient; one or more limits need a change.
                      required:
                        - limitId
                        - window
                        - remaining
                        - held
                        - resetsAt
                        - remedy
                      description: >-
                        A failing hard limit smaller than the request, or
                        otherwise the one that resets last. Other limits can
                        also block the request. The remedy considers all failing
                        limits.
                    balance:
                      type: object
                      properties:
                        remaining:
                          type: string
                          nullable: true
                          description: >-
                            The least remaining over hard limits; null when the
                            budget has no hard limit
                        held:
                          type: string
                          description: >-
                            The sum of open holds and the unreported part of
                            open leases
                        limits:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              window:
                                type: string
                                enum:
                                  - hour
                                  - day
                                  - week
                                  - month
                                  - never
                                description: >-
                                  The period a limit counts over. hour, day,
                                  week (ISO, from Monday), and month are UTC
                                  calendar periods unless anchored; never counts
                                  for the life of the budget.
                                example: month
                              enforce:
                                type: string
                                enum:
                                  - hard
                                  - soft
                                description: >-
                                  hard denies authorize and charge that would
                                  exceed the limit; soft never denies. Either
                                  kind is reported in `crossed` once usage
                                  passes it, and only a record can pass a hard
                                  limit.
                                example: hard
                              amount:
                                type: string
                                description: The limit
                              consumed:
                                type: string
                                description: Used in the current period
                              held:
                                type: string
                                description: Held by open holds and leases
                              remaining:
                                type: string
                                description: >-
                                  amount - consumed - held; negative for a soft
                                  limit, or a hard limit a record passed
                              resetsAt:
                                type: integer
                                nullable: true
                                description: >-
                                  When the limit's current period ends, in epoch
                                  milliseconds; null for never
                            required:
                              - id
                              - window
                              - enforce
                              - amount
                              - consumed
                              - held
                              - remaining
                              - resetsAt
                        asOf:
                          type: integer
                          description: >-
                            When this balance was computed, in epoch
                            milliseconds
                      required:
                        - remaining
                        - held
                        - limits
                        - asOf
                  required:
                    - kind
                    - blocked
                    - balance
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_closed
                    closedAt:
                      type: integer
                      description: When the budget closed, in epoch milliseconds
                  required:
                    - kind
                    - closedAt
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - hold_amount_exceeded
                    holdId:
                      type: string
                      pattern: ^h_[1-9][0-9]{0,15}$
                      description: The hold, as returned by authorize
                      example: h_42
                    maximum:
                      type: string
                      description: A decimal amount in the budget's unit
                    actual:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - holdId
                    - maximum
                    - actual
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - limit_below_usage
                    limitId:
                      type: string
                    minimum:
                      type: string
                      description: A decimal amount in the budget's unit
                    requested:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - limitId
                    - minimum
                    - requested
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - window_capacity_exceeded
                    maximum:
                      type: integer
                      minimum: 0
                    retained:
                      type: integer
                      minimum: 0
                  required:
                    - kind
                    - maximum
                    - retained
          required:
            - code
            - docs
            - message
            - requestId
      required:
        - error
    ErrUnauthorized:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - UNAUTHORIZED
              description: A machine readable error code.
              example: UNAUTHORIZED
            docs:
              type: string
              description: >-
                A link to our documentation with more details about this error
                code
              example: https://docs.unprice.dev/api-reference/errors/code/UNAUTHORIZED
            message:
              type: string
              description: A human readable explanation of what went wrong
            requestId:
              type: string
              description: Please always include the requestId in your error report
              example: req_1234
            details:
              oneOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - invalid_config
                        - slug_conflict
                        - unresolved_reference
                      description: What kind of failure this is
                      example: invalid_config
                    issues:
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            description: JSON path into the submitted document
                            example: config.plans[0].version.features[1].featureSlug
                          message:
                            type: string
                        required:
                          - path
                          - message
                      description: Per-location detail, when the failure has locations
                  required:
                    - kind
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_exceeded
                    blocked:
                      type: object
                      properties:
                        limitId:
                          type: string
                        window:
                          type: string
                          enum:
                            - hour
                            - day
                            - week
                            - month
                            - never
                          description: >-
                            The period a limit counts over. hour, day, week
                            (ISO, from Monday), and month are UTC calendar
                            periods unless anchored; never counts for the life
                            of the budget.
                          example: month
                        remaining:
                          type: string
                          description: A decimal amount in the budget's unit
                        held:
                          type: string
                          description: A decimal amount in the budget's unit
                        resetsAt:
                          type: integer
                          nullable: true
                          description: >-
                            When the limit's current period ends, in epoch
                            milliseconds; null for never
                        remedy:
                          type: string
                          enum:
                            - release_holds
                            - wait_for_reset
                            - raise_limit
                          description: >-
                            release_holds: releasing holds makes the request fit
                            all failing limits. wait_for_reset: resetting the
                            failing windows makes the request fit with holds
                            unchanged. raise_limit: neither action alone is
                            sufficient; one or more limits need a change.
                      required:
                        - limitId
                        - window
                        - remaining
                        - held
                        - resetsAt
                        - remedy
                      description: >-
                        A failing hard limit smaller than the request, or
                        otherwise the one that resets last. Other limits can
                        also block the request. The remedy considers all failing
                        limits.
                    balance:
                      type: object
                      properties:
                        remaining:
                          type: string
                          nullable: true
                          description: >-
                            The least remaining over hard limits; null when the
                            budget has no hard limit
                        held:
                          type: string
                          description: >-
                            The sum of open holds and the unreported part of
                            open leases
                        limits:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              window:
                                type: string
                                enum:
                                  - hour
                                  - day
                                  - week
                                  - month
                                  - never
                                description: >-
                                  The period a limit counts over. hour, day,
                                  week (ISO, from Monday), and month are UTC
                                  calendar periods unless anchored; never counts
                                  for the life of the budget.
                                example: month
                              enforce:
                                type: string
                                enum:
                                  - hard
                                  - soft
                                description: >-
                                  hard denies authorize and charge that would
                                  exceed the limit; soft never denies. Either
                                  kind is reported in `crossed` once usage
                                  passes it, and only a record can pass a hard
                                  limit.
                                example: hard
                              amount:
                                type: string
                                description: The limit
                              consumed:
                                type: string
                                description: Used in the current period
                              held:
                                type: string
                                description: Held by open holds and leases
                              remaining:
                                type: string
                                description: >-
                                  amount - consumed - held; negative for a soft
                                  limit, or a hard limit a record passed
                              resetsAt:
                                type: integer
                                nullable: true
                                description: >-
                                  When the limit's current period ends, in epoch
                                  milliseconds; null for never
                            required:
                              - id
                              - window
                              - enforce
                              - amount
                              - consumed
                              - held
                              - remaining
                              - resetsAt
                        asOf:
                          type: integer
                          description: >-
                            When this balance was computed, in epoch
                            milliseconds
                      required:
                        - remaining
                        - held
                        - limits
                        - asOf
                  required:
                    - kind
                    - blocked
                    - balance
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_closed
                    closedAt:
                      type: integer
                      description: When the budget closed, in epoch milliseconds
                  required:
                    - kind
                    - closedAt
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - hold_amount_exceeded
                    holdId:
                      type: string
                      pattern: ^h_[1-9][0-9]{0,15}$
                      description: The hold, as returned by authorize
                      example: h_42
                    maximum:
                      type: string
                      description: A decimal amount in the budget's unit
                    actual:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - holdId
                    - maximum
                    - actual
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - limit_below_usage
                    limitId:
                      type: string
                    minimum:
                      type: string
                      description: A decimal amount in the budget's unit
                    requested:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - limitId
                    - minimum
                    - requested
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - window_capacity_exceeded
                    maximum:
                      type: integer
                      minimum: 0
                    retained:
                      type: integer
                      minimum: 0
                  required:
                    - kind
                    - maximum
                    - retained
          required:
            - code
            - docs
            - message
            - requestId
      required:
        - error
    ErrBudgetExceeded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - BUDGET_EXCEEDED
              description: A machine readable error code.
              example: BUDGET_EXCEEDED
            docs:
              type: string
              description: >-
                A link to our documentation with more details about this error
                code
              example: >-
                https://docs.unprice.dev/api-reference/errors/code/BUDGET_EXCEEDED
            message:
              type: string
              description: A human readable explanation of what went wrong
            requestId:
              type: string
              description: Please always include the requestId in your error report
              example: req_1234
            details:
              oneOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - invalid_config
                        - slug_conflict
                        - unresolved_reference
                      description: What kind of failure this is
                      example: invalid_config
                    issues:
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            description: JSON path into the submitted document
                            example: config.plans[0].version.features[1].featureSlug
                          message:
                            type: string
                        required:
                          - path
                          - message
                      description: Per-location detail, when the failure has locations
                  required:
                    - kind
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_exceeded
                    blocked:
                      type: object
                      properties:
                        limitId:
                          type: string
                        window:
                          type: string
                          enum:
                            - hour
                            - day
                            - week
                            - month
                            - never
                          description: >-
                            The period a limit counts over. hour, day, week
                            (ISO, from Monday), and month are UTC calendar
                            periods unless anchored; never counts for the life
                            of the budget.
                          example: month
                        remaining:
                          type: string
                          description: A decimal amount in the budget's unit
                        held:
                          type: string
                          description: A decimal amount in the budget's unit
                        resetsAt:
                          type: integer
                          nullable: true
                          description: >-
                            When the limit's current period ends, in epoch
                            milliseconds; null for never
                        remedy:
                          type: string
                          enum:
                            - release_holds
                            - wait_for_reset
                            - raise_limit
                          description: >-
                            release_holds: releasing holds makes the request fit
                            all failing limits. wait_for_reset: resetting the
                            failing windows makes the request fit with holds
                            unchanged. raise_limit: neither action alone is
                            sufficient; one or more limits need a change.
                      required:
                        - limitId
                        - window
                        - remaining
                        - held
                        - resetsAt
                        - remedy
                      description: >-
                        A failing hard limit smaller than the request, or
                        otherwise the one that resets last. Other limits can
                        also block the request. The remedy considers all failing
                        limits.
                    balance:
                      type: object
                      properties:
                        remaining:
                          type: string
                          nullable: true
                          description: >-
                            The least remaining over hard limits; null when the
                            budget has no hard limit
                        held:
                          type: string
                          description: >-
                            The sum of open holds and the unreported part of
                            open leases
                        limits:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              window:
                                type: string
                                enum:
                                  - hour
                                  - day
                                  - week
                                  - month
                                  - never
                                description: >-
                                  The period a limit counts over. hour, day,
                                  week (ISO, from Monday), and month are UTC
                                  calendar periods unless anchored; never counts
                                  for the life of the budget.
                                example: month
                              enforce:
                                type: string
                                enum:
                                  - hard
                                  - soft
                                description: >-
                                  hard denies authorize and charge that would
                                  exceed the limit; soft never denies. Either
                                  kind is reported in `crossed` once usage
                                  passes it, and only a record can pass a hard
                                  limit.
                                example: hard
                              amount:
                                type: string
                                description: The limit
                              consumed:
                                type: string
                                description: Used in the current period
                              held:
                                type: string
                                description: Held by open holds and leases
                              remaining:
                                type: string
                                description: >-
                                  amount - consumed - held; negative for a soft
                                  limit, or a hard limit a record passed
                              resetsAt:
                                type: integer
                                nullable: true
                                description: >-
                                  When the limit's current period ends, in epoch
                                  milliseconds; null for never
                            required:
                              - id
                              - window
                              - enforce
                              - amount
                              - consumed
                              - held
                              - remaining
                              - resetsAt
                        asOf:
                          type: integer
                          description: >-
                            When this balance was computed, in epoch
                            milliseconds
                      required:
                        - remaining
                        - held
                        - limits
                        - asOf
                  required:
                    - kind
                    - blocked
                    - balance
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_closed
                    closedAt:
                      type: integer
                      description: When the budget closed, in epoch milliseconds
                  required:
                    - kind
                    - closedAt
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - hold_amount_exceeded
                    holdId:
                      type: string
                      pattern: ^h_[1-9][0-9]{0,15}$
                      description: The hold, as returned by authorize
                      example: h_42
                    maximum:
                      type: string
                      description: A decimal amount in the budget's unit
                    actual:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - holdId
                    - maximum
                    - actual
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - limit_below_usage
                    limitId:
                      type: string
                    minimum:
                      type: string
                      description: A decimal amount in the budget's unit
                    requested:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - limitId
                    - minimum
                    - requested
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - window_capacity_exceeded
                    maximum:
                      type: integer
                      minimum: 0
                    retained:
                      type: integer
                      minimum: 0
                  required:
                    - kind
                    - maximum
                    - retained
          required:
            - code
            - docs
            - message
            - requestId
      required:
        - error
    ErrForbidden:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - FORBIDDEN
              description: A machine readable error code.
              example: FORBIDDEN
            docs:
              type: string
              description: >-
                A link to our documentation with more details about this error
                code
              example: https://docs.unprice.dev/api-reference/errors/code/FORBIDDEN
            message:
              type: string
              description: A human readable explanation of what went wrong
            requestId:
              type: string
              description: Please always include the requestId in your error report
              example: req_1234
            details:
              oneOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - invalid_config
                        - slug_conflict
                        - unresolved_reference
                      description: What kind of failure this is
                      example: invalid_config
                    issues:
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            description: JSON path into the submitted document
                            example: config.plans[0].version.features[1].featureSlug
                          message:
                            type: string
                        required:
                          - path
                          - message
                      description: Per-location detail, when the failure has locations
                  required:
                    - kind
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_exceeded
                    blocked:
                      type: object
                      properties:
                        limitId:
                          type: string
                        window:
                          type: string
                          enum:
                            - hour
                            - day
                            - week
                            - month
                            - never
                          description: >-
                            The period a limit counts over. hour, day, week
                            (ISO, from Monday), and month are UTC calendar
                            periods unless anchored; never counts for the life
                            of the budget.
                          example: month
                        remaining:
                          type: string
                          description: A decimal amount in the budget's unit
                        held:
                          type: string
                          description: A decimal amount in the budget's unit
                        resetsAt:
                          type: integer
                          nullable: true
                          description: >-
                            When the limit's current period ends, in epoch
                            milliseconds; null for never
                        remedy:
                          type: string
                          enum:
                            - release_holds
                            - wait_for_reset
                            - raise_limit
                          description: >-
                            release_holds: releasing holds makes the request fit
                            all failing limits. wait_for_reset: resetting the
                            failing windows makes the request fit with holds
                            unchanged. raise_limit: neither action alone is
                            sufficient; one or more limits need a change.
                      required:
                        - limitId
                        - window
                        - remaining
                        - held
                        - resetsAt
                        - remedy
                      description: >-
                        A failing hard limit smaller than the request, or
                        otherwise the one that resets last. Other limits can
                        also block the request. The remedy considers all failing
                        limits.
                    balance:
                      type: object
                      properties:
                        remaining:
                          type: string
                          nullable: true
                          description: >-
                            The least remaining over hard limits; null when the
                            budget has no hard limit
                        held:
                          type: string
                          description: >-
                            The sum of open holds and the unreported part of
                            open leases
                        limits:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              window:
                                type: string
                                enum:
                                  - hour
                                  - day
                                  - week
                                  - month
                                  - never
                                description: >-
                                  The period a limit counts over. hour, day,
                                  week (ISO, from Monday), and month are UTC
                                  calendar periods unless anchored; never counts
                                  for the life of the budget.
                                example: month
                              enforce:
                                type: string
                                enum:
                                  - hard
                                  - soft
                                description: >-
                                  hard denies authorize and charge that would
                                  exceed the limit; soft never denies. Either
                                  kind is reported in `crossed` once usage
                                  passes it, and only a record can pass a hard
                                  limit.
                                example: hard
                              amount:
                                type: string
                                description: The limit
                              consumed:
                                type: string
                                description: Used in the current period
                              held:
                                type: string
                                description: Held by open holds and leases
                              remaining:
                                type: string
                                description: >-
                                  amount - consumed - held; negative for a soft
                                  limit, or a hard limit a record passed
                              resetsAt:
                                type: integer
                                nullable: true
                                description: >-
                                  When the limit's current period ends, in epoch
                                  milliseconds; null for never
                            required:
                              - id
                              - window
                              - enforce
                              - amount
                              - consumed
                              - held
                              - remaining
                              - resetsAt
                        asOf:
                          type: integer
                          description: >-
                            When this balance was computed, in epoch
                            milliseconds
                      required:
                        - remaining
                        - held
                        - limits
                        - asOf
                  required:
                    - kind
                    - blocked
                    - balance
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_closed
                    closedAt:
                      type: integer
                      description: When the budget closed, in epoch milliseconds
                  required:
                    - kind
                    - closedAt
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - hold_amount_exceeded
                    holdId:
                      type: string
                      pattern: ^h_[1-9][0-9]{0,15}$
                      description: The hold, as returned by authorize
                      example: h_42
                    maximum:
                      type: string
                      description: A decimal amount in the budget's unit
                    actual:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - holdId
                    - maximum
                    - actual
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - limit_below_usage
                    limitId:
                      type: string
                    minimum:
                      type: string
                      description: A decimal amount in the budget's unit
                    requested:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - limitId
                    - minimum
                    - requested
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - window_capacity_exceeded
                    maximum:
                      type: integer
                      minimum: 0
                    retained:
                      type: integer
                      minimum: 0
                  required:
                    - kind
                    - maximum
                    - retained
          required:
            - code
            - docs
            - message
            - requestId
      required:
        - error
    ErrNotFound:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - NOT_FOUND
              description: A machine readable error code.
              example: NOT_FOUND
            docs:
              type: string
              description: >-
                A link to our documentation with more details about this error
                code
              example: https://docs.unprice.dev/api-reference/errors/code/NOT_FOUND
            message:
              type: string
              description: A human readable explanation of what went wrong
            requestId:
              type: string
              description: Please always include the requestId in your error report
              example: req_1234
            details:
              oneOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - invalid_config
                        - slug_conflict
                        - unresolved_reference
                      description: What kind of failure this is
                      example: invalid_config
                    issues:
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            description: JSON path into the submitted document
                            example: config.plans[0].version.features[1].featureSlug
                          message:
                            type: string
                        required:
                          - path
                          - message
                      description: Per-location detail, when the failure has locations
                  required:
                    - kind
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_exceeded
                    blocked:
                      type: object
                      properties:
                        limitId:
                          type: string
                        window:
                          type: string
                          enum:
                            - hour
                            - day
                            - week
                            - month
                            - never
                          description: >-
                            The period a limit counts over. hour, day, week
                            (ISO, from Monday), and month are UTC calendar
                            periods unless anchored; never counts for the life
                            of the budget.
                          example: month
                        remaining:
                          type: string
                          description: A decimal amount in the budget's unit
                        held:
                          type: string
                          description: A decimal amount in the budget's unit
                        resetsAt:
                          type: integer
                          nullable: true
                          description: >-
                            When the limit's current period ends, in epoch
                            milliseconds; null for never
                        remedy:
                          type: string
                          enum:
                            - release_holds
                            - wait_for_reset
                            - raise_limit
                          description: >-
                            release_holds: releasing holds makes the request fit
                            all failing limits. wait_for_reset: resetting the
                            failing windows makes the request fit with holds
                            unchanged. raise_limit: neither action alone is
                            sufficient; one or more limits need a change.
                      required:
                        - limitId
                        - window
                        - remaining
                        - held
                        - resetsAt
                        - remedy
                      description: >-
                        A failing hard limit smaller than the request, or
                        otherwise the one that resets last. Other limits can
                        also block the request. The remedy considers all failing
                        limits.
                    balance:
                      type: object
                      properties:
                        remaining:
                          type: string
                          nullable: true
                          description: >-
                            The least remaining over hard limits; null when the
                            budget has no hard limit
                        held:
                          type: string
                          description: >-
                            The sum of open holds and the unreported part of
                            open leases
                        limits:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              window:
                                type: string
                                enum:
                                  - hour
                                  - day
                                  - week
                                  - month
                                  - never
                                description: >-
                                  The period a limit counts over. hour, day,
                                  week (ISO, from Monday), and month are UTC
                                  calendar periods unless anchored; never counts
                                  for the life of the budget.
                                example: month
                              enforce:
                                type: string
                                enum:
                                  - hard
                                  - soft
                                description: >-
                                  hard denies authorize and charge that would
                                  exceed the limit; soft never denies. Either
                                  kind is reported in `crossed` once usage
                                  passes it, and only a record can pass a hard
                                  limit.
                                example: hard
                              amount:
                                type: string
                                description: The limit
                              consumed:
                                type: string
                                description: Used in the current period
                              held:
                                type: string
                                description: Held by open holds and leases
                              remaining:
                                type: string
                                description: >-
                                  amount - consumed - held; negative for a soft
                                  limit, or a hard limit a record passed
                              resetsAt:
                                type: integer
                                nullable: true
                                description: >-
                                  When the limit's current period ends, in epoch
                                  milliseconds; null for never
                            required:
                              - id
                              - window
                              - enforce
                              - amount
                              - consumed
                              - held
                              - remaining
                              - resetsAt
                        asOf:
                          type: integer
                          description: >-
                            When this balance was computed, in epoch
                            milliseconds
                      required:
                        - remaining
                        - held
                        - limits
                        - asOf
                  required:
                    - kind
                    - blocked
                    - balance
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_closed
                    closedAt:
                      type: integer
                      description: When the budget closed, in epoch milliseconds
                  required:
                    - kind
                    - closedAt
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - hold_amount_exceeded
                    holdId:
                      type: string
                      pattern: ^h_[1-9][0-9]{0,15}$
                      description: The hold, as returned by authorize
                      example: h_42
                    maximum:
                      type: string
                      description: A decimal amount in the budget's unit
                    actual:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - holdId
                    - maximum
                    - actual
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - limit_below_usage
                    limitId:
                      type: string
                    minimum:
                      type: string
                      description: A decimal amount in the budget's unit
                    requested:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - limitId
                    - minimum
                    - requested
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - window_capacity_exceeded
                    maximum:
                      type: integer
                      minimum: 0
                    retained:
                      type: integer
                      minimum: 0
                  required:
                    - kind
                    - maximum
                    - retained
          required:
            - code
            - docs
            - message
            - requestId
      required:
        - error
    ErrConflict:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - CONFLICT
              description: A machine readable error code.
              example: CONFLICT
            docs:
              type: string
              description: >-
                A link to our documentation with more details about this error
                code
              example: https://docs.unprice.dev/api-reference/errors/code/CONFLICT
            message:
              type: string
              description: A human readable explanation of what went wrong
            requestId:
              type: string
              description: Please always include the requestId in your error report
              example: req_1234
            details:
              oneOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - invalid_config
                        - slug_conflict
                        - unresolved_reference
                      description: What kind of failure this is
                      example: invalid_config
                    issues:
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            description: JSON path into the submitted document
                            example: config.plans[0].version.features[1].featureSlug
                          message:
                            type: string
                        required:
                          - path
                          - message
                      description: Per-location detail, when the failure has locations
                  required:
                    - kind
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_exceeded
                    blocked:
                      type: object
                      properties:
                        limitId:
                          type: string
                        window:
                          type: string
                          enum:
                            - hour
                            - day
                            - week
                            - month
                            - never
                          description: >-
                            The period a limit counts over. hour, day, week
                            (ISO, from Monday), and month are UTC calendar
                            periods unless anchored; never counts for the life
                            of the budget.
                          example: month
                        remaining:
                          type: string
                          description: A decimal amount in the budget's unit
                        held:
                          type: string
                          description: A decimal amount in the budget's unit
                        resetsAt:
                          type: integer
                          nullable: true
                          description: >-
                            When the limit's current period ends, in epoch
                            milliseconds; null for never
                        remedy:
                          type: string
                          enum:
                            - release_holds
                            - wait_for_reset
                            - raise_limit
                          description: >-
                            release_holds: releasing holds makes the request fit
                            all failing limits. wait_for_reset: resetting the
                            failing windows makes the request fit with holds
                            unchanged. raise_limit: neither action alone is
                            sufficient; one or more limits need a change.
                      required:
                        - limitId
                        - window
                        - remaining
                        - held
                        - resetsAt
                        - remedy
                      description: >-
                        A failing hard limit smaller than the request, or
                        otherwise the one that resets last. Other limits can
                        also block the request. The remedy considers all failing
                        limits.
                    balance:
                      type: object
                      properties:
                        remaining:
                          type: string
                          nullable: true
                          description: >-
                            The least remaining over hard limits; null when the
                            budget has no hard limit
                        held:
                          type: string
                          description: >-
                            The sum of open holds and the unreported part of
                            open leases
                        limits:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              window:
                                type: string
                                enum:
                                  - hour
                                  - day
                                  - week
                                  - month
                                  - never
                                description: >-
                                  The period a limit counts over. hour, day,
                                  week (ISO, from Monday), and month are UTC
                                  calendar periods unless anchored; never counts
                                  for the life of the budget.
                                example: month
                              enforce:
                                type: string
                                enum:
                                  - hard
                                  - soft
                                description: >-
                                  hard denies authorize and charge that would
                                  exceed the limit; soft never denies. Either
                                  kind is reported in `crossed` once usage
                                  passes it, and only a record can pass a hard
                                  limit.
                                example: hard
                              amount:
                                type: string
                                description: The limit
                              consumed:
                                type: string
                                description: Used in the current period
                              held:
                                type: string
                                description: Held by open holds and leases
                              remaining:
                                type: string
                                description: >-
                                  amount - consumed - held; negative for a soft
                                  limit, or a hard limit a record passed
                              resetsAt:
                                type: integer
                                nullable: true
                                description: >-
                                  When the limit's current period ends, in epoch
                                  milliseconds; null for never
                            required:
                              - id
                              - window
                              - enforce
                              - amount
                              - consumed
                              - held
                              - remaining
                              - resetsAt
                        asOf:
                          type: integer
                          description: >-
                            When this balance was computed, in epoch
                            milliseconds
                      required:
                        - remaining
                        - held
                        - limits
                        - asOf
                  required:
                    - kind
                    - blocked
                    - balance
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_closed
                    closedAt:
                      type: integer
                      description: When the budget closed, in epoch milliseconds
                  required:
                    - kind
                    - closedAt
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - hold_amount_exceeded
                    holdId:
                      type: string
                      pattern: ^h_[1-9][0-9]{0,15}$
                      description: The hold, as returned by authorize
                      example: h_42
                    maximum:
                      type: string
                      description: A decimal amount in the budget's unit
                    actual:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - holdId
                    - maximum
                    - actual
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - limit_below_usage
                    limitId:
                      type: string
                    minimum:
                      type: string
                      description: A decimal amount in the budget's unit
                    requested:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - limitId
                    - minimum
                    - requested
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - window_capacity_exceeded
                    maximum:
                      type: integer
                      minimum: 0
                    retained:
                      type: integer
                      minimum: 0
                  required:
                    - kind
                    - maximum
                    - retained
          required:
            - code
            - docs
            - message
            - requestId
      required:
        - error
    ErrPreconditionFailed:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - PRECONDITION_FAILED
              description: A machine readable error code.
              example: PRECONDITION_FAILED
            docs:
              type: string
              description: >-
                A link to our documentation with more details about this error
                code
              example: >-
                https://docs.unprice.dev/api-reference/errors/code/PRECONDITION_FAILED
            message:
              type: string
              description: A human readable explanation of what went wrong
            requestId:
              type: string
              description: Please always include the requestId in your error report
              example: req_1234
            details:
              oneOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - invalid_config
                        - slug_conflict
                        - unresolved_reference
                      description: What kind of failure this is
                      example: invalid_config
                    issues:
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            description: JSON path into the submitted document
                            example: config.plans[0].version.features[1].featureSlug
                          message:
                            type: string
                        required:
                          - path
                          - message
                      description: Per-location detail, when the failure has locations
                  required:
                    - kind
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_exceeded
                    blocked:
                      type: object
                      properties:
                        limitId:
                          type: string
                        window:
                          type: string
                          enum:
                            - hour
                            - day
                            - week
                            - month
                            - never
                          description: >-
                            The period a limit counts over. hour, day, week
                            (ISO, from Monday), and month are UTC calendar
                            periods unless anchored; never counts for the life
                            of the budget.
                          example: month
                        remaining:
                          type: string
                          description: A decimal amount in the budget's unit
                        held:
                          type: string
                          description: A decimal amount in the budget's unit
                        resetsAt:
                          type: integer
                          nullable: true
                          description: >-
                            When the limit's current period ends, in epoch
                            milliseconds; null for never
                        remedy:
                          type: string
                          enum:
                            - release_holds
                            - wait_for_reset
                            - raise_limit
                          description: >-
                            release_holds: releasing holds makes the request fit
                            all failing limits. wait_for_reset: resetting the
                            failing windows makes the request fit with holds
                            unchanged. raise_limit: neither action alone is
                            sufficient; one or more limits need a change.
                      required:
                        - limitId
                        - window
                        - remaining
                        - held
                        - resetsAt
                        - remedy
                      description: >-
                        A failing hard limit smaller than the request, or
                        otherwise the one that resets last. Other limits can
                        also block the request. The remedy considers all failing
                        limits.
                    balance:
                      type: object
                      properties:
                        remaining:
                          type: string
                          nullable: true
                          description: >-
                            The least remaining over hard limits; null when the
                            budget has no hard limit
                        held:
                          type: string
                          description: >-
                            The sum of open holds and the unreported part of
                            open leases
                        limits:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              window:
                                type: string
                                enum:
                                  - hour
                                  - day
                                  - week
                                  - month
                                  - never
                                description: >-
                                  The period a limit counts over. hour, day,
                                  week (ISO, from Monday), and month are UTC
                                  calendar periods unless anchored; never counts
                                  for the life of the budget.
                                example: month
                              enforce:
                                type: string
                                enum:
                                  - hard
                                  - soft
                                description: >-
                                  hard denies authorize and charge that would
                                  exceed the limit; soft never denies. Either
                                  kind is reported in `crossed` once usage
                                  passes it, and only a record can pass a hard
                                  limit.
                                example: hard
                              amount:
                                type: string
                                description: The limit
                              consumed:
                                type: string
                                description: Used in the current period
                              held:
                                type: string
                                description: Held by open holds and leases
                              remaining:
                                type: string
                                description: >-
                                  amount - consumed - held; negative for a soft
                                  limit, or a hard limit a record passed
                              resetsAt:
                                type: integer
                                nullable: true
                                description: >-
                                  When the limit's current period ends, in epoch
                                  milliseconds; null for never
                            required:
                              - id
                              - window
                              - enforce
                              - amount
                              - consumed
                              - held
                              - remaining
                              - resetsAt
                        asOf:
                          type: integer
                          description: >-
                            When this balance was computed, in epoch
                            milliseconds
                      required:
                        - remaining
                        - held
                        - limits
                        - asOf
                  required:
                    - kind
                    - blocked
                    - balance
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_closed
                    closedAt:
                      type: integer
                      description: When the budget closed, in epoch milliseconds
                  required:
                    - kind
                    - closedAt
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - hold_amount_exceeded
                    holdId:
                      type: string
                      pattern: ^h_[1-9][0-9]{0,15}$
                      description: The hold, as returned by authorize
                      example: h_42
                    maximum:
                      type: string
                      description: A decimal amount in the budget's unit
                    actual:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - holdId
                    - maximum
                    - actual
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - limit_below_usage
                    limitId:
                      type: string
                    minimum:
                      type: string
                      description: A decimal amount in the budget's unit
                    requested:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - limitId
                    - minimum
                    - requested
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - window_capacity_exceeded
                    maximum:
                      type: integer
                      minimum: 0
                    retained:
                      type: integer
                      minimum: 0
                  required:
                    - kind
                    - maximum
                    - retained
          required:
            - code
            - docs
            - message
            - requestId
      required:
        - error
    ErrPayloadTooLarge:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - PAYLOAD_TOO_LARGE
              description: A machine readable error code.
              example: PAYLOAD_TOO_LARGE
            docs:
              type: string
              description: >-
                A link to our documentation with more details about this error
                code
              example: >-
                https://docs.unprice.dev/api-reference/errors/code/PAYLOAD_TOO_LARGE
            message:
              type: string
              description: A human readable explanation of what went wrong
            requestId:
              type: string
              description: Please always include the requestId in your error report
              example: req_1234
            details:
              oneOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - invalid_config
                        - slug_conflict
                        - unresolved_reference
                      description: What kind of failure this is
                      example: invalid_config
                    issues:
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            description: JSON path into the submitted document
                            example: config.plans[0].version.features[1].featureSlug
                          message:
                            type: string
                        required:
                          - path
                          - message
                      description: Per-location detail, when the failure has locations
                  required:
                    - kind
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_exceeded
                    blocked:
                      type: object
                      properties:
                        limitId:
                          type: string
                        window:
                          type: string
                          enum:
                            - hour
                            - day
                            - week
                            - month
                            - never
                          description: >-
                            The period a limit counts over. hour, day, week
                            (ISO, from Monday), and month are UTC calendar
                            periods unless anchored; never counts for the life
                            of the budget.
                          example: month
                        remaining:
                          type: string
                          description: A decimal amount in the budget's unit
                        held:
                          type: string
                          description: A decimal amount in the budget's unit
                        resetsAt:
                          type: integer
                          nullable: true
                          description: >-
                            When the limit's current period ends, in epoch
                            milliseconds; null for never
                        remedy:
                          type: string
                          enum:
                            - release_holds
                            - wait_for_reset
                            - raise_limit
                          description: >-
                            release_holds: releasing holds makes the request fit
                            all failing limits. wait_for_reset: resetting the
                            failing windows makes the request fit with holds
                            unchanged. raise_limit: neither action alone is
                            sufficient; one or more limits need a change.
                      required:
                        - limitId
                        - window
                        - remaining
                        - held
                        - resetsAt
                        - remedy
                      description: >-
                        A failing hard limit smaller than the request, or
                        otherwise the one that resets last. Other limits can
                        also block the request. The remedy considers all failing
                        limits.
                    balance:
                      type: object
                      properties:
                        remaining:
                          type: string
                          nullable: true
                          description: >-
                            The least remaining over hard limits; null when the
                            budget has no hard limit
                        held:
                          type: string
                          description: >-
                            The sum of open holds and the unreported part of
                            open leases
                        limits:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              window:
                                type: string
                                enum:
                                  - hour
                                  - day
                                  - week
                                  - month
                                  - never
                                description: >-
                                  The period a limit counts over. hour, day,
                                  week (ISO, from Monday), and month are UTC
                                  calendar periods unless anchored; never counts
                                  for the life of the budget.
                                example: month
                              enforce:
                                type: string
                                enum:
                                  - hard
                                  - soft
                                description: >-
                                  hard denies authorize and charge that would
                                  exceed the limit; soft never denies. Either
                                  kind is reported in `crossed` once usage
                                  passes it, and only a record can pass a hard
                                  limit.
                                example: hard
                              amount:
                                type: string
                                description: The limit
                              consumed:
                                type: string
                                description: Used in the current period
                              held:
                                type: string
                                description: Held by open holds and leases
                              remaining:
                                type: string
                                description: >-
                                  amount - consumed - held; negative for a soft
                                  limit, or a hard limit a record passed
                              resetsAt:
                                type: integer
                                nullable: true
                                description: >-
                                  When the limit's current period ends, in epoch
                                  milliseconds; null for never
                            required:
                              - id
                              - window
                              - enforce
                              - amount
                              - consumed
                              - held
                              - remaining
                              - resetsAt
                        asOf:
                          type: integer
                          description: >-
                            When this balance was computed, in epoch
                            milliseconds
                      required:
                        - remaining
                        - held
                        - limits
                        - asOf
                  required:
                    - kind
                    - blocked
                    - balance
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_closed
                    closedAt:
                      type: integer
                      description: When the budget closed, in epoch milliseconds
                  required:
                    - kind
                    - closedAt
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - hold_amount_exceeded
                    holdId:
                      type: string
                      pattern: ^h_[1-9][0-9]{0,15}$
                      description: The hold, as returned by authorize
                      example: h_42
                    maximum:
                      type: string
                      description: A decimal amount in the budget's unit
                    actual:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - holdId
                    - maximum
                    - actual
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - limit_below_usage
                    limitId:
                      type: string
                    minimum:
                      type: string
                      description: A decimal amount in the budget's unit
                    requested:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - limitId
                    - minimum
                    - requested
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - window_capacity_exceeded
                    maximum:
                      type: integer
                      minimum: 0
                    retained:
                      type: integer
                      minimum: 0
                  required:
                    - kind
                    - maximum
                    - retained
          required:
            - code
            - docs
            - message
            - requestId
      required:
        - error
    ErrTooManyRequests:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - TOO_MANY_REQUESTS
              description: A machine readable error code.
              example: TOO_MANY_REQUESTS
            docs:
              type: string
              description: >-
                A link to our documentation with more details about this error
                code
              example: >-
                https://docs.unprice.dev/api-reference/errors/code/TOO_MANY_REQUESTS
            message:
              type: string
              description: A human readable explanation of what went wrong
            requestId:
              type: string
              description: Please always include the requestId in your error report
              example: req_1234
            details:
              oneOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - invalid_config
                        - slug_conflict
                        - unresolved_reference
                      description: What kind of failure this is
                      example: invalid_config
                    issues:
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            description: JSON path into the submitted document
                            example: config.plans[0].version.features[1].featureSlug
                          message:
                            type: string
                        required:
                          - path
                          - message
                      description: Per-location detail, when the failure has locations
                  required:
                    - kind
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_exceeded
                    blocked:
                      type: object
                      properties:
                        limitId:
                          type: string
                        window:
                          type: string
                          enum:
                            - hour
                            - day
                            - week
                            - month
                            - never
                          description: >-
                            The period a limit counts over. hour, day, week
                            (ISO, from Monday), and month are UTC calendar
                            periods unless anchored; never counts for the life
                            of the budget.
                          example: month
                        remaining:
                          type: string
                          description: A decimal amount in the budget's unit
                        held:
                          type: string
                          description: A decimal amount in the budget's unit
                        resetsAt:
                          type: integer
                          nullable: true
                          description: >-
                            When the limit's current period ends, in epoch
                            milliseconds; null for never
                        remedy:
                          type: string
                          enum:
                            - release_holds
                            - wait_for_reset
                            - raise_limit
                          description: >-
                            release_holds: releasing holds makes the request fit
                            all failing limits. wait_for_reset: resetting the
                            failing windows makes the request fit with holds
                            unchanged. raise_limit: neither action alone is
                            sufficient; one or more limits need a change.
                      required:
                        - limitId
                        - window
                        - remaining
                        - held
                        - resetsAt
                        - remedy
                      description: >-
                        A failing hard limit smaller than the request, or
                        otherwise the one that resets last. Other limits can
                        also block the request. The remedy considers all failing
                        limits.
                    balance:
                      type: object
                      properties:
                        remaining:
                          type: string
                          nullable: true
                          description: >-
                            The least remaining over hard limits; null when the
                            budget has no hard limit
                        held:
                          type: string
                          description: >-
                            The sum of open holds and the unreported part of
                            open leases
                        limits:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              window:
                                type: string
                                enum:
                                  - hour
                                  - day
                                  - week
                                  - month
                                  - never
                                description: >-
                                  The period a limit counts over. hour, day,
                                  week (ISO, from Monday), and month are UTC
                                  calendar periods unless anchored; never counts
                                  for the life of the budget.
                                example: month
                              enforce:
                                type: string
                                enum:
                                  - hard
                                  - soft
                                description: >-
                                  hard denies authorize and charge that would
                                  exceed the limit; soft never denies. Either
                                  kind is reported in `crossed` once usage
                                  passes it, and only a record can pass a hard
                                  limit.
                                example: hard
                              amount:
                                type: string
                                description: The limit
                              consumed:
                                type: string
                                description: Used in the current period
                              held:
                                type: string
                                description: Held by open holds and leases
                              remaining:
                                type: string
                                description: >-
                                  amount - consumed - held; negative for a soft
                                  limit, or a hard limit a record passed
                              resetsAt:
                                type: integer
                                nullable: true
                                description: >-
                                  When the limit's current period ends, in epoch
                                  milliseconds; null for never
                            required:
                              - id
                              - window
                              - enforce
                              - amount
                              - consumed
                              - held
                              - remaining
                              - resetsAt
                        asOf:
                          type: integer
                          description: >-
                            When this balance was computed, in epoch
                            milliseconds
                      required:
                        - remaining
                        - held
                        - limits
                        - asOf
                  required:
                    - kind
                    - blocked
                    - balance
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_closed
                    closedAt:
                      type: integer
                      description: When the budget closed, in epoch milliseconds
                  required:
                    - kind
                    - closedAt
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - hold_amount_exceeded
                    holdId:
                      type: string
                      pattern: ^h_[1-9][0-9]{0,15}$
                      description: The hold, as returned by authorize
                      example: h_42
                    maximum:
                      type: string
                      description: A decimal amount in the budget's unit
                    actual:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - holdId
                    - maximum
                    - actual
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - limit_below_usage
                    limitId:
                      type: string
                    minimum:
                      type: string
                      description: A decimal amount in the budget's unit
                    requested:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - limitId
                    - minimum
                    - requested
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - window_capacity_exceeded
                    maximum:
                      type: integer
                      minimum: 0
                    retained:
                      type: integer
                      minimum: 0
                  required:
                    - kind
                    - maximum
                    - retained
          required:
            - code
            - docs
            - message
            - requestId
      required:
        - error
    ErrInternalServerError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - INTERNAL_SERVER_ERROR
              description: A machine readable error code.
              example: INTERNAL_SERVER_ERROR
            docs:
              type: string
              description: >-
                A link to our documentation with more details about this error
                code
              example: >-
                https://docs.unprice.dev/api-reference/errors/code/INTERNAL_SERVER_ERROR
            message:
              type: string
              description: A human readable explanation of what went wrong
            requestId:
              type: string
              description: Please always include the requestId in your error report
              example: req_1234
            details:
              oneOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - invalid_config
                        - slug_conflict
                        - unresolved_reference
                      description: What kind of failure this is
                      example: invalid_config
                    issues:
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            description: JSON path into the submitted document
                            example: config.plans[0].version.features[1].featureSlug
                          message:
                            type: string
                        required:
                          - path
                          - message
                      description: Per-location detail, when the failure has locations
                  required:
                    - kind
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_exceeded
                    blocked:
                      type: object
                      properties:
                        limitId:
                          type: string
                        window:
                          type: string
                          enum:
                            - hour
                            - day
                            - week
                            - month
                            - never
                          description: >-
                            The period a limit counts over. hour, day, week
                            (ISO, from Monday), and month are UTC calendar
                            periods unless anchored; never counts for the life
                            of the budget.
                          example: month
                        remaining:
                          type: string
                          description: A decimal amount in the budget's unit
                        held:
                          type: string
                          description: A decimal amount in the budget's unit
                        resetsAt:
                          type: integer
                          nullable: true
                          description: >-
                            When the limit's current period ends, in epoch
                            milliseconds; null for never
                        remedy:
                          type: string
                          enum:
                            - release_holds
                            - wait_for_reset
                            - raise_limit
                          description: >-
                            release_holds: releasing holds makes the request fit
                            all failing limits. wait_for_reset: resetting the
                            failing windows makes the request fit with holds
                            unchanged. raise_limit: neither action alone is
                            sufficient; one or more limits need a change.
                      required:
                        - limitId
                        - window
                        - remaining
                        - held
                        - resetsAt
                        - remedy
                      description: >-
                        A failing hard limit smaller than the request, or
                        otherwise the one that resets last. Other limits can
                        also block the request. The remedy considers all failing
                        limits.
                    balance:
                      type: object
                      properties:
                        remaining:
                          type: string
                          nullable: true
                          description: >-
                            The least remaining over hard limits; null when the
                            budget has no hard limit
                        held:
                          type: string
                          description: >-
                            The sum of open holds and the unreported part of
                            open leases
                        limits:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              window:
                                type: string
                                enum:
                                  - hour
                                  - day
                                  - week
                                  - month
                                  - never
                                description: >-
                                  The period a limit counts over. hour, day,
                                  week (ISO, from Monday), and month are UTC
                                  calendar periods unless anchored; never counts
                                  for the life of the budget.
                                example: month
                              enforce:
                                type: string
                                enum:
                                  - hard
                                  - soft
                                description: >-
                                  hard denies authorize and charge that would
                                  exceed the limit; soft never denies. Either
                                  kind is reported in `crossed` once usage
                                  passes it, and only a record can pass a hard
                                  limit.
                                example: hard
                              amount:
                                type: string
                                description: The limit
                              consumed:
                                type: string
                                description: Used in the current period
                              held:
                                type: string
                                description: Held by open holds and leases
                              remaining:
                                type: string
                                description: >-
                                  amount - consumed - held; negative for a soft
                                  limit, or a hard limit a record passed
                              resetsAt:
                                type: integer
                                nullable: true
                                description: >-
                                  When the limit's current period ends, in epoch
                                  milliseconds; null for never
                            required:
                              - id
                              - window
                              - enforce
                              - amount
                              - consumed
                              - held
                              - remaining
                              - resetsAt
                        asOf:
                          type: integer
                          description: >-
                            When this balance was computed, in epoch
                            milliseconds
                      required:
                        - remaining
                        - held
                        - limits
                        - asOf
                  required:
                    - kind
                    - blocked
                    - balance
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - budget_closed
                    closedAt:
                      type: integer
                      description: When the budget closed, in epoch milliseconds
                  required:
                    - kind
                    - closedAt
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - hold_amount_exceeded
                    holdId:
                      type: string
                      pattern: ^h_[1-9][0-9]{0,15}$
                      description: The hold, as returned by authorize
                      example: h_42
                    maximum:
                      type: string
                      description: A decimal amount in the budget's unit
                    actual:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - holdId
                    - maximum
                    - actual
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - limit_below_usage
                    limitId:
                      type: string
                    minimum:
                      type: string
                      description: A decimal amount in the budget's unit
                    requested:
                      type: string
                      description: A decimal amount in the budget's unit
                  required:
                    - kind
                    - limitId
                    - minimum
                    - requested
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - window_capacity_exceeded
                    maximum:
                      type: integer
                      minimum: 0
                    retained:
                      type: integer
                      minimum: 0
                  required:
                    - kind
                    - maximum
                    - retained
          required:
            - code
            - docs
            - message
            - requestId
      required:
        - error
  securitySchemes:
    bearerAuth:
      bearerFormat: root key
      type: http
      scheme: bearer
      x-speakeasy-example: UNPRICE_API_KEY

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.