> ## 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.

# settle a hold with the actual amount

> Settle final usage after work has stopped and release the unused reservation. Actual usage must not exceed the authorized amount. A larger amount returns 409 and leaves the reservation unchanged. Expired open holds still settle against their reservation. The hold id is the idempotency key: the same amount replays, another amount returns 409. A hold retires 1 day after it closes; settling or releasing it after that returns 409.



## OpenAPI

````yaml /openapi.json post /v1/budgets/settle
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/settle:
    post:
      tags:
        - budgets
      summary: settle a hold with the actual amount
      description: >-
        Settle final usage after work has stopped and release the unused
        reservation. Actual usage must not exceed the authorized amount. A
        larger amount returns 409 and leaves the reservation unchanged. Expired
        open holds still settle against their reservation. The hold id is the
        idempotency key: the same amount replays, another amount returns 409. A
        hold retires 1 day after it closes; settling or releasing it after that
        returns 409.
      operationId: budgets.settle
      requestBody:
        description: The settle 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
                holdId:
                  type: string
                  pattern: ^h_[1-9][0-9]{0,15}$
                  description: The hold, as returned by authorize
                  example: h_42
                amount:
                  type: string
                  pattern: ^\d{1,19}(\.\d{1,8})?$
                  description: >-
                    Final usage after work has stopped. Must not exceed the
                    authorized amount. Settlement returns the unused
                    reservation. An amount above the reservation returns 409 and
                    leaves the hold unchanged.
                  example: '0.05'
              required:
                - key
                - holdId
                - amount
              additionalProperties: false
      responses:
        '200':
          description: The settlement
          content:
            application/json:
              schema:
                type: object
                properties:
                  holdId:
                    type: string
                    pattern: ^h_[1-9][0-9]{0,15}$
                    description: The hold, as returned by authorize
                    example: h_42
                  actual:
                    type: string
                    description: The amount settled
                  released:
                    type: string
                    description: The unused part of the hold, returned
                  expired:
                    type: boolean
                    description: Settled at or after the hold's expiresAt
                  crossed:
                    type: array
                    items:
                      type: string
                    description: >-
                      Limit ids whose consumed amount first exceeded the limit's
                      amount. A hard limit crosses only after recorded usage
                      took its room. Reservations do not trigger crossings.
                      Replays preserve the original result.
                  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:
                  - holdId
                  - actual
                  - released
                  - expired
                  - crossed
                  - 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'
        '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
    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.