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

# List Usage Events

> List usage events for a customer and feature.



## OpenAPI

````yaml POST /v1/usage/events
openapi: 3.1.0
info:
  title: PriceOS Public API
  version: 1.0.0
servers: []
security: []
paths:
  /v1/usage/events:
    post:
      summary: List usage events
      description: List usage events for a customer and feature.
      parameters:
        - schema:
            type: string
            description: API key from your PriceOS dashboard.
          required: true
          description: API key from your PriceOS dashboard.
          name: x-api-key
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customerId:
                  type: string
                  description: Internal customer ID.
                featureKey:
                  type: string
                  description: Feature key to filter usage events.
                offset:
                  type: integer
                  minimum: 0
                  default: 0
                  description: Offset for pagination.
                limit:
                  type: integer
                  minimum: 1
                  maximum: 1000
                  default: 100
                  description: Limit for pagination.
                customRange:
                  type: object
                  properties:
                    start:
                      type: integer
                      description: Unix timestamp (ms) start for the custom range.
                    end:
                      type: integer
                      description: Unix timestamp (ms) end for the custom range.
                  required:
                    - start
                    - end
                  description: >-
                    Custom time range (optional). Mutually exclusive with
                    period.
                period:
                  type: string
                  enum:
                    - current
                    - previous
                  description: Usage period to list events for (current or previous).
              required:
                - customerId
                - featureKey
      responses:
        '200':
          description: Usage events list
          content:
            application/json:
              schema:
                type: object
                properties:
                  usageEvents:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Usage event ID.
                        amount:
                          type: number
                          description: Usage amount recorded.
                        occurredAt:
                          type: integer
                          description: Unix timestamp (ms) when the event occurred.
                        eventKey:
                          type:
                            - string
                            - 'null'
                          description: >-
                            Stable unique identifier for this event. Reuse it on
                            retries and for deduplication.
                        source:
                          type: string
                          enum:
                            - usage
                            - usage_set_adjustment
                          description: Usage event source.
                        metadata:
                          type: object
                          additionalProperties:
                            type: string
                          description: Event metadata (string key/value pairs).
                      required:
                        - id
                        - amount
                        - occurredAt
                        - source
                    description: Usage events.
                  hasMore:
                    type: boolean
                    description: Whether there are more results.
                  offset:
                    type: integer
                    description: Offset used for pagination.
                  limit:
                    type: integer
                    description: Limit used for pagination.
                  total:
                    type: integer
                    description: Total usage events matching the query.
                required:
                  - usageEvents
                  - hasMore
                  - offset
                  - limit
                  - total
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
        '404':
          description: Not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
      x-codeSamples:
        - lang: typescript
          label: Node.js
          source: >-
            import { PriceOS } from "priceos";

            import type { MyFeatures } from "./priceos.types";


            const priceos = new
            PriceOS<MyFeatures>(process.env.PRICEOS_API_KEY!);


            const result = await priceos.usage.listEvents({
              customerId: "customer_123",
              featureKey: "api_calls",
              period: "current",
              limit: 20,
              offset: 0,
            });
        - lang: bash
          label: cURL
          source: |-
            curl -X POST "https://api.priceos.com/v1/usage/events" \
              -H "x-api-key: PRICEOS_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "customerId": "customer_123",
                "featureKey": "api_calls",
                "period": "current",
                "limit": 20,
                "offset": 0
              }'

````