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

# Retrieve an API key by id



## OpenAPI

````yaml get /api/v1/workspace/{id}/api-key/{akid}
openapi: 3.0.0
info:
  title: Oneloop API
  version: 1.0.0
  description: API Key Management
servers:
  - url: https://prod.oneloop.ai
    description: Production server
security:
  - bearerAuth: []
paths:
  /api/v1/workspace/{id}/api-key/{akid}:
    get:
      summary: Retrieve an API key by id
      operationId: getApiKeyById
      parameters:
        - schema:
            type: string
            description: The workspace id.
          required: true
          name: id
          in: path
        - schema:
            type: string
            description: The API key id.
          required: true
          name: akid
          in: path
      responses:
        '200':
          description: The API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RetrieveApiKeyByIdResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    RetrieveApiKeyByIdResponse:
      type: object
      properties:
        apiKey:
          $ref: '#/components/schemas/ApiKey'
      required:
        - apiKey
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: number
              minimum: 0
              exclusiveMinimum: true
            message:
              type: string
          required:
            - code
            - message
      required:
        - error
    ApiKey:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        maskedKey:
          type: string
        prefix:
          type: string
          nullable: true
        expiresAt:
          type: integer
          nullable: true
          minimum: 0
          exclusiveMinimum: true
        scopes:
          type: array
          items:
            $ref: '#/components/schemas/ApiKeyScope'
        enabled:
          type: boolean
        customerId:
          type: string
          nullable: true
        deleted:
          type: boolean
        createdAt:
          type: string
        updatedAt:
          type: string
        lastUsedAt:
          type: string
          nullable: true
        billingId:
          type: string
          nullable: true
      required:
        - id
        - name
        - maskedKey
        - prefix
        - expiresAt
        - scopes
        - enabled
        - customerId
        - deleted
        - createdAt
        - updatedAt
        - lastUsedAt
        - billingId
    ApiKeyScope:
      type: object
      properties:
        id:
          type: string
        representation:
          type: string
        create:
          type: boolean
        read:
          type: boolean
        update:
          type: boolean
        del:
          type: boolean
      required:
        - representation
        - create
        - read
        - update
        - del
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````