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

# Set Usage

> Set absolute usage for the current period by recording an adjustment event.



## OpenAPI

````yaml POST /v1/usage/set
openapi: 3.1.0
info:
  title: PriceOS Public API
  version: 1.0.0
servers: []
security: []
paths:
  /v1/usage/set:
    post:
      summary: Set usage
      description: >-
        Set absolute usage for the current period by recording an adjustment
        event.
      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 set usage for.
                used:
                  type: number
                  minimum: 0
                  description: Absolute usage value to set for the current usage period.
                eventKey:
                  type: string
                  description: >-
                    Stable unique identifier for this event. Reuse it on retries
                    and for deduplication.
                metadata:
                  type: object
                  additionalProperties:
                    type: string
                  description: >-
                    Optional metadata for the adjustment event (string key/value
                    pairs).
              required:
                - customerId
                - featureKey
                - used
      responses:
        '200':
          description: Usage set
          content:
            application/json:
              schema:
                type: object
                properties:
                  applied:
                    type: boolean
                    description: Whether the usage event was applied.
                  used:
                    type:
                      - number
                      - 'null'
                    description: Updated usage total, if applicable.
                  eventId:
                    type:
                      - string
                      - 'null'
                    format: uuid
                    description: Usage event ID when available.
                  reason:
                    type:
                      - string
                      - 'null'
                    description: Reason the usage event was not applied.
                  adjustment:
                    type: number
                    description: >-
                      Adjustment amount applied to reach the requested usage
                      value.
                required:
                  - applied
                  - used
                  - adjustment
                description: Usage set result.
        '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.set({
              customerId: "customer_123",
              featureKey: "api_calls",
              used: 1200,
              eventKey: "set_usage_customer_123_api_calls_2026_02_18",
            });
        - lang: bash
          label: cURL
          source: |-
            curl -X POST "https://api.priceos.com/v1/usage/set" \
              -H "x-api-key: PRICEOS_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "customerId": "customer_123",
                "featureKey": "api_calls",
                "used": 1200,
                "eventKey": "set_usage_customer_123_api_calls_2026_02_18"
              }'

````