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

# get current billing-period usage

> Get metered usage and priced deltas for the customer's active subscription billing period. This reports billing data; use access.check for real-time quota enforcement.



## OpenAPI

````yaml /openapi.json post /v1/analytics/usage/current-billing-period
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/analytics/usage/current-billing-period:
    post:
      tags:
        - analytics
      summary: get current billing-period usage
      description: >-
        Get metered usage and priced deltas for the customer's active
        subscription billing period. This reports billing data; use access.check
        for real-time quota enforcement.
      operationId: analytics.usage.currentBillingPeriod
      requestBody:
        description: Current billing-period usage request
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customer_id:
                  type: string
                  description: >-
                    The customer ID. Optional when the API key is bound to a
                    customer.
                  example: cus_1H7KQFLr7RepUyQBKdnvY
                project_id:
                  type: string
                  description: >-
                    The project ID. Only main-project keys can select another
                    project.
                  example: project_1H7KQFLr7RepUyQBKdnvY
      responses:
        '200':
          description: Current billing-period usage
          content:
            application/json:
              schema:
                type: object
                properties:
                  billing_periods:
                    type: array
                    items:
                      type: object
                      properties:
                        billing_period_id:
                          type: string
                        cycle_start_at:
                          type: integer
                        cycle_end_at:
                          type: integer
                        usage:
                          type: array
                          items:
                            type: object
                            properties:
                              feature_slug:
                                type: string
                              usage:
                                type: number
                              spending:
                                type: object
                                properties:
                                  amount:
                                    type: string
                                  currency:
                                    type: string
                                    minLength: 3
                                    maxLength: 3
                                  display_amount:
                                    type: string
                                required:
                                  - amount
                                  - currency
                                  - display_amount
                            required:
                              - feature_slug
                              - usage
                              - spending
                      required:
                        - billing_period_id
                        - cycle_start_at
                        - cycle_end_at
                        - usage
                required:
                  - billing_periods
        '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:
              type: object
              properties:
                kind:
                  type: string
                  enum:
                    - invalid_config
                    - slug_conflict
                    - unresolved_reference
                  description: >-
                    What kind of failure this is. Currently only the
                    monetization configuration operations set it
                  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
          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:
              type: object
              properties:
                kind:
                  type: string
                  enum:
                    - invalid_config
                    - slug_conflict
                    - unresolved_reference
                  description: >-
                    What kind of failure this is. Currently only the
                    monetization configuration operations set it
                  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
          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:
              type: object
              properties:
                kind:
                  type: string
                  enum:
                    - invalid_config
                    - slug_conflict
                    - unresolved_reference
                  description: >-
                    What kind of failure this is. Currently only the
                    monetization configuration operations set it
                  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
          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:
              type: object
              properties:
                kind:
                  type: string
                  enum:
                    - invalid_config
                    - slug_conflict
                    - unresolved_reference
                  description: >-
                    What kind of failure this is. Currently only the
                    monetization configuration operations set it
                  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
          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:
              type: object
              properties:
                kind:
                  type: string
                  enum:
                    - invalid_config
                    - slug_conflict
                    - unresolved_reference
                  description: >-
                    What kind of failure this is. Currently only the
                    monetization configuration operations set it
                  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
          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:
              type: object
              properties:
                kind:
                  type: string
                  enum:
                    - invalid_config
                    - slug_conflict
                    - unresolved_reference
                  description: >-
                    What kind of failure this is. Currently only the
                    monetization configuration operations set it
                  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
          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:
              type: object
              properties:
                kind:
                  type: string
                  enum:
                    - invalid_config
                    - slug_conflict
                    - unresolved_reference
                  description: >-
                    What kind of failure this is. Currently only the
                    monetization configuration operations set it
                  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
          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:
              type: object
              properties:
                kind:
                  type: string
                  enum:
                    - invalid_config
                    - slug_conflict
                    - unresolved_reference
                  description: >-
                    What kind of failure this is. Currently only the
                    monetization configuration operations set it
                  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
          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:
              type: object
              properties:
                kind:
                  type: string
                  enum:
                    - invalid_config
                    - slug_conflict
                    - unresolved_reference
                  description: >-
                    What kind of failure this is. Currently only the
                    monetization configuration operations set it
                  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
          required:
            - code
            - docs
            - message
            - requestId
      required:
        - error
  securitySchemes:
    bearerAuth:
      bearerFormat: root key
      type: http
      scheme: bearer
      x-speakeasy-example: UNPRICE_API_KEY

````