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

# Get API key

> Get one API key by public hash.



## OpenAPI

````yaml /openapi/v0-api/public.openapi.yaml get /api/v1/keys/{hash}
openapi: 3.1.0
info:
  title: MyRouter V0 Public API
  version: 0.1.0
  description: >-
    Customer-facing MyRouter V0 API. Core paths follow OpenRouter where
    possible; billing is a MyRouter extension using Stripe-style resource
    naming.
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
  x-platform-contract-commit: 56b047ef2c076be151e090aa4e2f5e974180ea14
  x-phase-sources:
    - phase1/2026-05-28-source-inventory.md
    - phase8/2026-05-28-public-v0-api-review-matrix.md
servers:
  - url: https://api.myrouter.example
    description: Placeholder until public environment is finalized.
security:
  - bearerApiKey: []
paths:
  /api/v1/keys/{hash}:
    get:
      tags:
        - Keys
      summary: Get API key
      description: Get one API key by public hash.
      operationId: getKey
      parameters:
        - $ref: '#/components/parameters/RequestIdHeader'
        - name: hash
          in: path
          required: true
          schema:
            type: string
            minLength: 1
          description: Public key hash.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
      responses:
        '200':
          description: Get API key response.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    RequestIdHeader:
      name: x-request-id
      in: header
      required: false
      schema:
        type: string
      description: Optional caller request id.
      x-source: Platform error contracts and product API convention
      x-owner: shared
      x-status: product-to-build
      x-platform-dependency: Platform runtime errors and product API errors
      x-rationale: Every API needs a stable supportable error envelope with request id.
  headers:
    RequestId:
      schema:
        type: string
      description: Effective request id.
      x-source: Platform error contracts and product API convention
      x-owner: shared
      x-status: product-to-build
      x-platform-dependency: Platform runtime errors and product API errors
      x-rationale: Every API needs a stable supportable error envelope with request id.
  schemas:
    KeyResponse:
      type: object
      additionalProperties: false
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/ApiKey'
          description: Current API key.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
        request_id:
          type: string
          description: Request id.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
      x-source: >-
        OpenRouter /key and /keys management API; platform API key
        lifecycle@56b047e; June 4 label association
      x-owner: shared
      x-status: june-4-dependent
      x-platform-dependency: Platform API key lifecycle plus label/account association
      x-rationale: >-
        Public key management follows OpenRouter naming; product maps public
        hash/account_id to platform API key and label internals.
    ApiKey:
      type: object
      additionalProperties: false
      required:
        - hash
        - name
        - account_id
        - disabled
        - usage
        - created_at
      properties:
        hash:
          type: string
          description: OpenRouter-style public key hash.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
        name:
          type: string
          description: Key display name.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
        label:
          type: string
          description: Customer-visible key label; not platform label id.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
        account_id:
          type: string
          description: Customer-visible account scope.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
        disabled:
          type: boolean
          description: Whether this key is disabled.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
        limit:
          type: number
          description: Optional key-level customer charge limit.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
        usage:
          type: number
          description: Customer charge consumed by this key.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
        limit_remaining:
          type: number
          description: Remaining key limit if configured.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
        created_at:
          type: string
          description: Creation timestamp.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
          format: date-time
        last_used_at:
          type: string
          description: Last observed usage timestamp.
          x-source: >-
            OpenRouter /key and /keys management API; platform API key
            lifecycle@56b047e; June 4 label association
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: Platform API key lifecycle plus label/account association
          x-rationale: >-
            Public key management follows OpenRouter naming; product maps public
            hash/account_id to platform API key and label internals.
          format: date-time
      x-source: >-
        OpenRouter /key and /keys management API; platform API key
        lifecycle@56b047e; June 4 label association
      x-owner: shared
      x-status: june-4-dependent
      x-platform-dependency: Platform API key lifecycle plus label/account association
      x-rationale: >-
        Public key management follows OpenRouter naming; product maps public
        hash/account_id to platform API key and label internals.
    ErrorEnvelope:
      type: object
      additionalProperties: false
      required:
        - error
        - request_id
      properties:
        error:
          type: object
          additionalProperties: false
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable machine-readable error code.
              x-source: Platform error contracts and product API convention
              x-owner: shared
              x-status: product-to-build
              x-platform-dependency: Platform runtime errors and product API errors
              x-rationale: >-
                Every API needs a stable supportable error envelope with request
                id.
            message:
              type: string
              description: Human-readable error message.
              x-source: Platform error contracts and product API convention
              x-owner: shared
              x-status: product-to-build
              x-platform-dependency: Platform runtime errors and product API errors
              x-rationale: >-
                Every API needs a stable supportable error envelope with request
                id.
            type:
              type: string
              description: Error category.
              x-source: Platform error contracts and product API convention
              x-owner: shared
              x-status: product-to-build
              x-platform-dependency: Platform runtime errors and product API errors
              x-rationale: >-
                Every API needs a stable supportable error envelope with request
                id.
          x-source: Platform error contracts and product API convention
          x-owner: shared
          x-status: product-to-build
          x-platform-dependency: Platform runtime errors and product API errors
          x-rationale: Every API needs a stable supportable error envelope with request id.
        request_id:
          type: string
          description: Effective request id for support.
          x-source: Platform error contracts and product API convention
          x-owner: shared
          x-status: product-to-build
          x-platform-dependency: Platform runtime errors and product API errors
          x-rationale: Every API needs a stable supportable error envelope with request id.
      x-source: Platform error contracts and product API convention
      x-owner: shared
      x-status: product-to-build
      x-platform-dependency: Platform runtime errors and product API errors
      x-rationale: Every API needs a stable supportable error envelope with request id.
  responses:
    BadRequest:
      description: Invalid request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unauthorized:
      description: Missing or invalid authentication.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: Authenticated principal is not allowed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RateLimited:
      description: Rate limit exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    InternalError:
      description: Internal error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      bearerFormat: MyRouter API key

````