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

# Consume metered usage

> Atomically checks a metered entitlement, burns credits if configured, and increments usage. Auth: API key or embed access token.



## OpenAPI

````yaml /openapi.yaml post /usage/consume
openapi: 3.0.3
info:
  title: ArcenPay API
  description: >
    The ArcenPay REST API powers subscription billing, entitlements, usage
    metering,

    payment links, checkout sessions, and autonomous agent payments across EVM
    (BOT Chain,

    Base, Arc, Sepolia) and Stellar.


    Every endpoint that accepts an API key supports the `Authorization: Bearer
    <key>` header.

    Key prefixes: `sk_…` (secret), `rk_…` (restricted), `pk_…` (publishable,
    read-only),

    `api_…` (legacy). Company-scoped customer endpoints accept an embed access
    token

    (`arc_tok_…` or a signed JWT from `identify()`). See the Authentication page
    for the

    full endpoint auth matrix.


    Manage catalog, environments, invoices, webhooks, feature flags, and agent
    configuration

    from the *dashboard* — those are not part of the developer-facing API
    reference.
  version: 1.0.0
servers:
  - url: https://api.arcenpay.com/api/v1
    description: Production
  - url: http://localhost:3300/api/v1
    description: Local development
security:
  - bearerAuth: []
tags:
  - name: Credentials
    description: >-
      API keys, secret/publishable/restricted credentials, and short-lived
      tokens.
  - name: Companies
    description: Customer organizations, identity synchronization, and feature overrides.
  - name: Users
    description: Customer end-users associated with company organizations.
  - name: Events
    description: Ingest customer usage events and identification signals.
  - name: Access control
    description: >-
      Real-time entitlement checks, feature flags, and metered credit
      consumption.
  - name: Subscriptions
    description: >-
      On-chain subscription activation, self-serve plan switching, proration,
      and cancellation.
  - name: Checkout sessions
    description: Hosted checkout session lifecycle and status lookup.
  - name: Payment links
    description: Crypto payment links and dynamic payment URLs.
  - name: Autonomous agents
    description: >-
      Agent permissions, budget checking, on-chain funding, and auto-topup
      dispatch.
  - name: Mandates
    description: Recurring billing authorizations and mandate lifecycle.
  - name: Coupons
    description: Discount code validation and proration quoting.
  - name: zkTLS proofs
    description: Zero-knowledge TLS proofs verification via Reclaim Protocol.
  - name: Public
    description: Unauthenticated payment link specifications and checkout sessions.
  - name: Escrow
    description: >-
      Autonomous commit-reveal escrow reservations, release settlement, and
      dispute handling.
  - name: Features
    description: Feature catalog definitions, feature types, and linked plan entitlements.
paths:
  /usage/consume:
    post:
      tags:
        - Access control
      summary: Consume metered usage
      description: >-
        Atomically checks a metered entitlement, burns credits if configured,
        and increments usage. Auth: API key or embed access token.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - featureKey
              properties:
                featureKey:
                  type: string
                traits:
                  type: object
                  additionalProperties: true
                idempotencyKey:
                  type: string
      responses:
        '200':
          description: Usage consumed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConsumeEntitlementResult'
        '402':
          $ref: '#/components/responses/InsufficientCredits'
        '403':
          $ref: '#/components/responses/UpgradeRequired'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - bearerAuth: []
components:
  schemas:
    ConsumeEntitlementResult:
      allOf:
        - $ref: '#/components/schemas/EntitlementResult'
        - type: object
          properties:
            consumed:
              type: boolean
              description: True when a usage unit was actually recorded.
    EntitlementResult:
      type: object
      properties:
        key:
          type: string
        enabled:
          type: boolean
        reason:
          type: string
          description: >-
            Machine-readable resolution reason (`PLAN_ALLOWS`, `OVERRIDE`,
            `NO_PLAN`, …).
        allocation:
          type: number
          nullable: true
          description: Total allowed units; `null` = unlimited.
        usage:
          type: number
          description: Units consumed in the active billing period.
        exceeded:
          type: boolean
          description: True when usage >= allocation.
  responses:
    InsufficientCredits:
      description: The company does not have enough credits for the operation.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
    UpgradeRequired:
      description: The workspace tier does not allow this operation.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
    RateLimited:
      description: Rate limit exceeded (429).
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: sk_… / rk_… / pk_… / api_…

````