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

# Get API Key

> One of your API keys: name, expiry, creation time and scopes. The key string itself is never returned.

API keys authenticate scripts and integrations as you: send one as `Authorization: Bearer <key>`. A key acts with your permissions (or fewer, when created with `narrowing`) and stops working when it expires or is deleted. Create keys in the Copilot (Settings → API keys) or with `POST /auth/api-keys`.

**Failure Modes:**
- **401**: Token is missing, invalid, expired or revoked
- **403**: `access_denied` when your role cannot read API keys
- **404**: `API key not found` when no key of yours has this id

**Required Auth Scopes:**
- `api_keys:read`



## OpenAPI

````yaml /api-reference/openapi.json get /auth/api-keys/{uuid}
openapi: 3.1.0
info:
  title: SWITCH API
  version: '1.0'
  description: >-
    The SWITCH API gives mobility and logistics teams programmatic access to
    SWITCH forecasts, fleet operations, routing and analytics. Every request is
    authenticated with an API key sent as a bearer token.
servers:
  - url: https://stage-api.getswitch.io
    description: Stage
security: []
tags:
  - name: Forecast
    description: Demand forecasts per zone and time window.
  - name: Operations
    description: Fleet imbalance, rebalancing suggestions and generated tasks.
  - name: Routing
    description: Route optimisation for single and multiple fleets.
  - name: Routing Sessions
    description: Saved routing sessions, their routes and drivers.
  - name: Routing Operations
    description: Complete, undo and re-route the stops of a route.
  - name: Fleet Management
    description: Your depots, stations, drivers and cargo vehicles.
  - name: Integrations
    description: Vehicles, statuses and commands on your fleet platform.
  - name: Station Based Analytics
    description: Analytics for station-based (docked) services.
  - name: Zone Based Analytics
    description: Analytics for free-floating services, by zone.
  - name: Free Float Analytics
    description: Trip history for free-floating services.
  - name: Transit Analytics
    description: Punctuality and service delivery for public transit.
  - name: Live
    description: Real-time fleet, delivery and transit status.
  - name: Grids
    description: Spatial grids used by forecasts and analytics.
  - name: API Keys
    description: Create and manage the API keys you call this API with.
paths:
  /auth/api-keys/{uuid}:
    get:
      tags:
        - API Keys
      summary: Get API Key
      description: >-
        One of your API keys: name, expiry, creation time and scopes. The key
        string itself is never returned.


        API keys authenticate scripts and integrations as you: send one as
        `Authorization: Bearer <key>`. A key acts with your permissions (or
        fewer, when created with `narrowing`) and stops working when it expires
        or is deleted. Create keys in the Copilot (Settings → API keys) or with
        `POST /auth/api-keys`.


        **Failure Modes:**

        - **401**: Token is missing, invalid, expired or revoked

        - **403**: `access_denied` when your role cannot read API keys

        - **404**: `API key not found` when no key of yours has this id


        **Required Auth Scopes:**

        - `api_keys:read`
      operationId: get_api_key
      parameters:
        - name: uuid
          in: path
          required: true
          schema:
            type: string
            description: >-
              Id of the API key: the `uuid` returned when it was created or by
              `GET /auth/api-keys`.
            title: Uuid
          description: >-
            Id of the API key: the `uuid` returned when it was created or by
            `GET /auth/api-keys`.
      responses:
        '200':
          description: API key metadata successfully retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyPublic'
        '401':
          description: >-
            Unauthorized. Authentication credentials missing, invalid, expired,
            or revoked.
        '403':
          description: Forbidden. Missing required `api_keys:read` authorization scope.
        '404':
          description: Not Found. API key not found or user lacks ownership permissions.
        '422':
          description: Unprocessable Entity. Invalid UUID format in path parameter.
        '500':
          description: >-
            Internal Server Error. Database query failure or unexpected server
            error.
      security:
        - HTTPBearer: []
        - HTTPBearer: []
components:
  schemas:
    ApiKeyPublic:
      properties:
        uuid:
          type: string
          title: Uuid
          description: Unique UUID identifier for the API key.
        name:
          type: string
          title: Name
          description: Name of the API key.
        exp:
          type:
            - string
            - 'null'
          format: date-time
          title: Exp
          description: When the key expires (UTC).
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Datetime when the API key was created.
        auth_scopes:
          items:
            $ref: '#/components/schemas/AuthScopePublic'
          type: array
          title: Auth Scopes
          description: List of authorization scopes assigned to the API key.
      type: object
      required:
        - uuid
        - name
        - created_at
        - auth_scopes
      title: ApiKeyPublic
      description: >-
        Public schema for an API key resource.


        Exposes API key metadata and associated authorization scopes to API
        consumers.
      examples:
        - auth_scopes:
            - description: Read forecast data
              slug: forecast:read
            - description: Read access to upstream vehicles
              slug: integrations:vehicles:read
          created_at: '2026-11-30T09:00:00Z'
          exp: '2027-11-30T09:00:00Z'
          name: Nightly forecast export
          uuid: 3f2b8c1e-5d4a-4e7b-9c0d-1a2b3c4d5e6f
    AuthScopePublic:
      properties:
        slug:
          type: string
          title: Slug
          description: Unique slug identifier for the authorization scope.
        description:
          type: string
          title: Description
          description: Description of the authorization scope.
      type: object
      required:
        - slug
        - description
      title: AuthScopePublic
      description: >-
        Public schema for an authorization scope.


        Exposes information about an available authorization scope to API
        consumers.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      description: >-
        An API key, sent as `Authorization: Bearer <key>`. Create one in the
        SWITCH Copilot under **Settings → API keys** (needs the API keys
        permission in your company), or with `POST /auth/api-keys`. The key is
        shown once, at creation.

````

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