> ## 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.

# List API keys

> Returns the API keys of a workspace with their spend so far. The secret is never included.



## OpenAPI

````yaml /api-reference/cloud-platform-openapi.json get /v1/workspaces/{workspace_id}/api-keys
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/workspaces/{workspace_id}/api-keys:
    get:
      tags:
        - API keys
      summary: List API keys
      description: >-
        Returns the API keys of a workspace with their spend so far. The secret
        is never included.
      operationId: list_api_keys
      parameters:
        - description: The workspace id (a UUID).
          in: path
          name: workspace_id
          required: true
          schema:
            type: string
        - description: 'Page size: 1 to 1000, default 100.'
          in: query
          name: limit
          required: false
          schema:
            format: int64
            type: integer
        - description: Number of items to skip.
          in: query
          name: offset
          required: false
          schema:
            format: int64
            type: integer
        - description: 'Sort key: `created_at` or `usage`.'
          in: query
          name: order_by
          required: false
          schema:
            type: string
        - description: 'Sort direction: `asc` or `desc`.'
          in: query
          name: order_direction
          required: false
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListApiKeysResponse'
          description: A page of API keys.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: The request 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 caller is not allowed to do this.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: The resource does not exist.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal error.
      security:
        - session: []
components:
  schemas:
    ListApiKeysResponse:
      description: Paginated API keys list response
      properties:
        api_keys:
          items:
            $ref: '#/components/schemas/ApiKeyResponse'
          type: array
        limit:
          format: int64
          type: integer
        offset:
          format: int64
          type: integer
        total:
          format: int64
          type: integer
      required:
        - api_keys
        - total
        - limit
        - offset
      type: object
    ErrorResponse:
      description: The body of every error answer on the user routes.
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      required:
        - error
      type: object
    ApiKeyResponse:
      description: An API key.
      properties:
        created_at:
          format: date-time
          type: string
        created_by_user_id:
          description: The user who created the key.
          type: string
        deleted_at:
          format: date-time
          type:
            - string
            - 'null'
        expires_at:
          description: When the key stops working, if it expires.
          format: date-time
          type:
            - string
            - 'null'
        id:
          description: The key's id (a UUID).
          type: string
        is_active:
          description: Whether the key can be used.
          type: boolean
        key:
          description: >-
            The full secret key, beginning with `sk-`. It is returned only in
            the response that

            creates the key and cannot be retrieved again; store it securely.
          type:
            - string
            - 'null'
        key_prefix:
          description: The first characters of the key, for recognizing it.
          type: string
        last_used_at:
          description: When the key was last used, if ever.
          format: date-time
          type:
            - string
            - 'null'
        name:
          description: The key's name.
          type:
            - string
            - 'null'
        spend_limit:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/DecimalPrice'
              description: The spending limit, if one is set.
        usage:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/DecimalPrice'
              description: Spend so far, where reported.
        workspace_id:
          description: The workspace the key belongs to.
          type: string
      required:
        - id
        - key_prefix
        - workspace_id
        - created_by_user_id
        - created_at
        - is_active
      type: object
    ErrorDetail:
      properties:
        code:
          type:
            - string
            - 'null'
        message:
          type: string
        param:
          type:
            - string
            - 'null'
        type:
          type: string
      required:
        - message
        - type
      type: object
    DecimalPrice:
      description: A price in a response.
      properties:
        amount:
          description: The amount in units of 10^-`scale` of the currency.
          format: int64
          type: integer
        currency:
          description: Currency code, for example `USD`.
          type: string
        scale:
          description: Number of decimal places in `amount`; 9 means nano-dollars.
          format: int64
          type: integer
      required:
        - amount
        - scale
        - currency
      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.