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

# Discover tenant from API key (CLI Login)

> Returns tenant information for the provided API key. Used by CLI for authentication.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/runtime/auth/discover
openapi: 3.0.0
info:
  title: Runflow Runtime API
  description: >-
    Programmatic surface for the Runflow platform — used by the SDK, the CLI,
    the execution engine, and any server-to-server caller. Authenticate with an
    `x-api-key` header (or `Authorization: Bearer ...`).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.runflow.ai
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags: []
paths:
  /api/v1/runtime/auth/discover:
    post:
      tags:
        - Runtime API - Authentication
      summary: Discover tenant from API key (CLI Login)
      description: >-
        Returns tenant information for the provided API key. Used by CLI for
        authentication.
      operationId: RuntimeAuthController_discoverApiKey
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyDiscoveryRequestDto'
      responses:
        '200':
          description: API key information retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyDiscoveryResponseDto'
        '400':
          description: Bad request - invalid API key format
        '401':
          description: Invalid or expired API key
components:
  schemas:
    ApiKeyDiscoveryRequestDto:
      type: object
      properties:
        apiKey:
          type: string
          description: API key to validate and discover tenant
          example: sk-1234567890abcdef...
      required:
        - apiKey
    ApiKeyDiscoveryResponseDto:
      type: object
      properties:
        success:
          type: boolean
          description: Success status
        data:
          type: object
          description: Discovery data
          properties:
            tenantId:
              type: string
            tenantName:
              type: string
            tenantDomain:
              type: string
            apiKeyId:
              type: string
            apiKeyName:
              type: string
            scopes:
              type: array
              items:
                type: string
            isActive:
              type: boolean
            expiresAt:
              type: string
              nullable: true
            lastUsedAt:
              type: string
              nullable: true
      required:
        - success
        - data

````