> ## 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.

# Create a new OAuth application

> ⚠️ SECURITY: Creates an OAuth2 application. Only OWNERS and ADMINS can create OAuth apps. Returns client secret ONCE - store it securely!



## OpenAPI

````yaml https://api.timbrix.mx/api/openapi.json post /oauth/apps
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/apps:
    post:
      tags:
        - oauth
      summary: Create a new OAuth application
      description: >-
        ⚠️ SECURITY: Creates an OAuth2 application. Only OWNERS and ADMINS can
        create OAuth apps. Returns client secret ONCE - store it securely!
      operationId: OAuthController_createApp
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOAuthAppDto'
      responses:
        '201':
          description: >-
            OAuth application created successfully. Client secret returned only
            once - save it immediately!
        '400':
          description: Invalid input data. Check validation errors.
        '401':
          description: Authentication required. Provide a valid bearer token.
        '403':
          description: Access denied. Only owners and admins can create OAuth applications.
      security:
        - bearer: []
components:
  schemas:
    CreateOAuthAppDto:
      type: object
      properties:
        name:
          type: string
          description: Application name
          example: My Integration
          minLength: 1
          maxLength: 100
        description:
          type: string
          description: Application description
          example: Integration for managing organization data
          maxLength: 500
        redirectUri:
          type: string
          description: Redirect URI for OAuth flow
          example: https://example.com/callback
        scopes:
          type: array
          description: OAuth scopes requested
          example:
            - read:organization
            - write:organization
          items:
            type: string
            enum:
              - read:user
              - write:user
              - read:organization
              - write:organization
              - read:members
              - write:members
              - read:webhooks
              - write:webhooks
              - admin:organization
              - admin:all
      required:
        - name
        - scopes
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````