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

# Get an organization's usage over time

> Returns request, token and cost totals per hour, day or week for a time range. The range defaults to the last 30 days and may not exceed 366 days. Costs are in USD.



## OpenAPI

````yaml /api-reference/cloud-platform-openapi.json get /v1/organizations/{org_id}/usage/timeseries
openapi: 3.1.0
info:
  description: Account, organization, workspace and billing routes of NEAR AI Cloud.
  title: NEAR AI Cloud Platform API
  version: '5'
servers:
  - url: https://cloud-platform.near.ai
    description: NEAR AI Cloud Platform
security: []
paths:
  /v1/organizations/{org_id}/usage/timeseries:
    get:
      tags:
        - Usage
      summary: Get an organization's usage over time
      description: >-
        Returns request, token and cost totals per hour, day or week for a time
        range. The range defaults to the last 30 days and may not exceed 366
        days. Costs are in USD.
      operationId: get_organization_usage_timeseries
      parameters:
        - description: The organization id (a UUID).
          in: path
          name: org_id
          required: true
          schema:
            type: string
        - description: Start of the range (ISO 8601). Defaults to 30 days before `end`.
          in: query
          name: start
          required: false
          schema:
            type: string
        - description: >-
            End of the range (ISO 8601). Defaults to now. The range may not
            exceed 366 days.
          in: query
          name: end
          required: false
          schema:
            type: string
        - description: 'Bucket size: `hour`, `day` or `week`. Defaults to `day`.'
          example: day
          in: query
          name: granularity
          required: false
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserTimeSeriesMetrics'
          description: Usage per time bucket.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: A parameter is invalid.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Missing or invalid credential.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: The user is not a member of this organization.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: The organization does not exist.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal error.
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: The query took too long; narrow the time range.
      security:
        - session: []
components:
  schemas:
    UserTimeSeriesMetrics:
      properties:
        data:
          items:
            $ref: '#/components/schemas/UserTimeSeriesPoint'
          type: array
        granularity:
          type: string
        organization_id:
          type: string
        period_end:
          format: date-time
          type: string
        period_start:
          format: date-time
          type: string
      required:
        - organization_id
        - period_start
        - period_end
        - granularity
        - data
      type: object
    ErrorResponse:
      description: The body of every error answer on the user routes.
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      required:
        - error
      type: object
    UserTimeSeriesPoint:
      properties:
        cache_read_tokens:
          format: int64
          type: integer
        cost_usd:
          format: double
          type: number
        date:
          description: The start of the bucket.
          type: string
        input_tokens:
          format: int64
          type: integer
        output_tokens:
          format: int64
          type: integer
        requests:
          format: int64
          type: integer
      required:
        - date
        - requests
        - input_tokens
        - output_tokens
        - cache_read_tokens
        - cost_usd
      type: object
    ErrorDetail:
      properties:
        code:
          type:
            - string
            - 'null'
        message:
          type: string
        param:
          type:
            - string
            - 'null'
        type:
          type: string
      required:
        - message
        - type
      type: object
  securitySchemes:
    session:
      bearerFormat: Session token
      description: 'Session token from signing in, sent as `Authorization: Bearer <token>`.'
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.