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

# Add usage to a tenant

> Admin action (full API keys only — devic-ui restricted keys are blocked at the gateway). Adds usage your own product measured outside Devic. It consumes the tenant's quota exactly like a call Devic measured, including blocking the tenant with 429 TENANT_LIMIT_EXCEEDED once a window is spent, and is tagged as injected so it can be told apart from measured usage. It only adds: negative amounts are rejected — use the reset endpoint to clear counters.



## OpenAPI

````yaml POST /v1/tenant-admin/{tenantId}/add-usage
openapi: 3.0.0
info:
  title: Devic.ai Public API
  description: >-
    Devic.ai is an AI platform that allows you to create, manage, and use AI
    agents for various tasks.
  version: 1.0.0
  contact:
    name: Devic.ai Support
    url: https://devic.ai
  x-logo:
    url: https://devic.ai/logo.png
    altText: Devic.ai Logo
  x-summary: Public API for interacting with Devic.ai platform
servers:
  - url: https://api.devic.ai
    description: Production server
  - url: https://staging-api.devic.ai
    description: Staging server
security:
  - bearerAuth: []
tags:
  - name: Environments
    description: >-
      The machine an agent works on and everything it may reach: sandbox,
      snapshot, knowledge, tools and encrypted variables
  - name: Sandboxes
    description: >-
      Start a real Linux machine on an environment, run commands and files on
      it, and save its snapshot
  - name: Projects
    description: Group agents, assistants, documents and costs into projects
  - name: Documents
    description: >-
      Knowledge base documents: create, version, attach and index markdown
      content for RAG
  - name: Document Folders
    description: Organise knowledge base documents into folders and attach them in bulk
  - name: Files
    description: Upload files and obtain shareable download URLs to attach to messages
  - name: Agents
    description: Endpoints related to AI agents and their operations
  - name: Assistants
    description: Endpoints for interacting with assistants and their specializations
  - name: Tool Servers
    description: Endpoints for managing tool servers and their tool definitions
  - name: Health
    description: API health check endpoints
  - name: Documentation
    description: Endpoints for retrieving markdown documentation
  - name: Integrations
    description: Connect third-party apps and turn them into tools
  - name: Triggers
    description: Start an agent or an assistant from an app event
  - name: Tenant Integrations
    description: Apps that each end user connects for themselves
  - name: Memory
    description: What an assistant remembers between conversations
  - name: Skills
    description: Reusable instruction packs for agents and assistants
  - name: Speech to Text
    description: Audio transcription
  - name: Tenants
    description: Tenants, subtenants and their usage
  - name: MCP Gateway
    description: One MCP endpoint over many servers, with visibility per user
  - name: Tenant Sessions
    description: Tokens that prove which end user is calling
paths:
  /v1/tenant-admin/{tenantId}/add-usage:
    post:
      tags:
        - Tenant Admin
      summary: Add usage to a tenant
      description: >-
        Admin action (full API keys only — devic-ui restricted keys are blocked
        at the gateway). Adds usage your own product measured outside Devic. It
        consumes the tenant's quota exactly like a call Devic measured,
        including blocking the tenant with 429 TENANT_LIMIT_EXCEEDED once a
        window is spent, and is tagged as injected so it can be told apart from
        measured usage. It only adds: negative amounts are rejected — use the
        reset endpoint to clear counters.
      operationId: addTenantUsage
      parameters:
        - name: tenantId
          in: path
          required: true
          description: tenantId
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: At least one of `tokens` or `cost` must be greater than 0.
              properties:
                tokens:
                  type: integer
                  minimum: 0
                  description: Tokens to add. Rounded to an integer.
                  example: 1500
                cost:
                  type: number
                  minimum: 0
                  description: Cost to add, in the same unit as the tenant's cost limits.
                  example: 0.42
                source:
                  type: string
                  pattern: ^[a-z0-9_-]{1,40}$
                  default: external
                  description: >-
                    Tag this injection is filed under, so usage can be broken
                    down by origin.
                  example: crm-sync
                reason:
                  type: string
                  description: >-
                    Free-text note for your own auditing. Not stored on the
                    counters.
      responses:
        '200':
          description: Usage added
          content:
            application/json:
              schema:
                type: object
                properties:
                  tenantId:
                    type: string
                  source:
                    type: string
                  applied:
                    type: object
                    properties:
                      tokens:
                        type: integer
                      cost:
                        type: number
                      countedTowardLimits:
                        type: boolean
                        description: >-
                          False when the tenant has no tier and no ad-hoc rules:
                          the usage is recorded in the cost aggregates, but
                          there is no quota for it to consume.
                  usage:
                    type: array
                    description: >-
                      Usage of every effective rule after the injection, so the
                      remaining quota is visible in the same call. Each rule
                      carries `externalConsumption`: the part of `current` that
                      was injected rather than measured.
                    items:
                      type: object
        '400':
          description: >-
            Bad Request - no amount given, a negative amount, or an invalid
            source tag
        '401':
          description: Unauthorized - Invalid or missing token
        '403':
          description: >-
            Forbidden - key not allowed on /tenant-admin, or a tenant session
            token
        '500':
          description: Internal Server Error
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An API key from your Devic console, sent as `Authorization: Bearer
        <key>`. An embedded front end sends a tenant-session token instead, so
        no API key reaches the browser, and an OAuth integration sends its
        access token. Missing, invalid or expired credentials get a `401`. See
        [Authentication](/api-reference/introduction#authentication).

````