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

# Get an API key's usage

> Returns the consumption of one API key over a date window, as a time series at the requested granularity, optionally narrowed by feature, subfeature, provider or phase. A key that belongs to another organization returns 404. Without `begin`/`end` the last 7 days are returned. Requires the `manage:read` scope.



## OpenAPI

````yaml https://api.edenai.run/v2/info/splitted-schema/management_api/openapi.json get /v3/manage/keys/{key_id}/usage/
openapi: 3.0.3
info:
  title: Organization Management
  version: '2.0'
  description: Your project description
servers:
  - url: https://api.edenai.run
security: []
paths:
  /v3/manage/keys/{key_id}/usage/:
    get:
      tags:
        - Usage
      summary: Get an API key's usage
      description: >-
        Returns the consumption of one API key over a date window, as a time
        series at the requested granularity, optionally narrowed by feature,
        subfeature, provider or phase. A key that belongs to another
        organization returns 404. Without `begin`/`end` the last 7 days are
        returned. Requires the `manage:read` scope.
      operationId: manage_keys_usage_retrieve
      parameters:
        - in: query
          name: begin
          schema:
            type: string
            format: date
          description: >-
            First day of the window (inclusive). Provide both `begin` and `end`,
            or neither to get the last 7 days.
        - in: query
          name: end
          schema:
            type: string
            format: date
          description: >-
            Day after the last day of the window (exclusive). The window may not
            exceed 366 days.
        - in: query
          name: feature
          schema:
            type: string
            minLength: 1
          description: Only count this feature.
        - in: path
          name: key_id
          schema:
            type: string
            format: uuid
          required: true
        - in: query
          name: phase
          schema:
            type: string
            minLength: 1
          description: Only count this phase.
        - in: query
          name: provider
          schema:
            type: string
            minLength: 1
          description: Only count this provider.
        - in: query
          name: step
          schema:
            type: integer
            maximum: 4
            minimum: 1
          description: >-
            Granularity of the time series: 1 = day, 2 = week, 3 = month, 4 =
            year.
          required: true
        - in: query
          name: subfeature
          schema:
            type: string
            minLength: 1
          description: Only count this subfeature.
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyUsageResponse'
          description: ''
      security:
        - ManagementKeyAuth: []
components:
  schemas:
    KeyUsageResponse:
      description: Usage of one API key as a time series.
      properties:
        usage:
          items:
            $ref: '#/components/schemas/TokenData'
          title: Usage
          type: array
      required:
        - usage
      title: KeyUsageResponse
      type: object
    TokenData:
      properties:
        token:
          title: Token
          type: string
        data:
          additionalProperties:
            additionalProperties:
              $ref: '#/components/schemas/Details'
            type: object
          title: Data
          type: object
      required:
        - token
        - data
      title: TokenData
      type: object
    Details:
      properties:
        total_cost:
          title: Total Cost
          type: number
        details:
          title: Details
          type: integer
        cost_per_provider:
          additionalProperties:
            type: number
          title: Cost Per Provider
          type: object
      required:
        - total_cost
        - details
        - cost_per_provider
      title: Details
      type: object
  securitySchemes:
    ManagementKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: opaque
      description: >-
        A management key (created from the organization dashboard or with `POST
        /v3/manage/auth-keys`), sent as `Authorization: Bearer
        <management_key>`. Inference API keys (`sk-eden...`) are not accepted on
        these endpoints.

````