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

# Generate OAuth access token

> 🔓 PUBLIC ENDPOINT: Generates an OAuth2 access token using client credentials flow. Requires valid client_id and client_secret. Token scopes are validated against application configuration. Rate limit: 10 requests per minute.



## OpenAPI

````yaml https://api.timbrix.mx/api/openapi.json post /oauth/token
openapi: 3.0.0
info:
  title: Timbrix API
  description: >-
    API de facturación electrónica CFDI 4.0 para México, con servidor OAuth2
    para gestionar organizaciones, miembros y webhooks. Compatible con agentes
    de IA — ver la extensión `x-ai-agent-friendly` en la raíz de esta spec.


    REST API with OAuth2 server for managing organizations, members, and
    webhooks.
  version: '1.0'
  contact: {}
servers: []
security: []
tags:
  - name: organizations
    description: Organization management endpoints
  - name: oauth
    description: OAuth2 authentication and authorization
  - name: webhooks
    description: Webhook configuration and delivery
  - name: users
    description: User information endpoints
  - name: api-keys
    description: API Keys management and validation
paths:
  /oauth/token:
    post:
      tags:
        - oauth
      summary: Generate OAuth access token
      description: >-
        🔓 PUBLIC ENDPOINT: Generates an OAuth2 access token using client
        credentials flow. Requires valid client_id and client_secret. Token
        scopes are validated against application configuration. Rate limit: 10
        requests per minute.
      operationId: OAuthController_generateToken
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateTokenDto'
      responses:
        '201':
          description: >-
            Access token generated successfully. Returns token, type (Bearer),
            expiration time, and granted scopes.
        '400':
          description: >-
            Invalid request. Check required fields: client_id, client_secret,
            scopes.
        '401':
          description: Invalid client credentials. Check client_id and client_secret.
        '429':
          description: >-
            Rate limit exceeded. Maximum 10 requests per minute for token
            generation.
components:
  schemas:
    GenerateTokenDto:
      type: object
      properties:
        clientId:
          type: string
          description: Client ID of the OAuth application
          example: app_1234567890abcdef
        clientSecret:
          type: string
          description: Client secret of the OAuth application
          example: cs_1234567890abcdef
        scopes:
          description: OAuth scopes requested
          example:
            - read:organization
          type: array
          items:
            type: array
        userId:
          type: string
          description: User ID for user-specific tokens
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - clientId
        - clientSecret
        - scopes

````