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

# Get Usage

> Retrieve tenant usage stats, including billable date range and number of licensed users.

<Note>For common API errors, see [API Troubleshooting](/docs/api-reference/troubleshooting).</Note>

<Note>This route is limited to **10 requests per minute**.</Note>


## OpenAPI

````yaml GET /v1/usage
openapi: 3.0.3
info:
  title: Petra Security API
  description: >-
    The Petra Security API provides programmatic access to security data and
    functionality within your Petra portal.
  version: 1.0.0
  contact:
    name: Petra Security Support
    email: support@petrasecurity.com
servers:
  - url: https://api.petrasecurity.com
    description: Production server
security:
  - bearerAuth: []
paths:
  /v1/usage:
    get:
      tags: []
      summary: Get tenant usage
      description: >-
        Retrieve tenant usage stats, including billable date range and number of
        licensed users.
      operationId: getUsage
      parameters:
        - name: asOf
          in: query
          required: false
          description: >-
            Date in ISO format (YYYY-MM-DD) to get usage data for. Defaults to
            current date if not provided.
          schema:
            type: string
            format: date
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageResponse'
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too Many Requests - Rate limit exceeded for this route
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    UsageResponse:
      type: object
      properties:
        asOf:
          type: string
          format: date
        reportGeneratedAt:
          type: string
          format: date-time
        organizationName:
          type: string
        totalTenants:
          type: integer
        tenants:
          type: array
          items:
            $ref: '#/components/schemas/TenantUsageResponse'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Error code
            message:
              type: string
              description: Human-readable error message
            details:
              type: string
              description: Additional error details
      example:
        error:
          code: UNAUTHORIZED
          message: Invalid API key
          details: The provided API key is invalid or has been revoked
    TenantUsageResponse:
      type: object
      properties:
        petraTenantId:
          type: string
        microsoftTenantId:
          type: string
        onboardingDate:
          type: string
          format: date
        displayName:
          type: string
        service:
          type: string
          enum:
            - Monitoring
            - Autopsy
        isPaused:
          type: boolean
        firstBillableDate:
          type: string
          format: date
        billableStatus:
          type: string
          enum:
            - Trial
            - Active
            - NFR
            - Deleted
        totalLicensedUsers:
          type: integer
        billableUsersThisMonth:
          type: integer
        proratingPercentageThisMonth:
          type: number
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token authentication. Include your API key in the Authorization
        header as 'Bearer YOUR_API_KEY'

````