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

# Retrieve API Key

> Retrieve a single API key by id.

Retrieve metadata for a single API key by its `id`. Like
[List](/api-reference/api-keys/list), this never returns the raw token secret —
only the fields you can safely display. A key that doesn't belong to your
workspace returns `404`.

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.byteport.com/v1/tokens/9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34 \
    -H "Authorization: Bearer $BYTEPORT_API_KEY" \
    -H "User-Agent: my-app/1.0"
  ```

  ```javascript JavaScript theme={null}
  const id = "9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34";
  const res = await fetch(`https://api.byteport.com/v1/tokens/${id}`, {
    headers: {
      Authorization: `Bearer ${process.env.BYTEPORT_API_KEY}`,
      "User-Agent": "my-app/1.0",
    },
  });
  const key = await res.json();
  ```

  ```python Python theme={null}
  import os, requests

  key_id = "9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34"
  key = requests.get(
      f"https://api.byteport.com/v1/tokens/{key_id}",
      headers={
          "Authorization": f"Bearer {os.environ['BYTEPORT_API_KEY']}",
          "User-Agent": "my-app/1.0",
      },
  ).json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "id":         "9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34",
    "name":       "production-pipeline",
    "created_at": "2026-05-14T17:02:11Z",
    "expires_at": "2026-12-31T23:59:59Z"
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "error": 404,
    "message": "not found"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /v1/tokens/{id}
openapi: 3.1.0
info:
  title: Byteport API
  description: >-
    The Byteport API lets you move, share, and manage files across every storage
    location connected to your workspace through a single HTTP interface.
  version: 1.0.0
servers:
  - url: https://api.byteport.com
security:
  - bearerAuth: []
paths:
  /v1/tokens/{id}:
    get:
      summary: Retrieve API Key
      description: >-
        Retrieve metadata for a single API key by its `id`, scoped to the
        authenticated workspace. As with List, the raw token secret is never
        returned.
      parameters:
        - name: id
          in: path
          required: true
          description: >-
            Identifier of the API key — the `id` returned by Create or List (a
            UUID).
          schema:
            type: string
          example: 9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34
      responses:
        '200':
          description: The requested API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKey'
        '401':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
components:
  schemas:
    ApiKey:
      type: object
      description: >-
        An API key as exposed to callers. Never includes the raw token secret or
        its hash.
      properties:
        id:
          type: string
          description: >-
            Unique identifier for the key (a UUID). Use it as the `{id}` path
            segment for Retrieve, Update, and Delete.
          example: 9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34
        name:
          type: string
          description: The human-readable label set at creation or via Update.
          example: production-pipeline
        created_at:
          type: string
          format: date-time
          description: When the key was created (RFC 3339, UTC).
          example: '2026-05-14T17:02:11Z'
        expires_at:
          type: string
          format: date-time
          description: When the key expires. Omitted entirely if the key never expires.
          example: '2026-12-31T23:59:59Z'
        revoked_at:
          type: string
          format: date-time
          description: When the key was revoked. Omitted entirely while the key is active.
          example: '2026-04-20T12:00:00Z'
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: integer
        message:
          type: string
  responses:
    Error:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````