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

# Uso

> Conversas e tarefas cobradas, por espaço e período.



## OpenAPI

````yaml openapi/pt/control.json GET /v1/usage
openapi: 3.1.0
info:
  title: API de controle da Niadra
  version: '1'
  description: >-
    Tenants, projetos, fontes, chaves, pessoas, configuração e uso. Nunca recebe
    conteúdo de cliente.
servers:
  - url: https://control.api.niadra.com
security: []
paths:
  /v1/usage:
    get:
      summary: Uso
      description: >-
        O uso do tenant por espaço, período e métrica, como sessões cobradas e
        eventos recebidos, com as cotas em vigor.


        **Autenticação.** Token de pessoa emitido pelo controle (`Authorization:
        Bearer <JWT>`), com o papel que a operação pede.
      operationId: usage_v1_usage_get
      parameters:
        - in: query
          name: since
          required: true
          schema:
            format: date-time
            title: Since
            type: string
          description: Início do período, incluído.
          example: '2026-09-01T00:00:00Z'
        - in: query
          name: until
          required: true
          schema:
            format: date-time
            title: Until
            type: string
          description: Fim do período, excluído.
          example: '2026-10-01T00:00:00Z'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageOut'
              example:
                items:
                  - space_id: 0192f0a0-3d4e-7f50-8b61-7c8d9e0f1a23
                    period_start: '2026-09-01T00:00:00Z'
                    metric: session_billable
                    quantity: 182340
                    cost_micros: 0
                  - space_id: 0192f0a0-3d4e-7f50-8b61-7c8d9e0f1a23
                    period_start: '2026-09-01T00:00:00Z'
                    metric: event_ingested
                    quantity: 4120775
                    cost_micros: 0
                quotas:
                  - tenant_id: 0192f0a0-1b2c-7d3e-8f40-5a6b7c8d9e01
                    metric: session_billable
                    limit: 250000
                    period: month
          description: O uso por espaço, período e métrica, com as cotas do tenant.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: O pedido não bate com o contrato.
      security:
        - personToken: []
components:
  schemas:
    UsageOut:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: '#/components/schemas/UsageItem'
          title: Items
          type: array
        quotas:
          items:
            $ref: '#/components/schemas/QuotaIn'
          title: Quotas
          type: array
      required:
        - items
        - quotas
      title: UsageOut
      type: object
    Problem:
      additionalProperties: false
      description: >-
        Detalhes do problema no formato da RFC 9457; `code` vem do catálogo de
        erros versionado.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    UsageItem:
      additionalProperties: false
      properties:
        cost_micros:
          default: 0
          minimum: 0
          title: Cost Micros
          type: integer
          description: Custo em milionésimos de dólar, quando a métrica tem custo.
        metric:
          maxLength: 256
          minLength: 1
          title: Metric
          type: string
        period_start:
          format: date-time
          title: Period Start
          type: string
        quantity:
          minimum: 0
          title: Quantity
          type: integer
        space_id:
          format: uuid
          title: Space Id
          type: string
      required:
        - space_id
        - period_start
        - metric
        - quantity
      title: UsageItem
      type: object
    QuotaIn:
      additionalProperties: false
      properties:
        limit:
          minimum: 0
          title: Limit
          type: integer
        metric:
          maxLength: 256
          minLength: 1
          title: Metric
          type: string
        period:
          default: month
          title: Period
          type: string
          description: O período em que o limite é contado. O padrão é `month`.
        tenant_id:
          format: uuid
          title: Tenant Id
          type: string
      required:
        - tenant_id
        - metric
        - limit
      title: QuotaIn
      type: object
  securitySchemes:
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````