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

# List API Keys

> The API keys you created, 10 per page by default (`size` up to 50). Only your own keys are listed, and never the key string itself. Filter by name, id, expiry or creation time, search by name, or by scope (`authscope__*`). `order_by` (for example `["-created_at"]`), `uuid__in` and `name__in` are lists and are read from a JSON body, not the query string.

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
- **422**: Invalid filter parameters

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



## OpenAPI

````yaml /api-reference/openapi.json get /auth/api-keys
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:
    get:
      tags:
        - API Keys
      summary: List API Keys
      description: >-
        The API keys you created, 10 per page by default (`size` up to 50). Only
        your own keys are listed, and never the key string itself. Filter by
        name, id, expiry or creation time, search by name, or by scope
        (`authscope__*`). `order_by` (for example `["-created_at"]`), `uuid__in`
        and `name__in` are lists and are read from a JSON body, not the query
        string.


        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

        - **422**: Invalid filter parameters


        **Required Auth Scopes:**

        - `api_keys:read`
      operationId: list_api_keys
      parameters:
        - name: search
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            description: Search term to filter API keys by name.
            title: Search
          description: Search term to filter API keys by name.
        - name: uuid
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            description: Exact UUID to filter by.
            title: Uuid
          description: Exact UUID to filter by.
        - name: name
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            description: Exact name to filter by.
            title: Name
          description: Exact name to filter by.
        - name: exp__gte
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
            description: >-
              Filter for API keys with expiration greater than or equal to this
              datetime.
            title: Exp  Gte
          description: >-
            Filter for API keys with expiration greater than or equal to this
            datetime.
        - name: exp__gt
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
            description: Filter for API keys with expiration greater than this datetime.
            title: Exp  Gt
          description: Filter for API keys with expiration greater than this datetime.
        - name: exp__lte
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
            description: >-
              Filter for API keys with expiration less than or equal to this
              datetime.
            title: Exp  Lte
          description: >-
            Filter for API keys with expiration less than or equal to this
            datetime.
        - name: exp__lt
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
            description: Filter for API keys with expiration less than this datetime.
            title: Exp  Lt
          description: Filter for API keys with expiration less than this datetime.
        - name: created_at__gte
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
            description: Filter for API keys created after or at this datetime.
            title: Created At  Gte
          description: Filter for API keys created after or at this datetime.
        - name: created_at__gt
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
            description: Filter for API keys created after this datetime.
            title: Created At  Gt
          description: Filter for API keys created after this datetime.
        - name: created_at__lte
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
            description: Filter for API keys created before or at this datetime.
            title: Created At  Lte
          description: Filter for API keys created before or at this datetime.
        - name: created_at__lt
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
            description: Filter for API keys created before this datetime.
            title: Created At  Lt
          description: Filter for API keys created before this datetime.
        - name: authscope__order_by
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            description: Fields to order the results by. Comma-separated.
            title: Authscope  Order By
          description: Fields to order the results by. Comma-separated.
        - name: authscope__search
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            description: Search term to filter scopes by slug or description.
            title: Authscope  Search
          description: Search term to filter scopes by slug or description.
        - name: authscope__slug
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            description: Exact slug to filter by.
            title: Authscope  Slug
          description: Exact slug to filter by.
        - name: authscope__slug__in
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            description: List of slugs to filter by. Comma-separated.
            title: Authscope  Slug  In
          description: List of slugs to filter by. Comma-separated.
        - name: authscope__description
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            description: Exact description to filter by.
            title: Authscope  Description
          description: Exact description to filter by.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_list_api_keys'
            example:
              order_by:
                - '-created_at'
      responses:
        '200':
          description: >-
            Paginated list of API keys successfully retrieved with applied
            filters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page__T_Customized_ApiKeyPublic_'
              example:
                items:
                  - uuid: 3f2b8c1e-5d4a-4e7b-9c0d-1a2b3c4d5e6f
                    name: Nightly forecast export
                    exp: '2027-11-30T09:00:00Z'
                    created_at: '2026-11-30T09:00:00Z'
                    auth_scopes:
                      - slug: forecast:read
                        description: Read forecast data
                      - slug: integrations:vehicles:read
                        description: Read access to upstream vehicles
                total: 1
                page: 1
                size: 10
                pages: 1
        '401':
          description: >-
            Unauthorized. Authentication credentials missing, invalid, expired,
            or revoked.
        '403':
          description: Forbidden. Missing required `api_keys:read` authorization scope.
        '422':
          description: >-
            Unprocessable Entity. Validation error in filter parameters or query
            string format.
        '500':
          description: >-
            Internal Server Error. Database connection failure or unexpected
            server error.
      security:
        - HTTPBearer: []
        - HTTPBearer: []
components:
  schemas:
    Body_list_api_keys:
      properties:
        order_by:
          items:
            type: string
          type:
            - array
            - 'null'
          title: Order By
        uuid__in:
          items:
            type: string
          type:
            - array
            - 'null'
          title: Uuid  In
        name__in:
          items:
            type: string
          type:
            - array
            - 'null'
          title: Name  In
      type: object
      title: Body_list_api_keys
    Page__T_Customized_ApiKeyPublic_:
      properties:
        items:
          items:
            $ref: '#/components/schemas/ApiKeyPublic'
          type: array
          title: Items
        total:
          type: integer
          minimum: 0
          title: Total
        page:
          type: integer
          minimum: 1
          title: Page
        size:
          type: integer
          minimum: 1
          title: Size
        pages:
          type: integer
          minimum: 0
          title: Pages
      type: object
      required:
        - items
        - total
        - page
        - size
        - pages
      title: Page[~T]Customized[ApiKeyPublic]
    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.