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

> ## Agent Instructions
> These docs moved from docs.flintai.dev to docs.switchagents.ai. Use docs.switchagents.ai for every link and request.
> To search these docs from an AI tool, connect the MCP server at https://docs.switchagents.ai/mcp. The page index is at https://docs.switchagents.ai/llms.txt.
> The source code for these products is public on GitHub. Switch Rooms: https://github.com/sandbox-quantum/switch. Switch Trust CLI: https://github.com/sandbox-quantum/switch-trust-cli. Switch Trust CodeScan action: https://github.com/sandbox-quantum/switch-trust-codescan-action. Switch Trust MCP server: https://github.com/sandbox-quantum/switch-trust-mcp. Switch Trust Python SDK: https://github.com/sandbox-quantum/switch-trust-sdk-py. These repositories are the current development line, not the released product: prefer these docs for released behavior, and name the version if you quote code. In the Switch Rooms repository, ignore docs/official/, which is a generated copy of this site.

# Get caller identity

> Get the tenant ID and workspace ID for the calling credential, for use in tenant/workspace-scoped request paths. Works with an API key or a user session token. key_scope reflects the credential's scope, not whether it is a key: a session token returns "tenant_workspace_user", the same value a user-scoped API key returns.



## OpenAPI

````yaml /switch-trust/api-reference/openapi.json get /auth/api-key/identity
openapi: 3.0.3
info:
  contact: {}
  description: Switch Trust API
  license:
    name: Switch AI
    url: https://docs.switchagents.ai/legal/terms
  title: Switch Trust API
  version: 1.0.0
servers:
  - description: Switch Trust API
    url: https://{host}/api/v1
    variables:
      host:
        default: api.switchagents.ai
        description: Your instance's API host
security: []
paths:
  /auth/api-key/identity:
    get:
      tags:
        - auth
      summary: Get caller identity
      description: >-
        Get the tenant ID and workspace ID for the calling credential, for use
        in tenant/workspace-scoped request paths. Works with an API key or a
        user session token. key_scope reflects the credential's scope, not
        whether it is a key: a session token returns "tenant_workspace_user",
        the same value a user-scoped API key returns.
      operationId: GetAuthIdentity
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.IdentityConfig'
          description: OK
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/common.RequestError'
          description: Unauthorized
      security:
        - BearerAuth: []
components:
  schemas:
    api.IdentityConfig:
      properties:
        key_scope:
          type: string
        org_id:
          type: string
        tenant_id:
          type: string
        user_id:
          nullable: true
          type: string
        workspace_id:
          type: string
      type: object
    common.RequestError:
      description: Error responses returned by the API
      properties:
        code:
          example: 400
          type: integer
        message:
          example: Invalid request
          type: string
      required:
        - code
        - message
      type: object
  securitySchemes:
    BearerAuth:
      description: >-
        Send "ApiKey <your_api_key>" to authenticate with an API key, or "Bearer
        <token>" with a user session token.
      in: header
      name: Authorization
      type: apiKey

````