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

# Token Endpoint

> RFC 6749 token endpoint. Supports grant types: client_credentials, refresh_token, urn:ietf:params:oauth:grant-type:device_code, urn:openid:params:grant-type:ciba. Request body must be application/x-www-form-urlencoded.



## OpenAPI

````yaml post /oauth/token
openapi: 3.1.0
info:
  title: BKey API
  description: Biometric approval infrastructure for AI agents — OAuth 2.1 + CIBA
  version: 1.0.0
  contact:
    name: BKey
    url: https://bkey.id
    email: dev@bkey.id
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
  - url: https://api.bkey.id
    description: Production
security:
  - bearerAuth: []
tags:
  - name: OAuth
    description: OAuth 2.1 token, device auth, CIBA, revocation
  - name: Checkout
    description: Agent-initiated checkout with biometric approval
  - name: Vault
    description: Encrypted secret storage with biometric access
  - name: Payments
    description: Payment methods and shared payment tokens
  - name: Identity
    description: DID and identity management
paths:
  /oauth/token:
    post:
      tags:
        - OAuth
      summary: Token Endpoint
      description: >-
        RFC 6749 token endpoint. Supports grant types: client_credentials,
        refresh_token, urn:ietf:params:oauth:grant-type:device_code,
        urn:openid:params:grant-type:ciba. Request body must be
        application/x-www-form-urlencoded.
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                    description: EdDSA-signed JWT
                  token_type:
                    type: string
                    enum:
                      - Bearer
                  expires_in:
                    type: integer
                    description: Token lifetime in seconds
                  scope:
                    type: string
                    description: Space-separated list of granted scopes
                  refresh_token:
                    type: string
                  id_token:
                    type: string
                    description: OIDC ID token (if openid scope was granted)
                required:
                  - access_token
                  - token_type
                  - expires_in
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code (e.g., invalid_grant, unauthorized_client)
                  error_description:
                    type: string
                  error_uri:
                    type: string
                    format: uri
                required:
                  - error
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code (e.g., invalid_grant, unauthorized_client)
                  error_description:
                    type: string
                  error_uri:
                    type: string
                    format: uri
                required:
                  - error
                additionalProperties: false
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: EdDSA-signed JWT obtained via OAuth 2.1 client_credentials or CIBA

````