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

# create or update a budget

> Create the budget at a key, or replace its definition. Every upsert sends the whole definition: a field it leaves out takes its default, so an omitted closesAt reopens a closing budget and omitted hold TTLs return to their defaults. Sending the same definition again changes nothing. The unit cannot change after creation. A hard cap below current consumption plus outstanding reservations returns 409. A runtime key can create a budget or tighten it; raising or removing a hard limit, making it soft, or clearing or postponing closesAt needs a config key and otherwise returns 403, so whoever spends under a cap cannot lift it.



## OpenAPI

````yaml /openapi.json post /v1/budgets/upsert
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/upsert:
    post:
      tags:
        - budgets
      summary: create or update a budget
      description: >-
        Create the budget at a key, or replace its definition. Every upsert
        sends the whole definition: a field it leaves out takes its default, so
        an omitted closesAt reopens a closing budget and omitted hold TTLs
        return to their defaults. Sending the same definition again changes
        nothing. The unit cannot change after creation. A hard cap below current
        consumption plus outstanding reservations returns 409. A runtime key can
        create a budget or tighten it; raising or removing a hard limit, making
        it soft, or clearing or postponing closesAt needs a config key and
        otherwise returns 403, so whoever spends under a cap cannot lift it.
      operationId: budgets.upsert
      requestBody:
        description: The upsert 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
                unit:
                  type: string
                  pattern: >-
                    ^([A-Z]{3}|money:[A-Z]{3}|credits:[a-z0-9_-]{1,64}|units:[a-z0-9_-]{1,64})$
                  description: >-
                    A currency code (shorthand for money:<code>), credits:<id>,
                    or units:<slug>
                  example: USD
                limits:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        pattern: ^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$
                        description: >-
                          Unique within the budget. Defaults to the window name.
                          The id fixes the limit's recurring schedule.
                          Equivalent UTC anchors share usage. A different
                          schedule under the same id returns 409, so use a new
                          id for a different schedule.
                        example: month
                      amount:
                        type: string
                        pattern: ^\d{1,19}(\.\d{1,8})?$
                        description: >-
                          A non-negative decimal string in the budget's unit,
                          with at most 8 decimal places. Strings keep amounts
                          exact.
                        example: '0.05'
                      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
                      anchor:
                        type: integer
                        minimum: 0
                        description: >-
                          Anchors a day, week, or month window, in epoch
                          milliseconds: periods start at this instant and repeat
                          every window. A month anchored on the 31st starts on
                          the last day of shorter months. Equivalent UTC anchors
                          share one counter. Usage counts from the moment the
                          schedule is first tracked. Removed schedules retain
                          current usage until their period ends. A budget
                          retains at most 32 distinct anchored schedules.
                        example: 1792022400000
                      enforce:
                        type: string
                        enum:
                          - hard
                          - soft
                        description: Defaults to hard
                        example: hard
                    required:
                      - amount
                      - window
                  maxItems: 16
                  description: >-
                    Up to 16 limits. Every hard limit must have room for a hold
                    or charge. An empty list makes a budget that only counts.
                closesAt:
                  type: integer
                  nullable: true
                  minimum: 0
                  description: >-
                    When the budget closes, in epoch milliseconds. From then on
                    authorize and charge return 409, record is accepted for 1
                    day more, and settle and release keep working. 30 days after
                    closesAt, once nothing is left to settle or replay, the
                    budget is deleted: get returns 404 and an upsert creates it
                    anew. An upsert replaces the whole definition, so omitting
                    closesAt or sending null leaves the budget open and clears
                    any close time it had. A runtime key cannot close a budget
                    in the past: an earlier closesAt takes effect now.
                  example: 1798761599000
                holds:
                  type: object
                  properties:
                    defaultTtlMs:
                      type: integer
                      minimum: 1000
                      maximum: 86400000
                      description: >-
                        TTL for an authorize that sends no ttlMs, in
                        milliseconds. Defaults to 900000 (15 minutes).
                      example: 900000
                    maxTtlMs:
                      type: integer
                      minimum: 1000
                      maximum: 86400000
                      description: >-
                        The largest ttlMs an authorize may ask for, in
                        milliseconds. Defaults to 86400000 (1 day).
                      example: 86400000
                  additionalProperties: false
                  description: >-
                    Hold timing. Both TTLs must be between 1000 and 86400000 ms,
                    and the default must not exceed the max. An omitted TTL
                    takes its default on every upsert.
                onUnavailable:
                  type: string
                  enum:
                    - deny
                  description: >-
                    Deny new work when Unprice cannot be reached. Defaults to
                    deny.
                  example: deny
              required:
                - key
                - unit
                - limits
              additionalProperties: false
      responses:
        '200':
          description: The changes applied and the budget
          content:
            application/json:
              schema:
                type: object
                properties:
                  changes:
                    type: array
                    items:
                      type: object
                      properties:
                        change:
                          type: string
                          description: >-
                            limit.added, limit.removed, limit.amount,
                            limit.enforce, limits.order, holds, or closesAt.
                            Creating a budget lists each limit as limit.added.
                          example: limit.amount
                        limitId:
                          type: string
                          description: The limit that changed
                        from:
                          type: string
                          description: The previous value
                        to:
                          type: string
                          description: The new value
                      required:
                        - change
                    description: What this upsert changed; empty when it changed nothing
                  budget:
                    type: object
                    properties:
                      key:
                        type: string
                      unit:
                        type: string
                        description: money:<code>, credits:<id>, or units:<slug>
                        example: money:USD
                      version:
                        type: integer
                        description: Increments on every upsert that changes the budget
                      limits:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            amount:
                              type: string
                              description: A decimal amount in the budget's unit
                            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
                            anchor:
                              type: integer
                              description: >-
                                The anchor instant of an anchored window, in
                                epoch milliseconds
                            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
                          required:
                            - id
                            - amount
                            - window
                            - enforce
                      holds:
                        type: object
                        properties:
                          defaultTtlMs:
                            type: integer
                          maxTtlMs:
                            type: integer
                        required:
                          - defaultTtlMs
                          - maxTtlMs
                      onUnavailable:
                        type: string
                        enum:
                          - deny
                      closesAt:
                        type: integer
                        nullable: true
                        description: When the budget closes, in epoch milliseconds, or null
                      closed:
                        type: boolean
                        description: True from closesAt on
                      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
                      operations:
                        type: object
                        properties:
                          upsert:
                            type: integer
                            minimum: 0
                          authorize:
                            type: integer
                            minimum: 0
                          settle:
                            type: integer
                            minimum: 0
                          release:
                            type: integer
                            minimum: 0
                          charge:
                            type: integer
                            minimum: 0
                          record:
                            type: integer
                            minimum: 0
                          lease:
                            type: integer
                            minimum: 0
                          report:
                            type: integer
                            minimum: 0
                        required:
                          - upsert
                          - authorize
                          - settle
                          - release
                          - charge
                          - record
                          - lease
                          - report
                        description: >-
                          Accepted calls that changed the budget, per verb,
                          since it was created. Replays, rejections, reads,
                          upserts that changed nothing, and holds and leases the
                          alarm closed at expiry are not counted.
                    required:
                      - key
                      - unit
                      - version
                      - limits
                      - holds
                      - onUnavailable
                      - closesAt
                      - closed
                      - balance
                      - operations
                required:
                  - changes
                  - budget
        '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.