{
  "openapi": "3.0.3",
  "info": {
    "title": "Billora API",
    "version": "1.0.0",
    "description": "API REST de **Billora** para integrar la facturación, los gastos, los contactos y el resto de\nmódulos de tu organización desde aplicaciones externas.\n\n* **Autenticación:** API key en `Authorization: Bearer blr_…` (o `X-Api-Key: blr_…`). Cada clave\n  pertenece a una organización y sólo puede usar los recursos de sus *scopes*\n  (`recurso:read` / `recurso:write`; `write` incluye `read`). Cada operación indica su scope en\n  `x-scope`.\n* **Formato:** JSON UTF-8; importes y cantidades como cadenas decimales (`\"1234.50\"`); fechas\n  `YYYY-MM-DD`; fechas-hora ISO 8601.\n* **Errores:** `{\"detail\", \"code\", \"errors\", \"request_id\"}` (ver el esquema `Error`).\n* **Paginación:** `?page=` y `?page_size=` (por defecto 50, máx. 200) →\n  `{count, next, previous, results}`.\n* **Sincronización:** `created_after`, `created_before`, `updated_after`, `updated_before`.\n* **Idempotencia:** cabecera `Idempotency-Key` en POST/PATCH (24 h).\n* **Límites:** **3000** peticiones por minuto por API key (cabeceras `X-RateLimit-*`);\n  al superarlos, 429 `rate_limited` con `Retry-After`.\n\nGuías y ejemplos: [https://billora.app/es/desarrolladores](https://billora.app/es/desarrolladores).\n",
    "termsOfService": "https://billora.app/es/legal/terminos",
    "contact": {
      "name": "Soporte de Billora",
      "url": "https://billora.app/es/desarrolladores",
      "email": "soporte@billora.app"
    },
    "x-scopes": [
      {
        "scope": "invoices:read",
        "description": "Leer facturas, presupuestos, proformas, notas de crédito, facturas externas, facturas recurrentes, categorías de ingreso y métodos de cobro; descargar PDF y Facturae."
      },
      {
        "scope": "invoices:write",
        "description": "Crear, editar y borrar borradores; emitir (numerar y registrar en VeriFactu), anular, rectificar, convertir, enviar por email y generar enlaces de pago. Incluye acciones irreversibles."
      },
      {
        "scope": "contacts:read",
        "description": "Leer clientes, proveedores, personas de contacto, direcciones, etiquetas y condiciones de pago."
      },
      {
        "scope": "contacts:write",
        "description": "Crear, editar y borrar clientes, proveedores, personas de contacto, direcciones, etiquetas y condiciones de pago."
      },
      {
        "scope": "products:read",
        "description": "Leer productos, unidades y plantillas de impuestos."
      },
      {
        "scope": "products:write",
        "description": "Crear, editar y borrar productos, unidades y plantillas de impuestos."
      },
      {
        "scope": "payments:read",
        "description": "Leer cobros de facturas y pagos de gastos."
      },
      {
        "scope": "payments:write",
        "description": "Registrar, editar y borrar cobros de facturas y pagos de gastos."
      },
      {
        "scope": "expenses:read",
        "description": "Leer gastos, categorías de gasto, métodos de pago de gastos y escaneos de documentos."
      },
      {
        "scope": "expenses:write",
        "description": "Crear, editar, confirmar y borrar gastos y categorías; subir documentos para escanear."
      },
      {
        "scope": "series:read",
        "description": "Leer las series de numeración de documentos."
      },
      {
        "scope": "taxes:read",
        "description": "Leer tipos impositivos españoles (IVA, IGIC, IRPF, recargo…), regímenes, plantillas de impuestos y la configuración fiscal de la organización."
      },
      {
        "scope": "webhooks:read",
        "description": "Leer endpoints de webhooks, eventos y entregas."
      },
      {
        "scope": "webhooks:write",
        "description": "Crear, editar, probar y borrar endpoints de webhooks, rotar secretos y reenviar entregas."
      },
      {
        "scope": "files:read",
        "description": "Descargar archivos generados (descargas masivas de PDF en ZIP) y leer escaneos de documentos."
      },
      {
        "scope": "files:write",
        "description": "Subir documentos para escanear (OCR)."
      },
      {
        "scope": "cases:read",
        "description": "Leer expedientes, partes, actuaciones, carpetas, archivos y documentos vinculados."
      },
      {
        "scope": "cases:write",
        "description": "Crear, editar y borrar expedientes, partes, actuaciones, carpetas y archivos (subida multipart)."
      },
      {
        "scope": "crm:read",
        "description": "Leer embudos, etapas, leads, oportunidades, actividades y notas."
      },
      {
        "scope": "crm:write",
        "description": "Crear, editar y borrar leads, oportunidades, actividades, notas y embudos."
      },
      {
        "scope": "agenda:read",
        "description": "Leer tipos de evento, reservas y disponibilidad."
      },
      {
        "scope": "agenda:write",
        "description": "Crear, editar y cancelar tipos de evento, reservas y disponibilidad."
      },
      {
        "scope": "purchases:read",
        "description": "Leer pedidos de compra, facturas de proveedor y sus pagos."
      },
      {
        "scope": "purchases:write",
        "description": "Crear, editar y borrar pedidos de compra, facturas de proveedor y pagos; enviar y recibir pedidos, convertirlos en factura, aprobar (numerar) y anular facturas de proveedor."
      },
      {
        "scope": "settings:read",
        "description": "Leer el perfil y los datos fiscales de la organización, las series, la configuración fiscal, los diseños de factura y las plantillas de email."
      },
      {
        "scope": "settings:write",
        "description": "Editar el perfil y los datos fiscales de la organización (con las mismas validaciones del NIF que la aplicación), crear y editar series, configuración fiscal, diseños de factura y plantillas de email."
      },
      {
        "scope": "templates:read",
        "description": "Leer y descargar las plantillas de documentos (Word) de expedientes, clínica y consentimientos, sus marcadores y generar documentos a partir de ellas."
      },
      {
        "scope": "templates:write",
        "description": "Subir, editar y borrar plantillas de documentos."
      },
      {
        "scope": "hr:read",
        "description": "Leer empleados, departamentos, puestos, centros, contratos, horarios, ausencias, saldos, festivos, fichajes, códigos QR, nóminas, documentos y el registro horario."
      },
      {
        "scope": "hr:write",
        "description": "Crear, editar y borrar datos de RRHH; aprobar, rechazar y cancelar ausencias; subir documentos y nóminas."
      },
      {
        "scope": "clinica:read",
        "description": "Leer pacientes, historia clínica (alergias, antecedentes, constantes, episodios, diagnósticos, tratamientos), consentimientos, carpetas y archivos. Datos de salud (categoría especial del RGPD): cada acceso con API key queda en el registro de auditoría."
      },
      {
        "scope": "clinica:write",
        "description": "Crear, editar y borrar pacientes, episodios, diagnósticos, tratamientos, constantes, consentimientos, carpetas y archivos clínicos; firmar y reabrir episodios."
      },
      {
        "scope": "signatures:read",
        "description": "Leer solicitudes de firma, su evidencia y descargar el documento original, el firmado y el certificado."
      },
      {
        "scope": "signatures:write",
        "description": "Crear, enviar, recordar, cancelar y borrar solicitudes de firma (envío por email/SMS)."
      },
      {
        "scope": "imports:read",
        "description": "Leer trabajos de importación, sus filas, los tipos admitidos y descargar plantillas Excel."
      },
      {
        "scope": "imports:write",
        "description": "Subir, validar y procesar importaciones desde Excel. Además exige el scope de escritura del recurso importado (p. ej. contacts:write para clientes)."
      },
      {
        "scope": "verifactu:read",
        "description": "Leer los registros VeriFactu (estado de envío a la AEAT) y la configuración VeriFactu."
      },
      {
        "scope": "verifactu:write",
        "description": "Reintentar o reenviar registros VeriFactu a la AEAT."
      },
      {
        "scope": "sms:read",
        "description": "Leer el saldo de SMS, los bonos comprados y el historial de envíos."
      },
      {
        "scope": "sms:send",
        "description": "Enviar SMS (consume saldo: créditos gratuitos del mes o bonos de pago)."
      },
      {
        "scope": "accounting:read",
        "description": "Leer el plan de cuentas, ejercicios, asientos, configuración e informes contables."
      },
      {
        "scope": "accounting:write",
        "description": "Crear y editar cuentas, ejercicios y asientos contables; contabilizar, cerrar ejercicios y cambiar la configuración contable."
      },
      {
        "scope": "treasury:read",
        "description": "Leer cuentas bancarias, extractos importados, movimientos bancarios con sus sugerencias de conciliación, reglas, resumen banco ↔ contabilidad y ajustes."
      },
      {
        "scope": "treasury:write",
        "description": "Crear y editar cuentas bancarias y reglas, importar extractos (Norma 43, CSV, XLSX), conciliar movimientos (cobros, pagos, traspasos, impuestos, nóminas, comisiones), aceptar sugerencias, ignorar y deshacer conciliaciones."
      },
      {
        "scope": "reports:read",
        "description": "Leer informes fiscales y de IVA, cuadros de mando, modelos tributarios (303, 130, 111, 347…) y sus exportaciones."
      },
      {
        "scope": "reports:write",
        "description": "Ajustar manualmente casillas editables de los modelos tributarios."
      },
      {
        "scope": "audit:read",
        "description": "Leer el registro de auditoría (altas, cambios y borrados; accesos con API key a datos clínicos)."
      },
      {
        "scope": "account:read",
        "description": "Leer la información de la organización, el plan, el uso y los límites, los módulos activos, los miembros y el estado de las integraciones."
      }
    ]
  },
  "paths": {
    "/api/v1/account/": {
      "get": {
        "operationId": "account_retrieve",
        "description": "Organización, plan y estado de la suscripción, módulos activos y uso frente a los límites\ndel plan. No incluye datos de pago.\n\n**Scope requerido:** `account:read`.",
        "summary": "Resumen de la cuenta",
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountOverview"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/account/members/": {
      "get": {
        "operationId": "account_members_list",
        "description": "Miembros activos de la organización con su rol. Úsalos como valor de los campos que\nreferencian usuarios (`assigned_to`, `assigned_user`…). Sólo lectura: invitar y quitar\nmiembros se hace desde la aplicación.\n\n**Scope requerido:** `account:read`.",
        "summary": "Listar miembros",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedAccountMemberList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read"
      }
    },
    "/api/v1/accounting/accounts/": {
      "get": {
        "operationId": "accounting_accounts_list",
        "description": "Plan de cuentas (PGC PYMES) con subcuentas de terceros. Saldos anotados en la\nconsulta (sin N+1). No se puede cambiar código/grupo/tipo de una cuenta con\nmovimientos ni eliminar cuentas del sistema o con movimientos (409); desactivar sí.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Listar cuentas contables",
        "parameters": [
          {
            "in": "query",
            "name": "account_type",
            "schema": {
              "type": "string",
              "enum": [
                "asset",
                "equity",
                "expense",
                "income",
                "liability"
              ]
            },
            "description": "* `asset` - Activo\n* `liability` - Pasivo\n* `equity` - Patrimonio neto\n* `income` - Ingreso\n* `expense` - Gasto"
          },
          {
            "in": "query",
            "name": "code__startswith",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "group",
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7",
                "8",
                "9"
              ]
            },
            "description": "* `1` - 1\n* `2` - 2\n* `3` - 3\n* `4` - 4\n* `5` - 5\n* `6` - 6\n* `7` - 7\n* `8` - 8\n* `9` - 9"
          },
          {
            "in": "query",
            "name": "has_movements",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "is_active",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "is_contra",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "is_party",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "is_system",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "parent",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedAccountList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      },
      "post": {
        "operationId": "accounting_accounts_create",
        "description": "Plan de cuentas (PGC PYMES) con subcuentas de terceros. Saldos anotados en la\nconsulta (sin N+1). No se puede cambiar código/grupo/tipo de una cuenta con\nmovimientos ni eliminar cuentas del sistema o con movimientos (409); desactivar sí.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Crear cuenta contable",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/AccountRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AccountRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/accounts/{id}/": {
      "get": {
        "operationId": "accounting_accounts_retrieve",
        "description": "Plan de cuentas (PGC PYMES) con subcuentas de terceros. Saldos anotados en la\nconsulta (sin N+1). No se puede cambiar código/grupo/tipo de una cuenta con\nmovimientos ni eliminar cuentas del sistema o con movimientos (409); desactivar sí.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Obtener cuenta contable",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este account.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      },
      "put": {
        "operationId": "accounting_accounts_update",
        "description": "Plan de cuentas (PGC PYMES) con subcuentas de terceros. Saldos anotados en la\nconsulta (sin N+1). No se puede cambiar código/grupo/tipo de una cuenta con\nmovimientos ni eliminar cuentas del sistema o con movimientos (409); desactivar sí.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Reemplazar cuenta contable",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este account.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/AccountRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AccountRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      },
      "patch": {
        "operationId": "accounting_accounts_partial_update",
        "description": "Plan de cuentas (PGC PYMES) con subcuentas de terceros. Saldos anotados en la\nconsulta (sin N+1). No se puede cambiar código/grupo/tipo de una cuenta con\nmovimientos ni eliminar cuentas del sistema o con movimientos (409); desactivar sí.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Actualizar cuenta contable",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este account.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAccountRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAccountRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAccountRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      },
      "delete": {
        "operationId": "accounting_accounts_destroy",
        "description": "Plan de cuentas (PGC PYMES) con subcuentas de terceros. Saldos anotados en la\nconsulta (sin N+1). No se puede cambiar código/grupo/tipo de una cuenta con\nmovimientos ni eliminar cuentas del sistema o con movimientos (409); desactivar sí.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Eliminar cuenta contable",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este account.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/accounts/tree/": {
      "get": {
        "operationId": "accounting_accounts_tree_list",
        "description": "Árbol completo del plan de cuentas con saldos, construido en memoria (una consulta).\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Árbol de cuentas",
        "parameters": [
          {
            "in": "query",
            "name": "account_type",
            "schema": {
              "type": "string",
              "enum": [
                "asset",
                "equity",
                "expense",
                "income",
                "liability"
              ]
            },
            "description": "* `asset` - Activo\n* `liability` - Pasivo\n* `equity` - Patrimonio neto\n* `income` - Ingreso\n* `expense` - Gasto"
          },
          {
            "in": "query",
            "name": "code__startswith",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "group",
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7",
                "8",
                "9"
              ]
            },
            "description": "* `1` - 1\n* `2` - 2\n* `3` - 3\n* `4` - 4\n* `5` - 5\n* `6` - 6\n* `7` - 7\n* `8` - 8\n* `9` - 9"
          },
          {
            "in": "query",
            "name": "has_movements",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "include_inactive",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "include_party",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir subcuentas de terceros (por defecto no)."
          },
          {
            "in": "query",
            "name": "is_active",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "is_contra",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "is_party",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "is_system",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "parent",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedAccountTreeList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/backfill/": {
      "post": {
        "operationId": "accounting_backfill_create",
        "description": "Contabiliza el histórico de la organización (documentos sin asiento), opcionalmente\nre-sincronizando los ya contabilizados. Síncrono: pensado para volúmenes moderados.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Contabilizar el histórico",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BackfillRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/BackfillRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/BackfillRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/config/": {
      "get": {
        "operationId": "accounting_config_list",
        "description": "Configuración contable: cuentas por defecto (validadas por tipo), mapeo de métodos de pago a\ncuentas de tesorería, fecha de bloqueo y bloqueo automático al liquidar el IVA.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Listar configuraciones",
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AccountingConfiguration"
                  }
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/accounting/config/{id}/": {
      "get": {
        "operationId": "accounting_config_retrieve",
        "description": "Configuración contable: cuentas por defecto (validadas por tipo), mapeo de métodos de pago a\ncuentas de tesorería, fecha de bloqueo y bloqueo automático al liquidar el IVA.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Obtener configuración",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Configuración contable.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingConfiguration"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      },
      "patch": {
        "operationId": "accounting_config_partial_update",
        "description": "Configuración contable: cuentas por defecto (validadas por tipo), mapeo de métodos de pago a\ncuentas de tesorería, fecha de bloqueo y bloqueo automático al liquidar el IVA.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Actualizar configuración",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Configuración contable.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAccountingConfigurationRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAccountingConfigurationRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAccountingConfigurationRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingConfiguration"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/config/accounting-start/": {
      "post": {
        "operationId": "accounting_config_accounting_start_create",
        "description": "Cuerpo ``{start_date, dry_run}``. Con ``dry_run`` (por defecto ``true``) sólo devuelve lo que ocurriría.\nAl aplicarlo (``dry_run=false``) se ELIMINAN todos los asientos (automáticos y manuales) con fecha anterior,\nlos ejercicios que terminan antes y las liquidaciones de IVA contabilizadas de esos periodos; se renumeran\nlos ejercicios afectados y se re-sincronizan los documentos posteriores. Desde entonces nada se contabiliza\ncon fecha anterior: los documentos previos siguen en los libros de IVA y modelos fiscales, y sus cobros y\npagos posteriores sí se contabilizan (contra la subcuenta del tercero, cuyo saldo viene de la apertura).\n``start_date=null`` quita el inicio y vuelve a contabilizar los documentos del histórico (no se recuperan\nlos asientos manuales). 409 ``accounting_error`` si hay ejercicios cerrados o un periodo bloqueado\nafectados.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Fijar o quitar el inicio de la contabilidad",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingStartRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/AccountingStartRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AccountingStartRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingStartResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/config/current/": {
      "patch": {
        "operationId": "accounting_config_current_partial_update",
        "description": "Actualiza la configuración de la organización activa (sin conocer su id).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Actualiza la configuración de la organización activa (sin conocer su id)",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingConfiguration"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/doubtful-debts/": {
      "get": {
        "operationId": "accounting_doubtful_debts_list",
        "description": "Deudores de dudoso cobro: reclasificación 430 → 436 con deterioro (694/490), recuperación\n(vuelta a 430 y reversión 490/794) y baja por incobrable (650).\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Listar facturas en dudoso cobro",
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/JournalEntryList"
                  }
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/accounting/doubtful-debts/mark/": {
      "post": {
        "operationId": "accounting_doubtful_debts_mark_create",
        "description": "Deudores de dudoso cobro: reclasificación 430 → 436 con deterioro (694/490), recuperación\n(vuelta a 430 y reversión 490/794) y baja por incobrable (650).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Marcar una factura como de dudoso cobro",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DoubtfulDebtRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DoubtfulDebtRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DoubtfulDebtRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/doubtful-debts/recover/": {
      "post": {
        "operationId": "accounting_doubtful_debts_recover_create",
        "description": "Deudores de dudoso cobro: reclasificación 430 → 436 con deterioro (694/490), recuperación\n(vuelta a 430 y reversión 490/794) y baja por incobrable (650).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Recuperar (volver a 430 y revertir el deterioro)",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DoubtfulDebtRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DoubtfulDebtRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DoubtfulDebtRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/doubtful-debts/write-off/": {
      "post": {
        "operationId": "accounting_doubtful_debts_write_off_create",
        "description": "Deudores de dudoso cobro: reclasificación 430 → 436 con deterioro (694/490), recuperación\n(vuelta a 430 y reversión 490/794) y baja por incobrable (650).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Dar el crédito por incobrable (650)",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DoubtfulDebtRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DoubtfulDebtRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DoubtfulDebtRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/fiscal-years/": {
      "get": {
        "operationId": "accounting_fiscal_years_list",
        "description": "Ejercicios contables: crear, editar fechas (sin asientos), cerrar, reabrir y aplicar el\nresultado. ``status`` es de sólo lectura: cambia con ``close`` / ``reopen``.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Listar ejercicios fiscales",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "closed",
                "open"
              ]
            },
            "description": "* `open` - Abierto\n* `closed` - Cerrado"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedFiscalYearList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      },
      "post": {
        "operationId": "accounting_fiscal_years_create",
        "description": "Ejercicios contables: crear, editar fechas (sin asientos), cerrar, reabrir y aplicar el\nresultado. ``status`` es de sólo lectura: cambia con ``close`` / ``reopen``.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Crear ejercicio fiscal",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FiscalYearRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/FiscalYearRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/FiscalYearRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FiscalYear"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/fiscal-years/{id}/": {
      "get": {
        "operationId": "accounting_fiscal_years_retrieve",
        "description": "Ejercicios contables: crear, editar fechas (sin asientos), cerrar, reabrir y aplicar el\nresultado. ``status`` es de sólo lectura: cambia con ``close`` / ``reopen``.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Obtener ejercicio fiscal",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este fiscal year.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FiscalYear"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      },
      "put": {
        "operationId": "accounting_fiscal_years_update",
        "description": "Ejercicios contables: crear, editar fechas (sin asientos), cerrar, reabrir y aplicar el\nresultado. ``status`` es de sólo lectura: cambia con ``close`` / ``reopen``.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Reemplazar ejercicio fiscal",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este fiscal year.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FiscalYearRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/FiscalYearRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/FiscalYearRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FiscalYear"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      },
      "patch": {
        "operationId": "accounting_fiscal_years_partial_update",
        "description": "Ejercicios contables: crear, editar fechas (sin asientos), cerrar, reabrir y aplicar el\nresultado. ``status`` es de sólo lectura: cambia con ``close`` / ``reopen``.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Actualizar ejercicio fiscal",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este fiscal year.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedFiscalYearRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedFiscalYearRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedFiscalYearRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FiscalYear"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      },
      "delete": {
        "operationId": "accounting_fiscal_years_destroy",
        "description": "Ejercicios contables: crear, editar fechas (sin asientos), cerrar, reabrir y aplicar el\nresultado. ``status`` es de sólo lectura: cambia con ``close`` / ``reopen``.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Eliminar ejercicio fiscal",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este fiscal year.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/fiscal-years/{id}/apply-result/": {
      "post": {
        "operationId": "accounting_fiscal_years_apply_result_create",
        "description": "129 → cuentas indicadas en ``allocations`` (``{account_code|account, amount}``, admitidas\n112/113/114/118/120/121/129/550; deben sumar el resultado) o, sin ``allocations``, la\npropuesta de ``result-proposal`` (10 % a 112 reserva legal mientras no alcance el 20 % del\ncapital, resto a 113; pérdidas a 121), en el ejercicio siguiente.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Aplicar el resultado del ejercicio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este fiscal year.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyResultRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ApplyResultRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ApplyResultRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/fiscal-years/{id}/close/": {
      "post": {
        "operationId": "accounting_fiscal_years_close_create",
        "description": "Secuencia atómica: amortizaciones, periodificación 480, renumeración cronológica,\nregularización 6/7 → 129, asiento de cierre y apertura del ejercicio siguiente (se crea si\nno existe). Bloquea el periodo hasta la fecha de cierre. 409 si hay borradores o documentos\nsin contabilizar (ver ``closing-preflight``).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Cerrar el ejercicio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este fiscal year.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CloseFiscalYearRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CloseFiscalYearRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CloseFiscalYearRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FiscalYear"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/fiscal-years/{id}/closing-preflight/": {
      "get": {
        "operationId": "accounting_fiscal_years_closing_preflight_retrieve",
        "description": "Borradores, documentos sin contabilizar, ejercicios anteriores abiertos, resultado\nprevisto y periodificaciones pendientes: lo que el asistente de cierre debe mostrar.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Comprobaciones previas al cierre del ejercicio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este fiscal year.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/fiscal-years/{id}/corporate-tax/": {
      "post": {
        "operationId": "accounting_fiscal_years_corporate_tax_create",
        "description": "Debe 630 / Haber 4752 por la cuota del IS (``amount`` > 0) o Debe 4709 / Haber 630 si\nes a devolver (``amount`` < 0), fechado por defecto el último día del ejercicio (abierto).\nAl cerrar, la regularización lo incluye en el resultado.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Contabilizar el impuesto sobre beneficios del ejercicio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este fiscal year.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CorporateTaxRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CorporateTaxRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CorporateTaxRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/fiscal-years/{id}/legalization/": {
      "get": {
        "operationId": "accounting_fiscal_years_legalization_retrieve",
        "description": "ZIP con el libro diario, sumas y saldos, balance y PyG (XLSX/CSV) y un\n``manifest.json`` con el SHA-256 de cada fichero.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Paquete de legalización de libros (ZIP)",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este fiscal year.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/fiscal-years/{id}/reopen/": {
      "post": {
        "operationId": "accounting_fiscal_years_reopen_create",
        "description": "Revierte con contra-asientos la aplicación del resultado, la apertura, el cierre y la\nregularización (por clase de asiento) aunque el ejercicio siguiente ya tenga actividad:\nel resto de asientos se conserva y un nuevo cierre los recalcula. La fecha de bloqueo\nretrocede al mayor bloqueo anterior al ejercicio (ejercicios cerrados previos,\nliquidaciones de IVA anteriores). 409 si el ejercicio siguiente está cerrado.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Reabrir el ejercicio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este fiscal year.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FiscalYear"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/fiscal-years/{id}/result-proposal/": {
      "get": {
        "operationId": "accounting_fiscal_years_result_proposal_retrieve",
        "description": "Propuesta por defecto (art. 274 LSC): 10 % del beneficio a 112 reserva legal mientras\nno alcance el 20 % del capital (100/101/102), el resto a 113; pérdidas a 121. Devuelve\n``allocations`` listas para ``apply-result`` y el capital / reserva legal actuales.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Propuesta de aplicación del resultado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este fiscal year.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/fixed-assets/": {
      "get": {
        "operationId": "accounting_fixed_assets_list",
        "description": "Inmovilizado: fichas creadas automáticamente desde los gastos marcados como bien de\ninversión o a mano; amortización lineal mensual (``depreciate``) y baja (``dispose``).\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Listar registros",
        "parameters": [
          {
            "in": "query",
            "name": "account",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "expense",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "disposed",
                "fully_depreciated"
              ]
            },
            "description": "* `active` - En uso\n* `fully_depreciated` - Totalmente amortizado\n* `disposed` - Dado de baja"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedFixedAssetList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      },
      "post": {
        "operationId": "accounting_fixed_assets_create",
        "description": "Inmovilizado: fichas creadas automáticamente desde los gastos marcados como bien de\ninversión o a mano; amortización lineal mensual (``depreciate``) y baja (``dispose``).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Crear registro",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FixedAsset"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/fixed-assets/{id}/": {
      "get": {
        "operationId": "accounting_fixed_assets_retrieve",
        "description": "Inmovilizado: fichas creadas automáticamente desde los gastos marcados como bien de\ninversión o a mano; amortización lineal mensual (``depreciate``) y baja (``dispose``).\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Obtener registro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Inmovilizado.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FixedAsset"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      },
      "put": {
        "operationId": "accounting_fixed_assets_update",
        "description": "Inmovilizado: fichas creadas automáticamente desde los gastos marcados como bien de\ninversión o a mano; amortización lineal mensual (``depreciate``) y baja (``dispose``).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Reemplazar registro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Inmovilizado.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FixedAsset"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      },
      "patch": {
        "operationId": "accounting_fixed_assets_partial_update",
        "description": "Inmovilizado: fichas creadas automáticamente desde los gastos marcados como bien de\ninversión o a mano; amortización lineal mensual (``depreciate``) y baja (``dispose``).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Actualizar registro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Inmovilizado.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedFixedAssetRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedFixedAssetRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedFixedAssetRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FixedAsset"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      },
      "delete": {
        "operationId": "accounting_fixed_assets_destroy",
        "description": "Inmovilizado: fichas creadas automáticamente desde los gastos marcados como bien de\ninversión o a mano; amortización lineal mensual (``depreciate``) y baja (``dispose``).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Eliminar registro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Inmovilizado.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/fixed-assets/{id}/depreciate/": {
      "post": {
        "operationId": "accounting_fixed_assets_depreciate_create",
        "description": "Asientos mensuales Debe 68x / Haber 28x hasta ``until`` (por defecto, el último fin de mes).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Contabilizar las amortizaciones pendientes",
        "parameters": [
          {
            "in": "query",
            "name": "account",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "expense",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Inmovilizado.",
            "required": true
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "disposed",
                "fully_depreciated"
              ]
            },
            "description": "* `active` - En uso\n* `fully_depreciated` - Totalmente amortizado\n* `disposed` - Dado de baja"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepreciateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DepreciateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DepreciateRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedJournalEntryListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/fixed-assets/{id}/dispose/": {
      "post": {
        "operationId": "accounting_fixed_assets_dispose_create",
        "description": "Amortiza hasta la fecha, da de baja coste y amortización acumulada y lleva la diferencia\ncon el importe obtenido a 671/771.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Baja del inmovilizado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Inmovilizado.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DisposeAssetRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DisposeAssetRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DisposeAssetRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/fixed-assets/{id}/entries/": {
      "get": {
        "operationId": "accounting_fixed_assets_entries_list",
        "description": "Amortizaciones y baja contabilizadas de la ficha.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Asientos del inmovilizado",
        "parameters": [
          {
            "in": "query",
            "name": "account",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "expense",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Inmovilizado.",
            "required": true
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "disposed",
                "fully_depreciated"
              ]
            },
            "description": "* `active` - En uso\n* `fully_depreciated` - Totalmente amortizado\n* `disposed` - Dado de baja"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedJournalEntryListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/fixed-assets/{id}/schedule/": {
      "get": {
        "operationId": "accounting_fixed_assets_schedule_retrieve",
        "description": "Cuotas mensuales pendientes hasta el final de la vida útil.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Plan de amortización previsto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Inmovilizado.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/initialize/": {
      "post": {
        "operationId": "accounting_initialize_create",
        "description": "Inicializa (o completa) el plan de cuentas PGC PYMES de la organización. Idempotente: añade\nlas cuentas que falten y las cuentas por defecto no asignadas.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Inicializar el plan de cuentas PGC PYMES",
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingInitialized"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/journal-entries/": {
      "get": {
        "operationId": "accounting_journal_entries_list",
        "description": "Asientos contables con sus apuntes (``lines``: cuenta, debe, haber). Un asiento confirmado,\nde un ejercicio cerrado, de un periodo bloqueado o generado desde un documento (``is_sourced``)\nno se puede editar ni borrar (409): los automáticos se corrigen desde su documento o con\n``resync``. Filtros: fiscal_year, status, kind, date_from/date_to (o date__gte/date__lte),\naccount, account_code, source_type, source_id, is_sourced, search.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Listar asientos",
        "parameters": [
          {
            "in": "query",
            "name": "account",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "account_code",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "amount_max",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "amount_min",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "date",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date__gte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date__lte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "fiscal_year",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "in": "query",
            "name": "is_closing",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "is_opening",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "is_sourced",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string",
              "enum": [
                "accrual",
                "asset_disposal",
                "bank_movement",
                "closing",
                "corporate_tax",
                "credit_note",
                "depreciation",
                "doubtful",
                "expense",
                "expense_payment",
                "fx_difference",
                "invoice",
                "manual",
                "opening",
                "payment",
                "payment_fee",
                "payroll",
                "payroll_payment",
                "regularisation",
                "result_application",
                "tax_payment",
                "transfer",
                "vat_settlement",
                "vat_transfer"
              ]
            },
            "description": "* `manual` - Manual\n* `invoice` - Factura emitida\n* `credit_note` - Factura rectificativa / abono\n* `expense` - Gasto / factura recibida\n* `payment` - Cobro de factura\n* `expense_payment` - Pago de gasto\n* `payment_fee` - Comisión de cobro\n* `fx_difference` - Diferencia de cambio\n* `vat_transfer` - Traspaso IVA pendiente de deducir\n* `vat_settlement` - Liquidación de IVA\n* `tax_payment` - Pago / devolución de impuestos\n* `payroll` - Nómina\n* `payroll_payment` - Pago de nómina\n* `depreciation` - Amortización\n* `asset_disposal` - Baja de inmovilizado\n* `accrual` - Periodificación\n* `doubtful` - Deudor de dudoso cobro\n* `regularisation` - Regularización de resultado\n* `closing` - Asiento de cierre\n* `opening` - Asiento de apertura\n* `result_application` - Aplicación del resultado\n* `corporate_tax` - Impuesto sobre beneficios\n* `bank_movement` - Movimiento bancario\n* `transfer` - Traspaso de tesorería"
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "reversal_of",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "source_id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "source_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "posted"
              ]
            },
            "description": "* `draft` - Borrador\n* `posted` - Confirmado"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedJournalEntryListList"
                }
              },
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedJournalEntryListList"
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedJournalEntryListList"
                }
              },
              "application/pdf": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedJournalEntryListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      },
      "post": {
        "operationId": "accounting_journal_entries_create",
        "description": "Asientos contables con sus apuntes (``lines``: cuenta, debe, haber). Un asiento confirmado,\nde un ejercicio cerrado, de un periodo bloqueado o generado desde un documento (``is_sourced``)\nno se puede editar ni borrar (409): los automáticos se corrigen desde su documento o con\n``resync``. Filtros: fiscal_year, status, kind, date_from/date_to (o date__gte/date__lte),\naccount, account_code, source_type, source_id, is_sourced, search.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Crear asiento",
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JournalEntryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/JournalEntryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/JournalEntryRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/pdf": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/journal-entries/{id}/": {
      "get": {
        "operationId": "accounting_journal_entries_retrieve",
        "description": "Asientos contables con sus apuntes (``lines``: cuenta, debe, haber). Un asiento confirmado,\nde un ejercicio cerrado, de un periodo bloqueado o generado desde un documento (``is_sourced``)\nno se puede editar ni borrar (409): los automáticos se corrigen desde su documento o con\n``resync``. Filtros: fiscal_year, status, kind, date_from/date_to (o date__gte/date__lte),\naccount, account_code, source_type, source_id, is_sourced, search.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Obtener asiento",
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este journal entry.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/pdf": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      },
      "put": {
        "operationId": "accounting_journal_entries_update",
        "description": "Asientos contables con sus apuntes (``lines``: cuenta, debe, haber). Un asiento confirmado,\nde un ejercicio cerrado, de un periodo bloqueado o generado desde un documento (``is_sourced``)\nno se puede editar ni borrar (409): los automáticos se corrigen desde su documento o con\n``resync``. Filtros: fiscal_year, status, kind, date_from/date_to (o date__gte/date__lte),\naccount, account_code, source_type, source_id, is_sourced, search.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Reemplazar asiento",
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este journal entry.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JournalEntryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/JournalEntryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/JournalEntryRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/pdf": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      },
      "patch": {
        "operationId": "accounting_journal_entries_partial_update",
        "description": "Asientos contables con sus apuntes (``lines``: cuenta, debe, haber). Un asiento confirmado,\nde un ejercicio cerrado, de un periodo bloqueado o generado desde un documento (``is_sourced``)\nno se puede editar ni borrar (409): los automáticos se corrigen desde su documento o con\n``resync``. Filtros: fiscal_year, status, kind, date_from/date_to (o date__gte/date__lte),\naccount, account_code, source_type, source_id, is_sourced, search.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Actualizar asiento",
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este journal entry.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedJournalEntryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedJournalEntryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedJournalEntryRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/pdf": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      },
      "delete": {
        "operationId": "accounting_journal_entries_destroy",
        "description": "Asientos contables con sus apuntes (``lines``: cuenta, debe, haber). Un asiento confirmado,\nde un ejercicio cerrado, de un periodo bloqueado o generado desde un documento (``is_sourced``)\nno se puede editar ni borrar (409): los automáticos se corrigen desde su documento o con\n``resync``. Filtros: fiscal_year, status, kind, date_from/date_to (o date__gte/date__lte),\naccount, account_code, source_type, source_id, is_sourced, search.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Eliminar asiento",
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este journal entry.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/journal-entries/{id}/post-entry/": {
      "post": {
        "operationId": "accounting_journal_entries_post_entry_create",
        "description": "Valida líneas (cuentas hoja y activas, importes), cuadre en base de datos, ejercicio\nabierto y periodo no bloqueado; asigna número. Deja de ser editable.\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Confirmar (contabilizar) un asiento",
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este journal entry.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/pdf": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/journal-entries/{id}/resync/": {
      "post": {
        "operationId": "accounting_journal_entries_resync_create",
        "description": "Vuelve a generar la contabilidad del documento origen (regularización por diferencias\nsi el asiento está confirmado). 400 si el asiento es manual.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Re-sincronizar el asiento con su documento",
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este journal entry.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/pdf": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/journal-entries/{id}/reverse/": {
      "post": {
        "operationId": "accounting_journal_entries_reverse_create",
        "description": "Crea y confirma el asiento inverso (``reversal_of``) en la fecha indicada (por defecto,\nla del original o el primer día abierto si está bloqueado).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Contra-asiento (anulación) de un asiento confirmado",
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este journal entry.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReverseEntryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ReverseEntryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ReverseEntryRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              },
              "application/pdf": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/accounting/journal-entries/ledger/": {
      "get": {
        "operationId": "accounting_journal_entries_ledger_retrieve",
        "description": "Movimientos de una cuenta con saldo inicial, contrapartida y saldo acumulado (paginado).\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Libro mayor de una cuenta",
        "parameters": [
          {
            "in": "query",
            "name": "account",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Desde (YYYY-MM-DD). También se acepta date__gte."
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Hasta (YYYY-MM-DD). También se acepta date__lte."
          },
          {
            "in": "query",
            "name": "fiscal_year",
            "schema": {
              "type": "integer"
            },
            "description": "Id del ejercicio (por defecto: fechas libres)."
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string"
            },
            "description": "json (defecto), csv o xlsx (pdf en balance y PyG)."
          },
          {
            "in": "query",
            "name": "include_closing",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir los asientos de regularización Y de cierre del ejercicio que termina con el periodo (tras el cierre todos los saldos quedan a cero). Por defecto se excluyen. El asiento de apertura del ejercicio (el del cierre anterior o el importado del balance del asesor) siempre cuenta: forma el saldo inicial y no se repite entre los movimientos del periodo."
          },
          {
            "in": "query",
            "name": "include_regularisation",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir sólo la regularización 6/7 → 129 (no el cierre). Por defecto no."
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "text/csv": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/opening-balances/import/": {
      "post": {
        "operationId": "accounting_opening_balances_import_create",
        "description": "Multipart con ``file``, ``fiscal_year`` y ``replace`` (por defecto true: sustituye el asiento de\napertura existente con un contra-asiento), ``account_mapping`` (JSON {código del fichero: destino}; por\ndefecto la sugerencia del preview), ``regularize`` (lleva las cuentas 6/7 a la 129) y\n``bank_account_mapping`` (mapeo histórico de los saldos 57x). Valida el cuadre (tolerancia 0,01 €), crea\nlas cuentas que falten (las subcuentas de terceros con ``AccountResolver``), agrega las filas con el mismo\ndestino y fecha el asiento el primer día del ejercicio o, si es posterior, en el inicio de la contabilidad.\n409 ``accounting_error`` si no cuadra, trae cuentas 6/7 sin ``regularize``, un código choca con la\nsubcuenta de otro tercero o el ejercicio está cerrado.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Importar el asiento de apertura desde sumas y saldos",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/OpeningBalancesImportRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpeningBalancesImportResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/opening-balances/preview/": {
      "post": {
        "operationId": "accounting_opening_balances_preview_create",
        "description": "Multipart con ``file`` (CSV/XLSX). Devuelve las filas (``source_code``, ``source_name``, ``debit``,\n``credit``, ``target``, ``target_account_code``, ``target_label``, ``suggested_target``,\n``suggested_reason``, ``account_exists``, ``will_create``, ``link_party``, ``bank_account``, ``error``),\nlos totales, ``balanced``, ``warnings``, ``can_import``, el mapeo aplicado (``account_mapping``), el\nsugerido (``suggested_mapping``) y los códigos sin destino claro (``unmapped``).\n\nCada fila propone un destino: la cuenta con el mismo código; el prefijo significativo de los códigos\nlargos con ceros de relleno (1000000000 → 100, 4751000007 → 4751); la subcuenta del cliente / proveedor\nque casa por NIF o nombre (subcuentas 430/400/410); o la cuenta bancaria (57x). ``account_mapping``\n{código del fichero: destino} cambia el destino fila a fila (código de cuenta existente, ``customer:<id>``,\n``supplier:<id>``, ``employee:<id>``, ``bank:<id>`` o ``skip``). Las cuentas de gasto/ingreso (6/7) se\nrechazan salvo con ``regularize=true``, que lleva su saldo neto a la 129 (``result_to_129``). Un código\nque ya es la subcuenta de otro tercero en Billora bloquea la importación mientras no se le asigne otro\ndestino. ``bank_account_mapping`` {código: id} es el mapeo histórico de los saldos 57x;\n``bank_accounts`` enumera las cuentas disponibles.\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Previsualizar un balance de sumas y saldos",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/OpeningBalancesPreviewRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpeningBalancesPreview"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/reports/aging/": {
      "get": {
        "operationId": "accounting_reports_aging_retrieve",
        "description": "Pendiente por tercero y tramo de vencimiento (no vencido, 0-30, 31-60, 61-90, 91-180, 181+)\ncon el saldo contable de su subcuenta y la diferencia.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Antigüedad de saldos de clientes / proveedores",
        "parameters": [
          {
            "in": "query",
            "name": "as_of",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string"
            },
            "description": "receivable (430, defecto) o payable (400/410)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "text/csv": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/reports/balance-sheet/": {
      "get": {
        "operationId": "accounting_reports_balance_sheet_retrieve",
        "description": "Activo (no corriente / corriente) y patrimonio neto y pasivo con las partidas del modelo\nPYMES, cuentas compensadoras netas, columna comparativa y cuentas sin clasificar.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Balance de situación (PGC PYMES)",
        "parameters": [
          {
            "in": "query",
            "name": "compare_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "fiscal_year",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "text/csv": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/reports/cash-flow/": {
      "get": {
        "operationId": "accounting_reports_cash_flow_retrieve",
        "description": "Entradas y salidas de tesorería por mes y por categoría de contrapartida (clientes,\nproveedores, personal, impuestos…), con saldo inicial y final.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Flujo de caja (movimientos de tesorería 57x)",
        "parameters": [
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Desde (YYYY-MM-DD). También se acepta date__gte."
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Hasta (YYYY-MM-DD). También se acepta date__lte."
          },
          {
            "in": "query",
            "name": "fiscal_year",
            "schema": {
              "type": "integer"
            },
            "description": "Id del ejercicio (por defecto: fechas libres)."
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string"
            },
            "description": "json (defecto), csv o xlsx (pdf en balance y PyG)."
          },
          {
            "in": "query",
            "name": "include_closing",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir los asientos de regularización Y de cierre del ejercicio que termina con el periodo (tras el cierre todos los saldos quedan a cero). Por defecto se excluyen. El asiento de apertura del ejercicio (el del cierre anterior o el importado del balance del asesor) siempre cuenta: forma el saldo inicial y no se repite entre los movimientos del periodo."
          },
          {
            "in": "query",
            "name": "include_regularisation",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir sólo la regularización 6/7 → 129 (no el cierre). Por defecto no."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "text/csv": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/reports/income-statement/": {
      "get": {
        "operationId": "accounting_reports_income_statement_retrieve",
        "description": "Partidas 1-18 y subtotales A-D del modelo PYMES, con el detalle de cuentas de cada\npartida y la columna comparativa del ejercicio indicado.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Cuenta de pérdidas y ganancias (PGC PYMES)",
        "parameters": [
          {
            "in": "query",
            "name": "compare_fiscal_year",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Desde (YYYY-MM-DD). También se acepta date__gte."
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Hasta (YYYY-MM-DD). También se acepta date__lte."
          },
          {
            "in": "query",
            "name": "fiscal_year",
            "schema": {
              "type": "integer"
            },
            "description": "Id del ejercicio (por defecto: fechas libres)."
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string"
            },
            "description": "json (defecto), csv o xlsx (pdf en balance y PyG)."
          },
          {
            "in": "query",
            "name": "include_closing",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir los asientos de regularización Y de cierre del ejercicio que termina con el periodo (tras el cierre todos los saldos quedan a cero). Por defecto se excluyen. El asiento de apertura del ejercicio (el del cierre anterior o el importado del balance del asesor) siempre cuenta: forma el saldo inicial y no se repite entre los movimientos del periodo."
          },
          {
            "in": "query",
            "name": "include_regularisation",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir sólo la regularización 6/7 → 129 (no el cierre). Por defecto no."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "text/csv": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/reports/journal/": {
      "get": {
        "operationId": "accounting_reports_journal_retrieve",
        "description": "Asientos confirmados con sus apuntes en orden cronológico; CSV/XLSX con una fila por apunte.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Libro diario (exportable)",
        "parameters": [
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Desde (YYYY-MM-DD). También se acepta date__gte."
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Hasta (YYYY-MM-DD). También se acepta date__lte."
          },
          {
            "in": "query",
            "name": "fiscal_year",
            "schema": {
              "type": "integer"
            },
            "description": "Id del ejercicio (por defecto: fechas libres)."
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string"
            },
            "description": "json (defecto), csv o xlsx (pdf en balance y PyG)."
          },
          {
            "in": "query",
            "name": "include_closing",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir los asientos de regularización Y de cierre del ejercicio que termina con el periodo (tras el cierre todos los saldos quedan a cero). Por defecto se excluyen. El asiento de apertura del ejercicio (el del cierre anterior o el importado del balance del asesor) siempre cuenta: forma el saldo inicial y no se repite entre los movimientos del periodo."
          },
          {
            "in": "query",
            "name": "include_regularisation",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir sólo la regularización 6/7 → 129 (no el cierre). Por defecto no."
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "text/csv": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/reports/ledger/": {
      "get": {
        "operationId": "accounting_reports_ledger_retrieve",
        "description": "Movimientos de la cuenta con saldo inicial, contrapartida, saldo acumulado y totales;\npaginado. ``opening_balance`` es el acumulado anterior a ``date_from`` más el asiento de\napertura del ejercicio (el generado por el cierre anterior o el importado del balance del\nasesor); ``opening_entries`` lista esos asientos de apertura (``entry_id``, ``entry_number``,\n``date``, ``description``, ``debit``, ``credit``), que no se repiten en ``lines``.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Libro mayor de una cuenta",
        "parameters": [
          {
            "in": "query",
            "name": "account",
            "schema": {
              "type": "integer"
            },
            "description": "Id de la cuenta (o ``account_code``)."
          },
          {
            "in": "query",
            "name": "account_code",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Desde (YYYY-MM-DD). También se acepta date__gte."
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Hasta (YYYY-MM-DD). También se acepta date__lte."
          },
          {
            "in": "query",
            "name": "fiscal_year",
            "schema": {
              "type": "integer"
            },
            "description": "Id del ejercicio (por defecto: fechas libres)."
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string"
            },
            "description": "json (defecto), csv o xlsx (pdf en balance y PyG)."
          },
          {
            "in": "query",
            "name": "include_closing",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir los asientos de regularización Y de cierre del ejercicio que termina con el periodo (tras el cierre todos los saldos quedan a cero). Por defecto se excluyen. El asiento de apertura del ejercicio (el del cierre anterior o el importado del balance del asesor) siempre cuenta: forma el saldo inicial y no se repite entre los movimientos del periodo."
          },
          {
            "in": "query",
            "name": "include_regularisation",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir sólo la regularización 6/7 → 129 (no el cierre). Por defecto no."
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "text/csv": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/reports/trial-balance/": {
      "get": {
        "operationId": "accounting_reports_trial_balance_retrieve",
        "description": "El saldo de apertura (``opening_debit`` / ``opening_credit``) incluye el asiento de\napertura del ejercicio. Por cuenta: saldo de apertura, sumas del periodo y saldo final, con subtotales por\ncuenta de 3 dígitos, subgrupo y grupo (``rows``) y la lista plana (``lines``).\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Balance de sumas y saldos",
        "parameters": [
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Desde (YYYY-MM-DD). También se acepta date__gte."
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Hasta (YYYY-MM-DD). También se acepta date__lte."
          },
          {
            "in": "query",
            "name": "fiscal_year",
            "schema": {
              "type": "integer"
            },
            "description": "Id del ejercicio (por defecto: fechas libres)."
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string"
            },
            "description": "json (defecto), csv o xlsx (pdf en balance y PyG)."
          },
          {
            "in": "query",
            "name": "include_closing",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir los asientos de regularización Y de cierre del ejercicio que termina con el periodo (tras el cierre todos los saldos quedan a cero). Por defecto se excluyen. El asiento de apertura del ejercicio (el del cierre anterior o el importado del balance del asesor) siempre cuenta: forma el saldo inicial y no se repite entre los movimientos del periodo."
          },
          {
            "in": "query",
            "name": "include_regularisation",
            "schema": {
              "type": "boolean"
            },
            "description": "Incluir sólo la regularización 6/7 → 129 (no el cierre). Por defecto no."
          },
          {
            "in": "query",
            "name": "include_subaccounts",
            "schema": {
              "type": "boolean"
            },
            "description": "Detallar subcuentas de terceros (por defecto sí)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "text/csv": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/reports/unposted-documents/": {
      "get": {
        "operationId": "accounting_reports_unposted_documents_list",
        "description": "Asientos automáticos en borrador (descuadre > 0,05 €, cuenta inactiva, periodo\nbloqueado…) y documentos contabilizables sin asiento, con el motivo.\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Documentos sin contabilizar",
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UnpostedDocument"
                  }
                }
              },
              "text/csv": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UnpostedDocument"
                  }
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UnpostedDocument"
                  }
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UnpostedDocument"
                  }
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/reports/vat-reconciliation/": {
      "get": {
        "operationId": "accounting_reports_vat_reconciliation_retrieve",
        "description": "Casillas 27/45/71 frente a los saldos del periodo de 477 (+4771) y 472, con las\ndiferencias y los apuntes que las explican. Periodos trimestrales (1T-4T) o mensuales (01-12).\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Conciliación IVA: libro (472/477) frente al modelo 303",
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "in": "query",
            "name": "period",
            "schema": {
              "type": "string"
            },
            "description": "1T, 2T, 3T o 4T (trimestral) o 01…12 (mensual, REDEME).",
            "required": true
          },
          {
            "in": "query",
            "name": "year",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "text/csv": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/resync/": {
      "post": {
        "operationId": "accounting_resync_create",
        "description": "Re-sincroniza la contabilidad de un documento (factura, abono, gasto, cobro, pago o nómina).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Re-sincronizar la contabilidad de un documento",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResyncRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ResyncRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ResyncRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/tax-payments/": {
      "get": {
        "operationId": "accounting_tax_payments_list",
        "description": "Pagos y devoluciones de modelos tributarios (303, 111, 115, 130, 200…): Debe 4750/4751/4752/473\n/ Haber tesorería (o la inversa en devoluciones).\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Listar pagos de impuestos contabilizados",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedJournalEntryListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      },
      "post": {
        "operationId": "accounting_tax_payments_create",
        "description": "Pagos y devoluciones de modelos tributarios (303, 111, 115, 130, 200…): Debe 4750/4751/4752/473\n/ Haber tesorería (o la inversa en devoluciones).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Contabilizar el pago (o devolución) de un modelo",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxPaymentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TaxPaymentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TaxPaymentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/vat-settlements/": {
      "get": {
        "operationId": "accounting_vat_settlements_list",
        "description": "Liquidaciones de IVA (303) contabilizadas: ``POST {year, period}`` genera (idempotente por\nperiodo) el asiento 477/4771 → 472 → 4750/4700 a fin del periodo; ``period`` admite 1T-4T\n(trimestral) o 01-12 (mensual, REDEME); ``force`` sustituye una liquidación ya confirmada\n(contra-asiento + nuevo asiento).\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Listar registros",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "model",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "period",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "year",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedVatSettlementList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      },
      "post": {
        "operationId": "accounting_vat_settlements_create",
        "description": "Liquidaciones de IVA (303) contabilizadas: ``POST {year, period}`` genera (idempotente por\nperiodo) el asiento 477/4771 → 472 → 4750/4700 a fin del periodo; ``period`` admite 1T-4T\n(trimestral) o 01-12 (mensual, REDEME); ``force`` sustituye una liquidación ya confirmada\n(contra-asiento + nuevo asiento).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Contabilizar la liquidación de IVA de un periodo",
        "tags": [
          "Contabilidad"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VatSettlementCreateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/VatSettlementCreateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/VatSettlementCreateRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VatSettlement"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/accounting/vat-settlements/{id}/": {
      "get": {
        "operationId": "accounting_vat_settlements_retrieve",
        "description": "Liquidaciones de IVA (303) contabilizadas: ``POST {year, period}`` genera (idempotente por\nperiodo) el asiento 477/4771 → 472 → 4750/4700 a fin del periodo; ``period`` admite 1T-4T\n(trimestral) o 01-12 (mensual, REDEME); ``force`` sustituye una liquidación ya confirmada\n(contra-asiento + nuevo asiento).\n\n**Scope requerido:** `accounting:read`.",
        "summary": "Obtener registro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Liquidación de IVA.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VatSettlement"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:read"
      }
    },
    "/api/v1/accounting/vat-settlements/{id}/reverse/": {
      "post": {
        "operationId": "accounting_vat_settlements_reverse_create",
        "description": "Crea el contra-asiento de la liquidación y la deja sin asiento (se puede volver a generar).\n\n**Scope requerido:** `accounting:write`.",
        "summary": "Anular la liquidación (contra-asiento)",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Liquidación de IVA.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Contabilidad"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VatSettlement"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "accounting:write"
      }
    },
    "/api/v1/addresses/": {
      "get": {
        "operationId": "addresses_list",
        "description": "Listar direcciones (Direcciones).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Listar direcciones",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Direcciones"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedAddressList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      },
      "post": {
        "operationId": "addresses_create",
        "description": "Crear dirección (Direcciones).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Crear dirección",
        "tags": [
          "Direcciones"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddressRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/AddressRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AddressRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Address"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/addresses/{id}/": {
      "get": {
        "operationId": "addresses_retrieve",
        "description": "Obtener dirección (Direcciones).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Obtener dirección",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este address.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Direcciones"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Address"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      },
      "put": {
        "operationId": "addresses_update",
        "description": "Reemplazar dirección (Direcciones).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Reemplazar dirección",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este address.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Direcciones"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddressRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/AddressRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AddressRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Address"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      },
      "patch": {
        "operationId": "addresses_partial_update",
        "description": "Actualizar dirección (Direcciones).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Actualizar dirección",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este address.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Direcciones"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAddressRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAddressRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAddressRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Address"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      },
      "delete": {
        "operationId": "addresses_destroy",
        "description": "Eliminar dirección (Direcciones).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Eliminar dirección",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este address.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Direcciones"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      }
    },
    "/api/v1/agenda/availability-overrides/": {
      "get": {
        "operationId": "agenda_availability_overrides_list",
        "description": "Listar excepciones de disponibilidad (Agenda).\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Listar excepciones de disponibilidad",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedAvailabilityOverrideList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read"
      },
      "post": {
        "operationId": "agenda_availability_overrides_create",
        "description": "Crear excepción de disponibilidad (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Crear excepción de disponibilidad",
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityOverrideRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityOverrideRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityOverrideRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityOverride"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/agenda/availability-overrides/{id}/": {
      "get": {
        "operationId": "agenda_availability_overrides_retrieve",
        "description": "Obtener excepción de disponibilidad (Agenda).\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Obtener excepción de disponibilidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este availability override.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityOverride"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read"
      },
      "put": {
        "operationId": "agenda_availability_overrides_update",
        "description": "Reemplazar excepción de disponibilidad (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Reemplazar excepción de disponibilidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este availability override.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityOverrideRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityOverrideRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityOverrideRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityOverride"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      },
      "patch": {
        "operationId": "agenda_availability_overrides_partial_update",
        "description": "Actualizar excepción de disponibilidad (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Actualizar excepción de disponibilidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este availability override.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAvailabilityOverrideRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAvailabilityOverrideRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAvailabilityOverrideRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityOverride"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      },
      "delete": {
        "operationId": "agenda_availability_overrides_destroy",
        "description": "Eliminar excepción de disponibilidad (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Eliminar excepción de disponibilidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este availability override.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      }
    },
    "/api/v1/agenda/availability-rules/": {
      "get": {
        "operationId": "agenda_availability_rules_list",
        "description": "Listar reglas de disponibilidad (Agenda).\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Listar reglas de disponibilidad",
        "parameters": [
          {
            "in": "query",
            "name": "day_of_week",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "event_type",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "is_active",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedAvailabilityRuleList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read"
      },
      "post": {
        "operationId": "agenda_availability_rules_create",
        "description": "Crear regla de disponibilidad (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Crear regla de disponibilidad",
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityRuleRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityRuleRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityRuleRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityRule"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/agenda/availability-rules/{id}/": {
      "get": {
        "operationId": "agenda_availability_rules_retrieve",
        "description": "Obtener regla de disponibilidad (Agenda).\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Obtener regla de disponibilidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este availability rule.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityRule"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read"
      },
      "put": {
        "operationId": "agenda_availability_rules_update",
        "description": "Reemplazar regla de disponibilidad (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Reemplazar regla de disponibilidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este availability rule.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityRuleRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityRuleRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityRuleRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityRule"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      },
      "patch": {
        "operationId": "agenda_availability_rules_partial_update",
        "description": "Actualizar regla de disponibilidad (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Actualizar regla de disponibilidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este availability rule.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAvailabilityRuleRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAvailabilityRuleRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAvailabilityRuleRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityRule"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      },
      "delete": {
        "operationId": "agenda_availability_rules_destroy",
        "description": "Eliminar regla de disponibilidad (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Eliminar regla de disponibilidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este availability rule.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      }
    },
    "/api/v1/agenda/availability-rules/bulk/": {
      "post": {
        "operationId": "agenda_availability_rules_bulk_create",
        "description": "Replace all availability rules for the org (or for a specific event_type).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Replace all availability rules for the org (or for a specific event_type)",
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityRule"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/agenda/bookings/": {
      "get": {
        "operationId": "agenda_bookings_list",
        "description": "Listar reservas (Agenda).\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Listar reservas",
        "parameters": [
          {
            "in": "query",
            "name": "booker_email",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "event_type",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "patient",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "payment_status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedBookingList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read"
      },
      "post": {
        "operationId": "agenda_bookings_create",
        "description": "Crear reserva (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Crear reserva",
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookingRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/BookingRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/BookingRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Booking"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/agenda/bookings-calendar/": {
      "get": {
        "operationId": "agenda_bookings_calendar_retrieve",
        "description": "Reservas en un rango de fechas para los calendarios de clínica y expedientes.\n\nParámetros: `date_from` y `date_to` (YYYY-MM-DD, obligatorios) y `scope`\n(`patient`, `customer` o `all`, por defecto `all`).\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Reservas en un rango de fechas para los calendarios de clínica y expedientes",
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/agenda/bookings/{id}/": {
      "get": {
        "operationId": "agenda_bookings_retrieve",
        "description": "Obtener reserva (Agenda).\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Obtener reserva",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este booking.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Booking"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read"
      },
      "put": {
        "operationId": "agenda_bookings_update",
        "description": "Reemplazar reserva (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Reemplazar reserva",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este booking.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookingRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/BookingRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/BookingRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Booking"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      },
      "patch": {
        "operationId": "agenda_bookings_partial_update",
        "description": "Actualizar reserva (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Actualizar reserva",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este booking.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedBookingRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedBookingRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedBookingRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Booking"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      },
      "delete": {
        "operationId": "agenda_bookings_destroy",
        "description": "Eliminar reserva (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Eliminar reserva",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este booking.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      }
    },
    "/api/v1/agenda/bookings/{id}/cancel/": {
      "post": {
        "operationId": "agenda_bookings_cancel_create",
        "description": "Anular (Agenda).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Anular",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este booking.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      }
    },
    "/api/v1/agenda/bookings/{id}/complete/": {
      "post": {
        "operationId": "agenda_bookings_complete_create",
        "description": "Completar (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Completar",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este booking.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Booking"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      }
    },
    "/api/v1/agenda/bookings/{id}/confirm/": {
      "post": {
        "operationId": "agenda_bookings_confirm_create",
        "description": "Confirmar (contabilizar) (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Confirmar (contabilizar)",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este booking.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Booking"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      }
    },
    "/api/v1/agenda/bookings/{id}/no-show/": {
      "post": {
        "operationId": "agenda_bookings_no_show_create",
        "description": "No show (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "No show",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este booking.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Booking"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      }
    },
    "/api/v1/agenda/check-slug/": {
      "get": {
        "operationId": "agenda_check_slug_retrieve",
        "description": "Comprueba si un slug (`?slug=`) está libre para la página pública de reservas.\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Comprueba si un slug (`?slug=`) está libre para la página pública de reservas",
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/agenda/dashboard/": {
      "get": {
        "operationId": "agenda_dashboard_retrieve",
        "description": "Indicadores de la agenda: reservas de hoy, próximas y por estado.\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Indicadores de la agenda: reservas de hoy, próximas y por estado",
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/agenda/event-types/": {
      "get": {
        "operationId": "agenda_event_types_list",
        "description": "Listar tipos de evento (Agenda).\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Listar tipos de evento",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "is_active",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "link_to",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "requires_payment",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedEventTypeList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read"
      },
      "post": {
        "operationId": "agenda_event_types_create",
        "description": "Crear tipo de evento (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Crear tipo de evento",
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventTypeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EventTypeRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/EventTypeRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/agenda/event-types/{id}/": {
      "get": {
        "operationId": "agenda_event_types_retrieve",
        "description": "Obtener tipo de evento (Agenda).\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Obtener tipo de evento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este event type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read"
      },
      "put": {
        "operationId": "agenda_event_types_update",
        "description": "Reemplazar tipo de evento (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Reemplazar tipo de evento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este event type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventTypeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EventTypeRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/EventTypeRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      },
      "patch": {
        "operationId": "agenda_event_types_partial_update",
        "description": "Actualizar tipo de evento (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Actualizar tipo de evento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este event type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEventTypeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEventTypeRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEventTypeRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      },
      "delete": {
        "operationId": "agenda_event_types_destroy",
        "description": "Eliminar tipo de evento (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Eliminar tipo de evento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este event type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      }
    },
    "/api/v1/agenda/event-types/{id}/toggle-active/": {
      "post": {
        "operationId": "agenda_event_types_toggle_active_create",
        "description": "Toggle active (Agenda).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Toggle active",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este event type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write"
      }
    },
    "/api/v1/agenda/google-calendar/status/": {
      "get": {
        "operationId": "agenda_google_calendar_status_retrieve",
        "description": "Estado de la conexión con Google Calendar de la agenda (sin tokens).\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Estado de la conexión con Google Calendar de la agenda (sin tokens)",
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/agenda/settings/": {
      "get": {
        "operationId": "agenda_settings_retrieve",
        "description": "Ajustes de la agenda (página pública de reservas, recordatorios, zona horaria).\n\n**Scope requerido:** `agenda:read`.",
        "summary": "Obtener ajustes de la agenda (página pública de reservas, recordatorios, zona horaria)",
        "tags": [
          "Agenda"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgendaSettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      },
      "patch": {
        "operationId": "agenda_settings_partial_update",
        "description": "Ajustes de la agenda (página pública de reservas, recordatorios, zona horaria).\n\n**Scope requerido:** `agenda:write`.",
        "summary": "Actualizar ajustes de la agenda (página pública de reservas, recordatorios, zona horaria)",
        "tags": [
          "Agenda"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAgendaSettingsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAgendaSettingsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedAgendaSettingsRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgendaSettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "agenda:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/auditlog/": {
      "get": {
        "operationId": "auditlog_list",
        "description": "Registro de auditoría de la organización: altas, cambios y borrados de documentos,\ncontactos, productos, cobros y gastos, y los accesos con API key a datos clínicos\n(`action=ACCESS`). Sólo lectura.\n\n**Scope requerido:** `audit:read`.",
        "summary": "Listar entradas de auditoría",
        "parameters": [
          {
            "in": "query",
            "name": "action",
            "schema": {
              "type": "string",
              "enum": [
                "ACCESS",
                "CREATE",
                "DELETE",
                "UPDATE"
              ]
            },
            "description": "* `CREATE` - Create\n* `UPDATE` - Update\n* `DELETE` - Delete\n* `ACCESS` - Access"
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "model",
            "schema": {
              "type": "string"
            },
            "description": "Modelo (p. ej. `Invoice`, `Patient`)."
          },
          {
            "in": "query",
            "name": "object_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Auditoría"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedAuditLogList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "audit:read"
      }
    },
    "/api/v1/auditlog/{id}/": {
      "get": {
        "operationId": "auditlog_retrieve",
        "description": "Registro de auditoría de la organización: altas, cambios y borrados de documentos,\ncontactos, productos, cobros y gastos, y los accesos con API key a datos clínicos\n(`action=ACCESS`). Sólo lectura.\n\n**Scope requerido:** `audit:read`.",
        "summary": "Obtener entrada de auditoría",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este audit log.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Auditoría"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditLog"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "audit:read"
      }
    },
    "/api/v1/bulk-download/expenses/": {
      "post": {
        "operationId": "bulk_download_expenses_create",
        "description": "Descarga masiva de PDFs de gastos.\n\nBody:\n{\n    \"expense_ids\": [1, 2, 3, ...]\n}\n\nResponse (< 50 gastos):\n{\n    \"type\": \"direct\",\n    \"download_url\": \"https://...\",\n    \"filename\": \"expenses_20241127_143022.pdf\",\n    \"count\": 3\n}\n\nResponse (>= 50 gastos):\n{\n    \"type\": \"async\",\n    \"job_id\": \"uuid-string\",\n    \"message\": \"Se procesarán X gastos. Recibirás un email...\",\n    \"count\": 75\n}\n\n**Scope requerido:** `files:read`.",
        "summary": "Descarga masiva de PDFs de gastos",
        "tags": [
          "Descargas masivas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "files:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/bulk-download/file/{file_id}/": {
      "get": {
        "operationId": "bulk_download_file_retrieve",
        "description": "Descarga un archivo de descarga masiva por su ID.\n\nGET /api/documents/bulk-download/file/{file_id}/\n\n**Scope requerido:** `files:read`.",
        "summary": "Descarga un archivo de descarga masiva por su ID",
        "parameters": [
          {
            "in": "path",
            "name": "file_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Descargas masivas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "files:read"
      }
    },
    "/api/v1/bulk-download/invoices/": {
      "post": {
        "operationId": "bulk_download_invoices_create",
        "description": "Descarga masiva de PDFs de facturas emitidas.\n\nPOST /api/documents/bulk-download/invoices/\n{\n    \"invoice_ids\": [1, 2, 3, ...]\n}\n\n**Scope requerido:** `files:read`.",
        "summary": "Descarga masiva de PDFs de facturas emitidas",
        "tags": [
          "Descargas masivas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "files:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/bulk-download/proformas/": {
      "post": {
        "operationId": "bulk_download_proformas_create",
        "description": "Descarga masiva de PDFs de proformas.\n\nPOST /api/documents/bulk-download/proformas/\n{\n    \"proforma_ids\": [1, 2, 3, ...]\n}\n\n**Scope requerido:** `files:read`.",
        "summary": "Descarga masiva de PDFs de proformas",
        "tags": [
          "Descargas masivas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "files:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/bulk-download/quotes/": {
      "post": {
        "operationId": "bulk_download_quotes_create",
        "description": "Descarga masiva de PDFs de presupuestos.\n\nPOST /api/documents/bulk-download/quotes/\n{\n    \"quote_ids\": [1, 2, 3, ...]\n}\n\n**Scope requerido:** `files:read`.",
        "summary": "Descarga masiva de PDFs de presupuestos",
        "tags": [
          "Descargas masivas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "files:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/bulk-download/status/{job_id}/": {
      "get": {
        "operationId": "bulk_download_status_retrieve",
        "description": "Consulta el estado de una descarga masiva asíncrona.\n\nGET /api/documents/bulk-download/status/{job_id}/\n\n**Scope requerido:** `files:read`.",
        "summary": "Consulta el estado de una descarga masiva asíncrona",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Descargas masivas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "files:read"
      }
    },
    "/api/v1/clinica/calendar/": {
      "get": {
        "operationId": "clinica_calendar_retrieve",
        "description": "Episodios para el calendario entre `?from=YYYY-MM-DD` y `?to=YYYY-MM-DD`.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Episodios para el calendario entre `?from=YYYY-MM-DD` y `?to=YYYY-MM-DD`",
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/clinica/consent-doc-templates/": {
      "get": {
        "operationId": "clinica_consent_doc_templates_list",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:read`.",
        "summary": "Listar plantillas de consentimiento",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedDocumentTemplateList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read"
      },
      "post": {
        "operationId": "clinica_consent_doc_templates_create",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:write`.",
        "summary": "Crear plantilla de consentimiento",
        "tags": [
          "Plantillas de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTemplateUpload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/clinica/consent-doc-templates/{id}/": {
      "get": {
        "operationId": "clinica_consent_doc_templates_retrieve",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:read`.",
        "summary": "Obtener plantilla de consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read"
      },
      "put": {
        "operationId": "clinica_consent_doc_templates_update",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:write`.",
        "summary": "Reemplazar plantilla de consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTemplateUpload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:write"
      },
      "patch": {
        "operationId": "clinica_consent_doc_templates_partial_update",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:write`.",
        "summary": "Actualizar plantilla de consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentTemplateUploadRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentTemplateUploadRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentTemplateUploadRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTemplateUpload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:write"
      },
      "delete": {
        "operationId": "clinica_consent_doc_templates_destroy",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:write`.",
        "summary": "Eliminar plantilla de consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:write"
      }
    },
    "/api/v1/clinica/consent-doc-templates/{id}/download/": {
      "get": {
        "operationId": "clinica_consent_doc_templates_download_retrieve",
        "description": "URL firmada temporal para descargar el archivo de la plantilla.\n\n**Scope requerido:** `templates:read`.",
        "summary": "Obtener la URL de descarga de la plantilla",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedDownloadUrl"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read"
      }
    },
    "/api/v1/clinica/consent-doc-templates/instructions-pdf/": {
      "get": {
        "operationId": "clinica_consent_doc_templates_instructions_pdf_retrieve",
        "description": "PDF con las instrucciones para crear plantillas del módulo.\n\n**Scope requerido:** `templates:read`.",
        "summary": "Descargar las instrucciones de las plantillas (PDF)",
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "PDF de instrucciones.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/clinica/consent-doc-templates/placeholders/": {
      "get": {
        "operationId": "clinica_consent_doc_templates_placeholders_retrieve",
        "description": "Marcadores disponibles en las plantillas del módulo (agrupados por entidad).\n\n**Scope requerido:** `templates:read`.",
        "summary": "Marcadores disponibles en las plantillas",
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/clinica/consent-templates/": {
      "get": {
        "operationId": "clinica_consent_templates_list",
        "description": "Plantillas de texto de los consentimientos informados.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar plantillas de consentimiento",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedConsentTemplateList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_consent_templates_create",
        "description": "Plantillas de texto de los consentimientos informados.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear plantilla de consentimiento",
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConsentTemplateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ConsentTemplateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ConsentTemplateRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsentTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/clinica/consent-templates/{id}/": {
      "get": {
        "operationId": "clinica_consent_templates_retrieve",
        "description": "Plantillas de texto de los consentimientos informados.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener plantilla de consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este consent template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsentTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "put": {
        "operationId": "clinica_consent_templates_update",
        "description": "Plantillas de texto de los consentimientos informados.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Reemplazar plantilla de consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este consent template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConsentTemplateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ConsentTemplateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ConsentTemplateRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsentTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "patch": {
        "operationId": "clinica_consent_templates_partial_update",
        "description": "Plantillas de texto de los consentimientos informados.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar plantilla de consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este consent template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedConsentTemplateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedConsentTemplateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedConsentTemplateRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsentTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_consent_templates_destroy",
        "description": "Plantillas de texto de los consentimientos informados.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar plantilla de consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este consent template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/dashboard/": {
      "get": {
        "operationId": "clinica_dashboard_retrieve",
        "description": "Indicadores de la clínica: pacientes, episodios de hoy y próximas citas.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Indicadores de la clínica: pacientes, episodios de hoy y próximas citas",
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/clinica/episodes/": {
      "get": {
        "operationId": "clinica_episodes_list",
        "description": "Episodios clínicos (consultas) de los pacientes.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar episodios",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "episode_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "is_signed",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "patient",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "practitioner",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedEpisodeListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_episodes_create",
        "description": "Episodios clínicos (consultas) de los pacientes.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear episodio",
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeDetailRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/clinica/episodes/{episode_pk}/diagnoses/": {
      "get": {
        "operationId": "clinica_episodes_diagnoses_list",
        "description": "Diagnósticos (CIE-11) del episodio.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar diagnósticos",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedDiagnosisList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_episodes_diagnoses_create",
        "description": "Diagnósticos (CIE-11) del episodio.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear diagnóstico",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiagnosisRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DiagnosisRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DiagnosisRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Diagnosis"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/episodes/{episode_pk}/diagnoses/{id}/": {
      "get": {
        "operationId": "clinica_episodes_diagnoses_retrieve",
        "description": "Diagnósticos (CIE-11) del episodio.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener diagnóstico",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Diagnosis"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "patch": {
        "operationId": "clinica_episodes_diagnoses_partial_update",
        "description": "Diagnósticos (CIE-11) del episodio.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar diagnóstico",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDiagnosisRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDiagnosisRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDiagnosisRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Diagnosis"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_episodes_diagnoses_destroy",
        "description": "Diagnósticos (CIE-11) del episodio.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar diagnóstico",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/episodes/{episode_pk}/files/": {
      "get": {
        "operationId": "clinica_episodes_files_list",
        "description": "Archivos clínicos del episodio (subida multipart en el campo `file`).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar archivos clínicos",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedClinicalFileList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_episodes_files_create",
        "description": "Archivos clínicos del episodio (subida multipart en el campo `file`).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear archivo clínico",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClinicalFileRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ClinicalFileRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ClinicalFileRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClinicalFile"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/episodes/{episode_pk}/files/{id}/": {
      "get": {
        "operationId": "clinica_episodes_files_retrieve",
        "description": "Archivos clínicos del episodio (subida multipart en el campo `file`).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener archivo clínico",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClinicalFile"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "patch": {
        "operationId": "clinica_episodes_files_partial_update",
        "description": "Archivos clínicos del episodio (subida multipart en el campo `file`).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar archivo clínico",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedClinicalFileRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedClinicalFileRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedClinicalFileRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClinicalFile"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_episodes_files_destroy",
        "description": "Archivos clínicos del episodio (subida multipart en el campo `file`).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar archivo clínico",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/episodes/{episode_pk}/treatments/": {
      "get": {
        "operationId": "clinica_episodes_treatments_list",
        "description": "Tratamientos pautados en el episodio.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar tratamientos",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedTreatmentList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_episodes_treatments_create",
        "description": "Tratamientos pautados en el episodio.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear tratamiento",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TreatmentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TreatmentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TreatmentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Treatment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/episodes/{episode_pk}/treatments/{id}/": {
      "get": {
        "operationId": "clinica_episodes_treatments_retrieve",
        "description": "Tratamientos pautados en el episodio.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener tratamiento",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Treatment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "patch": {
        "operationId": "clinica_episodes_treatments_partial_update",
        "description": "Tratamientos pautados en el episodio.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar tratamiento",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTreatmentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTreatmentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTreatmentRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Treatment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_episodes_treatments_destroy",
        "description": "Tratamientos pautados en el episodio.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar tratamiento",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/episodes/{episode_pk}/vitals/": {
      "get": {
        "operationId": "clinica_episodes_vitals_list",
        "description": "Constantes vitales tomadas en el episodio.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar constantes vitales",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedVitalSignsList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_episodes_vitals_create",
        "description": "Constantes vitales tomadas en el episodio.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear constante vital",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VitalSignsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/VitalSignsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/VitalSignsRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VitalSigns"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/episodes/{episode_pk}/vitals/{id}/": {
      "get": {
        "operationId": "clinica_episodes_vitals_retrieve",
        "description": "Constantes vitales tomadas en el episodio.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener constante vital",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VitalSigns"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "patch": {
        "operationId": "clinica_episodes_vitals_partial_update",
        "description": "Constantes vitales tomadas en el episodio.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar constante vital",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedVitalSignsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedVitalSignsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedVitalSignsRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VitalSigns"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_episodes_vitals_destroy",
        "description": "Constantes vitales tomadas en el episodio.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar constante vital",
        "parameters": [
          {
            "in": "path",
            "name": "episode_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/episodes/{id}/": {
      "get": {
        "operationId": "clinica_episodes_retrieve",
        "description": "Episodios clínicos (consultas) de los pacientes.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener episodio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este clinical episode.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "put": {
        "operationId": "clinica_episodes_update",
        "description": "Episodios clínicos (consultas) de los pacientes.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Reemplazar episodio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este clinical episode.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeDetailRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "patch": {
        "operationId": "clinica_episodes_partial_update",
        "description": "Episodios clínicos (consultas) de los pacientes.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar episodio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este clinical episode.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEpisodeDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEpisodeDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEpisodeDetailRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_episodes_destroy",
        "description": "Episodios clínicos (consultas) de los pacientes.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar episodio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este clinical episode.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/episodes/{id}/reopen/": {
      "post": {
        "operationId": "clinica_episodes_reopen_create",
        "description": "Reabre un episodio firmado para poder editarlo.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Reabrir el episodio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este clinical episode.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/episodes/{id}/sign/": {
      "post": {
        "operationId": "clinica_episodes_sign_create",
        "description": "Firma (cierra) el episodio: queda completado y no editable.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Firmar el episodio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este clinical episode.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/icd11/": {
      "get": {
        "operationId": "clinica_icd11_list",
        "description": "Busca códigos CIE-11 (catálogo local + API de la OMS) por código o texto (`?q=`, mín. 2 caracteres).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Buscar códigos CIE-11",
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "schema": {
              "type": "string"
            },
            "description": "Código o texto (mín. 2 caracteres).",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ICD11Code"
                  }
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      }
    },
    "/api/v1/clinica/icd11/{code}/": {
      "get": {
        "operationId": "clinica_icd11_retrieve",
        "description": "Detalle de un código CIE-11 (definición, inclusiones, exclusiones).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Detalle de un código CIE-11",
        "parameters": [
          {
            "in": "path",
            "name": "code",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      }
    },
    "/api/v1/clinica/patients/": {
      "get": {
        "operationId": "clinica_patients_list",
        "description": "Listar pacientes (Clínica).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar pacientes",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "gender",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "insurance_provider",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "is_active",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedPatientListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_patients_create",
        "description": "Crear paciente (Clínica).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear paciente",
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatientDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatientDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatientDetailRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/allergies/": {
      "get": {
        "operationId": "clinica_patients_allergies_list",
        "description": "Alergias del paciente.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar alergias",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedPatientAllergyList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_patients_allergies_create",
        "description": "Alergias del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear alergia",
        "parameters": [
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatientAllergyRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatientAllergyRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatientAllergyRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientAllergy"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/allergies/{id}/": {
      "get": {
        "operationId": "clinica_patients_allergies_retrieve",
        "description": "Alergias del paciente.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener alergia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientAllergy"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "patch": {
        "operationId": "clinica_patients_allergies_partial_update",
        "description": "Alergias del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar alergia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPatientAllergyRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPatientAllergyRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPatientAllergyRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientAllergy"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_patients_allergies_destroy",
        "description": "Alergias del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar alergia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/backgrounds/": {
      "get": {
        "operationId": "clinica_patients_backgrounds_list",
        "description": "Antecedentes del paciente (personales, familiares, quirúrgicos…).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar antecedentes",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedPatientBackgroundList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_patients_backgrounds_create",
        "description": "Antecedentes del paciente (personales, familiares, quirúrgicos…).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear antecedente",
        "parameters": [
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatientBackgroundRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatientBackgroundRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatientBackgroundRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientBackground"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/backgrounds/{id}/": {
      "get": {
        "operationId": "clinica_patients_backgrounds_retrieve",
        "description": "Antecedentes del paciente (personales, familiares, quirúrgicos…).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener antecedente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientBackground"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "patch": {
        "operationId": "clinica_patients_backgrounds_partial_update",
        "description": "Antecedentes del paciente (personales, familiares, quirúrgicos…).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar antecedente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPatientBackgroundRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPatientBackgroundRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPatientBackgroundRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientBackground"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_patients_backgrounds_destroy",
        "description": "Antecedentes del paciente (personales, familiares, quirúrgicos…).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar antecedente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/consents/": {
      "get": {
        "operationId": "clinica_patients_consents_list",
        "description": "Consentimientos informados del paciente.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar consentimientos",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedInformedConsentList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_patients_consents_create",
        "description": "Consentimientos informados del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InformedConsentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/InformedConsentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/InformedConsentRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InformedConsent"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/consents/{consent_pk}/generate-document/": {
      "post": {
        "operationId": "clinica_patients_consents_generate_document_create",
        "description": "Genera el documento de un consentimiento informado (PDF o DOCX) con una plantilla de\nconsentimientos (`template_id`) o la plantilla por defecto.\n\nAdemás de `templates:read` exige `clinica:read` (el acceso queda en la auditoría).\n\n**Scope requerido:** `templates:read`.",
        "summary": "Generar el documento del consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "consent_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateConsentDocumentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/GenerateConsentDocumentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/GenerateConsentDocumentRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "Documento PDF.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read",
        "x-scope-also-required": [
          "clinica:read"
        ]
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/consents/{id}/": {
      "get": {
        "operationId": "clinica_patients_consents_retrieve",
        "description": "Consentimientos informados del paciente.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InformedConsent"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "patch": {
        "operationId": "clinica_patients_consents_partial_update",
        "description": "Consentimientos informados del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedInformedConsentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedInformedConsentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedInformedConsentRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InformedConsent"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_patients_consents_destroy",
        "description": "Consentimientos informados del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/consents/{id}/revoke/": {
      "post": {
        "operationId": "clinica_patients_consents_revoke_create",
        "description": "Consentimientos informados del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Revocar el consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InformedConsent"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/consents/{id}/sign/": {
      "post": {
        "operationId": "clinica_patients_consents_sign_create",
        "description": "Consentimientos informados del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Firmar el consentimiento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConsentSignRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ConsentSignRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ConsentSignRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InformedConsent"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/episodes/": {
      "get": {
        "operationId": "clinica_patients_episodes_list",
        "description": "Episodios clínicos (consultas) de los pacientes.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar episodios",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "episode_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "is_signed",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "patient",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "practitioner",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedEpisodeListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_patients_episodes_create",
        "description": "Episodios clínicos (consultas) de los pacientes.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear episodio",
        "parameters": [
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeDetailRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/episodes/{id}/": {
      "get": {
        "operationId": "clinica_patients_episodes_retrieve",
        "description": "Episodios clínicos (consultas) de los pacientes.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener episodio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "put": {
        "operationId": "clinica_patients_episodes_update",
        "description": "Episodios clínicos (consultas) de los pacientes.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Reemplazar episodio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeDetailRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "patch": {
        "operationId": "clinica_patients_episodes_partial_update",
        "description": "Episodios clínicos (consultas) de los pacientes.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar episodio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEpisodeDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEpisodeDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEpisodeDetailRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_patients_episodes_destroy",
        "description": "Episodios clínicos (consultas) de los pacientes.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar episodio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/episodes/{id}/reopen/": {
      "post": {
        "operationId": "clinica_patients_episodes_reopen_create",
        "description": "Reabre un episodio firmado para poder editarlo.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Reabrir el episodio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/episodes/{id}/sign/": {
      "post": {
        "operationId": "clinica_patients_episodes_sign_create",
        "description": "Firma (cierra) el episodio: queda completado y no editable.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Firmar el episodio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/export-pdf/": {
      "get": {
        "operationId": "clinica_patients_export_pdf_retrieve",
        "description": "Exporta la historia clínica del paciente en PDF (todos los episodios o `?episodes=1,2`).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Exportar la historia clínica en PDF",
        "parameters": [
          {
            "in": "query",
            "name": "episodes",
            "schema": {
              "type": "string"
            },
            "description": "Ids de episodios separados por comas (opcional)."
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "PDF.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/files/": {
      "get": {
        "operationId": "clinica_patients_files_list",
        "description": "Archivos clínicos del paciente (subida multipart en el campo `file`).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar archivos clínicos",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedClinicalFileList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_patients_files_create",
        "description": "Archivos clínicos del paciente (subida multipart en el campo `file`).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear archivo clínico",
        "parameters": [
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClinicalFileRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ClinicalFileRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ClinicalFileRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClinicalFile"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/files/{id}/": {
      "get": {
        "operationId": "clinica_patients_files_retrieve",
        "description": "Archivos clínicos del paciente (subida multipart en el campo `file`).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener archivo clínico",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClinicalFile"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "patch": {
        "operationId": "clinica_patients_files_partial_update",
        "description": "Archivos clínicos del paciente (subida multipart en el campo `file`).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar archivo clínico",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedClinicalFileRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedClinicalFileRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedClinicalFileRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClinicalFile"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_patients_files_destroy",
        "description": "Archivos clínicos del paciente (subida multipart en el campo `file`).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar archivo clínico",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/files/{id}/download/": {
      "get": {
        "operationId": "clinica_patients_files_download_retrieve",
        "description": "URL firmada temporal para descargar el archivo clínico.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener la URL de descarga del archivo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedDownloadUrl"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/folders/": {
      "get": {
        "operationId": "clinica_patients_folders_list",
        "description": "Carpetas de documentos del paciente.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar carpetas clínicas",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedClinicalFolderList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_patients_folders_create",
        "description": "Carpetas de documentos del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear carpeta clínica",
        "parameters": [
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClinicalFolderRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ClinicalFolderRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ClinicalFolderRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClinicalFolder"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/folders/{id}/": {
      "get": {
        "operationId": "clinica_patients_folders_retrieve",
        "description": "Carpetas de documentos del paciente.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener carpeta clínica",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClinicalFolder"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "patch": {
        "operationId": "clinica_patients_folders_partial_update",
        "description": "Carpetas de documentos del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar carpeta clínica",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedClinicalFolderRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedClinicalFolderRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedClinicalFolderRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClinicalFolder"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_patients_folders_destroy",
        "description": "Carpetas de documentos del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar carpeta clínica",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/generate-document/": {
      "post": {
        "operationId": "clinica_patients_generate_document_create",
        "description": "Genera un documento (PDF o DOCX) a partir de una plantilla de clínica con los datos del\npaciente (y opcionalmente de un episodio, `episode_id`). No se guarda: se devuelve el archivo.\n\nAdemás de `templates:read` exige `clinica:read` (el acceso queda en la auditoría).\n\n**Scope requerido:** `templates:read`.",
        "summary": "Generar un documento del paciente",
        "parameters": [
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeneratePatientDocumentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/GeneratePatientDocumentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/GeneratePatientDocumentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "Documento PDF.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read",
        "x-scope-also-required": [
          "clinica:read"
        ]
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/vitals/": {
      "get": {
        "operationId": "clinica_patients_vitals_list",
        "description": "Constantes vitales del paciente.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar constantes vitales",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedVitalSignsList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_patients_vitals_create",
        "description": "Constantes vitales del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear constante vital",
        "parameters": [
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VitalSignsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/VitalSignsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/VitalSignsRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VitalSigns"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{patient_pk}/vitals/{id}/": {
      "get": {
        "operationId": "clinica_patients_vitals_retrieve",
        "description": "Constantes vitales del paciente.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener constante vital",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VitalSigns"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "patch": {
        "operationId": "clinica_patients_vitals_partial_update",
        "description": "Constantes vitales del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar constante vital",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedVitalSignsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedVitalSignsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedVitalSignsRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VitalSigns"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_patients_vitals_destroy",
        "description": "Constantes vitales del paciente.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar constante vital",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "patient_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{id}/": {
      "get": {
        "operationId": "clinica_patients_retrieve",
        "description": "Obtener paciente (Clínica).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener paciente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este patient.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "put": {
        "operationId": "clinica_patients_update",
        "description": "Reemplazar paciente (Clínica).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Reemplazar paciente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este patient.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatientDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatientDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatientDetailRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "patch": {
        "operationId": "clinica_patients_partial_update",
        "description": "Actualizar paciente (Clínica).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar paciente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este patient.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPatientDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPatientDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPatientDetailRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_patients_destroy",
        "description": "Eliminar paciente (Clínica).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar paciente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este patient.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{id}/cloud-sync/": {
      "post": {
        "operationId": "clinica_patients_cloud_sync_create",
        "description": "(Re)crea la carpeta del paciente en Drive/Dropbox y encola la\nsincronización de sus subcarpetas y archivos pendientes.\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Sincronizar con la nube",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este patient.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CloudSyncResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/patients/{id}/history/": {
      "get": {
        "operationId": "clinica_patients_history_retrieve",
        "description": "Timeline completa del paciente.\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Historia clínica completa",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este patient.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientHistory"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      }
    },
    "/api/v1/clinica/practitioners/": {
      "get": {
        "operationId": "clinica_practitioners_list",
        "description": "Listar profesionales (Clínica).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar profesionales",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedPractitionerList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_practitioners_create",
        "description": "Crear profesional (Clínica).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear profesional",
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PractitionerRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PractitionerRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PractitionerRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Practitioner"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/clinica/practitioners/{id}/": {
      "get": {
        "operationId": "clinica_practitioners_retrieve",
        "description": "Obtener profesional (Clínica).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener profesional",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este practitioner.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Practitioner"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "put": {
        "operationId": "clinica_practitioners_update",
        "description": "Reemplazar profesional (Clínica).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Reemplazar profesional",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este practitioner.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PractitionerRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PractitionerRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PractitionerRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Practitioner"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "patch": {
        "operationId": "clinica_practitioners_partial_update",
        "description": "Actualizar profesional (Clínica).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar profesional",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este practitioner.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPractitionerRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPractitionerRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPractitionerRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Practitioner"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_practitioners_destroy",
        "description": "Eliminar profesional (Clínica).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar profesional",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este practitioner.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/settings/": {
      "get": {
        "operationId": "clinica_settings_retrieve",
        "description": "Ajustes del módulo de clínica (numeración de pacientes y episodios, campos del episodio).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener ajustes del módulo de clínica (numeración de pacientes y episodios, campos del episodio)",
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClinicaSettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      },
      "patch": {
        "operationId": "clinica_settings_partial_update",
        "description": "Ajustes del módulo de clínica (numeración de pacientes y episodios, campos del episodio).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar ajustes del módulo de clínica (numeración de pacientes y episodios, campos del episodio)",
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedClinicaSettingsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedClinicaSettingsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedClinicaSettingsRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClinicaSettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/clinica/specialties/": {
      "get": {
        "operationId": "clinica_specialties_list",
        "description": "Listar especialidades (Clínica).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Listar especialidades",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSpecialtyList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "post": {
        "operationId": "clinica_specialties_create",
        "description": "Crear especialidad (Clínica).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Crear especialidad",
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpecialtyRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SpecialtyRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SpecialtyRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Specialty"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/clinica/specialties/{id}/": {
      "get": {
        "operationId": "clinica_specialties_retrieve",
        "description": "Obtener especialidad (Clínica).\n\n**Scope requerido:** `clinica:read`.",
        "summary": "Obtener especialidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este specialty.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Specialty"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:read"
      },
      "put": {
        "operationId": "clinica_specialties_update",
        "description": "Reemplazar especialidad (Clínica).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Reemplazar especialidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este specialty.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpecialtyRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SpecialtyRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SpecialtyRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Specialty"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "patch": {
        "operationId": "clinica_specialties_partial_update",
        "description": "Actualizar especialidad (Clínica).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Actualizar especialidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este specialty.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSpecialtyRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSpecialtyRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSpecialtyRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Specialty"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      },
      "delete": {
        "operationId": "clinica_specialties_destroy",
        "description": "Eliminar especialidad (Clínica).\n\n**Scope requerido:** `clinica:write`.",
        "summary": "Eliminar especialidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este specialty.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clínica"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "clinica:write"
      }
    },
    "/api/v1/clinica/templates/": {
      "get": {
        "operationId": "clinica_templates_list",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:read`.",
        "summary": "Listar plantillas de documentos",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedDocumentTemplateList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read"
      },
      "post": {
        "operationId": "clinica_templates_create",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:write`.",
        "summary": "Crear plantilla de documento",
        "tags": [
          "Plantillas de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTemplateUpload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/clinica/templates/{id}/": {
      "get": {
        "operationId": "clinica_templates_retrieve",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:read`.",
        "summary": "Obtener plantilla de documento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read"
      },
      "put": {
        "operationId": "clinica_templates_update",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:write`.",
        "summary": "Reemplazar plantilla de documento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTemplateUpload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:write"
      },
      "patch": {
        "operationId": "clinica_templates_partial_update",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:write`.",
        "summary": "Actualizar plantilla de documento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentTemplateUploadRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentTemplateUploadRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentTemplateUploadRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTemplateUpload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:write"
      },
      "delete": {
        "operationId": "clinica_templates_destroy",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:write`.",
        "summary": "Eliminar plantilla de documento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:write"
      }
    },
    "/api/v1/clinica/templates/{id}/download/": {
      "get": {
        "operationId": "clinica_templates_download_retrieve",
        "description": "URL firmada temporal para descargar el archivo de la plantilla.\n\n**Scope requerido:** `templates:read`.",
        "summary": "Obtener la URL de descarga de la plantilla",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedDownloadUrl"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read"
      }
    },
    "/api/v1/clinica/templates/instructions-pdf/": {
      "get": {
        "operationId": "clinica_templates_instructions_pdf_retrieve",
        "description": "PDF con las instrucciones para crear plantillas del módulo.\n\n**Scope requerido:** `templates:read`.",
        "summary": "Descargar las instrucciones de las plantillas (PDF)",
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "PDF de instrucciones.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/clinica/templates/placeholders/": {
      "get": {
        "operationId": "clinica_templates_placeholders_retrieve",
        "description": "Marcadores disponibles en las plantillas del módulo (agrupados por entidad).\n\n**Scope requerido:** `templates:read`.",
        "summary": "Marcadores disponibles en las plantillas",
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/credit-notes/": {
      "get": {
        "operationId": "credit_notes_list",
        "description": "Listar notas de crédito (Notas de crédito).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Listar notas de crédito",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "number",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "total_max",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "total_min",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Notas de crédito"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCreditNoteList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "post": {
        "operationId": "credit_notes_create",
        "description": "Crear nota de crédito (Notas de crédito).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Crear nota de crédito",
        "tags": [
          "Notas de crédito"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreditNoteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CreditNoteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CreditNoteRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditNote"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/credit-notes/{id}/": {
      "get": {
        "operationId": "credit_notes_retrieve",
        "description": "Obtener nota de crédito (Notas de crédito).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Obtener nota de crédito",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este credit note.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Notas de crédito"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditNote"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "put": {
        "operationId": "credit_notes_update",
        "description": "Reemplazar nota de crédito (Notas de crédito).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Reemplazar nota de crédito",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este credit note.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Notas de crédito"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreditNoteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CreditNoteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CreditNoteRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditNote"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "patch": {
        "operationId": "credit_notes_partial_update",
        "description": "Actualizar nota de crédito (Notas de crédito).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Actualizar nota de crédito",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este credit note.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Notas de crédito"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCreditNoteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCreditNoteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCreditNoteRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditNote"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "delete": {
        "operationId": "credit_notes_destroy",
        "description": "A1: solo se pueden eliminar documentos en borrador.\n\nLos documentos emitidos/enviados (con número asignado y/o registro\nVeriFactu) no deben borrarse nunca por integridad legal: para revertirlos\nse usa la anulación (cancel) o una factura rectificativa.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Eliminar nota de crédito",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este credit note.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Notas de crédito"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/credit-notes/{id}/email/": {
      "post": {
        "operationId": "credit_notes_email_create",
        "description": "Enviar por email (Notas de crédito).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Enviar por email",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este credit note.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Notas de crédito"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/credit-notes/{id}/pdf/": {
      "post": {
        "operationId": "credit_notes_pdf_create",
        "description": "Generar el PDF (asíncrono) (Notas de crédito).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Generar el PDF (asíncrono)",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este credit note.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Notas de crédito"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/credit-notes/{id}/send/": {
      "post": {
        "operationId": "credit_notes_send_create",
        "description": "Emitir / marcar como enviado (Notas de crédito).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Emitir / marcar como enviado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este credit note.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Notas de crédito"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentIssued"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/crm/activities/": {
      "get": {
        "operationId": "crm_activities_list",
        "description": "Listar actividades (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Listar actividades",
        "parameters": [
          {
            "in": "query",
            "name": "activity_type",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "assigned_to",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "deal",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "is_completed",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "lead",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "scheduled_from",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "scheduled_to",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedActivityList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "post": {
        "operationId": "crm_activities_create",
        "description": "Crear actividad (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Crear actividad",
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivityRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ActivityRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ActivityRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Activity"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/crm/activities/{id}/": {
      "get": {
        "operationId": "crm_activities_retrieve",
        "description": "Obtener actividad (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Obtener actividad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este activity.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Activity"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "put": {
        "operationId": "crm_activities_update",
        "description": "Reemplazar actividad (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Reemplazar actividad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este activity.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivityRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ActivityRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ActivityRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Activity"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "patch": {
        "operationId": "crm_activities_partial_update",
        "description": "Actualizar actividad (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Actualizar actividad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este activity.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedActivityRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedActivityRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedActivityRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Activity"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "delete": {
        "operationId": "crm_activities_destroy",
        "description": "Eliminar actividad (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Eliminar actividad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este activity.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/activities/{id}/complete/": {
      "post": {
        "operationId": "crm_activities_complete_create",
        "description": "Completar (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Completar",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este activity.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Activity"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/activities/{id}/reopen/": {
      "post": {
        "operationId": "crm_activities_reopen_create",
        "description": "Reabrir (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Reabrir",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este activity.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Activity"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/activity-types/": {
      "get": {
        "operationId": "crm_activity_types_list",
        "description": "Listar tipos de actividad (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Listar tipos de actividad",
        "parameters": [
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedActivityTypeList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "post": {
        "operationId": "crm_activity_types_create",
        "description": "Crear tipo de actividad (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Crear tipo de actividad",
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivityTypeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ActivityTypeRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ActivityTypeRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivityType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/crm/activity-types/{id}/": {
      "get": {
        "operationId": "crm_activity_types_retrieve",
        "description": "Obtener tipo de actividad (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Obtener tipo de actividad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este activity type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivityType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "put": {
        "operationId": "crm_activity_types_update",
        "description": "Reemplazar tipo de actividad (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Reemplazar tipo de actividad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este activity type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivityTypeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ActivityTypeRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ActivityTypeRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivityType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "patch": {
        "operationId": "crm_activity_types_partial_update",
        "description": "Actualizar tipo de actividad (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Actualizar tipo de actividad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este activity type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedActivityTypeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedActivityTypeRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedActivityTypeRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivityType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "delete": {
        "operationId": "crm_activity_types_destroy",
        "description": "Eliminar tipo de actividad (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Eliminar tipo de actividad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este activity type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/dashboard/": {
      "get": {
        "operationId": "crm_dashboard_retrieve",
        "description": "Indicadores del CRM: leads, oportunidades abiertas, valor del embudo y actividad.\n\n**Scope requerido:** `crm:read`.",
        "summary": "Indicadores del CRM: leads, oportunidades abiertas, valor del embudo y actividad",
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/crm/deals/": {
      "get": {
        "operationId": "crm_deals_list",
        "description": "Listar oportunidades (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Listar oportunidades",
        "parameters": [
          {
            "in": "query",
            "name": "assigned_to",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "created_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "expected_close_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "expected_close_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "lead",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "pipeline",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "stage",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tag",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "value_max",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "value_min",
            "schema": {
              "type": "number"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedDealListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "post": {
        "operationId": "crm_deals_create",
        "description": "Crear oportunidad (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Crear oportunidad",
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DealDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DealDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DealDetailRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DealDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/crm/deals/{id}/": {
      "get": {
        "operationId": "crm_deals_retrieve",
        "description": "Obtener oportunidad (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Obtener oportunidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este deal.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DealDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "put": {
        "operationId": "crm_deals_update",
        "description": "Reemplazar oportunidad (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Reemplazar oportunidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este deal.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DealDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DealDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DealDetailRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DealDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "patch": {
        "operationId": "crm_deals_partial_update",
        "description": "Actualizar oportunidad (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Actualizar oportunidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este deal.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDealDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDealDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDealDetailRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DealDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "delete": {
        "operationId": "crm_deals_destroy",
        "description": "Eliminar oportunidad (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Eliminar oportunidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este deal.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/deals/{id}/lose/": {
      "post": {
        "operationId": "crm_deals_lose_create",
        "description": "Lose (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Lose",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este deal.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DealDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/deals/{id}/move-stage/": {
      "post": {
        "operationId": "crm_deals_move_stage_create",
        "description": "Move stage (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Move stage",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este deal.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DealDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/deals/{id}/win/": {
      "post": {
        "operationId": "crm_deals_win_create",
        "description": "Win (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Win",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este deal.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DealDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/kanban/{pipeline_id}/": {
      "get": {
        "operationId": "crm_kanban_retrieve",
        "description": "Tablero kanban de un embudo: etapas con sus oportunidades abiertas.\n\n**Scope requerido:** `crm:read`.",
        "summary": "Tablero kanban de un embudo: etapas con sus oportunidades abiertas",
        "parameters": [
          {
            "in": "path",
            "name": "pipeline_id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      }
    },
    "/api/v1/crm/leads/": {
      "get": {
        "operationId": "crm_leads_list",
        "description": "Listar leads (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Listar leads",
        "parameters": [
          {
            "in": "query",
            "name": "assigned_to",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "created_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "has_email",
            "schema": {
              "type": "boolean"
            },
            "description": "Has email"
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "source",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tag",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedLeadListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "post": {
        "operationId": "crm_leads_create",
        "description": "Crear lead (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Crear lead",
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/LeadDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/LeadDetailRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/crm/leads/{id}/": {
      "get": {
        "operationId": "crm_leads_retrieve",
        "description": "Obtener lead (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Obtener lead",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este lead.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "put": {
        "operationId": "crm_leads_update",
        "description": "Reemplazar lead (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Reemplazar lead",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este lead.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/LeadDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/LeadDetailRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "patch": {
        "operationId": "crm_leads_partial_update",
        "description": "Actualizar lead (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Actualizar lead",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este lead.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeadDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeadDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeadDetailRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "delete": {
        "operationId": "crm_leads_destroy",
        "description": "Eliminar lead (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Eliminar lead",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este lead.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/leads/{id}/convert/": {
      "post": {
        "operationId": "crm_leads_convert_create",
        "description": "Convert (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Convert",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este lead.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/leads/{id}/lose/": {
      "post": {
        "operationId": "crm_leads_lose_create",
        "description": "Lose (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Lose",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este lead.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/leads/{id}/qualify/": {
      "post": {
        "operationId": "crm_leads_qualify_create",
        "description": "Qualify (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Qualify",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este lead.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/notes/": {
      "get": {
        "operationId": "crm_notes_list",
        "description": "Listar notas (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Listar notas",
        "parameters": [
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedNoteList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "post": {
        "operationId": "crm_notes_create",
        "description": "Crear nota (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Crear nota",
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/NoteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/NoteRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/crm/notes/{id}/": {
      "get": {
        "operationId": "crm_notes_retrieve",
        "description": "Obtener nota (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Obtener nota",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este note.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "put": {
        "operationId": "crm_notes_update",
        "description": "Reemplazar nota (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Reemplazar nota",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este note.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/NoteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/NoteRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "patch": {
        "operationId": "crm_notes_partial_update",
        "description": "Actualizar nota (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Actualizar nota",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este note.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedNoteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedNoteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedNoteRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "delete": {
        "operationId": "crm_notes_destroy",
        "description": "Eliminar nota (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Eliminar nota",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este note.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/pipelines/": {
      "get": {
        "operationId": "crm_pipelines_list",
        "description": "Listar embudos (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Listar embudos",
        "parameters": [
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedPipelineList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "post": {
        "operationId": "crm_pipelines_create",
        "description": "Crear embudo (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Crear embudo",
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PipelineRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PipelineRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PipelineRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pipeline"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/crm/pipelines/{pipeline_pk}/stages/": {
      "get": {
        "operationId": "crm_pipelines_stages_list",
        "description": "Etapas de un embudo de ventas.\n\n**Scope requerido:** `crm:read`.",
        "summary": "Listar etapas",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "pipeline_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedPipelineStageList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "post": {
        "operationId": "crm_pipelines_stages_create",
        "description": "Etapas de un embudo de ventas.\n\n**Scope requerido:** `crm:write`.",
        "summary": "Crear etapa",
        "parameters": [
          {
            "in": "path",
            "name": "pipeline_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PipelineStageRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PipelineStageRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PipelineStageRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PipelineStage"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/pipelines/{pipeline_pk}/stages/{id}/": {
      "get": {
        "operationId": "crm_pipelines_stages_retrieve",
        "description": "Etapas de un embudo de ventas.\n\n**Scope requerido:** `crm:read`.",
        "summary": "Obtener etapa",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "pipeline_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PipelineStage"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "put": {
        "operationId": "crm_pipelines_stages_update",
        "description": "Etapas de un embudo de ventas.\n\n**Scope requerido:** `crm:write`.",
        "summary": "Reemplazar etapa",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "pipeline_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PipelineStageRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PipelineStageRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PipelineStageRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PipelineStage"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "patch": {
        "operationId": "crm_pipelines_stages_partial_update",
        "description": "Etapas de un embudo de ventas.\n\n**Scope requerido:** `crm:write`.",
        "summary": "Actualizar etapa",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "pipeline_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPipelineStageRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPipelineStageRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPipelineStageRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PipelineStage"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "delete": {
        "operationId": "crm_pipelines_stages_destroy",
        "description": "Etapas de un embudo de ventas.\n\n**Scope requerido:** `crm:write`.",
        "summary": "Eliminar etapa",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "pipeline_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/pipelines/{id}/": {
      "get": {
        "operationId": "crm_pipelines_retrieve",
        "description": "Obtener embudo (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Obtener embudo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este pipeline.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PipelineWithStages"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "put": {
        "operationId": "crm_pipelines_update",
        "description": "Reemplazar embudo (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Reemplazar embudo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este pipeline.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PipelineRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PipelineRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PipelineRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pipeline"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "patch": {
        "operationId": "crm_pipelines_partial_update",
        "description": "Actualizar embudo (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Actualizar embudo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este pipeline.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPipelineRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPipelineRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPipelineRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pipeline"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "delete": {
        "operationId": "crm_pipelines_destroy",
        "description": "Eliminar embudo (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Eliminar embudo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este pipeline.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/crm/settings/": {
      "get": {
        "operationId": "crm_settings_retrieve",
        "description": "Ajustes del CRM.\n\n**Scope requerido:** `crm:read`.",
        "summary": "Obtener ajustes del CRM",
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CRMSettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      },
      "patch": {
        "operationId": "crm_settings_partial_update",
        "description": "Ajustes del CRM.\n\n**Scope requerido:** `crm:write`.",
        "summary": "Actualizar ajustes del CRM",
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCRMSettingsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCRMSettingsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCRMSettingsRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CRMSettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/crm/sources/": {
      "get": {
        "operationId": "crm_sources_list",
        "description": "Listar orígenes de lead (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Listar orígenes de lead",
        "parameters": [
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedLeadSourceList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "post": {
        "operationId": "crm_sources_create",
        "description": "Crear origen de lead (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Crear origen de lead",
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadSourceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/LeadSourceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/LeadSourceRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSource"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/crm/sources/{id}/": {
      "get": {
        "operationId": "crm_sources_retrieve",
        "description": "Obtener origen de lead (CRM).\n\n**Scope requerido:** `crm:read`.",
        "summary": "Obtener origen de lead",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este lead source.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSource"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:read"
      },
      "put": {
        "operationId": "crm_sources_update",
        "description": "Reemplazar origen de lead (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Reemplazar origen de lead",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este lead source.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadSourceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/LeadSourceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/LeadSourceRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSource"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "patch": {
        "operationId": "crm_sources_partial_update",
        "description": "Actualizar origen de lead (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Actualizar origen de lead",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este lead source.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "CRM"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeadSourceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeadSourceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeadSourceRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSource"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      },
      "delete": {
        "operationId": "crm_sources_destroy",
        "description": "Eliminar origen de lead (CRM).\n\n**Scope requerido:** `crm:write`.",
        "summary": "Eliminar origen de lead",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este lead source.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "CRM"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "crm:write"
      }
    },
    "/api/v1/current-organization": {
      "get": {
        "operationId": "current_organization_retrieve",
        "description": "Obtener datos de la organización actual\n\n**Scope requerido:** `settings:read`.",
        "summary": "Obtener obtener datos de la organización actual",
        "tags": [
          "Organización"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Organization"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      },
      "put": {
        "operationId": "current_organization_update",
        "description": "Actualizar datos de la organización actual\n\n**Scope requerido:** `settings:write`.",
        "summary": "Reemplazar actualizar datos de la organización actual",
        "tags": [
          "Organización"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Organization"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      },
      "patch": {
        "operationId": "current_organization_partial_update",
        "description": "Actualización parcial de la organización actual\n\n**Scope requerido:** `settings:write`.",
        "summary": "Actualizar actualización parcial de la organización actual",
        "tags": [
          "Organización"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedOrganizationRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedOrganizationRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedOrganizationRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Organization"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/current-organization/logo": {
      "get": {
        "operationId": "current_organization_logo_retrieve",
        "description": "Servir el logo de la organización actual como proxy\n\n**Scope requerido:** `settings:read`.",
        "summary": "Descargar el logo",
        "tags": [
          "Organización"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "image/*": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "Logo.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/customers/": {
      "get": {
        "operationId": "customers_list",
        "description": "Listar clientes (Clientes).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Listar clientes",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "created_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "email",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "has_mandate",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "legal_name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "payment_terms",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "phone",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tag",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "trade_name",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "vat_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCustomerList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      },
      "post": {
        "operationId": "customers_create",
        "description": "Crear cliente (Clientes).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Crear cliente",
        "tags": [
          "Clientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CustomerRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CustomerRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/customers/{id}/": {
      "get": {
        "operationId": "customers_retrieve",
        "description": "Obtener cliente (Clientes).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Obtener cliente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este customer.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      },
      "put": {
        "operationId": "customers_update",
        "description": "Reemplazar cliente (Clientes).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Reemplazar cliente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este customer.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CustomerRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CustomerRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      },
      "patch": {
        "operationId": "customers_partial_update",
        "description": "Actualizar cliente (Clientes).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Actualizar cliente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este customer.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCustomerRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCustomerRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCustomerRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      },
      "delete": {
        "operationId": "customers_destroy",
        "description": "Eliminar cliente (Clientes).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Eliminar cliente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este customer.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      }
    },
    "/api/v1/customers/{id}/merge/": {
      "post": {
        "operationId": "customers_merge_create",
        "description": "Fusiona en este contacto (el que se conserva) los duplicados indicados en ``source_ids``\n(o ``source_id``): reasigna sus documentos, pagos, anticipos y personas de contacto, traspasa\nel saldo de su subcuenta contable y elimina los duplicados. ``dry_run=true`` sólo informa de\nlo que se movería; ``force=true`` permite fusionar contactos con NIF distintos (409\n``vat_id_mismatch`` si no). Deja rastro en la auditoría y el nombre de cada duplicado en\n``previous_names``.\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Fusiona en este contacto (el que se conserva) los duplicados indicados en ``source_ids``",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este customer.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Clientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      }
    },
    "/api/v1/customers/{id}/vies/": {
      "get": {
        "operationId": "customers_vies_retrieve",
        "description": "``GET …/{id}/vies/``: si el NIF-IVA es válido, marca el contacto como\noperador intracomunitario y guarda el NIF-IVA normalizado. Si VIES no responde →\n503 ``vies_unavailable`` (el contacto no se modifica).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Comprobar el NIF-IVA en VIES",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este customer.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Clientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      }
    },
    "/api/v1/customers/vies-check/": {
      "get": {
        "operationId": "customers_vies_check_retrieve",
        "description": "``GET …/vies-check/?vat=IE3347697KH``: comprobación sin contacto.\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Comprobar un NIF-IVA en VIES",
        "tags": [
          "Clientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/dashboard/activity/": {
      "get": {
        "operationId": "dashboard_activity_retrieve",
        "description": "Actividad reciente optimizada.\n\n**Scope requerido:** `reports:read`.",
        "summary": "Actividad reciente",
        "parameters": [
          {
            "in": "query",
            "name": "days",
            "schema": {
              "type": "integer"
            },
            "description": "Días hacia atrás (1–366, por defecto 7)."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            },
            "description": "Elementos por tipo (1–100, por defecto 10)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cuadro de mando"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecentActivity"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read"
      }
    },
    "/api/v1/dashboard/charts/": {
      "get": {
        "operationId": "dashboard_charts_retrieve",
        "description": "Datos de gráficos del dashboard (ampliado).\n\n**Scope requerido:** `reports:read`.",
        "summary": "Datos de los gráficos del cuadro de mando",
        "parameters": [
          {
            "in": "query",
            "name": "period",
            "schema": {
              "type": "string",
              "enum": [
                "12m",
                "30d",
                "7d",
                "90d"
              ]
            },
            "description": "Periodo de los gráficos (por defecto 30d)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cuadro de mando"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChartData"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read"
      }
    },
    "/api/v1/dashboard/stats/": {
      "get": {
        "operationId": "dashboard_stats_retrieve",
        "description": "Estadísticas completas del dashboard.\nAcepta ?period=7d|30d|90d|12m.\n\n**Scope requerido:** `reports:read`.",
        "summary": "Indicadores del cuadro de mando",
        "parameters": [
          {
            "in": "query",
            "name": "period",
            "schema": {
              "type": "string",
              "enum": [
                "12m",
                "30d",
                "7d",
                "90d"
              ]
            },
            "description": "Periodo de los indicadores (por defecto 30d)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cuadro de mando"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardStats"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read"
      }
    },
    "/api/v1/email-templates/": {
      "get": {
        "operationId": "email_templates_list",
        "description": "Plantillas de email de la organización (asunto y cuerpo de los envíos de facturas,\npresupuestos, recordatorios…).\n\n**Scope requerido:** `settings:read`.",
        "summary": "Listar plantillas de email",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de email"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedEmailTemplateList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:read"
      },
      "post": {
        "operationId": "email_templates_create",
        "description": "Plantillas de email de la organización (asunto y cuerpo de los envíos de facturas,\npresupuestos, recordatorios…).\n\n**Scope requerido:** `settings:write`.",
        "summary": "Crear plantilla de email",
        "tags": [
          "Plantillas de email"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailTemplateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EmailTemplateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/EmailTemplateRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/email-templates/{id}/": {
      "get": {
        "operationId": "email_templates_retrieve",
        "description": "Plantillas de email de la organización (asunto y cuerpo de los envíos de facturas,\npresupuestos, recordatorios…).\n\n**Scope requerido:** `settings:read`.",
        "summary": "Obtener plantilla de email",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este email template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de email"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:read"
      },
      "put": {
        "operationId": "email_templates_update",
        "description": "Plantillas de email de la organización (asunto y cuerpo de los envíos de facturas,\npresupuestos, recordatorios…).\n\n**Scope requerido:** `settings:write`.",
        "summary": "Reemplazar plantilla de email",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este email template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de email"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailTemplateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EmailTemplateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/EmailTemplateRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      },
      "patch": {
        "operationId": "email_templates_partial_update",
        "description": "Plantillas de email de la organización (asunto y cuerpo de los envíos de facturas,\npresupuestos, recordatorios…).\n\n**Scope requerido:** `settings:write`.",
        "summary": "Actualizar plantilla de email",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este email template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Plantillas de email"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEmailTemplateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEmailTemplateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEmailTemplateRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      },
      "delete": {
        "operationId": "email_templates_destroy",
        "description": "Plantillas de email de la organización (asunto y cuerpo de los envíos de facturas,\npresupuestos, recordatorios…).\n\n**Scope requerido:** `settings:write`.",
        "summary": "Eliminar plantilla de email",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este email template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de email"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      }
    },
    "/api/v1/expedientes/all-actions/": {
      "get": {
        "operationId": "expedientes_all_actions_retrieve",
        "description": "Actuaciones de todos los expedientes.\n\nFiltro `?status=`: `pending` (por defecto), `overdue`, `all` o un estado concreto.\n\n**Scope requerido:** `cases:read`.",
        "summary": "Actuaciones de todos los expedientes",
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/expedientes/calendar/": {
      "get": {
        "operationId": "expedientes_calendar_retrieve",
        "description": "Plazos y actuaciones para el calendario.\n\nEntre `?from=YYYY-MM-DD` y `?to=YYYY-MM-DD` (ambos obligatorios).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Plazos y actuaciones para el calendario",
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/expedientes/case-types/": {
      "get": {
        "operationId": "expedientes_case_types_list",
        "description": "Listar tipos de expediente (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Listar tipos de expediente",
        "parameters": [
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCaseTypeList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "post": {
        "operationId": "expedientes_case_types_create",
        "description": "Crear tipo de expediente (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Crear tipo de expediente",
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseTypeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CaseTypeRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CaseTypeRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expedientes/case-types/{id}/": {
      "get": {
        "operationId": "expedientes_case_types_retrieve",
        "description": "Obtener tipo de expediente (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Obtener tipo de expediente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "put": {
        "operationId": "expedientes_case_types_update",
        "description": "Reemplazar tipo de expediente (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Reemplazar tipo de expediente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseTypeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CaseTypeRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CaseTypeRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "patch": {
        "operationId": "expedientes_case_types_partial_update",
        "description": "Actualizar tipo de expediente (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Actualizar tipo de expediente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseTypeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseTypeRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseTypeRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "delete": {
        "operationId": "expedientes_case_types_destroy",
        "description": "Eliminar tipo de expediente (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Eliminar tipo de expediente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/": {
      "get": {
        "operationId": "expedientes_cases_list",
        "description": "Listar expedientes (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Listar expedientes",
        "parameters": [
          {
            "in": "query",
            "name": "case_type",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "open_date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "open_date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "priority",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCaseListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "post": {
        "operationId": "expedientes_cases_create",
        "description": "Crear expediente (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Crear expediente",
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CaseDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CaseDetailRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/actions/": {
      "get": {
        "operationId": "expedientes_cases_actions_list",
        "description": "Listar actuaciones (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Listar actuaciones",
        "parameters": [
          {
            "in": "query",
            "name": "case",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "deadline_from",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "deadline_to",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "has_deadline",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCaseActionList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "post": {
        "operationId": "expedientes_cases_actions_create",
        "description": "Crear actuación (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Crear actuación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseActionRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CaseActionRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CaseActionRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseAction"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/actions/{id}/": {
      "get": {
        "operationId": "expedientes_cases_actions_retrieve",
        "description": "Obtener actuación (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Obtener actuación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseAction"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "put": {
        "operationId": "expedientes_cases_actions_update",
        "description": "Reemplazar actuación (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Reemplazar actuación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseActionRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CaseActionRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CaseActionRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseAction"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "patch": {
        "operationId": "expedientes_cases_actions_partial_update",
        "description": "Actualizar actuación (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Actualizar actuación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseActionRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseActionRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseActionRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseAction"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "delete": {
        "operationId": "expedientes_cases_actions_destroy",
        "description": "Eliminar actuación (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Eliminar actuación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/actions/{id}/complete/": {
      "post": {
        "operationId": "expedientes_cases_actions_complete_create",
        "description": "Completar (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Completar",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseAction"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/actions/{id}/reopen/": {
      "post": {
        "operationId": "expedientes_cases_actions_reopen_create",
        "description": "Reabrir (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Reabrir",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseAction"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/documents/": {
      "get": {
        "operationId": "expedientes_cases_documents_list",
        "description": "Listar documentos vinculados (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Listar documentos vinculados",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCaseLinkedDocumentList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "post": {
        "operationId": "expedientes_cases_documents_create",
        "description": "Crear documento vinculado (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Crear documento vinculado",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseLinkedDocumentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CaseLinkedDocumentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CaseLinkedDocumentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseLinkedDocument"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/documents/{id}/": {
      "get": {
        "operationId": "expedientes_cases_documents_retrieve",
        "description": "Obtener documento vinculado (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Obtener documento vinculado",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseLinkedDocument"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "patch": {
        "operationId": "expedientes_cases_documents_partial_update",
        "description": "Actualizar documento vinculado (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Actualizar documento vinculado",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseLinkedDocumentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseLinkedDocumentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseLinkedDocumentRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseLinkedDocument"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "delete": {
        "operationId": "expedientes_cases_documents_destroy",
        "description": "Eliminar documento vinculado (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Eliminar documento vinculado",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/files/": {
      "get": {
        "operationId": "expedientes_cases_files_list",
        "description": "Listar archivos (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Listar archivos",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCaseFileList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "post": {
        "operationId": "expedientes_cases_files_create",
        "description": "Crear archivo (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Crear archivo",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseFileRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CaseFileRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CaseFileRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseFile"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/files/{id}/": {
      "get": {
        "operationId": "expedientes_cases_files_retrieve",
        "description": "Obtener archivo (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Obtener archivo",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseFile"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "patch": {
        "operationId": "expedientes_cases_files_partial_update",
        "description": "Actualizar archivo (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Actualizar archivo",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseFileRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseFileRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseFileRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseFile"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "delete": {
        "operationId": "expedientes_cases_files_destroy",
        "description": "Eliminar archivo (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Eliminar archivo",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/files/{id}/download/": {
      "get": {
        "operationId": "expedientes_cases_files_download_retrieve",
        "description": "Descargar (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Descargar",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseFile"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/folders/": {
      "get": {
        "operationId": "expedientes_cases_folders_list",
        "description": "Listar carpetas (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Listar carpetas",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCaseFolderList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "post": {
        "operationId": "expedientes_cases_folders_create",
        "description": "Crear carpeta (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Crear carpeta",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseFolderRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CaseFolderRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CaseFolderRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseFolder"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/folders/{id}/": {
      "get": {
        "operationId": "expedientes_cases_folders_retrieve",
        "description": "Obtener carpeta (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Obtener carpeta",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseFolder"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "put": {
        "operationId": "expedientes_cases_folders_update",
        "description": "Reemplazar carpeta (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Reemplazar carpeta",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseFolderRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CaseFolderRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CaseFolderRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseFolder"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "patch": {
        "operationId": "expedientes_cases_folders_partial_update",
        "description": "Actualizar carpeta (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Actualizar carpeta",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseFolderRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseFolderRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseFolderRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseFolder"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "delete": {
        "operationId": "expedientes_cases_folders_destroy",
        "description": "Eliminar carpeta (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Eliminar carpeta",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/generate-document/": {
      "post": {
        "operationId": "expedientes_cases_generate_document_create",
        "description": "Genera un documento (PDF o DOCX) a partir de una plantilla de expedientes con los datos\ndel expediente. No se guarda: se devuelve el archivo.\n\nAdemás de `templates:read` exige `cases:read`.\n\n**Scope requerido:** `templates:read`.",
        "summary": "Generar un documento del expediente",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateDocumentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/GenerateDocumentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/GenerateDocumentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "Documento PDF.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read",
        "x-scope-also-required": [
          "cases:read"
        ]
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/parties/": {
      "get": {
        "operationId": "expedientes_cases_parties_list",
        "description": "Listar partes (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Listar partes",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCasePartyList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "post": {
        "operationId": "expedientes_cases_parties_create",
        "description": "Crear parte (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Crear parte",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CasePartyRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CasePartyRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CasePartyRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseParty"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/parties/{id}/": {
      "get": {
        "operationId": "expedientes_cases_parties_retrieve",
        "description": "Obtener parte (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Obtener parte",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseParty"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "put": {
        "operationId": "expedientes_cases_parties_update",
        "description": "Reemplazar parte (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Reemplazar parte",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CasePartyRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CasePartyRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CasePartyRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseParty"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "patch": {
        "operationId": "expedientes_cases_parties_partial_update",
        "description": "Actualizar parte (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Actualizar parte",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCasePartyRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCasePartyRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCasePartyRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseParty"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "delete": {
        "operationId": "expedientes_cases_parties_destroy",
        "description": "Eliminar parte (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Eliminar parte",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/requirements/": {
      "get": {
        "operationId": "expedientes_cases_requirements_list",
        "description": "Solicitudes de documentación al cliente del expediente (portal con enlace por email).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Listar solicitudes de documentación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedDocumentRequirementList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "post": {
        "operationId": "expedientes_cases_requirements_create",
        "description": "Solicitudes de documentación al cliente del expediente (portal con enlace por email).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Crear solicitud de documentación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentRequirementRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentRequirementRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentRequirementRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentRequirement"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/requirements/{id}/": {
      "get": {
        "operationId": "expedientes_cases_requirements_retrieve",
        "description": "Solicitudes de documentación al cliente del expediente (portal con enlace por email).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Obtener solicitud de documentación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentRequirement"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "put": {
        "operationId": "expedientes_cases_requirements_update",
        "description": "Solicitudes de documentación al cliente del expediente (portal con enlace por email).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Reemplazar solicitud de documentación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentRequirementRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentRequirementRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentRequirementRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentRequirement"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "patch": {
        "operationId": "expedientes_cases_requirements_partial_update",
        "description": "Solicitudes de documentación al cliente del expediente (portal con enlace por email).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Actualizar solicitud de documentación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentRequirementRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentRequirementRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentRequirementRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentRequirement"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "delete": {
        "operationId": "expedientes_cases_requirements_destroy",
        "description": "Solicitudes de documentación al cliente del expediente (portal con enlace por email).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Eliminar solicitud de documentación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/requirements/{id}/cancel/": {
      "post": {
        "operationId": "expedientes_cases_requirements_cancel_create",
        "description": "Solicitudes de documentación al cliente del expediente (portal con enlace por email).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `cases:write`.",
        "summary": "Cancelar la solicitud de documentación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentRequirement"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{case_pk}/requirements/{id}/resend/": {
      "post": {
        "operationId": "expedientes_cases_requirements_resend_create",
        "description": "Solicitudes de documentación al cliente del expediente (portal con enlace por email).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Reenviar la solicitud de documentación",
        "parameters": [
          {
            "in": "path",
            "name": "case_pk",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentRequirement"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{id}/": {
      "get": {
        "operationId": "expedientes_cases_retrieve",
        "description": "Obtener expediente (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Obtener expediente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "put": {
        "operationId": "expedientes_cases_update",
        "description": "Reemplazar expediente (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Reemplazar expediente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CaseDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CaseDetailRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "patch": {
        "operationId": "expedientes_cases_partial_update",
        "description": "Actualizar expediente (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Actualizar expediente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseDetailRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "delete": {
        "operationId": "expedientes_cases_destroy",
        "description": "Eliminar expediente (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Eliminar expediente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{id}/close/": {
      "post": {
        "operationId": "expedientes_cases_close_create",
        "description": "Cerrar (Expedientes).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `cases:write`.",
        "summary": "Cerrar",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{id}/cloud-sync/": {
      "post": {
        "operationId": "expedientes_cases_cloud_sync_create",
        "description": "(Re)crea la carpeta del expediente en Drive/Dropbox y encola la\nsincronización de sus subcarpetas y archivos pendientes.\n\n**Scope requerido:** `cases:write`.",
        "summary": "Sincronizar con la nube",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CloudSyncResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{id}/reopen/": {
      "post": {
        "operationId": "expedientes_cases_reopen_create",
        "description": "Reabrir (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Reabrir",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/cases/{id}/timeline/": {
      "get": {
        "operationId": "expedientes_cases_timeline_retrieve",
        "description": "Timeline (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Timeline",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      }
    },
    "/api/v1/expedientes/courts/": {
      "get": {
        "operationId": "expedientes_courts_list",
        "description": "Listar juzgados (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Listar juzgados",
        "parameters": [
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCourtList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "post": {
        "operationId": "expedientes_courts_create",
        "description": "Crear juzgado (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Crear juzgado",
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CourtRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CourtRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CourtRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Court"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expedientes/courts/{id}/": {
      "get": {
        "operationId": "expedientes_courts_retrieve",
        "description": "Obtener juzgado (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Obtener juzgado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este court.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Court"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "put": {
        "operationId": "expedientes_courts_update",
        "description": "Reemplazar juzgado (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Reemplazar juzgado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este court.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CourtRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CourtRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CourtRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Court"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "patch": {
        "operationId": "expedientes_courts_partial_update",
        "description": "Actualizar juzgado (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Actualizar juzgado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este court.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCourtRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCourtRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCourtRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Court"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "delete": {
        "operationId": "expedientes_courts_destroy",
        "description": "Eliminar juzgado (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Eliminar juzgado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este court.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/dashboard/": {
      "get": {
        "operationId": "expedientes_dashboard_retrieve",
        "description": "Indicadores de expedientes: abiertos, plazos próximos y actividad reciente.\n\n**Scope requerido:** `cases:read`.",
        "summary": "Indicadores de expedientes: abiertos, plazos próximos y actividad reciente",
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/expedientes/google-calendar/status/": {
      "get": {
        "operationId": "expedientes_google_calendar_status_retrieve",
        "description": "Estado de la conexión con Google Calendar de expedientes (sin tokens).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Estado de la conexión con Google Calendar de expedientes (sin tokens)",
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/expedientes/jurisdictions/": {
      "get": {
        "operationId": "expedientes_jurisdictions_list",
        "description": "Listar jurisdicciones (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Listar jurisdicciones",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedJurisdictionList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      }
    },
    "/api/v1/expedientes/jurisdictions/{id}/": {
      "get": {
        "operationId": "expedientes_jurisdictions_retrieve",
        "description": "Obtener jurisdicción (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Obtener jurisdicción",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este jurisdiction.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Jurisdiction"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      }
    },
    "/api/v1/expedientes/next-reference/": {
      "get": {
        "operationId": "expedientes_next_reference_retrieve",
        "description": "Siguiente referencia de expediente que se asignará (sin consumirla).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Siguiente referencia de expediente",
        "parameters": [
          {
            "in": "query",
            "name": "case_type",
            "schema": {
              "type": "integer"
            },
            "description": "Tipo de expediente (opcional)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NextCaseReference"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      }
    },
    "/api/v1/expedientes/settings/": {
      "get": {
        "operationId": "expedientes_settings_retrieve",
        "description": "Ajustes del módulo de expedientes (numeración de referencias y opciones).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Obtener ajustes del módulo de expedientes (numeración de referencias y opciones)",
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpedientesSettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      },
      "patch": {
        "operationId": "expedientes_settings_partial_update",
        "description": "Ajustes del módulo de expedientes (numeración de referencias y opciones).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Actualizar ajustes del módulo de expedientes (numeración de referencias y opciones)",
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpedientesSettingsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpedientesSettingsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpedientesSettingsRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpedientesSettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expedientes/tags/": {
      "get": {
        "operationId": "expedientes_tags_list",
        "description": "Listar etiquetas (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Listar etiquetas",
        "parameters": [
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCaseTagList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "post": {
        "operationId": "expedientes_tags_create",
        "description": "Crear etiqueta (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Crear etiqueta",
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseTagRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CaseTagRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CaseTagRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseTag"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expedientes/tags/{id}/": {
      "get": {
        "operationId": "expedientes_tags_retrieve",
        "description": "Obtener etiqueta (Expedientes).\n\n**Scope requerido:** `cases:read`.",
        "summary": "Obtener etiqueta",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case tag.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseTag"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:read"
      },
      "put": {
        "operationId": "expedientes_tags_update",
        "description": "Reemplazar etiqueta (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Reemplazar etiqueta",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case tag.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseTagRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CaseTagRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CaseTagRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseTag"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "patch": {
        "operationId": "expedientes_tags_partial_update",
        "description": "Actualizar etiqueta (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Actualizar etiqueta",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case tag.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseTagRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseTagRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedCaseTagRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseTag"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      },
      "delete": {
        "operationId": "expedientes_tags_destroy",
        "description": "Eliminar etiqueta (Expedientes).\n\n**Scope requerido:** `cases:write`.",
        "summary": "Eliminar etiqueta",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este case tag.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Expedientes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "cases:write"
      }
    },
    "/api/v1/expedientes/templates/": {
      "get": {
        "operationId": "expedientes_templates_list",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:read`.",
        "summary": "Listar plantillas de documentos",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedDocumentTemplateList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read"
      },
      "post": {
        "operationId": "expedientes_templates_create",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:write`.",
        "summary": "Crear plantilla de documento",
        "tags": [
          "Plantillas de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTemplateUpload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expedientes/templates/{id}/": {
      "get": {
        "operationId": "expedientes_templates_retrieve",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:read`.",
        "summary": "Obtener plantilla de documento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read"
      },
      "put": {
        "operationId": "expedientes_templates_update",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:write`.",
        "summary": "Reemplazar plantilla de documento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentTemplateUploadRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTemplateUpload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:write"
      },
      "patch": {
        "operationId": "expedientes_templates_partial_update",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:write`.",
        "summary": "Actualizar plantilla de documento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentTemplateUploadRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentTemplateUploadRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentTemplateUploadRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTemplateUpload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:write"
      },
      "delete": {
        "operationId": "expedientes_templates_destroy",
        "description": "Plantillas de documentos (Word `.docx` con marcadores) del módulo: expedientes, clínica o\nconsentimientos. Alta y edición en multipart (`file`, `name`, `description`…).\n\n**Scope requerido:** `templates:write`.",
        "summary": "Eliminar plantilla de documento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:write"
      }
    },
    "/api/v1/expedientes/templates/{id}/download/": {
      "get": {
        "operationId": "expedientes_templates_download_retrieve",
        "description": "URL firmada temporal para descargar el archivo de la plantilla.\n\n**Scope requerido:** `templates:read`.",
        "summary": "Obtener la URL de descarga de la plantilla",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedDownloadUrl"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read"
      }
    },
    "/api/v1/expedientes/templates/instructions-pdf/": {
      "get": {
        "operationId": "expedientes_templates_instructions_pdf_retrieve",
        "description": "PDF con las instrucciones para crear plantillas del módulo.\n\n**Scope requerido:** `templates:read`.",
        "summary": "Descargar las instrucciones de las plantillas (PDF)",
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "PDF de instrucciones.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/expedientes/templates/placeholders/": {
      "get": {
        "operationId": "expedientes_templates_placeholders_retrieve",
        "description": "Marcadores disponibles en las plantillas del módulo (agrupados por entidad).\n\n**Scope requerido:** `templates:read`.",
        "summary": "Marcadores disponibles en las plantillas",
        "tags": [
          "Plantillas de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "templates:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/expense-categories/": {
      "get": {
        "operationId": "expense_categories_list",
        "description": "Categorías de gasto.\n\n**Scope requerido:** `expenses:read`.",
        "summary": "Listar categorías de gasto",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "is_active",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Categorías de gasto"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedExpenseCategoryList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read"
      },
      "post": {
        "operationId": "expense_categories_create",
        "description": "Categorías de gasto.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Crear categoría de gasto",
        "tags": [
          "Categorías de gasto"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseCategoryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseCategoryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseCategoryRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseCategory"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expense-categories/{id}/": {
      "get": {
        "operationId": "expense_categories_retrieve",
        "description": "Categorías de gasto.\n\n**Scope requerido:** `expenses:read`.",
        "summary": "Obtener categoría de gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Categoría de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Categorías de gasto"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseCategory"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read"
      },
      "put": {
        "operationId": "expense_categories_update",
        "description": "Categorías de gasto.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Reemplazar categoría de gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Categoría de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Categorías de gasto"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseCategoryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseCategoryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseCategoryRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseCategory"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      },
      "patch": {
        "operationId": "expense_categories_partial_update",
        "description": "Categorías de gasto.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Actualizar categoría de gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Categoría de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Categorías de gasto"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpenseCategoryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpenseCategoryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpenseCategoryRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseCategory"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      },
      "delete": {
        "operationId": "expense_categories_destroy",
        "description": "Categorías de gasto.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Eliminar categoría de gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Categoría de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Categorías de gasto"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      }
    },
    "/api/v1/expense-payment-methods/": {
      "get": {
        "operationId": "expense_payment_methods_list",
        "description": "Métodos de pago de gastos.\n\n**Scope requerido:** `expenses:read`.",
        "summary": "Listar métodos de pago",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Métodos de pago de gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedExpensePaymentMethodList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read"
      },
      "post": {
        "operationId": "expense_payment_methods_create",
        "description": "Métodos de pago de gastos.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Crear método de pago",
        "tags": [
          "Métodos de pago de gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentMethodRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentMethodRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentMethodRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpensePaymentMethod"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expense-payment-methods/{id}/": {
      "get": {
        "operationId": "expense_payment_methods_retrieve",
        "description": "Métodos de pago de gastos.\n\n**Scope requerido:** `expenses:read`.",
        "summary": "Obtener método de pago",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Método de pago de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Métodos de pago de gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpensePaymentMethod"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read"
      },
      "put": {
        "operationId": "expense_payment_methods_update",
        "description": "Métodos de pago de gastos.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Reemplazar método de pago",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Método de pago de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Métodos de pago de gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentMethodRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentMethodRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentMethodRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpensePaymentMethod"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      },
      "patch": {
        "operationId": "expense_payment_methods_partial_update",
        "description": "Métodos de pago de gastos.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Actualizar método de pago",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Método de pago de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Métodos de pago de gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpensePaymentMethodRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpensePaymentMethodRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpensePaymentMethodRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpensePaymentMethod"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      },
      "delete": {
        "operationId": "expense_payment_methods_destroy",
        "description": "Métodos de pago de gastos.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Eliminar método de pago",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Método de pago de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Métodos de pago de gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      }
    },
    "/api/v1/expense-payments/": {
      "get": {
        "operationId": "expense_payments_list",
        "description": "Pagos de gastos y anticipos a proveedores (``kind=advance``: ``supplier`` sin ``expense``;\nse aplican a gastos con ``POST /expense-payments/{id}/apply/``). Gastos en divisa:\n``currency`` = divisa del gasto, ``amount`` en esa divisa y ``amount_eur`` con lo cargado\n(``amount`` se guarda siempre en euros).\n\n**Scope requerido:** `payments:read`.",
        "summary": "Listar pagos de gastos",
        "parameters": [
          {
            "in": "query",
            "name": "bank_account",
            "schema": {
              "type": "number"
            },
            "description": "ID de la cuenta bancaria (tesorería)"
          },
          {
            "in": "query",
            "name": "counter_account",
            "schema": {
              "type": "number"
            },
            "description": "ID de la cuenta de contrapartida (cobros/pagos fuera de tesorería)"
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "expense",
            "schema": {
              "type": "number"
            },
            "description": "ID del gasto"
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string",
              "enum": [
                "advance",
                "advance_application",
                "credit_note_application",
                "expense"
              ]
            },
            "description": "* `expense` - Pago de gasto\n* `advance` - Anticipo a proveedor\n* `advance_application` - Aplicación de anticipo\n* `credit_note_application` - Aplicación de abono de proveedor"
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "supplier",
            "schema": {
              "type": "number"
            },
            "description": "ID del proveedor (anticipos)"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Pagos de gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedExpensePaymentList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:read"
      },
      "post": {
        "operationId": "expense_payments_create",
        "description": "Pagos de gastos y anticipos a proveedores (``kind=advance``: ``supplier`` sin ``expense``;\nse aplican a gastos con ``POST /expense-payments/{id}/apply/``). Gastos en divisa:\n``currency`` = divisa del gasto, ``amount`` en esa divisa y ``amount_eur`` con lo cargado\n(``amount`` se guarda siempre en euros).\n\n**Scope requerido:** `payments:write`.",
        "summary": "Crear pago de gasto",
        "tags": [
          "Pagos de gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpensePayment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expense-payments/{id}/": {
      "get": {
        "operationId": "expense_payments_retrieve",
        "description": "Pagos de gastos y anticipos a proveedores (``kind=advance``: ``supplier`` sin ``expense``;\nse aplican a gastos con ``POST /expense-payments/{id}/apply/``). Gastos en divisa:\n``currency`` = divisa del gasto, ``amount`` en esa divisa y ``amount_eur`` con lo cargado\n(``amount`` se guarda siempre en euros).\n\n**Scope requerido:** `payments:read`.",
        "summary": "Obtener pago de gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Pago de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Pagos de gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpensePayment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:read"
      },
      "put": {
        "operationId": "expense_payments_update",
        "description": "Pagos de gastos y anticipos a proveedores (``kind=advance``: ``supplier`` sin ``expense``;\nse aplican a gastos con ``POST /expense-payments/{id}/apply/``). Gastos en divisa:\n``currency`` = divisa del gasto, ``amount`` en esa divisa y ``amount_eur`` con lo cargado\n(``amount`` se guarda siempre en euros).\n\n**Scope requerido:** `payments:write`.",
        "summary": "Reemplazar pago de gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Pago de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Pagos de gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpensePayment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write"
      },
      "patch": {
        "operationId": "expense_payments_partial_update",
        "description": "Pagos de gastos y anticipos a proveedores (``kind=advance``: ``supplier`` sin ``expense``;\nse aplican a gastos con ``POST /expense-payments/{id}/apply/``). Gastos en divisa:\n``currency`` = divisa del gasto, ``amount`` en esa divisa y ``amount_eur`` con lo cargado\n(``amount`` se guarda siempre en euros).\n\n**Scope requerido:** `payments:write`.",
        "summary": "Actualizar pago de gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Pago de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Pagos de gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpensePaymentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpensePaymentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpensePaymentRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpensePayment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write"
      },
      "delete": {
        "operationId": "expense_payments_destroy",
        "description": "Pagos de gastos y anticipos a proveedores (``kind=advance``: ``supplier`` sin ``expense``;\nse aplican a gastos con ``POST /expense-payments/{id}/apply/``). Gastos en divisa:\n``currency`` = divisa del gasto, ``amount`` en esa divisa y ``amount_eur`` con lo cargado\n(``amount`` se guarda siempre en euros).\n\n**Scope requerido:** `payments:write`.",
        "summary": "Eliminar pago de gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Pago de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Pagos de gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write"
      }
    },
    "/api/v1/expense-payments/{id}/apply/": {
      "post": {
        "operationId": "expense_payments_apply_create",
        "description": "Aplica un anticipo a proveedor (``kind=advance``) a un gasto confirmado: crea un pago\n``kind=advance_application`` (Debe 4x proveedor / Haber 4070xxxx) por ``amount`` (por\ndefecto el menor entre el anticipo pendiente y lo pendiente del gasto).\n\n**Scope requerido:** `payments:write`.",
        "summary": "Aplicar un anticipo a proveedor a un gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Pago de gasto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Pagos de gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplySupplierAdvanceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ApplySupplierAdvanceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ApplySupplierAdvanceRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpensePayment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write"
      }
    },
    "/api/v1/expenses/": {
      "get": {
        "operationId": "expenses_list",
        "description": "Gastos: facturas recibidas, facturas simplificadas y otros justificantes (recibos,\nliquidaciones, comisiones bancarias, tributos…) con su desglose de IVA y «otros tributos».\n\n* `document_type` decide si el gasto entra en los libros de IVA (sólo `invoice` y\n  `simplified_invoice`); el resto no lleva IVA deducible.\n* `deduction_date` (periodo del 303) sólo si el IVA se deduce en un periodo posterior a `date`.\n* Divisa: `amount` se envía en la divisa de `currency` y se guarda en euros\n  (`exchange_rate` = euros por 1 unidad; BCE automático si falta; o `amount_eur`).\n* Al crear, si ya existe un gasto del mismo proveedor con el mismo número de factura (o la\n  misma fecha e importe) se responde 409 `duplicate_expense` salvo con `?force=true`\n  (`duplicate_of` queda informado).\n* El listado es compacto (sin pagos, líneas ni enlaces firmados): `attachment` es un booleano\n  y el enlace `attachment_url` sólo aparece en el detalle.\n\n**Scope requerido:** `expenses:read`.",
        "summary": "Listar gastos",
        "parameters": [
          {
            "in": "query",
            "name": "amount__gte",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "amount__lte",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "category",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "currency",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date__gte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date__lte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "deduction_date__gte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "deduction_date__lte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "document_type",
            "schema": {
              "type": "string",
              "enum": [
                "bank_fee",
                "financial_interest",
                "insurance_receipt",
                "invoice",
                "other",
                "pass_through",
                "penalty",
                "receipt",
                "settlement",
                "simplified_invoice",
                "supplier_credit_note",
                "tax_or_fee"
              ]
            },
            "description": "Documento que justifica el gasto. Sólo «invoice», «simplified_invoice» y «supplier_credit_note» (abono de proveedor: importes en positivo que restan) entran en los libros de IVA, el 303, el 349 y el 347; el resto no deduce IVA (coste íntegro: 629/625/626/631, 678 sanciones, 669 intereses, 555 suplidos).\n\n* `invoice` - Factura recibida\n* `simplified_invoice` - Factura simplificada / ticket\n* `receipt` - Recibo o justificante (sin factura)\n* `settlement` - Liquidación (kilometraje, dietas, hoja de gastos)\n* `insurance_receipt` - Recibo de seguro\n* `bank_fee` - Comisión bancaria o de pasarela de pago\n* `tax_or_fee` - Tributo o tasa\n* `penalty` - Sanción o recargo (gasto excepcional)\n* `financial_interest` - Intereses de demora o financieros\n* `pass_through` - Suplido (pagado por cuenta del cliente)\n* `supplier_credit_note` - Abono / rectificativa de proveedor\n* `other` - Otro documento (no factura)"
          },
          {
            "in": "query",
            "name": "document_type__in",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Múltiples valores separados por comas.",
            "explode": false,
            "style": "form"
          },
          {
            "in": "query",
            "name": "operation_type",
            "schema": {
              "type": "string",
              "enum": [
                "domestic",
                "domestic_reverse_charge",
                "foreign_services",
                "import",
                "intra_eu",
                "non_deductible",
                "not_subject"
              ]
            },
            "description": "Tipo de operación a efectos de IVA (interior, intracomunitaria, ISP, importación...).\n\n* `domestic` - Operación interior\n* `intra_eu` - Adquisición intracomunitaria de bienes o servicios (UE)\n* `foreign_services` - Servicios de empresario no establecido en la UE (ISP)\n* `domestic_reverse_charge` - Inversión del sujeto pasivo interior (art. 84.Uno.2º)\n* `import` - Importación (DUA)\n* `not_subject` - No sujeta a IVA\n* `non_deductible` - IVA soportado no deducible"
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "payment_method",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "cancelled",
                "confirmed",
                "paid",
                "partially_paid",
                "pending"
              ]
            },
            "description": "* `pending` - Pendiente\n* `confirmed` - Confirmado\n* `paid` - Pagado\n* `partially_paid` - Parcialmente pagado\n* `cancelled` - Anulado"
          },
          {
            "in": "query",
            "name": "status__in",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Múltiples valores separados por comas.",
            "explode": false,
            "style": "form"
          },
          {
            "in": "query",
            "name": "supplier",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedExpenseListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read"
      },
      "post": {
        "operationId": "expenses_create",
        "description": "Gastos: facturas recibidas, facturas simplificadas y otros justificantes (recibos,\nliquidaciones, comisiones bancarias, tributos…) con su desglose de IVA y «otros tributos».\n\n* `document_type` decide si el gasto entra en los libros de IVA (sólo `invoice` y\n  `simplified_invoice`); el resto no lleva IVA deducible.\n* `deduction_date` (periodo del 303) sólo si el IVA se deduce en un periodo posterior a `date`.\n* Divisa: `amount` se envía en la divisa de `currency` y se guarda en euros\n  (`exchange_rate` = euros por 1 unidad; BCE automático si falta; o `amount_eur`).\n* Al crear, si ya existe un gasto del mismo proveedor con el mismo número de factura (o la\n  misma fecha e importe) se responde 409 `duplicate_expense` salvo con `?force=true`\n  (`duplicate_of` queda informado).\n* El listado es compacto (sin pagos, líneas ni enlaces firmados): `attachment` es un booleano\n  y el enlace `attachment_url` sólo aparece en el detalle.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Crear gasto",
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Expense"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expenses/{id}/": {
      "get": {
        "operationId": "expenses_retrieve",
        "description": "Gastos: facturas recibidas, facturas simplificadas y otros justificantes (recibos,\nliquidaciones, comisiones bancarias, tributos…) con su desglose de IVA y «otros tributos».\n\n* `document_type` decide si el gasto entra en los libros de IVA (sólo `invoice` y\n  `simplified_invoice`); el resto no lleva IVA deducible.\n* `deduction_date` (periodo del 303) sólo si el IVA se deduce en un periodo posterior a `date`.\n* Divisa: `amount` se envía en la divisa de `currency` y se guarda en euros\n  (`exchange_rate` = euros por 1 unidad; BCE automático si falta; o `amount_eur`).\n* Al crear, si ya existe un gasto del mismo proveedor con el mismo número de factura (o la\n  misma fecha e importe) se responde 409 `duplicate_expense` salvo con `?force=true`\n  (`duplicate_of` queda informado).\n* El listado es compacto (sin pagos, líneas ni enlaces firmados): `attachment` es un booleano\n  y el enlace `attachment_url` sólo aparece en el detalle.\n\n**Scope requerido:** `expenses:read`.",
        "summary": "Obtener gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este expense.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Expense"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read"
      },
      "put": {
        "operationId": "expenses_update",
        "description": "Gastos: facturas recibidas, facturas simplificadas y otros justificantes (recibos,\nliquidaciones, comisiones bancarias, tributos…) con su desglose de IVA y «otros tributos».\n\n* `document_type` decide si el gasto entra en los libros de IVA (sólo `invoice` y\n  `simplified_invoice`); el resto no lleva IVA deducible.\n* `deduction_date` (periodo del 303) sólo si el IVA se deduce en un periodo posterior a `date`.\n* Divisa: `amount` se envía en la divisa de `currency` y se guarda en euros\n  (`exchange_rate` = euros por 1 unidad; BCE automático si falta; o `amount_eur`).\n* Al crear, si ya existe un gasto del mismo proveedor con el mismo número de factura (o la\n  misma fecha e importe) se responde 409 `duplicate_expense` salvo con `?force=true`\n  (`duplicate_of` queda informado).\n* El listado es compacto (sin pagos, líneas ni enlaces firmados): `attachment` es un booleano\n  y el enlace `attachment_url` sólo aparece en el detalle.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Reemplazar gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este expense.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Expense"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      },
      "patch": {
        "operationId": "expenses_partial_update",
        "description": "Gastos: facturas recibidas, facturas simplificadas y otros justificantes (recibos,\nliquidaciones, comisiones bancarias, tributos…) con su desglose de IVA y «otros tributos».\n\n* `document_type` decide si el gasto entra en los libros de IVA (sólo `invoice` y\n  `simplified_invoice`); el resto no lleva IVA deducible.\n* `deduction_date` (periodo del 303) sólo si el IVA se deduce en un periodo posterior a `date`.\n* Divisa: `amount` se envía en la divisa de `currency` y se guarda en euros\n  (`exchange_rate` = euros por 1 unidad; BCE automático si falta; o `amount_eur`).\n* Al crear, si ya existe un gasto del mismo proveedor con el mismo número de factura (o la\n  misma fecha e importe) se responde 409 `duplicate_expense` salvo con `?force=true`\n  (`duplicate_of` queda informado).\n* El listado es compacto (sin pagos, líneas ni enlaces firmados): `attachment` es un booleano\n  y el enlace `attachment_url` sólo aparece en el detalle.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Actualizar gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este expense.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpenseRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpenseRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExpenseRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Expense"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      },
      "delete": {
        "operationId": "expenses_destroy",
        "description": "Gastos: facturas recibidas, facturas simplificadas y otros justificantes (recibos,\nliquidaciones, comisiones bancarias, tributos…) con su desglose de IVA y «otros tributos».\n\n* `document_type` decide si el gasto entra en los libros de IVA (sólo `invoice` y\n  `simplified_invoice`); el resto no lleva IVA deducible.\n* `deduction_date` (periodo del 303) sólo si el IVA se deduce en un periodo posterior a `date`.\n* Divisa: `amount` se envía en la divisa de `currency` y se guarda en euros\n  (`exchange_rate` = euros por 1 unidad; BCE automático si falta; o `amount_eur`).\n* Al crear, si ya existe un gasto del mismo proveedor con el mismo número de factura (o la\n  misma fecha e importe) se responde 409 `duplicate_expense` salvo con `?force=true`\n  (`duplicate_of` queda informado).\n* El listado es compacto (sin pagos, líneas ni enlaces firmados): `attachment` es un booleano\n  y el enlace `attachment_url` sólo aparece en el detalle.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Eliminar gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este expense.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      }
    },
    "/api/v1/expenses/{id}/apply-credit-note/": {
      "post": {
        "operationId": "expenses_apply_credit_note_create",
        "description": "Compensa un abono de proveedor (``credit_note``) con este gasto: registra un pago\n``kind=credit_note_application`` en ambos documentos por ``amount`` (por defecto el menor\npendiente de los dos) y el asiento de neteo entre las subcuentas del proveedor (4x ↔ 4x).\nAmbos quedan pagados por el importe aplicado.\n\n**Scope requerido:** `payments:write` (también se acepta `expenses:write`).",
        "summary": "Compensar un abono de proveedor con el gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este expense.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyCreditNoteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ApplyCreditNoteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ApplyCreditNoteRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write",
        "x-scope-alternatives": [
          "expenses:write"
        ]
      }
    },
    "/api/v1/expenses/{id}/change-status/": {
      "post": {
        "operationId": "expenses_change_status_create",
        "description": "Cambia el estado del gasto respetando el ciclo pendiente → confirmado → (parcialmente\npagado →) pagado y → anulado. `paid` registra el pago del importe pendiente con el método de\npago del gasto; `pending` sólo si no hay pagos; `partially_paid` se alcanza registrando pagos.\nTransición no permitida → 409 `invalid_transition`.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Cambiar el estado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este expense.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseStatusChangeRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseStatusChangeRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseStatusChangeRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Expense"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      }
    },
    "/api/v1/expenses/{id}/confirm/": {
      "post": {
        "operationId": "expenses_confirm_create",
        "description": "Confirma un gasto pendiente: genera el asiento contable y, si su método de pago se\nliquida en el momento (`auto_mark_paid`), registra el pago y lo deja como pagado.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Confirmar (contabilizar)",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este expense.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Expense"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      }
    },
    "/api/v1/expenses/{id}/create-payment/": {
      "post": {
        "operationId": "expenses_create_payment_create",
        "description": "Crear un pago para este gasto (``amount`` ≤ pendiente). Si el pago NO sale del banco ni de la\ncaja de la empresa («pagado con…»: lo paga la financiera con un préstamo, el socio…), indica\n``counter_account`` (id) o ``counter_account_code`` (551, 170, 520…): el asiento será Debe\nproveedor / Haber esa cuenta y el pago no se conciliará con el banco.\n\n**Scope requerido:** `payments:write` (también se acepta `expenses:write`).",
        "summary": "Registrar un pago",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este expense.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExpensePaymentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpensePayment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write",
        "x-scope-alternatives": [
          "expenses:write"
        ]
      }
    },
    "/api/v1/expenses/backfill-payments/": {
      "post": {
        "operationId": "expenses_backfill_payments_create",
        "description": "Marca como pagados los gastos confirmados o parcialmente pagados cuyo método de pago\nse liquida en el momento (`auto_mark_paid`: tarjeta, domiciliación, PayPal…): registra un\npago por el importe pendiente con la fecha que indique `settles_on` del método. Es la\nversión API del comando `backfill_expense_payments`.\n\nCuerpo: `dry_run` (por defecto `true`: sólo enumera lo que se pagaría); `method` (nombre o\nid de un método de pago que se asigna a los gastos sin método; desconocido → 400); `infer`\n(deducir el método de los gastos sin método a partir del proveedor); `supplier` (id, limitar\na un proveedor); `until` (sólo gastos con fecha ≤ YYYY-MM-DD); `include_pending` (confirmar\ntambién los pendientes antes de pagarlos); `force` (pagar también con métodos no automáticos,\ntransferencia o efectivo, con la fecha de la factura: sólo si el usuario confirma que ya están\npagados). Sin `force`, los gastos sin método automático o ya pagados se omiten. Cada gasto se paga en su propia transacción: un fallo no bloquea a los demás.\nRespuesta: `dry_run`, `paid`, `skipped` y `rows` (una por gasto tratado: `id`, `date`,\n`supplier`, `invoice_number`, `remaining`, `method`, `result` = would_pay | paid | error).\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Registrar pagos automáticos retroactivos",
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BackfillExpensePaymentsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/BackfillExpensePaymentsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/BackfillExpensePaymentsRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expenses/bulk-confirm/": {
      "post": {
        "operationId": "expenses_bulk_confirm_create",
        "description": "Confirma varios gastos pendientes de una vez (p. ej. los registrados por el conector).\n\nCuerpo: `expense_ids` (lista) o `all_pending: true`; `dry_run: true` sólo muestra qué\nse confirmaría y con qué avisos fiscales; `skip_with_warnings: true` deja sin confirmar los\nque tienen avisos (para revisarlos antes); `only_with_attachment: true` exige documento.\nCada gasto se confirma en su propia transacción: un fallo no bloquea a los demás.\nRespuesta: resumen y una fila por gasto (confirmed | skipped + motivo + avisos).\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Confirma varios gastos pendientes de una vez (p. ej. los registrados por el conector)",
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Expense"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expenses/bulk-payment/": {
      "post": {
        "operationId": "expenses_bulk_payment_create",
        "description": "Crear pagos en bloque para múltiples gastos.\n\n**Scope requerido:** `payments:write` (también se acepta `expenses:write`).",
        "summary": "Registrar cobros/pagos en bloque",
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseBulkPaymentRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseBulkPaymentRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseBulkPaymentRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseBulkPaymentResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write",
        "x-scope-alternatives": [
          "expenses:write"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/expenses/exchange-rate/": {
      "get": {
        "operationId": "expenses_exchange_rate_retrieve",
        "description": "Cambio de referencia del BCE: ``?currency=USD&date=YYYY-MM-DD`` → euros por 1 USD.\n\n**Scope requerido:** `expenses:read`.",
        "summary": "Tipo de cambio de referencia (BCE)",
        "parameters": [
          {
            "in": "query",
            "name": "currency",
            "schema": {
              "type": "string"
            },
            "description": "Código ISO de la divisa (USD, GBP…).",
            "required": true
          },
          {
            "in": "query",
            "name": "date",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Día de la factura (por defecto hoy)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read"
      }
    },
    "/api/v1/expenses/gaps/": {
      "get": {
        "operationId": "expenses_gaps_retrieve",
        "description": "Posibles facturas que faltan: por cada proveedor con `recurring_alerts` y\n`expected_frequency`, los periodos (mes, trimestre o año) sin gasto y los saltos en la\nnumeración de sus facturas (`F-100` → `F-103`). Se calcula en el momento; el job\nsemanal guarda el mismo resultado en los ajustes de gastos.\n\n**Scope requerido:** `expenses:read`.",
        "summary": "Posibles facturas que faltan de proveedores recurrentes",
        "parameters": [
          {
            "in": "query",
            "name": "since",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Analizar desde esta fecha (por defecto, los últimos 400 días)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Expense"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read"
      }
    },
    "/api/v1/expenses/settings/": {
      "get": {
        "operationId": "expenses_settings_retrieve",
        "description": "Ajustes del módulo de gastos: confirmación automática al guardar el justificante\n(`auto_confirm_on_attachment`) o al crear una factura con número\n(`auto_confirm_on_create_with_number`) y el último resultado del análisis semanal de\nproveedores recurrentes (`gap_alerts`).\n\n**Scope requerido:** `expenses:read`.",
        "summary": "Ajustes del módulo de gastos",
        "tags": [
          "Gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Expense"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      },
      "patch": {
        "operationId": "expenses_settings_partial_update",
        "description": "Ajustes del módulo de gastos: confirmación automática al guardar el justificante\n(`auto_confirm_on_attachment`) o al crear una factura con número\n(`auto_confirm_on_create_with_number`) y el último resultado del análisis semanal de\nproveedores recurrentes (`gap_alerts`).\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Ajustes del módulo de gastos",
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Expense"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/external-invoices/": {
      "get": {
        "operationId": "external_invoices_list",
        "description": "Registrar, corregir, anular y eliminar facturas de ingreso que no expide\nBillora (p. ej. las que la aseguradora emite a su agente exclusivo).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Listar facturas externas",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "is_rectifying",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "issue_date__gte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "issue_date__lte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "issuer_type",
            "schema": {
              "type": "string",
              "enum": [
                "own",
                "recipient",
                "third_party"
              ]
            },
            "description": "* `own` - Emitida por la organización\n* `recipient` - Autofacturación (emitida por el cliente/destinatario)\n* `third_party` - Emitida por un tercero en nombre de la organización"
          },
          {
            "in": "query",
            "name": "number",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "cancelled",
                "draft",
                "overdue",
                "paid",
                "partially_paid",
                "posted",
                "rectified",
                "sent",
                "verifactu_error",
                "verifactu_pending"
              ]
            },
            "description": "* `draft` - Borrador\n* `posted` - Emitida (sin remisión)\n* `sent` - Emitida/Enviada (remitida a AEAT)\n* `partially_paid` - Parcialmente pagada\n* `paid` - Pagada\n* `overdue` - Vencida\n* `rectified` - Rectificada\n* `cancelled` - Anulada\n* `verifactu_pending` - VeriFactu Pendiente\n* `verifactu_error` - VeriFactu Error"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas externas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedExternalInvoiceList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "post": {
        "operationId": "external_invoices_create",
        "description": "Registrar, corregir, anular y eliminar facturas de ingreso que no expide\nBillora (p. ej. las que la aseguradora emite a su agente exclusivo).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Crear factura externa",
        "tags": [
          "Facturas externas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalInvoiceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExternalInvoiceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExternalInvoiceRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalInvoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/external-invoices/{id}/": {
      "get": {
        "operationId": "external_invoices_retrieve",
        "description": "Registrar, corregir, anular y eliminar facturas de ingreso que no expide\nBillora (p. ej. las que la aseguradora emite a su agente exclusivo).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Obtener factura externa",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas externas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalInvoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "put": {
        "operationId": "external_invoices_update",
        "description": "Registrar, corregir, anular y eliminar facturas de ingreso que no expide\nBillora (p. ej. las que la aseguradora emite a su agente exclusivo).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Reemplazar factura externa",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas externas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalInvoiceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExternalInvoiceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ExternalInvoiceRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalInvoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "patch": {
        "operationId": "external_invoices_partial_update",
        "description": "Registrar, corregir, anular y eliminar facturas de ingreso que no expide\nBillora (p. ej. las que la aseguradora emite a su agente exclusivo).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Actualizar factura externa",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas externas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExternalInvoiceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExternalInvoiceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedExternalInvoiceRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalInvoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "delete": {
        "operationId": "external_invoices_destroy",
        "description": "Elimina un registro hecho por error (p. ej. duplicado). No se puede si\ntiene cobros o rectificativas; su asiento contable se revierte.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Eliminar factura externa",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas externas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/external-invoices/{id}/cancel/": {
      "post": {
        "operationId": "external_invoices_cancel_create",
        "description": "El emisor anuló la factura: queda anulada y se revierte su asiento.\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Anular",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas externas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalInvoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/external-invoices/{id}/document/": {
      "get": {
        "operationId": "external_invoices_document_retrieve",
        "description": "Descarga el documento original (PDF/imagen) de la factura.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Descargar el documento original",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas externas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "Documento original (PDF o imagen).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      }
    },
    "/api/v1/features/": {
      "get": {
        "operationId": "features_list",
        "description": "Catálogo de funcionalidades y límites que pueden incluir los planes (sólo lectura).\n\n**Scope requerido:** `account:read`.",
        "summary": "Listar funcionalidades",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedFeatureList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read"
      }
    },
    "/api/v1/features/{id}/": {
      "get": {
        "operationId": "features_retrieve",
        "description": "Catálogo de funcionalidades y límites que pueden incluir los planes (sólo lectura).\n\n**Scope requerido:** `account:read`.",
        "summary": "Obtener funcionalidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este feature.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Feature"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read"
      }
    },
    "/api/v1/hr/contracts/": {
      "get": {
        "operationId": "hr_contracts_list",
        "description": "Listar contratos (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar contratos",
        "parameters": [
          {
            "in": "query",
            "name": "contract_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "employee",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "is_current",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedContractList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_contracts_create",
        "description": "Crear contrato (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear contrato",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContractRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ContractRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ContractRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contract"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/contracts/{id}/": {
      "get": {
        "operationId": "hr_contracts_retrieve",
        "description": "Obtener contrato (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener contrato",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este contract.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contract"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_contracts_update",
        "description": "Reemplazar contrato (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar contrato",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este contract.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContractRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ContractRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ContractRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contract"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_contracts_partial_update",
        "description": "Actualizar contrato (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar contrato",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este contract.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedContractRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedContractRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedContractRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contract"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_contracts_destroy",
        "description": "Eliminar contrato (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar contrato",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este contract.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/dashboard/": {
      "get": {
        "operationId": "hr_dashboard_retrieve",
        "description": "Indicadores de RRHH: empleados activos y de baja, ausencias pendientes y fichajes de hoy.\n\n**Scope requerido:** `hr:read`.",
        "summary": "Indicadores de RRHH",
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HRDashboard"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/hr/departments/": {
      "get": {
        "operationId": "hr_departments_list",
        "description": "Listar departamentos (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar departamentos",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedDepartmentList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_departments_create",
        "description": "Crear departamento (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear departamento",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Department"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/departments/{id}/": {
      "get": {
        "operationId": "hr_departments_retrieve",
        "description": "Obtener departamento (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener departamento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este department.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Department"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_departments_update",
        "description": "Reemplazar departamento (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar departamento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este department.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Department"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_departments_partial_update",
        "description": "Actualizar departamento (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar departamento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este department.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDepartmentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDepartmentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDepartmentRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Department"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_departments_destroy",
        "description": "Eliminar departamento (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar departamento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este department.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/documents/": {
      "get": {
        "operationId": "hr_documents_list",
        "description": "Listar documentos de empleados (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar documentos de empleados",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "doc_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "employee",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedEmployeeDocumentList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_documents_create",
        "description": "Crear documento de empleado (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear documento de empleado",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeDocumentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeDocumentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeDocumentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployeeDocument"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/documents/{id}/": {
      "get": {
        "operationId": "hr_documents_retrieve",
        "description": "Obtener documento de empleado (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener documento de empleado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este employee document.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployeeDocument"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_documents_update",
        "description": "Reemplazar documento de empleado (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar documento de empleado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este employee document.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeDocumentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeDocumentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeDocumentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployeeDocument"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_documents_partial_update",
        "description": "Actualizar documento de empleado (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar documento de empleado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este employee document.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEmployeeDocumentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEmployeeDocumentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEmployeeDocumentRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployeeDocument"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_documents_destroy",
        "description": "Eliminar documento de empleado (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar documento de empleado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este employee document.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/employees/": {
      "get": {
        "operationId": "hr_employees_list",
        "description": "Listar empleados (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar empleados",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "department",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "work_center",
            "schema": {
              "type": "number"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedEmployeeListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_employees_create",
        "description": "Crear empleado (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear empleado",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeDetailRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployeeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/employees/{id}/": {
      "get": {
        "operationId": "hr_employees_retrieve",
        "description": "Obtener empleado (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener empleado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este employee.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployeeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_employees_update",
        "description": "Reemplazar empleado (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar empleado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este employee.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeDetailRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployeeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_employees_partial_update",
        "description": "Actualizar empleado (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar empleado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este employee.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEmployeeDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEmployeeDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedEmployeeDetailRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployeeDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_employees_destroy",
        "description": "Eliminar empleado (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar empleado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este employee.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/holidays/": {
      "get": {
        "operationId": "hr_holidays_list",
        "description": "Listar festivos (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar festivos",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedHolidayList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_holidays_create",
        "description": "Crear festivo (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear festivo",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HolidayRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/HolidayRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/HolidayRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Holiday"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/holidays/{id}/": {
      "get": {
        "operationId": "hr_holidays_retrieve",
        "description": "Obtener festivo (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener festivo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este holiday.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Holiday"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_holidays_update",
        "description": "Reemplazar festivo (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar festivo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este holiday.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HolidayRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/HolidayRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/HolidayRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Holiday"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_holidays_partial_update",
        "description": "Actualizar festivo (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar festivo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este holiday.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedHolidayRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedHolidayRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedHolidayRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Holiday"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_holidays_destroy",
        "description": "Eliminar festivo (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar festivo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este holiday.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/leave-balances/": {
      "get": {
        "operationId": "hr_leave_balances_list",
        "description": "CRUD de saldos (ajustes manuales de RRHH). Filtros: employee, leave_type, year.\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar saldos de ausencias",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "employee",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "leave_type",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "year",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedLeaveBalanceList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_leave_balances_create",
        "description": "CRUD de saldos (ajustes manuales de RRHH). Filtros: employee, leave_type, year.\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear saldo de ausencias",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeaveBalanceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/LeaveBalanceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/LeaveBalanceRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveBalance"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/leave-balances/{id}/": {
      "get": {
        "operationId": "hr_leave_balances_retrieve",
        "description": "CRUD de saldos (ajustes manuales de RRHH). Filtros: employee, leave_type, year.\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener saldo de ausencias",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave balance.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveBalance"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_leave_balances_update",
        "description": "CRUD de saldos (ajustes manuales de RRHH). Filtros: employee, leave_type, year.\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar saldo de ausencias",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave balance.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeaveBalanceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/LeaveBalanceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/LeaveBalanceRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveBalance"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_leave_balances_partial_update",
        "description": "CRUD de saldos (ajustes manuales de RRHH). Filtros: employee, leave_type, year.\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar saldo de ausencias",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave balance.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeaveBalanceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeaveBalanceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeaveBalanceRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveBalance"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_leave_balances_destroy",
        "description": "CRUD de saldos (ajustes manuales de RRHH). Filtros: employee, leave_type, year.\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar saldo de ausencias",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave balance.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/leave-requests/": {
      "get": {
        "operationId": "hr_leave_requests_list",
        "description": "Listar solicitudes de ausencia (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar solicitudes de ausencia",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "employee",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "leave_type",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedLeaveRequestList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_leave_requests_create",
        "description": "Crear solicitud de ausencia (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear solicitud de ausencia",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeaveRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/LeaveRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/LeaveRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveRequest"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/leave-requests/{id}/": {
      "get": {
        "operationId": "hr_leave_requests_retrieve",
        "description": "Obtener solicitud de ausencia (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener solicitud de ausencia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveRequest"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_leave_requests_update",
        "description": "Reemplazar solicitud de ausencia (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar solicitud de ausencia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeaveRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/LeaveRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/LeaveRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveRequest"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_leave_requests_partial_update",
        "description": "Actualizar solicitud de ausencia (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar solicitud de ausencia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeaveRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeaveRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeaveRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveRequest"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_leave_requests_destroy",
        "description": "Eliminar solicitud de ausencia (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar solicitud de ausencia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/leave-requests/{id}/approve/": {
      "post": {
        "operationId": "hr_leave_requests_approve_create",
        "description": "Aprobar la ausencia (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Aprobar la ausencia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveRequest"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/leave-requests/{id}/cancel/": {
      "post": {
        "operationId": "hr_leave_requests_cancel_create",
        "description": "Cancela una solicitud pendiente o aprobada restituyendo el saldo.\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `hr:write`.",
        "summary": "Cancelar la ausencia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveRequest"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/leave-requests/{id}/reject/": {
      "post": {
        "operationId": "hr_leave_requests_reject_create",
        "description": "Rechazar la ausencia (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Rechazar la ausencia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeaveRejectRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/LeaveRejectRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/LeaveRejectRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveRequest"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/leave-types/": {
      "get": {
        "operationId": "hr_leave_types_list",
        "description": "Listar tipos de ausencia (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar tipos de ausencia",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedLeaveTypeList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_leave_types_create",
        "description": "Crear tipo de ausencia (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear tipo de ausencia",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeaveTypeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/LeaveTypeRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/LeaveTypeRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/leave-types/{id}/": {
      "get": {
        "operationId": "hr_leave_types_retrieve",
        "description": "Obtener tipo de ausencia (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener tipo de ausencia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_leave_types_update",
        "description": "Reemplazar tipo de ausencia (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar tipo de ausencia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeaveTypeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/LeaveTypeRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/LeaveTypeRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_leave_types_partial_update",
        "description": "Actualizar tipo de ausencia (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar tipo de ausencia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeaveTypeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeaveTypeRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedLeaveTypeRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaveType"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_leave_types_destroy",
        "description": "Eliminar tipo de ausencia (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar tipo de ausencia",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este leave type.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/payroll/": {
      "get": {
        "operationId": "hr_payroll_list",
        "description": "Listar nóminas (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar nóminas",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "employee",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "period_month",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "period_year",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedPayrollRecordList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_payroll_create",
        "description": "Crear nómina (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear nómina",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PayrollRecordRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PayrollRecordRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PayrollRecordRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayrollRecord"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/payroll/{id}/": {
      "get": {
        "operationId": "hr_payroll_retrieve",
        "description": "Obtener nómina (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener nómina",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este payroll record.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayrollRecord"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_payroll_update",
        "description": "Reemplazar nómina (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar nómina",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este payroll record.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PayrollRecordRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PayrollRecordRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PayrollRecordRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayrollRecord"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_payroll_partial_update",
        "description": "Actualizar nómina (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar nómina",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este payroll record.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPayrollRecordRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPayrollRecordRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPayrollRecordRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayrollRecord"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_payroll_destroy",
        "description": "Eliminar nómina (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar nómina",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este payroll record.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/positions/": {
      "get": {
        "operationId": "hr_positions_list",
        "description": "Listar puestos (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar puestos",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedPositionList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_positions_create",
        "description": "Crear puesto (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear puesto",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PositionRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PositionRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PositionRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Position"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/positions/{id}/": {
      "get": {
        "operationId": "hr_positions_retrieve",
        "description": "Obtener puesto (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener puesto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este position.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Position"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_positions_update",
        "description": "Reemplazar puesto (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar puesto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este position.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PositionRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PositionRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PositionRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Position"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_positions_partial_update",
        "description": "Actualizar puesto (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar puesto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este position.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPositionRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPositionRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPositionRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Position"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_positions_destroy",
        "description": "Eliminar puesto (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar puesto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este position.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/qr-codes/": {
      "get": {
        "operationId": "hr_qr_codes_list",
        "description": "Listar códigos QR de fichaje (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar códigos QR de fichaje",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedTimeTrackingQRList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_qr_codes_create",
        "description": "Crear código QR de fichaje (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear código QR de fichaje",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TimeTrackingQRRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TimeTrackingQRRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TimeTrackingQRRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeTrackingQR"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/qr-codes/{id}/": {
      "get": {
        "operationId": "hr_qr_codes_retrieve",
        "description": "Obtener código QR de fichaje (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener código QR de fichaje",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este QR Code.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeTrackingQR"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_qr_codes_update",
        "description": "Reemplazar código QR de fichaje (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar código QR de fichaje",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este QR Code.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TimeTrackingQRRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TimeTrackingQRRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TimeTrackingQRRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeTrackingQR"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_qr_codes_partial_update",
        "description": "Actualizar código QR de fichaje (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar código QR de fichaje",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este QR Code.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTimeTrackingQRRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTimeTrackingQRRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTimeTrackingQRRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeTrackingQR"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_qr_codes_destroy",
        "description": "Eliminar código QR de fichaje (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar código QR de fichaje",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este QR Code.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/qr-codes/{id}/regenerate/": {
      "post": {
        "operationId": "hr_qr_codes_regenerate_create",
        "description": "Regenerar el código (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Regenerar el código",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este QR Code.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeTrackingQR"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/settings/": {
      "get": {
        "operationId": "hr_settings_retrieve",
        "description": "Ajustes del módulo de RRHH.\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener ajustes del módulo de RRHH",
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HRSettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      },
      "patch": {
        "operationId": "hr_settings_partial_update",
        "description": "Ajustes del módulo de RRHH.\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar ajustes del módulo de RRHH",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedHRSettingsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedHRSettingsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedHRSettingsRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HRSettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/time-entries/": {
      "get": {
        "operationId": "hr_time_entries_list",
        "description": "Listar fichajes (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar fichajes",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "employee",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "source",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedTimeEntryList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_time_entries_create",
        "description": "Crear fichaje (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear fichaje",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TimeEntryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TimeEntryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TimeEntryRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/time-entries/{id}/": {
      "get": {
        "operationId": "hr_time_entries_retrieve",
        "description": "Obtener fichaje (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener fichaje",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este time entry.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_time_entries_update",
        "description": "Reemplazar fichaje (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar fichaje",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este time entry.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TimeEntryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TimeEntryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TimeEntryRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_time_entries_partial_update",
        "description": "Actualizar fichaje (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar fichaje",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este time entry.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTimeEntryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTimeEntryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTimeEntryRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeEntry"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_time_entries_destroy",
        "description": "Eliminar fichaje (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar fichaje",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este time entry.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/time-report/{employee_id}/": {
      "get": {
        "operationId": "hr_time_report_retrieve",
        "description": "GET /hr/time-report/<employee_id>/?month=3&year=2026\nGenera un PDF del registro horario conforme al RD 8/2019.\n\n**Scope requerido:** `hr:read`.",
        "summary": "Descargar el registro horario mensual (PDF)",
        "parameters": [
          {
            "in": "path",
            "name": "employee_id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "month",
            "schema": {
              "type": "integer"
            },
            "description": "Mes (1–12, por defecto el actual)."
          },
          {
            "in": "query",
            "name": "year",
            "schema": {
              "type": "integer"
            },
            "description": "Año (por defecto el actual)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "Registro horario (RD 8/2019).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      }
    },
    "/api/v1/hr/work-centers/": {
      "get": {
        "operationId": "hr_work_centers_list",
        "description": "Listar centros de trabajo (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar centros de trabajo",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedWorkCenterList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_work_centers_create",
        "description": "Crear centro de trabajo (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear centro de trabajo",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkCenterRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/WorkCenterRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/WorkCenterRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkCenter"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/work-centers/{id}/": {
      "get": {
        "operationId": "hr_work_centers_retrieve",
        "description": "Obtener centro de trabajo (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener centro de trabajo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este work center.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkCenter"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_work_centers_update",
        "description": "Reemplazar centro de trabajo (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar centro de trabajo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este work center.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkCenterRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/WorkCenterRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/WorkCenterRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkCenter"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_work_centers_partial_update",
        "description": "Actualizar centro de trabajo (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar centro de trabajo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este work center.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedWorkCenterRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedWorkCenterRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedWorkCenterRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkCenter"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_work_centers_destroy",
        "description": "Eliminar centro de trabajo (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar centro de trabajo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este work center.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/hr/work-schedules/": {
      "get": {
        "operationId": "hr_work_schedules_list",
        "description": "Listar horarios (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Listar horarios",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedWorkScheduleList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "post": {
        "operationId": "hr_work_schedules_create",
        "description": "Crear horario (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Crear horario",
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkScheduleWriteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/WorkScheduleWriteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/WorkScheduleWriteRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkScheduleWrite"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/hr/work-schedules/{id}/": {
      "get": {
        "operationId": "hr_work_schedules_retrieve",
        "description": "Obtener horario (RRHH).\n\n**Scope requerido:** `hr:read`.",
        "summary": "Obtener horario",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este work schedule.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSchedule"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:read"
      },
      "put": {
        "operationId": "hr_work_schedules_update",
        "description": "Reemplazar horario (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Reemplazar horario",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este work schedule.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkScheduleWriteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/WorkScheduleWriteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/WorkScheduleWriteRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkScheduleWrite"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "patch": {
        "operationId": "hr_work_schedules_partial_update",
        "description": "Actualizar horario (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Actualizar horario",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este work schedule.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedWorkScheduleWriteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedWorkScheduleWriteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedWorkScheduleWriteRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkScheduleWrite"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      },
      "delete": {
        "operationId": "hr_work_schedules_destroy",
        "description": "Eliminar horario (RRHH).\n\n**Scope requerido:** `hr:write`.",
        "summary": "Eliminar horario",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este work schedule.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "RRHH"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "hr:write"
      }
    },
    "/api/v1/imports/": {
      "get": {
        "operationId": "imports_list",
        "description": "Importaciones desde Excel (.xlsx): subir y validar (`upload`), revisar la vista previa y los\nerrores, procesar (`process`) y consultar el resultado fila a fila (`rows`).\n\nCon API key, además de `imports:write` hace falta el scope de escritura del recurso\nimportado (`contacts:write`, `products:write`, `invoices:write` o `expenses:write`).\n\n**Scope requerido:** `imports:read`.",
        "summary": "Listar importaciones",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "import_type",
            "schema": {
              "type": "string",
              "enum": [
                "contacts",
                "customers",
                "expenses",
                "external_invoices",
                "invoices",
                "products",
                "suppliers"
              ]
            },
            "description": "* `customers` - Clientes\n* `suppliers` - Proveedores\n* `products` - Productos\n* `invoices` - Facturas\n* `expenses` - Gastos\n* `contacts` - Personas de contacto\n* `external_invoices` - Facturas emitidas por clientes/terceros (autofacturación)"
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "completed",
                "completed_with_errors",
                "failed",
                "pending",
                "processing",
                "validated",
                "validating",
                "validation_error"
              ]
            },
            "description": "* `pending` - Pendiente\n* `validating` - Validando\n* `validated` - Validado\n* `validation_error` - Error de validación\n* `processing` - Procesando\n* `completed` - Completado\n* `completed_with_errors` - Completado con errores\n* `failed` - Fallido"
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Importaciones"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedImportJobList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "imports:read"
      },
      "post": {
        "operationId": "imports_create",
        "description": "Importaciones desde Excel (.xlsx): subir y validar (`upload`), revisar la vista previa y los\nerrores, procesar (`process`) y consultar el resultado fila a fila (`rows`).\n\nCon API key, además de `imports:write` hace falta el scope de escritura del recurso\nimportado (`contacts:write`, `products:write`, `invoices:write` o `expenses:write`).\n\n**Scope requerido:** `imports:write`.",
        "summary": "Crear importación",
        "tags": [
          "Importaciones"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportJobRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ImportJobRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ImportJobRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportJob"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "imports:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/imports/{id}/": {
      "get": {
        "operationId": "imports_retrieve",
        "description": "Importaciones desde Excel (.xlsx): subir y validar (`upload`), revisar la vista previa y los\nerrores, procesar (`process`) y consultar el resultado fila a fila (`rows`).\n\nCon API key, además de `imports:write` hace falta el scope de escritura del recurso\nimportado (`contacts:write`, `products:write`, `invoices:write` o `expenses:write`).\n\n**Scope requerido:** `imports:read`.",
        "summary": "Obtener importación",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este import job.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Importaciones"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportJob"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "imports:read"
      },
      "delete": {
        "operationId": "imports_destroy",
        "description": "Importaciones desde Excel (.xlsx): subir y validar (`upload`), revisar la vista previa y los\nerrores, procesar (`process`) y consultar el resultado fila a fila (`rows`).\n\nCon API key, además de `imports:write` hace falta el scope de escritura del recurso\nimportado (`contacts:write`, `products:write`, `invoices:write` o `expenses:write`).\n\n**Scope requerido:** `imports:write`.",
        "summary": "Eliminar importación",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este import job.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Importaciones"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "imports:write"
      }
    },
    "/api/v1/imports/{id}/process/": {
      "post": {
        "operationId": "imports_process_create",
        "description": "Procesa (importa) un trabajo validado. Hasta 200 filas se procesa en el momento; si\nhay más, en segundo plano (consulta el trabajo hasta que esté `completed`). Las filas con\nerrores se omiten. Opciones: `update_existing`, `skip_duplicates`, `import_as_issued`.\n\n**Scope requerido:** `imports:write`.",
        "summary": "Procesar la importación",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este import job.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Importaciones"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportProcessRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ImportProcessRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ImportProcessRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportJob"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "imports:write"
      }
    },
    "/api/v1/imports/{id}/rows/": {
      "get": {
        "operationId": "imports_rows_list",
        "description": "Resultado fila a fila del trabajo (`?status=success|error|skipped`).\n\n**Scope requerido:** `imports:read`.",
        "summary": "Resultado por fila",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este import job.",
            "required": true
          },
          {
            "in": "query",
            "name": "import_type",
            "schema": {
              "type": "string",
              "enum": [
                "contacts",
                "customers",
                "expenses",
                "external_invoices",
                "invoices",
                "products",
                "suppliers"
              ]
            },
            "description": "* `customers` - Clientes\n* `suppliers` - Proveedores\n* `products` - Productos\n* `invoices` - Facturas\n* `expenses` - Gastos\n* `contacts` - Personas de contacto\n* `external_invoices` - Facturas emitidas por clientes/terceros (autofacturación)"
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "completed",
                "completed_with_errors",
                "failed",
                "pending",
                "processing",
                "validated",
                "validating",
                "validation_error"
              ]
            },
            "description": "* `pending` - Pendiente\n* `validating` - Validando\n* `validated` - Validado\n* `validation_error` - Error de validación\n* `processing` - Procesando\n* `completed` - Completado\n* `completed_with_errors` - Completado con errores\n* `failed` - Fallido"
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Importaciones"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedImportRowList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "imports:read"
      }
    },
    "/api/v1/imports/template/{import_type}/": {
      "get": {
        "operationId": "imports_template_retrieve",
        "description": "Descarga la plantilla Excel (.xlsx) del tipo de importación.\n\n**Scope requerido:** `imports:read`.",
        "summary": "Descargar la plantilla Excel",
        "parameters": [
          {
            "in": "path",
            "name": "import_type",
            "schema": {
              "type": "string",
              "pattern": "^[a-z_]+$"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Importaciones"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "Plantilla Excel (.xlsx).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "imports:read"
      }
    },
    "/api/v1/imports/types/": {
      "get": {
        "operationId": "imports_types_list",
        "description": "Tipos de importación admitidos con sus columnas (nombre, ejemplo y si es obligatoria).\n\n**Scope requerido:** `imports:read`.",
        "summary": "Tipos de importación",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "import_type",
            "schema": {
              "type": "string",
              "enum": [
                "contacts",
                "customers",
                "expenses",
                "external_invoices",
                "invoices",
                "products",
                "suppliers"
              ]
            },
            "description": "* `customers` - Clientes\n* `suppliers` - Proveedores\n* `products` - Productos\n* `invoices` - Facturas\n* `expenses` - Gastos\n* `contacts` - Personas de contacto\n* `external_invoices` - Facturas emitidas por clientes/terceros (autofacturación)"
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "completed",
                "completed_with_errors",
                "failed",
                "pending",
                "processing",
                "validated",
                "validating",
                "validation_error"
              ]
            },
            "description": "* `pending` - Pendiente\n* `validating` - Validando\n* `validated` - Validado\n* `validation_error` - Error de validación\n* `processing` - Procesando\n* `completed` - Completado\n* `completed_with_errors` - Completado con errores\n* `failed` - Fallido"
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Importaciones"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedImportTypeList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "imports:read"
      }
    },
    "/api/v1/imports/upload/": {
      "post": {
        "operationId": "imports_upload_create",
        "description": "Sube un Excel (.xlsx, máx. 10 MB) y lo valida: crea el trabajo con la vista previa\n(primeras filas) y los errores encontrados. No importa nada hasta llamar a `process`.\n\n**Scope requerido:** `imports:write`.",
        "summary": "Subir y validar un archivo",
        "tags": [
          "Importaciones"
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ImportJobUploadRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportJob"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "imports:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/income-categories/": {
      "get": {
        "operationId": "income_categories_list",
        "description": "Categorías de ingreso.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Listar categorías de ingreso",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "is_active",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Categorías de ingreso"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedIncomeCategoryList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "post": {
        "operationId": "income_categories_create",
        "description": "Categorías de ingreso.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Crear categoría de ingreso",
        "tags": [
          "Categorías de ingreso"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IncomeCategoryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/IncomeCategoryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/IncomeCategoryRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IncomeCategory"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/income-categories/{id}/": {
      "get": {
        "operationId": "income_categories_retrieve",
        "description": "Categorías de ingreso.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Obtener categoría de ingreso",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Categoría de ingreso.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Categorías de ingreso"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IncomeCategory"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "put": {
        "operationId": "income_categories_update",
        "description": "Categorías de ingreso.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Reemplazar categoría de ingreso",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Categoría de ingreso.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Categorías de ingreso"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IncomeCategoryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/IncomeCategoryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/IncomeCategoryRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IncomeCategory"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "patch": {
        "operationId": "income_categories_partial_update",
        "description": "Categorías de ingreso.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Actualizar categoría de ingreso",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Categoría de ingreso.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Categorías de ingreso"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedIncomeCategoryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedIncomeCategoryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedIncomeCategoryRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IncomeCategory"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "delete": {
        "operationId": "income_categories_destroy",
        "description": "Categorías de ingreso.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Eliminar categoría de ingreso",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Categoría de ingreso.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Categorías de ingreso"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/integrations/dropbox/status/": {
      "get": {
        "operationId": "integrations_dropbox_status_retrieve",
        "description": "Estado de la sincronización con Dropbox (sin tokens).\n\n**Scope requerido:** `account:read`.",
        "summary": "Estado de la sincronización con Dropbox (sin tokens)",
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/integrations/google-drive/status/": {
      "get": {
        "operationId": "integrations_google_drive_status_retrieve",
        "description": "Estado de la sincronización con Google Drive (sin tokens).\n\n**Scope requerido:** `account:read`.",
        "summary": "Estado de la sincronización con Google Drive (sin tokens)",
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/integrations/shopify/status/": {
      "get": {
        "operationId": "integrations_shopify_status_retrieve",
        "description": "Estado y configuración de la integración con Shopify (sin tokens).\n\n**Scope requerido:** `account:read`.",
        "summary": "Estado y configuración de la integración con Shopify (sin tokens)",
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/integrations/status/": {
      "get": {
        "operationId": "integrations_status_retrieve",
        "description": "Proveedor de almacenamiento en la nube activo (Google Drive o Dropbox) y su estado.\n\n**Scope requerido:** `account:read`.",
        "summary": "Proveedor de almacenamiento en la nube activo (Google Drive o Dropbox) y su estado",
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/integrations/stripe-connect/status/": {
      "get": {
        "operationId": "integrations_stripe_connect_status_retrieve",
        "description": "Estado de la cuenta de Stripe Connect conectada para cobrar facturas (sin claves).\n\n**Scope requerido:** `account:read`.",
        "summary": "Estado de la cuenta de Stripe Connect conectada para cobrar facturas (sin claves)",
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/invoice-payment-methods/": {
      "get": {
        "operationId": "invoice_payment_methods_list",
        "description": "Métodos de cobro de facturas (transferencia, tarjeta, Bizum…).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Listar métodos de cobro",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Métodos de cobro"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedInvoicePaymentMethodList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "post": {
        "operationId": "invoice_payment_methods_create",
        "description": "Métodos de cobro de facturas (transferencia, tarjeta, Bizum…).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Crear método de cobro",
        "tags": [
          "Métodos de cobro"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvoicePaymentMethodRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/InvoicePaymentMethodRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/InvoicePaymentMethodRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoicePaymentMethod"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/invoice-payment-methods/{id}/": {
      "get": {
        "operationId": "invoice_payment_methods_retrieve",
        "description": "Métodos de cobro de facturas (transferencia, tarjeta, Bizum…).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Obtener método de cobro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Método de pago de factura.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Métodos de cobro"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoicePaymentMethod"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "put": {
        "operationId": "invoice_payment_methods_update",
        "description": "Métodos de cobro de facturas (transferencia, tarjeta, Bizum…).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Reemplazar método de cobro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Método de pago de factura.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Métodos de cobro"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvoicePaymentMethodRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/InvoicePaymentMethodRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/InvoicePaymentMethodRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoicePaymentMethod"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "patch": {
        "operationId": "invoice_payment_methods_partial_update",
        "description": "Métodos de cobro de facturas (transferencia, tarjeta, Bizum…).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Actualizar método de cobro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Método de pago de factura.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Métodos de cobro"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedInvoicePaymentMethodRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedInvoicePaymentMethodRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedInvoicePaymentMethodRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoicePaymentMethod"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "delete": {
        "operationId": "invoice_payment_methods_destroy",
        "description": "Métodos de cobro de facturas (transferencia, tarjeta, Bizum…).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Eliminar método de cobro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Método de pago de factura.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Métodos de cobro"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoice-templates/": {
      "get": {
        "operationId": "invoice_templates_list",
        "description": "Diseños de factura de la organización (uno por diseño, con colores, textos de cabecera y pie\ny logo). El diseño activo (`activate`) es el que se usa en los PDF.\n\n**Scope requerido:** `settings:read`.",
        "summary": "Listar diseños de factura",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Diseños de factura"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedInvoiceTemplateList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:read"
      },
      "post": {
        "operationId": "invoice_templates_create",
        "description": "Diseños de factura de la organización (uno por diseño, con colores, textos de cabecera y pie\ny logo). El diseño activo (`activate`) es el que se usa en los PDF.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Crear diseño de factura",
        "tags": [
          "Diseños de factura"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceTemplateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceTemplateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceTemplateRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/invoice-templates/{id}/": {
      "get": {
        "operationId": "invoice_templates_retrieve",
        "description": "Diseños de factura de la organización (uno por diseño, con colores, textos de cabecera y pie\ny logo). El diseño activo (`activate`) es el que se usa en los PDF.\n\n**Scope requerido:** `settings:read`.",
        "summary": "Obtener diseño de factura",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Diseños de factura"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:read"
      },
      "put": {
        "operationId": "invoice_templates_update",
        "description": "Diseños de factura de la organización (uno por diseño, con colores, textos de cabecera y pie\ny logo). El diseño activo (`activate`) es el que se usa en los PDF.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Reemplazar diseño de factura",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Diseños de factura"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceTemplateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceTemplateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceTemplateRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      },
      "patch": {
        "operationId": "invoice_templates_partial_update",
        "description": "Diseños de factura de la organización (uno por diseño, con colores, textos de cabecera y pie\ny logo). El diseño activo (`activate`) es el que se usa en los PDF.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Actualizar diseño de factura",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Diseños de factura"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedInvoiceTemplateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedInvoiceTemplateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedInvoiceTemplateRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      },
      "delete": {
        "operationId": "invoice_templates_destroy",
        "description": "Diseños de factura de la organización (uno por diseño, con colores, textos de cabecera y pie\ny logo). El diseño activo (`activate`) es el que se usa en los PDF.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Eliminar diseño de factura",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Diseños de factura"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      }
    },
    "/api/v1/invoice-templates/{id}/activate/": {
      "post": {
        "operationId": "invoice_templates_activate_create",
        "description": "Activa el diseño: pasa a usarse en los PDF de la organización (desactiva el resto).\n\n**Scope requerido:** `settings:write`.",
        "summary": "Activar el diseño",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Diseños de factura"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      }
    },
    "/api/v1/invoice-templates/{id}/download-preview/": {
      "get": {
        "operationId": "invoice_templates_download_preview_retrieve",
        "description": "Descarga un PDF de muestra del diseño con datos de ejemplo (`doc_type`, `verifactu`,\n`draft`, `primary_color`, `secondary_color`, `header_text`, `footer_text`). No se guarda.\n\n**Scope requerido:** `settings:read`.",
        "summary": "Descargar un PDF de muestra",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Diseños de factura"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "Archivo PDF.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:read"
      }
    },
    "/api/v1/invoice-templates/available-types/": {
      "get": {
        "operationId": "invoice_templates_available_types_list",
        "description": "Diseños disponibles con sus metadatos (categoría, uso recomendado,\ntipografías y colores por defecto) para la galería del frontend.\n\n**Scope requerido:** `settings:read`.",
        "summary": "Diseños disponibles",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Diseños de factura"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedInvoiceDesignList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:read"
      }
    },
    "/api/v1/invoice-templates/preview-settings/": {
      "get": {
        "operationId": "invoice_templates_preview_settings_retrieve",
        "description": "Ajustes de la galería: modo VeriFactu actual de la organización (para\nel valor por defecto del interruptor de la previsualización) y\ncategorías de diseños.\n\n**Scope requerido:** `settings:read`.",
        "summary": "Ajustes de la previsualización",
        "tags": [
          "Diseños de factura"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/invoices/": {
      "get": {
        "operationId": "invoices_list",
        "description": "Listar facturas (Facturas).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Listar facturas",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "is_rectifying",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "is_simplified",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "number",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "rectifies",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "total_max",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "total_min",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedInvoiceListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "post": {
        "operationId": "invoices_create",
        "description": "Crear factura (Facturas).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Crear factura",
        "tags": [
          "Facturas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/invoices/{id}/": {
      "get": {
        "operationId": "invoices_retrieve",
        "description": "Obtener factura (Facturas).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Obtener factura",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "put": {
        "operationId": "invoices_update",
        "description": "Reemplazar factura (Facturas).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Reemplazar factura",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "patch": {
        "operationId": "invoices_partial_update",
        "description": "Actualizar factura (Facturas).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Actualizar factura",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedInvoiceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedInvoiceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedInvoiceRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "delete": {
        "operationId": "invoices_destroy",
        "description": "A1: solo se pueden eliminar documentos en borrador.\n\nLos documentos emitidos/enviados (con número asignado y/o registro\nVeriFactu) no deben borrarse nunca por integridad legal: para revertirlos\nse usa la anulación (cancel) o una factura rectificativa.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Eliminar factura",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoices/{id}/cancel/": {
      "post": {
        "operationId": "invoices_cancel_create",
        "description": "Anula la factura. Si tiene cobros (pagada o parcialmente pagada) sólo se anula con\n``refund=true`` (query o body): se registran devoluciones (``Payment`` con ``is_refund``\ne importe negativo: Debe 4300xxxx / Haber 572) por lo cobrado y después el extorno del\nasiento; sin ``refund`` responde 400 ``refund_required``.\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Anular",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoices/{id}/collect-payment/": {
      "post": {
        "operationId": "invoices_collect_payment_create",
        "description": "Create a Stripe Payment Link and send the invoice + link by email.\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Crear enlace de pago",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectPaymentRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CollectPaymentRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CollectPaymentRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectPaymentResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoices/{id}/convert-to-full/": {
      "post": {
        "operationId": "invoices_convert_to_full_create",
        "description": "Crea en borrador la factura completa que SUSTITUYE a una factura simplificada ya expedida (canje, art. 7 del Reglamento de facturación), para un cliente identificado con NIF y domicilio. Copia las líneas, la moneda y el criterio de precios, y fija como fecha de operación la del devengo de la simplificada, de modo que el IVA sigue declarándose en el mismo periodo. Al emitirla (`send`) se registra en VeriFactu como **F3** con el bloque FacturasSustituidas; la simplificada queda «anulada por canje» (sin registro de anulación en VeriFactu: sigue siendo válida ante la AEAT como factura sustituida), deja de contar en libros, modelos y contabilidad —la sustituye la completa— y sus cobros pasan a la nueva factura.",
        "summary": "Canjear una factura simplificada por una factura completa (F3)",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceConvertToFullRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceConvertToFullRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceConvertToFullRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceConvertToFullResponse"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "description": "La factura no es una simplificada expedida, ya está canjeada o rectificada, o falta el cliente identificado."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoices/{id}/correct-imported/": {
      "post": {
        "operationId": "invoices_correct_imported_create",
        "description": "Corrige una factura IMPORTADA «como emitida» (expedida fuera de Billora y traída con una\nimportación) cuando la importación trajo un dato erróneo: ``lines`` (sustituyen a todas),\n``issue_date``, ``number`` y ``customer``. Sólo los campos enviados.\n\nRequisitos: la factura no ha pasado por VeriFactu (sin registro, huella ni QR), su número no lo\nasignó una serie de Billora, no está anulada ni rectificada y ni su fecha anterior ni la nueva caen en\nun periodo contable bloqueado. Las facturas emitidas por Billora o registradas en VeriFactu responden\n409: ésas sólo se corrigen con una factura rectificativa.\n\nEfectos: recalcula totales, saldo y estado, regulariza el asiento contable, ajusta los cobros\nindicados en ``adjust_payments`` (``amount`` 0 elimina el cobro; es obligatorio cuando lo cobrado\nsupera el total corregido) y deja traza en ``metadata.corrections`` (quién, cuándo, motivo y valores\nanteriores). Sólo propietario o administrador; con API key, scope ``invoices:write``.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Corregir una factura importada como emitida",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportedInvoiceCorrectionRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ImportedInvoiceCorrectionRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ImportedInvoiceCorrectionRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "description": "Datos no válidos: número duplicado, los cobros superan el total corregido (indica ``adjust_payments``), nada que corregir…"
          },
          "409": {
            "description": "La factura no admite corrección: ``not_imported_invoice`` (la emitió Billora), ``verifactu_registered`` (tiene registro, huella o QR de VeriFactu), ``external_invoice``, ``invoice_is_draft``, ``invoice_cancelled``, ``invoice_rectified``, ``payment_reconciled`` o ``period_locked`` (periodo contable bloqueado o ejercicio cerrado)."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoices/{id}/create-rectifying/": {
      "post": {
        "operationId": "invoices_create_rectifying_create",
        "description": "Crea una factura rectificativa basada en la factura actual\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Crear factura rectificativa",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RectifyingInvoiceRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RectifyingInvoiceRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RectifyingInvoiceRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RectifyingInvoiceCreated"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoices/{id}/download-facturae/": {
      "get": {
        "operationId": "invoices_download_facturae_retrieve",
        "description": "Genera y descarga el XML FacturaE 3.2.2 (sin firma) de la factura.\nSolo disponible si el cliente tiene códigos DIR3 configurados.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Descargar el XML Facturae",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "XML Facturae 3.2.2 sin firmar.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      }
    },
    "/api/v1/invoices/{id}/download-pdf/": {
      "get": {
        "operationId": "invoices_download_pdf_retrieve",
        "description": "Genera y descarga el PDF de la factura bajo demanda.\nNo almacena el PDF, solo lo genera y lo retorna para descarga.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Descargar el PDF",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "PDF del documento.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      }
    },
    "/api/v1/invoices/{id}/email/": {
      "post": {
        "operationId": "invoices_email_create",
        "description": "Enviar por email (Facturas).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Enviar por email",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoices/{id}/lines/": {
      "get": {
        "operationId": "invoices_lines_list",
        "description": "Obtener las líneas de una factura específica.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Listar las líneas",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "in": "query",
            "name": "is_rectifying",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "is_simplified",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "number",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "rectifies",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "total_max",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "total_min",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedDocumentLineList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      }
    },
    "/api/v1/invoices/{id}/mark-paid/": {
      "post": {
        "operationId": "invoices_mark_paid_create",
        "description": "Marcar como pagada (Facturas).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Marcar como pagada",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoices/{id}/original-document/": {
      "get": {
        "operationId": "invoices_original_document_retrieve",
        "description": "PDF original (o imagen) de una factura EMITIDA que no generó Billora: las importadas de otro\nprograma de facturación («importadas como emitidas», las mismas que admite ``correct-imported``) y\nlas expedidas por terceros (autofacturación). Es sólo un justificante: no cambia el PDF que genera\nBillora (``download-pdf``), no pasa por VeriFactu y no toca importes, estado ni contabilidad.\n\n* ``GET``: estado del documento (``has_document``, ``filename``, ``content_type``, ``size``,\n  ``uploaded_at``, ``uploaded_by``, ``download_url`` firmada y temporal, ``document_url``).\n* ``PUT`` / ``POST`` (multipart, campo ``original_document`` o ``file``): adjunta o sustituye el\n  documento. PDF, JPG, PNG o WEBP de hasta 10 MB.\n* ``DELETE``: lo quita.\n\nLas facturas emitidas por Billora responden 409 ``not_imported_invoice``. Escritura: propietario,\nadministrador, facturación o ventas; con API key, scope ``invoices:write``.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Documento original de una factura importada",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceOriginalDocument"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "post": {
        "operationId": "invoices_original_document_create",
        "description": "PDF original (o imagen) de una factura EMITIDA que no generó Billora: las importadas de otro\nprograma de facturación («importadas como emitidas», las mismas que admite ``correct-imported``) y\nlas expedidas por terceros (autofacturación). Es sólo un justificante: no cambia el PDF que genera\nBillora (``download-pdf``), no pasa por VeriFactu y no toca importes, estado ni contabilidad.\n\n* ``GET``: estado del documento (``has_document``, ``filename``, ``content_type``, ``size``,\n  ``uploaded_at``, ``uploaded_by``, ``download_url`` firmada y temporal, ``document_url``).\n* ``PUT`` / ``POST`` (multipart, campo ``original_document`` o ``file``): adjunta o sustituye el\n  documento. PDF, JPG, PNG o WEBP de hasta 10 MB.\n* ``DELETE``: lo quita.\n\nLas facturas emitidas por Billora responden 409 ``not_imported_invoice``. Escritura: propietario,\nadministrador, facturación o ventas; con API key, scope ``invoices:write``.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Adjuntar el documento original a una factura importada",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceOriginalDocumentUploadRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceOriginalDocument"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "description": "Archivo no válido: vacío, de más de 10 MB o que no es PDF/imagen."
          },
          "409": {
            "description": "``not_imported_invoice`` (la emitió Billora) o ``invoice_is_draft``."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "put": {
        "operationId": "invoices_original_document_update",
        "description": "PDF original (o imagen) de una factura EMITIDA que no generó Billora: las importadas de otro\nprograma de facturación («importadas como emitidas», las mismas que admite ``correct-imported``) y\nlas expedidas por terceros (autofacturación). Es sólo un justificante: no cambia el PDF que genera\nBillora (``download-pdf``), no pasa por VeriFactu y no toca importes, estado ni contabilidad.\n\n* ``GET``: estado del documento (``has_document``, ``filename``, ``content_type``, ``size``,\n  ``uploaded_at``, ``uploaded_by``, ``download_url`` firmada y temporal, ``document_url``).\n* ``PUT`` / ``POST`` (multipart, campo ``original_document`` o ``file``): adjunta o sustituye el\n  documento. PDF, JPG, PNG o WEBP de hasta 10 MB.\n* ``DELETE``: lo quita.\n\nLas facturas emitidas por Billora responden 409 ``not_imported_invoice``. Escritura: propietario,\nadministrador, facturación o ventas; con API key, scope ``invoices:write``.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Adjuntar el documento original a una factura importada",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceOriginalDocumentUploadRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceOriginalDocument"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "description": "Archivo no válido: vacío, de más de 10 MB o que no es PDF/imagen."
          },
          "409": {
            "description": "``not_imported_invoice`` (la emitió Billora) o ``invoice_is_draft``."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "delete": {
        "operationId": "invoices_original_document_destroy",
        "description": "PDF original (o imagen) de una factura EMITIDA que no generó Billora: las importadas de otro\nprograma de facturación («importadas como emitidas», las mismas que admite ``correct-imported``) y\nlas expedidas por terceros (autofacturación). Es sólo un justificante: no cambia el PDF que genera\nBillora (``download-pdf``), no pasa por VeriFactu y no toca importes, estado ni contabilidad.\n\n* ``GET``: estado del documento (``has_document``, ``filename``, ``content_type``, ``size``,\n  ``uploaded_at``, ``uploaded_by``, ``download_url`` firmada y temporal, ``document_url``).\n* ``PUT`` / ``POST`` (multipart, campo ``original_document`` o ``file``): adjunta o sustituye el\n  documento. PDF, JPG, PNG o WEBP de hasta 10 MB.\n* ``DELETE``: lo quita.\n\nLas facturas emitidas por Billora responden 409 ``not_imported_invoice``. Escritura: propietario,\nadministrador, facturación o ventas; con API key, scope ``invoices:write``.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Quitar el documento original de una factura importada",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "Documento eliminado (o no había).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "409": {
            "description": "``not_imported_invoice`` o ``invoice_is_draft``."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoices/{id}/original-document/download/": {
      "get": {
        "operationId": "invoices_original_document_download_retrieve",
        "description": "Devuelve el archivo original adjunto (PDF o imagen) de una factura importada o de terceros.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Descargar el documento original de una factura importada",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "404": {
            "description": "La factura no tiene documento original."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      }
    },
    "/api/v1/invoices/{id}/pdf/": {
      "post": {
        "operationId": "invoices_pdf_create",
        "description": "Generar el PDF (asíncrono) (Facturas).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Generar el PDF (asíncrono)",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoices/{id}/pdf-urls/": {
      "get": {
        "operationId": "invoices_pdf_urls_retrieve",
        "description": "Genera URLs frescas para los PDFs de la factura.\n\nSoluciona el problema de URLs firmadas expiradas de Google Cloud Storage.\nCada vez que se llama a este endpoint, se generan nuevas URLs con\ntiempo de expiración renovado (4 horas por defecto).\n\nReturns:\n    {\n        \"draft_pdf_url\": \"https://storage.googleapis.com/...\",\n        \"pdf_url\": \"https://storage.googleapis.com/...\",\n        \"expires_in_minutes\": 240\n    }\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Obtener URLs firmadas del PDF",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentPdfUrls"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      }
    },
    "/api/v1/invoices/{id}/retry-verifactu/": {
      "post": {
        "operationId": "invoices_retry_verifactu_create",
        "description": "Reintenta el envío VeriFactu de una factura rechazada o con error.\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Reintentar el envío a VeriFactu",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoices/{id}/send/": {
      "post": {
        "operationId": "invoices_send_create",
        "description": "Envía factura con integración VeriFactu según configuración de la organización\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Emitir / marcar como enviado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceIssued"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/invoices/drafts/": {
      "get": {
        "operationId": "invoices_drafts_retrieve",
        "description": "Endpoint específico para facturas en borrador.\nSolo devuelve facturas con status='draft' para máxima eficiencia.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Listar borradores",
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/invoices/issued/": {
      "get": {
        "operationId": "invoices_issued_retrieve",
        "description": "Endpoint específico para facturas emitidas (no borradores).\nSolo devuelve facturas que NO están en estado borrador para máxima eficiencia.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Listar emitidas",
        "tags": [
          "Facturas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/organization-tax-config/": {
      "get": {
        "operationId": "organization_tax_config_list",
        "description": "Configuración fiscal de la organización: impuestos habilitados y tipos/régimen por defecto.\nLectura con `taxes:read` (o `settings:read`); cambios con `settings:write`.\n\n**Scope requerido:** `taxes:read` (también se acepta `settings:read`).",
        "summary": "Listar configuraciones fiscales",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedOrganizationTaxConfigList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "taxes:read",
        "x-scope-alternatives": [
          "settings:read"
        ]
      },
      "post": {
        "operationId": "organization_tax_config_create",
        "description": "Configuración fiscal de la organización: impuestos habilitados y tipos/régimen por defecto.\nLectura con `taxes:read` (o `settings:read`); cambios con `settings:write`.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Crear configuración fiscal",
        "tags": [
          "Impuestos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationTaxConfigRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationTaxConfigRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationTaxConfigRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationTaxConfig"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/organization-tax-config/{id}/": {
      "get": {
        "operationId": "organization_tax_config_retrieve",
        "description": "Configuración fiscal de la organización: impuestos habilitados y tipos/régimen por defecto.\nLectura con `taxes:read` (o `settings:read`); cambios con `settings:write`.\n\n**Scope requerido:** `taxes:read` (también se acepta `settings:read`).",
        "summary": "Obtener configuración fiscal",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Configuración de Impuestos por Organización.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationTaxConfig"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "taxes:read",
        "x-scope-alternatives": [
          "settings:read"
        ]
      },
      "put": {
        "operationId": "organization_tax_config_update",
        "description": "Configuración fiscal de la organización: impuestos habilitados y tipos/régimen por defecto.\nLectura con `taxes:read` (o `settings:read`); cambios con `settings:write`.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Reemplazar configuración fiscal",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Configuración de Impuestos por Organización.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationTaxConfigRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationTaxConfigRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationTaxConfigRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationTaxConfig"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      },
      "patch": {
        "operationId": "organization_tax_config_partial_update",
        "description": "Configuración fiscal de la organización: impuestos habilitados y tipos/régimen por defecto.\nLectura con `taxes:read` (o `settings:read`); cambios con `settings:write`.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Actualizar configuración fiscal",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Configuración de Impuestos por Organización.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedOrganizationTaxConfigRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedOrganizationTaxConfigRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedOrganizationTaxConfigRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationTaxConfig"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      },
      "delete": {
        "operationId": "organization_tax_config_destroy",
        "description": "Configuración fiscal de la organización: impuestos habilitados y tipos/régimen por defecto.\nLectura con `taxes:read` (o `settings:read`); cambios con `settings:write`.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Eliminar configuración fiscal",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Configuración de Impuestos por Organización.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      }
    },
    "/api/v1/organization-tax-config/calculate-tax/": {
      "post": {
        "operationId": "organization_tax_config_calculate_tax_create",
        "description": "Calcula impuestos para un monto base.\n\n**Scope requerido:** `taxes:read`.",
        "summary": "Calcular impuestos de una base",
        "tags": [
          "Impuestos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxCalculationRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TaxCalculationRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TaxCalculationRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "taxes:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/organization-tax-config/enabled-taxes/": {
      "get": {
        "operationId": "organization_tax_config_enabled_taxes_retrieve",
        "description": "Impuestos habilitados para la organización.\n\n**Scope requerido:** `taxes:read` (también se acepta `settings:read`).",
        "summary": "Impuestos habilitados en la organización",
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "taxes:read",
        "x-scope-alternatives": [
          "settings:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/organization-tax-config/setup-defaults/": {
      "post": {
        "operationId": "organization_tax_config_setup_defaults_create",
        "description": "Configura impuestos por defecto para la organización.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Crear la configuración fiscal por defecto",
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxConfigSetupResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxConfigSetupResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/payment-terms/": {
      "get": {
        "operationId": "payment_terms_list",
        "description": "Listar condiciones de pago (Condiciones de pago).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Listar condiciones de pago",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Condiciones de pago"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedPaymentTermList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      },
      "post": {
        "operationId": "payment_terms_create",
        "description": "Crear condición de pago (Condiciones de pago).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Crear condición de pago",
        "tags": [
          "Condiciones de pago"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentTermRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PaymentTermRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PaymentTermRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentTerm"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/payment-terms/{id}/": {
      "get": {
        "operationId": "payment_terms_retrieve",
        "description": "Obtener condición de pago (Condiciones de pago).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Obtener condición de pago",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este payment term.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Condiciones de pago"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentTerm"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      },
      "put": {
        "operationId": "payment_terms_update",
        "description": "Reemplazar condición de pago (Condiciones de pago).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Reemplazar condición de pago",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este payment term.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Condiciones de pago"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentTermRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PaymentTermRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PaymentTermRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentTerm"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      },
      "patch": {
        "operationId": "payment_terms_partial_update",
        "description": "Actualizar condición de pago (Condiciones de pago).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Actualizar condición de pago",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este payment term.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Condiciones de pago"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPaymentTermRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPaymentTermRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPaymentTermRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentTerm"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      },
      "delete": {
        "operationId": "payment_terms_destroy",
        "description": "Eliminar condición de pago (Condiciones de pago).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Eliminar condición de pago",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este payment term.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Condiciones de pago"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      }
    },
    "/api/v1/payments/": {
      "get": {
        "operationId": "payments_list",
        "description": "Cobros registrados contra facturas emitidas, anticipos de clientes (``kind=advance``:\n``customer`` sin ``invoice``; se aplican a facturas con ``POST /payments/{id}/apply/``) y\ndevoluciones (``is_refund``, importe negativo, creadas al anular una factura cobrada con\n``refund=true``). Facturas en divisa: ``amount`` en la divisa de la factura y ``amount_eur``\ncon lo abonado en euros (o ``currency=EUR`` con el importe en euros).\n\n**Scope requerido:** `payments:read`.",
        "summary": "Listar cobros",
        "parameters": [
          {
            "in": "query",
            "name": "bank_account",
            "schema": {
              "type": "number"
            },
            "description": "ID de la cuenta bancaria (tesorería)"
          },
          {
            "in": "query",
            "name": "counter_account",
            "schema": {
              "type": "number"
            },
            "description": "ID de la cuenta de contrapartida (cobros/pagos fuera de tesorería)"
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            },
            "description": "ID del cliente (anticipos)"
          },
          {
            "in": "query",
            "name": "invoice",
            "schema": {
              "type": "number"
            },
            "description": "ID de la factura"
          },
          {
            "in": "query",
            "name": "is_refund",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string",
              "enum": [
                "advance",
                "advance_application",
                "invoice"
              ]
            },
            "description": "* `invoice` - Cobro de factura\n* `advance` - Anticipo de cliente\n* `advance_application` - Aplicación de anticipo"
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cobros"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedPaymentList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:read"
      },
      "post": {
        "operationId": "payments_create",
        "description": "Cobros registrados contra facturas emitidas, anticipos de clientes (``kind=advance``:\n``customer`` sin ``invoice``; se aplican a facturas con ``POST /payments/{id}/apply/``) y\ndevoluciones (``is_refund``, importe negativo, creadas al anular una factura cobrada con\n``refund=true``). Facturas en divisa: ``amount`` en la divisa de la factura y ``amount_eur``\ncon lo abonado en euros (o ``currency=EUR`` con el importe en euros).\n\n**Scope requerido:** `payments:write`.",
        "summary": "Crear cobro",
        "tags": [
          "Cobros"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PaymentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PaymentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/payments/{id}/": {
      "get": {
        "operationId": "payments_retrieve",
        "description": "Cobros registrados contra facturas emitidas, anticipos de clientes (``kind=advance``:\n``customer`` sin ``invoice``; se aplican a facturas con ``POST /payments/{id}/apply/``) y\ndevoluciones (``is_refund``, importe negativo, creadas al anular una factura cobrada con\n``refund=true``). Facturas en divisa: ``amount`` en la divisa de la factura y ``amount_eur``\ncon lo abonado en euros (o ``currency=EUR`` con el importe en euros).\n\n**Scope requerido:** `payments:read`.",
        "summary": "Obtener cobro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Pago de factura.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cobros"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:read"
      },
      "put": {
        "operationId": "payments_update",
        "description": "Cobros registrados contra facturas emitidas, anticipos de clientes (``kind=advance``:\n``customer`` sin ``invoice``; se aplican a facturas con ``POST /payments/{id}/apply/``) y\ndevoluciones (``is_refund``, importe negativo, creadas al anular una factura cobrada con\n``refund=true``). Facturas en divisa: ``amount`` en la divisa de la factura y ``amount_eur``\ncon lo abonado en euros (o ``currency=EUR`` con el importe en euros).\n\n**Scope requerido:** `payments:write`.",
        "summary": "Reemplazar cobro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Pago de factura.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cobros"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PaymentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PaymentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write"
      },
      "patch": {
        "operationId": "payments_partial_update",
        "description": "Cobros registrados contra facturas emitidas, anticipos de clientes (``kind=advance``:\n``customer`` sin ``invoice``; se aplican a facturas con ``POST /payments/{id}/apply/``) y\ndevoluciones (``is_refund``, importe negativo, creadas al anular una factura cobrada con\n``refund=true``). Facturas en divisa: ``amount`` en la divisa de la factura y ``amount_eur``\ncon lo abonado en euros (o ``currency=EUR`` con el importe en euros).\n\n**Scope requerido:** `payments:write`.",
        "summary": "Actualizar cobro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Pago de factura.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Cobros"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPaymentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPaymentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPaymentRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write"
      },
      "delete": {
        "operationId": "payments_destroy",
        "description": "Cobros registrados contra facturas emitidas, anticipos de clientes (``kind=advance``:\n``customer`` sin ``invoice``; se aplican a facturas con ``POST /payments/{id}/apply/``) y\ndevoluciones (``is_refund``, importe negativo, creadas al anular una factura cobrada con\n``refund=true``). Facturas en divisa: ``amount`` en la divisa de la factura y ``amount_eur``\ncon lo abonado en euros (o ``currency=EUR`` con el importe en euros).\n\n**Scope requerido:** `payments:write`.",
        "summary": "Eliminar cobro",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Pago de factura.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cobros"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write"
      }
    },
    "/api/v1/payments/{id}/apply/": {
      "post": {
        "operationId": "payments_apply_create",
        "description": "Aplica un anticipo de cliente (``kind=advance``) a una factura: crea un cobro\n``kind=advance_application`` (Debe 4380xxxx / Haber 4300xxxx) por ``amount`` (por defecto el\nmenor entre el anticipo pendiente y el saldo de la factura); el resto del anticipo sigue\ndisponible. 400 si el cobro no es un anticipo o la factura no admite cobros.\n\n**Scope requerido:** `payments:write`.",
        "summary": "Aplicar un anticipo de cliente a una factura",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Pago de factura.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Cobros"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyAdvanceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ApplyAdvanceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ApplyAdvanceRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write"
      }
    },
    "/api/v1/payments/bulk/": {
      "post": {
        "operationId": "payments_bulk_create",
        "description": "Cobros registrados contra facturas emitidas, anticipos de clientes (``kind=advance``:\n``customer`` sin ``invoice``; se aplican a facturas con ``POST /payments/{id}/apply/``) y\ndevoluciones (``is_refund``, importe negativo, creadas al anular una factura cobrada con\n``refund=true``). Facturas en divisa: ``amount`` en la divisa de la factura y ``amount_eur``\ncon lo abonado en euros (o ``currency=EUR`` con el importe en euros).\n\n**Scope requerido:** `payments:write`.",
        "summary": "Registrar cobros/pagos en bloque",
        "tags": [
          "Cobros"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkPaymentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/BulkPaymentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/BulkPaymentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkPaymentResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "payments:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/people/": {
      "get": {
        "operationId": "people_list",
        "description": "Listar personas de contacto (Personas de contacto).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Listar personas de contacto",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "email",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "supplier",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Personas de contacto"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedContactPersonList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      },
      "post": {
        "operationId": "people_create",
        "description": "Crear persona de contacto (Personas de contacto).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Crear persona de contacto",
        "tags": [
          "Personas de contacto"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactPersonRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ContactPersonRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ContactPersonRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactPerson"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/people/{id}/": {
      "get": {
        "operationId": "people_retrieve",
        "description": "Obtener persona de contacto (Personas de contacto).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Obtener persona de contacto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este contact person.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Personas de contacto"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactPerson"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      },
      "put": {
        "operationId": "people_update",
        "description": "Reemplazar persona de contacto (Personas de contacto).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Reemplazar persona de contacto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este contact person.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Personas de contacto"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactPersonRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ContactPersonRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ContactPersonRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactPerson"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      },
      "patch": {
        "operationId": "people_partial_update",
        "description": "Actualizar persona de contacto (Personas de contacto).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Actualizar persona de contacto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este contact person.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Personas de contacto"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedContactPersonRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedContactPersonRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedContactPersonRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactPerson"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      },
      "delete": {
        "operationId": "people_destroy",
        "description": "Eliminar persona de contacto (Personas de contacto).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Eliminar persona de contacto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este contact person.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Personas de contacto"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      }
    },
    "/api/v1/plans/": {
      "get": {
        "operationId": "plans_list",
        "description": "Planes de Billora disponibles con sus precios y límites (público).\n\n**Scope requerido:** `account:read`.",
        "summary": "Listar planes",
        "parameters": [
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedPlanListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read"
      }
    },
    "/api/v1/plans/{id}/": {
      "get": {
        "operationId": "plans_retrieve",
        "description": "Planes de Billora disponibles con sus precios y límites (público).\n\n**Scope requerido:** `account:read`.",
        "summary": "Obtener plan",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este plan.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read"
      }
    },
    "/api/v1/plans/{id}/pricing/": {
      "get": {
        "operationId": "plans_pricing_retrieve",
        "description": "Obtiene información de precios de un plan específico\n\n**Scope requerido:** `account:read`.",
        "summary": "Precios del plan",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este plan.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read"
      }
    },
    "/api/v1/products/": {
      "get": {
        "operationId": "products_list",
        "description": "Productos y servicios del catálogo.\n\n**Scope requerido:** `products:read`.",
        "summary": "Listar productos",
        "parameters": [
          {
            "in": "query",
            "name": "active",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "code",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "price_max",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "price_min",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tax_template",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Productos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedProductList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:read"
      },
      "post": {
        "operationId": "products_create",
        "description": "Productos y servicios del catálogo.\n\n**Scope requerido:** `products:write`.",
        "summary": "Crear producto",
        "tags": [
          "Productos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ProductRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ProductRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/products/{id}/": {
      "get": {
        "operationId": "products_retrieve",
        "description": "Productos y servicios del catálogo.\n\n**Scope requerido:** `products:read`.",
        "summary": "Obtener producto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este product.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Productos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:read"
      },
      "put": {
        "operationId": "products_update",
        "description": "Productos y servicios del catálogo.\n\n**Scope requerido:** `products:write`.",
        "summary": "Reemplazar producto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este product.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Productos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ProductRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ProductRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:write"
      },
      "patch": {
        "operationId": "products_partial_update",
        "description": "Productos y servicios del catálogo.\n\n**Scope requerido:** `products:write`.",
        "summary": "Actualizar producto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este product.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Productos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedProductRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedProductRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedProductRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:write"
      },
      "delete": {
        "operationId": "products_destroy",
        "description": "Productos y servicios del catálogo.\n\n**Scope requerido:** `products:write`.",
        "summary": "Eliminar producto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este product.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Productos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:write"
      }
    },
    "/api/v1/proformas/": {
      "get": {
        "operationId": "proformas_list",
        "description": "Listar proformas (Proformas).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Listar proformas",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "number",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "total_max",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "total_min",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedProformaList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "post": {
        "operationId": "proformas_create",
        "description": "Crear proforma (Proformas).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Crear proforma",
        "tags": [
          "Proformas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProformaRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ProformaRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ProformaRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Proforma"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/proformas/{id}/": {
      "get": {
        "operationId": "proformas_retrieve",
        "description": "Obtener proforma (Proformas).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Obtener proforma",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este proforma.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Proforma"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "put": {
        "operationId": "proformas_update",
        "description": "Reemplazar proforma (Proformas).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Reemplazar proforma",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este proforma.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProformaRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ProformaRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ProformaRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Proforma"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "patch": {
        "operationId": "proformas_partial_update",
        "description": "Actualizar proforma (Proformas).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Actualizar proforma",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este proforma.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedProformaRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedProformaRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedProformaRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Proforma"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "delete": {
        "operationId": "proformas_destroy",
        "description": "A1: solo se pueden eliminar documentos en borrador.\n\nLos documentos emitidos/enviados (con número asignado y/o registro\nVeriFactu) no deben borrarse nunca por integridad legal: para revertirlos\nse usa la anulación (cancel) o una factura rectificativa.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Eliminar proforma",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este proforma.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/proformas/{id}/cancel/": {
      "post": {
        "operationId": "proformas_cancel_create",
        "description": "Anular (Proformas).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Anular",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este proforma.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/proformas/{id}/download-pdf/": {
      "get": {
        "operationId": "proformas_download_pdf_retrieve",
        "description": "Genera y descarga el PDF de la proforma bajo demanda.\nNo almacena el PDF, solo lo genera y lo retorna para descarga.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Descargar el PDF",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este proforma.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "PDF del documento.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      }
    },
    "/api/v1/proformas/{id}/email/": {
      "post": {
        "operationId": "proformas_email_create",
        "description": "Enviar por email (Proformas).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Enviar por email",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este proforma.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/proformas/{id}/lines/": {
      "get": {
        "operationId": "proformas_lines_list",
        "description": "Obtener las líneas de una proforma específica.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Listar las líneas",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este proforma.",
            "required": true
          },
          {
            "in": "query",
            "name": "number",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "total_max",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "total_min",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedDocumentLineList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      }
    },
    "/api/v1/proformas/{id}/pdf/": {
      "post": {
        "operationId": "proformas_pdf_create",
        "description": "Generar el PDF (asíncrono) (Proformas).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Generar el PDF (asíncrono)",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este proforma.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/proformas/{id}/pdf-urls/": {
      "get": {
        "operationId": "proformas_pdf_urls_retrieve",
        "description": "Genera URLs frescas para los PDFs de la proforma.\n\nSoluciona el problema de URLs firmadas expiradas de Google Cloud Storage.\nCada vez que se llama a este endpoint, se generan nuevas URLs con\ntiempo de expiración renovado (4 horas por defecto).\n\nReturns:\n    {\n        \"draft_pdf_url\": \"https://storage.googleapis.com/...\",\n        \"pdf_url\": \"https://storage.googleapis.com/...\",\n        \"expires_in_minutes\": 240\n    }\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Obtener URLs firmadas del PDF",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este proforma.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentPdfUrls"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      }
    },
    "/api/v1/proformas/{id}/send/": {
      "post": {
        "operationId": "proformas_send_create",
        "description": "Emitir / marcar como enviado (Proformas).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Emitir / marcar como enviado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este proforma.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentIssued"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/proformas/{id}/to-invoice/": {
      "post": {
        "operationId": "proformas_to_invoice_create",
        "description": "Convertir en factura (Proformas).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Convertir en factura",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este proforma.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Proformas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertToInvoiceRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ConvertToInvoiceRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ConvertToInvoiceRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertedInvoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/purchase-orders/": {
      "get": {
        "operationId": "purchase_orders_list",
        "description": "Pedidos de compra a proveedores (borrador → enviado → recibido → factura de proveedor).\nEl detalle incluye las líneas (`lines`); en el listado no se incluyen.\n\n**Scope requerido:** `purchases:read`.",
        "summary": "Listar pedidos de compra",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "due_date__gte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "due_date__lte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "issue_date",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "issue_date__gte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "issue_date__lte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "series",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "cancelled",
                "draft",
                "received",
                "sent"
              ]
            },
            "description": "* `draft` - Borrador\n* `sent` - Enviado\n* `received` - Recibido\n* `cancelled` - Anulado"
          },
          {
            "in": "query",
            "name": "supplier",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Pedidos de compra"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedPurchaseOrderList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:read"
      },
      "post": {
        "operationId": "purchase_orders_create",
        "description": "Pedidos de compra a proveedores (borrador → enviado → recibido → factura de proveedor).\nEl detalle incluye las líneas (`lines`); en el listado no se incluyen.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Crear pedido de compra",
        "tags": [
          "Pedidos de compra"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/purchase-orders/{id}/": {
      "get": {
        "operationId": "purchase_orders_retrieve",
        "description": "Pedidos de compra a proveedores (borrador → enviado → recibido → factura de proveedor).\nEl detalle incluye las líneas (`lines`); en el listado no se incluyen.\n\n**Scope requerido:** `purchases:read`.",
        "summary": "Obtener pedido de compra",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este purchase order.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Pedidos de compra"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:read"
      },
      "put": {
        "operationId": "purchase_orders_update",
        "description": "Pedidos de compra a proveedores (borrador → enviado → recibido → factura de proveedor).\nEl detalle incluye las líneas (`lines`); en el listado no se incluyen.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Reemplazar pedido de compra",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este purchase order.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Pedidos de compra"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      },
      "patch": {
        "operationId": "purchase_orders_partial_update",
        "description": "Pedidos de compra a proveedores (borrador → enviado → recibido → factura de proveedor).\nEl detalle incluye las líneas (`lines`); en el listado no se incluyen.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Actualizar pedido de compra",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este purchase order.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Pedidos de compra"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPurchaseOrderRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPurchaseOrderRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPurchaseOrderRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      },
      "delete": {
        "operationId": "purchase_orders_destroy",
        "description": "Pedidos de compra a proveedores (borrador → enviado → recibido → factura de proveedor).\nEl detalle incluye las líneas (`lines`); en el listado no se incluyen.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Eliminar pedido de compra",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este purchase order.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Pedidos de compra"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      }
    },
    "/api/v1/purchase-orders/{id}/receive/": {
      "post": {
        "operationId": "purchase_orders_receive_create",
        "description": "Marca el pedido como recibido (sólo si está enviado).\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Marcar como recibido",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este purchase order.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Pedidos de compra"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      }
    },
    "/api/v1/purchase-orders/{id}/send/": {
      "post": {
        "operationId": "purchase_orders_send_create",
        "description": "Marca el pedido como enviado al proveedor (sólo desde borrador).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Marcar como enviado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este purchase order.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Pedidos de compra"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      }
    },
    "/api/v1/purchase-orders/{id}/to-vendor-bill/": {
      "post": {
        "operationId": "purchase_orders_to_vendor_bill_create",
        "description": "Crea una factura de proveedor en borrador con los datos y las líneas del pedido.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Convertir en factura de proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este purchase order.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Pedidos de compra"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VendorBillCreatedFromOrder"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      }
    },
    "/api/v1/quotes/": {
      "get": {
        "operationId": "quotes_list",
        "description": "Listar presupuestos (Presupuestos).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Listar presupuestos",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "number",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "total_max",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "total_min",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedQuoteList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "post": {
        "operationId": "quotes_create",
        "description": "Crear presupuesto (Presupuestos).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Crear presupuesto",
        "tags": [
          "Presupuestos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/QuoteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/QuoteRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/quotes/{id}/": {
      "get": {
        "operationId": "quotes_retrieve",
        "description": "Obtener presupuesto (Presupuestos).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Obtener presupuesto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "put": {
        "operationId": "quotes_update",
        "description": "Reemplazar presupuesto (Presupuestos).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Reemplazar presupuesto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/QuoteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/QuoteRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "patch": {
        "operationId": "quotes_partial_update",
        "description": "Actualizar presupuesto (Presupuestos).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Actualizar presupuesto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedQuoteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedQuoteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedQuoteRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "delete": {
        "operationId": "quotes_destroy",
        "description": "A1: solo se pueden eliminar documentos en borrador.\n\nLos documentos emitidos/enviados (con número asignado y/o registro\nVeriFactu) no deben borrarse nunca por integridad legal: para revertirlos\nse usa la anulación (cancel) o una factura rectificativa.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Eliminar presupuesto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/quotes/{id}/accept/": {
      "post": {
        "operationId": "quotes_accept_create",
        "description": "Aceptar (Presupuestos).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Aceptar",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/quotes/{id}/download-pdf/": {
      "get": {
        "operationId": "quotes_download_pdf_retrieve",
        "description": "Genera y descarga el PDF del presupuesto bajo demanda.\nNo almacena el PDF, solo lo genera y lo retorna para descarga.\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Descargar el PDF",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "PDF del documento.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      }
    },
    "/api/v1/quotes/{id}/email/": {
      "post": {
        "operationId": "quotes_email_create",
        "description": "Enviar por email (Presupuestos).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Enviar por email",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/quotes/{id}/pdf/": {
      "post": {
        "operationId": "quotes_pdf_create",
        "description": "Generar el PDF (asíncrono) (Presupuestos).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Generar el PDF (asíncrono)",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/quotes/{id}/pdf-urls/": {
      "get": {
        "operationId": "quotes_pdf_urls_retrieve",
        "description": "Genera URLs frescas para los PDFs del presupuesto.\n\nSoluciona el problema de URLs firmadas expiradas de Google Cloud Storage.\nCada vez que se llama a este endpoint, se generan nuevas URLs con\ntiempo de expiración renovado (4 horas por defecto).\n\nReturns:\n    {\n        \"draft_pdf_url\": \"https://storage.googleapis.com/...\",\n        \"pdf_url\": \"https://storage.googleapis.com/...\",\n        \"expires_in_minutes\": 240\n    }\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Obtener URLs firmadas del PDF",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentPdfUrls"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      }
    },
    "/api/v1/quotes/{id}/reject/": {
      "post": {
        "operationId": "quotes_reject_create",
        "description": "Rechazar (Presupuestos).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Rechazar",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/quotes/{id}/send/": {
      "post": {
        "operationId": "quotes_send_create",
        "description": "Emitir / marcar como enviado (Presupuestos).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Emitir / marcar como enviado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentIssued"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/quotes/{id}/to-invoice/": {
      "post": {
        "operationId": "quotes_to_invoice_create",
        "description": "Convertir en factura (Presupuestos).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Convertir en factura",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertToInvoiceRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ConvertToInvoiceRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ConvertToInvoiceRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertedInvoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/quotes/{id}/to-proforma/": {
      "post": {
        "operationId": "quotes_to_proforma_create",
        "description": "Convertir en proforma (Presupuestos).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Convertir en proforma",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este quote.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Presupuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertedProforma"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/recurring-invoices/": {
      "get": {
        "operationId": "recurring_invoices_list",
        "description": "Facturas recurrentes (plantillas que generan facturas periódicamente).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Listar facturas recurrentes",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "customer",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "is_active",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas recurrentes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedRecurringInvoiceList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "post": {
        "operationId": "recurring_invoices_create",
        "description": "Facturas recurrentes (plantillas que generan facturas periódicamente).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Crear factura recurrente",
        "tags": [
          "Facturas recurrentes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecurringInvoiceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RecurringInvoiceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RecurringInvoiceRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecurringInvoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/recurring-invoices/{id}/": {
      "get": {
        "operationId": "recurring_invoices_retrieve",
        "description": "Facturas recurrentes (plantillas que generan facturas periódicamente).\n\n**Scope requerido:** `invoices:read`.",
        "summary": "Obtener factura recurrente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este recurring invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas recurrentes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecurringInvoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:read"
      },
      "put": {
        "operationId": "recurring_invoices_update",
        "description": "Facturas recurrentes (plantillas que generan facturas periódicamente).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Reemplazar factura recurrente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este recurring invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas recurrentes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecurringInvoiceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RecurringInvoiceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RecurringInvoiceRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecurringInvoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "patch": {
        "operationId": "recurring_invoices_partial_update",
        "description": "Facturas recurrentes (plantillas que generan facturas periódicamente).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Actualizar factura recurrente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este recurring invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas recurrentes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedRecurringInvoiceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedRecurringInvoiceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedRecurringInvoiceRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecurringInvoice"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      },
      "delete": {
        "operationId": "recurring_invoices_destroy",
        "description": "Facturas recurrentes (plantillas que generan facturas periódicamente).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Eliminar factura recurrente",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este recurring invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas recurrentes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/recurring-invoices/{id}/pause/": {
      "post": {
        "operationId": "recurring_invoices_pause_create",
        "description": "Facturas recurrentes (plantillas que generan facturas periódicamente).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Pausar",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este recurring invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas recurrentes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecurringState"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/recurring-invoices/{id}/resume/": {
      "post": {
        "operationId": "recurring_invoices_resume_create",
        "description": "Facturas recurrentes (plantillas que generan facturas periódicamente).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Reanudar",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este recurring invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas recurrentes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecurringState"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/recurring-invoices/{id}/run-now/": {
      "post": {
        "operationId": "recurring_invoices_run_now_create",
        "description": "Facturas recurrentes (plantillas que generan facturas periódicamente).\n\n**Scope requerido:** `invoices:write`.",
        "summary": "Generar ahora",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este recurring invoice.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas recurrentes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "invoices:write"
      }
    },
    "/api/v1/reports/fiscal": {
      "get": {
        "operationId": "reports_fiscal_retrieve",
        "description": "Advanced fiscal reports with tax analysis for Spanish businesses.\nProvides comprehensive tax breakdown including VAT, IGIC, IPSI, withholdings, etc.\n\n**Scope requerido:** `reports:read`.",
        "summary": "Advanced fiscal reports with tax analysis for Spanish businesses",
        "tags": [
          "Informes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/reports/fiscal/quarters": {
      "get": {
        "operationId": "reports_fiscal_quarters_retrieve",
        "description": "Get available fiscal quarters for the organization.\n\n**Scope requerido:** `reports:read`.",
        "summary": "Get available fiscal quarters for the organization",
        "tags": [
          "Informes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/reports/tax-models/{code}/": {
      "get": {
        "operationId": "reports_tax_models_retrieve",
        "description": "Cálculo de un modelo tributario para un periodo (casillas e importes).\n\n**Scope requerido:** `reports:read`.",
        "summary": "Cálculo de un modelo tributario para un periodo (casillas e importes)",
        "parameters": [
          {
            "in": "path",
            "name": "code",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Informes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read"
      }
    },
    "/api/v1/reports/tax-models/{code}/casillas/{casilla_code}/sources/": {
      "get": {
        "operationId": "reports_tax_models_casillas_sources_retrieve",
        "description": "Documentos que alimentan una casilla de un modelo tributario.\n\n**Scope requerido:** `reports:read`.",
        "summary": "Documentos que alimentan una casilla de un modelo tributario",
        "parameters": [
          {
            "in": "path",
            "name": "casilla_code",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "code",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Informes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read"
      }
    },
    "/api/v1/reports/tax-models/{code}/declaration/": {
      "get": {
        "operationId": "reports_tax_models_declaration_retrieve",
        "description": "Datos de una declaración que no salen de la contabilidad.\n\n**Scope requerido:** `reports:read`.",
        "summary": "Datos de una declaración (complementaria, IBAN, 202, 123, 349…)",
        "parameters": [
          {
            "in": "path",
            "name": "code",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "period",
            "schema": {
              "type": "string"
            },
            "description": "Periodo de la declaración: `2026-1T` (trimestral), `2026` (anual), `2026-1P` (202) o `2026-03` (303 mensual).",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Informes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeclarationPayload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read"
      },
      "put": {
        "operationId": "reports_tax_models_declaration_update",
        "description": "Sustituye los datos de la declaración del modelo y periodo. Sólo se admiten los campos que aplican al modelo (`applicable_fields`).",
        "summary": "Guardar los datos de una declaración",
        "parameters": [
          {
            "in": "path",
            "name": "code",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "period",
            "schema": {
              "type": "string"
            },
            "description": "Periodo de la declaración: `2026-1T` (trimestral), `2026` (anual), `2026-1P` (202) o `2026-03` (303 mensual).",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Informes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeclarationDataRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DeclarationDataRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DeclarationDataRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeclarationPayload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:write"
      }
    },
    "/api/v1/reports/tax-models/{code}/export/": {
      "get": {
        "operationId": "reports_tax_models_export_retrieve",
        "description": "`format=boe` (por defecto) devuelve el fichero para la «Presentación mediante fichero» de la Sede de la AEAT, generado con el diseño de registro oficial del ejercicio y validado antes de servirlo (303, 111, 115, 123, 130, 202, 390 y las informativas 180, 190, 193, 347 y 349). Si faltan datos responde 400 con `missing` (lista de lo que hay que completar: NIF de un perceptor, referencia catastral, IBAN, persona de contacto…); se puede comprobar antes con `GET …/file-check/`. `format=pdf` devuelve el PDF de trabajo.",
        "summary": "Descargar el fichero de presentación (AEAT) o el PDF de un modelo",
        "parameters": [
          {
            "in": "path",
            "name": "code",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "boe",
                "pdf"
              ]
            },
            "description": "`boe` (fichero AEAT) o `pdf`."
          },
          {
            "in": "query",
            "name": "period",
            "schema": {
              "type": "string"
            },
            "description": "Periodo: `2026-1T`, `2026`, `2026-1P`, `2026-03`.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Informes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxModelExportError"
                }
              }
            },
            "description": ""
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read"
      }
    },
    "/api/v1/reports/tax-models/{code}/file-check/": {
      "get": {
        "operationId": "reports_tax_models_file_check_retrieve",
        "description": "Genera el fichero de presentación del modelo y periodo y lo valida contra el diseño de registro oficial de la AEAT (posiciones, longitudes, tipos, constantes, totales y reglas del modelo). `missing` lista los datos que hay que completar.",
        "summary": "Comprobar el fichero de un modelo antes de descargarlo",
        "parameters": [
          {
            "in": "path",
            "name": "code",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "period",
            "schema": {
              "type": "string"
            },
            "description": "Periodo de la declaración: `2026-1T` (trimestral), `2026` (anual), `2026-1P` (202) o `2026-03` (303 mensual).",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Informes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileCheck"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read"
      }
    },
    "/api/v1/reports/tax-models/{code}/overrides/": {
      "put": {
        "operationId": "reports_tax_models_overrides_update",
        "description": "Guarda ajustes manuales de las casillas editables (`editable: true`) del modelo y periodo y devuelve el modelo recalculado. Un valor igual al calculado elimina el ajuste. Responde 422 si la casilla no es editable o el valor no es válido.\n\n**Modelo 303 — casillas de texto** (`type: \"text\"`): `tipo_declaracion` e `iban`. El tipo de declaración admite las opciones de su campo `options`, que dependen del resultado YA ajustado y del periodo: resultado a ingresar `I` (ingreso) o `U` (domiciliación; exige IBAN) y `G` si la empresa tiene cuenta corriente tributaria; resultado negativo `C` (a compensar) y, sólo en el último periodo (4T / mes 12) o con REDEME, `D` (devolución; IBAN español) o `X` (devolución por transferencia al extranjero; IBAN no español y SWIFT), más `V` con cuenta corriente tributaria; resultado cero `N`. El IBAN se valida (formato y dígitos de control). Los importes se aplican antes que las casillas de texto, así que en una misma petición se puede ajustar una casilla y elegir el tipo resultante.\n\nCasillas de resultado editables del 303: 65, 76, 77, 110, 78, 68, 108, 70, 109, 112 y 111.",
        "summary": "Ajustar casillas de un modelo tributario",
        "parameters": [
          {
            "in": "path",
            "name": "code",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "period",
            "schema": {
              "type": "string"
            },
            "description": "Periodo (p. ej. `2026-1T`).",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Informes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxModelOverridesRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TaxModelOverridesRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TaxModelOverridesRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:write"
      }
    },
    "/api/v1/reports/tax-models/available/": {
      "get": {
        "operationId": "reports_tax_models_available_retrieve",
        "description": "Modelos tributarios disponibles (303, 130, 111, 115, 347, 349, 390…).\n\n**Scope requerido:** `reports:read`.",
        "summary": "Modelos tributarios disponibles (303, 130, 111, 115, 347, 349, 390…)",
        "tags": [
          "Informes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/reports/tax-models/declarant/": {
      "get": {
        "operationId": "reports_tax_models_declarant_retrieve",
        "description": "Datos del declarante e inmuebles arrendados para los ficheros de la AEAT.\n\n**Scope requerido:** `reports:read`.",
        "summary": "Datos del declarante para los ficheros de la AEAT",
        "tags": [
          "Informes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeclarantPayload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      },
      "put": {
        "operationId": "reports_tax_models_declarant_update",
        "description": "`declarante` se fusiona con lo guardado; `inmuebles`, si se envía, sustituye la lista completa. Se usan en todos los modelos (persona de contacto en las informativas; CNAE en el 202; actividad y epígrafe IAE en el 390; inmuebles en el 180 y el 347).",
        "summary": "Guardar los datos del declarante y los inmuebles arrendados",
        "tags": [
          "Informes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeclarantPayloadRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DeclarantPayloadRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DeclarantPayloadRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeclarantPayload"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/reports/tax-models/file-check/": {
      "post": {
        "operationId": "reports_tax_models_file_check_create",
        "description": "Valida un fichero de la AEAT subido (generado por Billora o por otro programa).\n\n**Scope requerido:** `reports:read`.",
        "summary": "Validar un fichero de presentación de la AEAT",
        "tags": [
          "Informes"
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/UploadedFileCheckRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadedFileCheck"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/reports/tax-models/settings/": {
      "get": {
        "operationId": "reports_tax_models_settings_retrieve",
        "description": "Criterio de imputación temporal de las retenciones (modelos 111/190 y 115/180): por defecto, por ejercicio y el efectivo del ejercicio `year`. `pago`: la retención se declara cuando la factura se paga (art. 78 RIRPF). `devengo`: por la fecha de la factura y el periodo de la nómina. Cuando el criterio cambia de un ejercicio a otro, cada documento se declara una sola vez (`transition_note` lo explica).",
        "summary": "Ajustes de los modelos tributarios",
        "parameters": [
          {
            "in": "query",
            "name": "year",
            "schema": {
              "type": "integer"
            },
            "description": "Ejercicio del que se devuelve el criterio efectivo (por defecto, el año actual)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Informes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxSettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read"
      },
      "patch": {
        "operationId": "reports_tax_models_settings_partial_update",
        "description": "Sólo propietario o administrador. Cambia el criterio de retenciones por defecto (`default`) y/o el de ejercicios concretos (`by_year`, o `year` + `criterion`); lo no indicado no se modifica. Afecta al cálculo de los modelos 111, 115, 180 y 190 de esos ejercicios: no cambies el criterio de un ejercicio con modelos ya presentados.",
        "summary": "Cambiar los ajustes de los modelos tributarios",
        "parameters": [
          {
            "in": "query",
            "name": "year",
            "schema": {
              "type": "integer"
            },
            "description": "Ejercicio del que se devuelve el criterio efectivo (por defecto, el año actual)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Informes"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTaxSettingsPatchRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTaxSettingsPatchRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTaxSettingsPatchRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxSettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:write"
      }
    },
    "/api/v1/reports/vat-purchases": {
      "get": {
        "operationId": "reports_vat_purchases_retrieve",
        "description": "Libro registro de facturas recibidas (formato AEAT) entre dos fechas, a partir de los gastos\ncon factura: una fila por gasto y tipo (base, cuota soportada y deducible, recargo, ISP, bien de\ninversión, fecha de deducción, emisor). ``format=csv|xlsx`` descarga el libro.\n\n**Scope requerido:** `reports:read`.",
        "summary": "Consultar informes",
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Informes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "text/csv": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read"
      }
    },
    "/api/v1/reports/vat-sales": {
      "get": {
        "operationId": "reports_vat_sales_retrieve",
        "description": "Libro registro de facturas expedidas (formato AEAT, Orden HAC/773/2019) entre dos fechas:\nuna fila por factura y tipo impositivo (base, tipo, cuota, recargo, retención, destinatario).\n``format=csv|xlsx`` descarga el libro; ``columns`` devuelve las cabeceras oficiales.\n\n**Scope requerido:** `reports:read`.",
        "summary": "Libro registro de facturas expedidas (formato AEAT, Orden HAC/773/2019) entre dos fechas:",
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "pdf",
                "xlsx"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Informes"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "text/csv": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "reports:read"
      }
    },
    "/api/v1/scan-jobs/": {
      "get": {
        "operationId": "scan_jobs_list",
        "description": "Escaneos (OCR) de facturas y tickets para convertirlos en gastos.\n\n**Scope requerido:** `expenses:read` (también se acepta `files:read`).",
        "summary": "Listar escaneos",
        "parameters": [
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "completed",
                "converted",
                "failed",
                "pending",
                "processing"
              ]
            },
            "description": "* `pending` - Pendiente\n* `processing` - Procesando\n* `completed` - Completado\n* `failed` - Error\n* `converted` - Convertido a gasto"
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Escaneo de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedScanJobListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read",
        "x-scope-alternatives": [
          "files:read"
        ]
      },
      "post": {
        "operationId": "scan_jobs_create",
        "description": "Escaneos (OCR) de facturas y tickets para convertirlos en gastos.\n\n**Scope requerido:** `expenses:write` (también se acepta `files:write`).",
        "summary": "Crear escaneo",
        "tags": [
          "Escaneo de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScanJobCreateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ScanJobCreateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ScanJobCreateRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanJobCreate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write",
        "x-scope-alternatives": [
          "files:write"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/scan-jobs/{id}/": {
      "get": {
        "operationId": "scan_jobs_retrieve",
        "description": "Escaneos (OCR) de facturas y tickets para convertirlos en gastos.\n\n**Scope requerido:** `expenses:read` (también se acepta `files:read`).",
        "summary": "Obtener escaneo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Trabajo de escaneo.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Escaneo de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanJob"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read",
        "x-scope-alternatives": [
          "files:read"
        ]
      },
      "put": {
        "operationId": "scan_jobs_update",
        "description": "Escaneos (OCR) de facturas y tickets para convertirlos en gastos.\n\n**Scope requerido:** `expenses:write` (también se acepta `files:write`).",
        "summary": "Reemplazar escaneo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Trabajo de escaneo.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Escaneo de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScanJobRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ScanJobRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ScanJobRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanJob"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write",
        "x-scope-alternatives": [
          "files:write"
        ]
      },
      "patch": {
        "operationId": "scan_jobs_partial_update",
        "description": "Escaneos (OCR) de facturas y tickets para convertirlos en gastos.\n\n**Scope requerido:** `expenses:write` (también se acepta `files:write`).",
        "summary": "Actualizar escaneo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Trabajo de escaneo.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Escaneo de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedScanJobRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedScanJobRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedScanJobRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanJob"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write",
        "x-scope-alternatives": [
          "files:write"
        ]
      },
      "delete": {
        "operationId": "scan_jobs_destroy",
        "description": "Eliminar escaneo solo si no ha sido convertido.\n\n**Scope requerido:** `expenses:write` (también se acepta `files:write`).",
        "summary": "Eliminar escaneo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Trabajo de escaneo.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Escaneo de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write",
        "x-scope-alternatives": [
          "files:write"
        ]
      }
    },
    "/api/v1/scan-jobs/{id}/convert-to-expense/": {
      "post": {
        "operationId": "scan_jobs_convert_to_expense_create",
        "description": "Convertir escaneo a gasto.\n\n**Scope requerido:** `expenses:write` (también se acepta `files:write`).",
        "summary": "Convertir en gasto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Trabajo de escaneo.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Escaneo de documentos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write",
        "x-scope-alternatives": [
          "files:write"
        ]
      }
    },
    "/api/v1/scan-jobs/{id}/reprocess/": {
      "post": {
        "operationId": "scan_jobs_reprocess_create",
        "description": "Reprocesar un documento.\n\n**Scope requerido:** `expenses:write` (también se acepta `files:write`).",
        "summary": "Reprocesar",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Trabajo de escaneo.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Escaneo de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write",
        "x-scope-alternatives": [
          "files:write"
        ]
      }
    },
    "/api/v1/scan-jobs/stats/": {
      "get": {
        "operationId": "scan_jobs_stats_retrieve",
        "description": "Obtener estadísticas de escaneos.\n\n**Scope requerido:** `expenses:read` (también se acepta `files:read`).",
        "summary": "Estadísticas",
        "tags": [
          "Escaneo de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read",
        "x-scope-alternatives": [
          "files:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/scan-results/": {
      "get": {
        "operationId": "scan_results_list",
        "description": "Resultados de escaneo (sólo lectura).\n\n**Scope requerido:** `expenses:read` (también se acepta `files:read`).",
        "summary": "Listar resultados de escaneo",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "identified_supplier",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "suggested_category",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Escaneo de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedScanResultList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read",
        "x-scope-alternatives": [
          "files:read"
        ]
      }
    },
    "/api/v1/scan-results/{id}/": {
      "get": {
        "operationId": "scan_results_retrieve",
        "description": "Resultados de escaneo (sólo lectura).\n\n**Scope requerido:** `expenses:read` (también se acepta `files:read`).",
        "summary": "Obtener resultado de escaneo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Resultado de escaneo.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Escaneo de documentos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read",
        "x-scope-alternatives": [
          "files:read"
        ]
      }
    },
    "/api/v1/settings/series/": {
      "get": {
        "operationId": "settings_series_list",
        "description": "Series de numeración de documentos. Lectura con `series:read` (o `settings:read`);\ncrear y editar con `settings:write`. Una serie con documentos numerados no se puede borrar.\n\n**Scope requerido:** `series:read` (también se acepta `settings:read`).",
        "summary": "Listar series",
        "parameters": [
          {
            "in": "query",
            "name": "code",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Series"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedDocumentSeriesList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "series:read",
        "x-scope-alternatives": [
          "settings:read"
        ]
      },
      "post": {
        "operationId": "settings_series_create",
        "description": "Series de numeración de documentos. Lectura con `series:read` (o `settings:read`);\ncrear y editar con `settings:write`. Una serie con documentos numerados no se puede borrar.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Crear serie",
        "tags": [
          "Series"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentSeriesRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentSeriesRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentSeriesRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSeries"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/settings/series/{id}/": {
      "get": {
        "operationId": "settings_series_retrieve",
        "description": "Series de numeración de documentos. Lectura con `series:read` (o `settings:read`);\ncrear y editar con `settings:write`. Una serie con documentos numerados no se puede borrar.\n\n**Scope requerido:** `series:read` (también se acepta `settings:read`).",
        "summary": "Obtener serie",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este document series.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Series"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSeries"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "series:read",
        "x-scope-alternatives": [
          "settings:read"
        ]
      },
      "put": {
        "operationId": "settings_series_update",
        "description": "Series de numeración de documentos. Lectura con `series:read` (o `settings:read`);\ncrear y editar con `settings:write`. Una serie con documentos numerados no se puede borrar.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Reemplazar serie",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este document series.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Series"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentSeriesRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentSeriesRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentSeriesRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSeries"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      },
      "patch": {
        "operationId": "settings_series_partial_update",
        "description": "Series de numeración de documentos. Lectura con `series:read` (o `settings:read`);\ncrear y editar con `settings:write`. Una serie con documentos numerados no se puede borrar.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Actualizar serie",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este document series.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Series"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentSeriesRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentSeriesRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedDocumentSeriesRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSeries"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      },
      "delete": {
        "operationId": "settings_series_destroy",
        "description": "Series de numeración de documentos. Lectura con `series:read` (o `settings:read`);\ncrear y editar con `settings:write`. Una serie con documentos numerados no se puede borrar.\n\n**Scope requerido:** `settings:write`.",
        "summary": "Eliminar serie",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este document series.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Series"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "settings:write"
      }
    },
    "/api/v1/settings/series/{id}/next-preview/": {
      "get": {
        "operationId": "settings_series_next_preview_retrieve",
        "description": "Vista de preview: NO incrementa.\n\n**Scope requerido:** `series:read` (también se acepta `settings:read`).",
        "summary": "Previsualizar el siguiente número",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este document series.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Series"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeriesNumberPreview"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "series:read",
        "x-scope-alternatives": [
          "settings:read"
        ]
      }
    },
    "/api/v1/signatures/": {
      "get": {
        "operationId": "signatures_list",
        "description": "Solicitudes de firma digital: se crean con el PDF (multipart, campo `pdf_file`), se envían\nal firmante por email y/o SMS y, al firmarse, generan la evidencia (PDF firmado y certificado).\n\n**Scope requerido:** `signatures:read`.",
        "summary": "Listar solicitudes de firma",
        "parameters": [
          {
            "in": "query",
            "name": "case",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "delivery_method",
            "schema": {
              "type": "string",
              "enum": [
                "both",
                "email",
                "sms"
              ]
            },
            "description": "* `email` - Email\n* `sms` - SMS\n* `both` - Email + SMS"
          },
          {
            "in": "query",
            "name": "document_type",
            "schema": {
              "type": "string",
              "enum": [
                "clinical_doc",
                "consent",
                "contract",
                "expediente_doc",
                "invoice",
                "other",
                "quote"
              ]
            },
            "description": "* `quote` - Presupuesto\n* `invoice` - Factura\n* `contract` - Contrato\n* `consent` - Consentimiento\n* `expediente_doc` - Documento de expediente\n* `clinical_doc` - Documento clínico\n* `other` - Otro"
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "patient",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "cancelled",
                "declined",
                "draft",
                "expired",
                "pending",
                "signed",
                "viewed"
              ]
            },
            "description": "* `draft` - Borrador\n* `pending` - Pendiente\n* `viewed` - Visto\n* `signed` - Firmado\n* `declined` - Rechazado\n* `expired` - Expirado\n* `cancelled` - Cancelado"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Firma digital"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSignatureRequestListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:read"
      },
      "post": {
        "operationId": "signatures_create",
        "description": "Solicitudes de firma digital: se crean con el PDF (multipart, campo `pdf_file`), se envían\nal firmante por email y/o SMS y, al firmarse, generan la evidencia (PDF firmado y certificado).\n\n**Scope requerido:** `signatures:write`.",
        "summary": "Crear solicitud de firma",
        "tags": [
          "Firma digital"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignatureRequestCreateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SignatureRequestCreateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SignatureRequestCreateRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignatureRequestCreate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/signatures/{id}/": {
      "get": {
        "operationId": "signatures_retrieve",
        "description": "Solicitudes de firma digital: se crean con el PDF (multipart, campo `pdf_file`), se envían\nal firmante por email y/o SMS y, al firmarse, generan la evidencia (PDF firmado y certificado).\n\n**Scope requerido:** `signatures:read`.",
        "summary": "Obtener solicitud de firma",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este signature request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Firma digital"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignatureRequestDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:read"
      },
      "put": {
        "operationId": "signatures_update",
        "description": "Solicitudes de firma digital: se crean con el PDF (multipart, campo `pdf_file`), se envían\nal firmante por email y/o SMS y, al firmarse, generan la evidencia (PDF firmado y certificado).\n\n**Scope requerido:** `signatures:write`.",
        "summary": "Reemplazar solicitud de firma",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este signature request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Firma digital"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignatureRequestDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SignatureRequestDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SignatureRequestDetailRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignatureRequestDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:write"
      },
      "patch": {
        "operationId": "signatures_partial_update",
        "description": "Solicitudes de firma digital: se crean con el PDF (multipart, campo `pdf_file`), se envían\nal firmante por email y/o SMS y, al firmarse, generan la evidencia (PDF firmado y certificado).\n\n**Scope requerido:** `signatures:write`.",
        "summary": "Actualizar solicitud de firma",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este signature request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Firma digital"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSignatureRequestDetailRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSignatureRequestDetailRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSignatureRequestDetailRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignatureRequestDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:write"
      },
      "delete": {
        "operationId": "signatures_destroy",
        "description": "Solicitudes de firma digital: se crean con el PDF (multipart, campo `pdf_file`), se envían\nal firmante por email y/o SMS y, al firmarse, generan la evidencia (PDF firmado y certificado).\n\n**Scope requerido:** `signatures:write`.",
        "summary": "Eliminar solicitud de firma",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este signature request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Firma digital"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:write"
      }
    },
    "/api/v1/signatures/{id}/cancel/": {
      "post": {
        "operationId": "signatures_cancel_create",
        "description": "Cancela la solicitud: el enlace de firma deja de funcionar.\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `signatures:write`.",
        "summary": "Cancelar la solicitud",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este signature request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Firma digital"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignatureRequestDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:write"
      }
    },
    "/api/v1/signatures/{id}/certificate/": {
      "get": {
        "operationId": "signatures_certificate_retrieve",
        "description": "Descarga el certificado de evidencias de la firma (PDF). 404 si todavía no se ha firmado.\n\n**Scope requerido:** `signatures:read`.",
        "summary": "Descargar el certificado de firma",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este signature request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Firma digital"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "Archivo PDF.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:read"
      }
    },
    "/api/v1/signatures/{id}/document/": {
      "get": {
        "operationId": "signatures_document_retrieve",
        "description": "Descarga el PDF original enviado a firmar.\n\n**Scope requerido:** `signatures:read`.",
        "summary": "Descargar el documento original",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este signature request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Firma digital"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "Archivo PDF.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:read"
      }
    },
    "/api/v1/signatures/{id}/evidence/": {
      "get": {
        "operationId": "signatures_evidence_retrieve",
        "description": "Evidencia de la firma: fecha, IP, navegador, geolocalización y hashes SHA-256.\n\n**Scope requerido:** `signatures:read`.",
        "summary": "Evidencia de la firma",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este signature request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Firma digital"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignatureEvidencePublic"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:read"
      }
    },
    "/api/v1/signatures/{id}/remind/": {
      "post": {
        "operationId": "signatures_remind_create",
        "description": "Reenvía el aviso al firmante de una solicitud pendiente o vista.\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `signatures:write`.",
        "summary": "Enviar recordatorio",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este signature request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Firma digital"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignatureReminderResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:write"
      }
    },
    "/api/v1/signatures/{id}/send/": {
      "post": {
        "operationId": "signatures_send_create",
        "description": "Envía la solicitud al firmante (email y/o SMS según `delivery_method`) y la deja pendiente.\n\nEl SMS consume saldo de SMS de la organización.\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `signatures:write`.",
        "summary": "Enviar al firmante",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este signature request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Firma digital"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignatureRequestDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:write"
      }
    },
    "/api/v1/signatures/{id}/signed-pdf/": {
      "get": {
        "operationId": "signatures_signed_pdf_retrieve",
        "description": "Descarga el PDF firmado (con la firma estampada). 404 si todavía no se ha firmado.\n\n**Scope requerido:** `signatures:read`.",
        "summary": "Descargar el PDF firmado",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este signature request.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Firma digital"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "Archivo PDF.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:read"
      }
    },
    "/api/v1/signatures/stats/": {
      "get": {
        "operationId": "signatures_stats_retrieve",
        "description": "Número de solicitudes por estado.\n\n**Scope requerido:** `signatures:read`.",
        "summary": "Estadísticas de firmas",
        "tags": [
          "Firma digital"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignatureStats"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "signatures:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/sms/balance/": {
      "get": {
        "operationId": "sms_balance_retrieve",
        "description": "Saldo de SMS: créditos gratuitos del mes, créditos de bonos y envíos realizados.\n\n**Scope requerido:** `sms:read`.",
        "summary": "Saldo de SMS: créditos gratuitos del mes, créditos de bonos y envíos realizados",
        "tags": [
          "SMS"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmsBalance"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "sms:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/sms/bundles/": {
      "get": {
        "operationId": "sms_bundles_list",
        "description": "Bonos de SMS pagados y sus créditos restantes.\n\n**Scope requerido:** `sms:read`.",
        "summary": "Bonos de SMS pagados y sus créditos restantes",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "SMS"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSmsCreditBundleList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "sms:read"
      }
    },
    "/api/v1/sms/history/": {
      "get": {
        "operationId": "sms_history_list",
        "description": "Historial de SMS enviados.\n\nMás recientes primero. Con API key (o `page`/`page_size`) la lista está paginada y admite\n`sent_after`/`sent_before`; la aplicación web recibe los 100 últimos.\n\n**Scope requerido:** `sms:read`.",
        "summary": "Historial de SMS enviados",
        "parameters": [
          {
            "in": "query",
            "name": "channel",
            "schema": {
              "type": "string",
              "enum": [
                "other",
                "signature"
              ]
            },
            "description": "* `signature` - Firma digital\n* `other` - Otro"
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Alias de sent_after (sincronización incremental)."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Alias de sent_before."
          },
          {
            "in": "query",
            "name": "is_free",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "sent_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Enviados desde (inclusive). Fecha o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "sent_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Enviados antes de (exclusivo). Fecha o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "SMS"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSmsUsageLogList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "sms:read"
      }
    },
    "/api/v1/sms/send/": {
      "post": {
        "operationId": "sms_send_create",
        "description": "Envía un SMS (máx. 480 caracteres) a un teléfono (formato internacional `+34600111222`;\nun número español de 9 cifras se completa con +34).\n\n**Consume saldo**: primero los 5 SMS gratuitos del mes y después los créditos de bonos. Sin\nsaldo → 402 `insufficient_sms_credits` (compra bonos desde la aplicación). Límites\nanti-abuso: 10 SMS por minuto por organización y 1 por minuto al mismo número\n(429 `sms_rate_limited`).\n\n**Scope requerido:** `sms:send`.",
        "summary": "Enviar un SMS",
        "tags": [
          "SMS"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SmsSendRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SmsSendRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SmsSendRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmsSent"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "sms:send",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/spanish-tax-rates/": {
      "get": {
        "operationId": "spanish_tax_rates_list",
        "description": "Tipos impositivos españoles (IVA, IGIC, IPSI, IRPF, recargo de equivalencia),\nsólo lectura. Sus ``id`` son los que se envían en ``spanish_taxes`` de las líneas.\n\n**Scope requerido:** `taxes:read`.",
        "summary": "Listar tipos impositivos",
        "parameters": [
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSpanishTaxRateList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "taxes:read"
      }
    },
    "/api/v1/spanish-tax-rates/{id}/": {
      "get": {
        "operationId": "spanish_tax_rates_retrieve",
        "description": "Tipos impositivos españoles (IVA, IGIC, IPSI, IRPF, recargo de equivalencia),\nsólo lectura. Sus ``id`` son los que se envían en ``spanish_taxes`` de las líneas.\n\n**Scope requerido:** `taxes:read`.",
        "summary": "Obtener tipo impositivo",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Tipo de Impuesto Español.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpanishTaxRate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "taxes:read"
      }
    },
    "/api/v1/spanish-tax-rates/by-category/": {
      "get": {
        "operationId": "spanish_tax_rates_by_category_retrieve",
        "description": "Impuestos agrupados por categoría.\n\n**Scope requerido:** `taxes:read`.",
        "summary": "Tipos agrupados por categoría",
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "taxes:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/spanish-tax-rates/for-verifactu/": {
      "get": {
        "operationId": "spanish_tax_rates_for_verifactu_retrieve",
        "description": "Solo impuestos que aparecen en VeriFactu.\n\n**Scope requerido:** `taxes:read`.",
        "summary": "Tipos que se declaran en VeriFactu",
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpanishTaxRate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "taxes:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/spanish-tax-regimes/": {
      "get": {
        "operationId": "spanish_tax_regimes_list",
        "description": "Regímenes fiscales españoles (IVA/IGIC), sólo lectura.\n\n**Scope requerido:** `taxes:read`.",
        "summary": "Listar regímenes fiscales",
        "parameters": [
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSpanishTaxRegimeList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "taxes:read"
      }
    },
    "/api/v1/spanish-tax-regimes/{id}/": {
      "get": {
        "operationId": "spanish_tax_regimes_retrieve",
        "description": "Regímenes fiscales españoles (IVA/IGIC), sólo lectura.\n\n**Scope requerido:** `taxes:read`.",
        "summary": "Obtener régimen fiscal",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Régimen Fiscal Español.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpanishTaxRegime"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "taxes:read"
      }
    },
    "/api/v1/supplier-expense-defaults/{id}/": {
      "get": {
        "operationId": "supplier_expense_defaults_retrieve",
        "description": "Valores por defecto de los gastos de un proveedor (`{id}` = id del proveedor): cuenta\ncontable, categoría, tipo de documento y de operación, y avisos de proveedor recurrente\n(`expected_frequency` + `recurring_alerts`). Se aplican al crear gastos de ese proveedor.\n\n**Scope requerido:** `expenses:read`.",
        "summary": "Obtener valores por defecto del proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este supplier.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierExpenseDefaults"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:read"
      },
      "put": {
        "operationId": "supplier_expense_defaults_update",
        "description": "Valores por defecto de los gastos de un proveedor (`{id}` = id del proveedor): cuenta\ncontable, categoría, tipo de documento y de operación, y avisos de proveedor recurrente\n(`expected_frequency` + `recurring_alerts`). Se aplican al crear gastos de ese proveedor.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Reemplazar valores por defecto del proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este supplier.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierExpenseDefaultsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SupplierExpenseDefaultsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SupplierExpenseDefaultsRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierExpenseDefaults"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      },
      "patch": {
        "operationId": "supplier_expense_defaults_partial_update",
        "description": "Valores por defecto de los gastos de un proveedor (`{id}` = id del proveedor): cuenta\ncontable, categoría, tipo de documento y de operación, y avisos de proveedor recurrente\n(`expected_frequency` + `recurring_alerts`). Se aplican al crear gastos de ese proveedor.\n\n**Scope requerido:** `expenses:write`.",
        "summary": "Actualizar valores por defecto del proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este supplier.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Gastos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSupplierExpenseDefaultsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSupplierExpenseDefaultsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSupplierExpenseDefaultsRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierExpenseDefaults"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "expenses:write"
      }
    },
    "/api/v1/suppliers/": {
      "get": {
        "operationId": "suppliers_list",
        "description": "Listar proveedores (Proveedores).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Listar proveedores",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "created_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "email",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "has_mandate",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "legal_name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "payment_terms",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "phone",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tag",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "trade_name",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "vat_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Proveedores"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSupplierList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      },
      "post": {
        "operationId": "suppliers_create",
        "description": "Crear proveedor (Proveedores).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Crear proveedor",
        "tags": [
          "Proveedores"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SupplierRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SupplierRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Supplier"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/suppliers/{id}/": {
      "get": {
        "operationId": "suppliers_retrieve",
        "description": "Obtener proveedor (Proveedores).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Obtener proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este supplier.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Proveedores"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Supplier"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      },
      "put": {
        "operationId": "suppliers_update",
        "description": "Reemplazar proveedor (Proveedores).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Reemplazar proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este supplier.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Proveedores"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SupplierRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SupplierRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Supplier"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      },
      "patch": {
        "operationId": "suppliers_partial_update",
        "description": "Actualizar proveedor (Proveedores).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Actualizar proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este supplier.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Proveedores"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSupplierRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSupplierRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSupplierRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Supplier"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      },
      "delete": {
        "operationId": "suppliers_destroy",
        "description": "Eliminar proveedor (Proveedores).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Eliminar proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este supplier.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Proveedores"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      }
    },
    "/api/v1/suppliers/{id}/merge/": {
      "post": {
        "operationId": "suppliers_merge_create",
        "description": "Fusiona en este contacto (el que se conserva) los duplicados indicados en ``source_ids``\n(o ``source_id``): reasigna sus documentos, pagos, anticipos y personas de contacto, traspasa\nel saldo de su subcuenta contable y elimina los duplicados. ``dry_run=true`` sólo informa de\nlo que se movería; ``force=true`` permite fusionar contactos con NIF distintos (409\n``vat_id_mismatch`` si no). Deja rastro en la auditoría y el nombre de cada duplicado en\n``previous_names``.\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Fusiona en este contacto (el que se conserva) los duplicados indicados en ``source_ids``",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este supplier.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Proveedores"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {}
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Supplier"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      }
    },
    "/api/v1/suppliers/{id}/vies/": {
      "get": {
        "operationId": "suppliers_vies_retrieve",
        "description": "``GET …/{id}/vies/``: si el NIF-IVA es válido, marca el contacto como\noperador intracomunitario y guarda el NIF-IVA normalizado. Si VIES no responde →\n503 ``vies_unavailable`` (el contacto no se modifica).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Comprobar el NIF-IVA en VIES",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este supplier.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Proveedores"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      }
    },
    "/api/v1/suppliers/vies-check/": {
      "get": {
        "operationId": "suppliers_vies_check_retrieve",
        "description": "``GET …/vies-check/?vat=IE3347697KH``: comprobación sin contacto.\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Comprobar un NIF-IVA en VIES",
        "tags": [
          "Proveedores"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/tags/": {
      "get": {
        "operationId": "tags_list",
        "description": "Listar etiquetas (Etiquetas).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Listar etiquetas",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Etiquetas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedTagList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      },
      "post": {
        "operationId": "tags_create",
        "description": "Crear etiqueta (Etiquetas).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Crear etiqueta",
        "tags": [
          "Etiquetas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TagRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TagRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TagRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tag"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/tags/{id}/": {
      "get": {
        "operationId": "tags_retrieve",
        "description": "Obtener etiqueta (Etiquetas).\n\n**Scope requerido:** `contacts:read`.",
        "summary": "Obtener etiqueta",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este tag.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Etiquetas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tag"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:read"
      },
      "put": {
        "operationId": "tags_update",
        "description": "Reemplazar etiqueta (Etiquetas).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Reemplazar etiqueta",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este tag.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Etiquetas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TagRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TagRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TagRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tag"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      },
      "patch": {
        "operationId": "tags_partial_update",
        "description": "Actualizar etiqueta (Etiquetas).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Actualizar etiqueta",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este tag.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Etiquetas"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTagRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTagRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTagRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tag"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      },
      "delete": {
        "operationId": "tags_destroy",
        "description": "Eliminar etiqueta (Etiquetas).\n\n**Scope requerido:** `contacts:write`.",
        "summary": "Eliminar etiqueta",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este tag.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Etiquetas"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "contacts:write"
      }
    },
    "/api/v1/tax-templates/": {
      "get": {
        "operationId": "tax_templates_list",
        "description": "Plantillas de impuestos (sistema anterior a los tipos españoles).\n\n**Scope requerido:** `taxes:read` (también se acepta `products:read`).",
        "summary": "Listar plantillas de impuestos",
        "parameters": [
          {
            "in": "query",
            "name": "active",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "country",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "rate_max",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "rate_min",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "scope",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedTaxTemplateList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "taxes:read",
        "x-scope-alternatives": [
          "products:read"
        ]
      },
      "post": {
        "operationId": "tax_templates_create",
        "description": "Plantillas de impuestos (sistema anterior a los tipos españoles).\n\n**Scope requerido:** `products:write`.",
        "summary": "Crear plantilla de impuestos",
        "tags": [
          "Impuestos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxTemplateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TaxTemplateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TaxTemplateRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/tax-templates/{id}/": {
      "get": {
        "operationId": "tax_templates_retrieve",
        "description": "Plantillas de impuestos (sistema anterior a los tipos españoles).\n\n**Scope requerido:** `taxes:read` (también se acepta `products:read`).",
        "summary": "Obtener plantilla de impuestos",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este tax template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "taxes:read",
        "x-scope-alternatives": [
          "products:read"
        ]
      },
      "put": {
        "operationId": "tax_templates_update",
        "description": "Plantillas de impuestos (sistema anterior a los tipos españoles).\n\n**Scope requerido:** `products:write`.",
        "summary": "Reemplazar plantilla de impuestos",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este tax template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxTemplateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TaxTemplateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TaxTemplateRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:write"
      },
      "patch": {
        "operationId": "tax_templates_partial_update",
        "description": "Plantillas de impuestos (sistema anterior a los tipos españoles).\n\n**Scope requerido:** `products:write`.",
        "summary": "Actualizar plantilla de impuestos",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este tax template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTaxTemplateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTaxTemplateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTaxTemplateRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxTemplate"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:write"
      },
      "delete": {
        "operationId": "tax_templates_destroy",
        "description": "Plantillas de impuestos (sistema anterior a los tipos españoles).\n\n**Scope requerido:** `products:write`.",
        "summary": "Eliminar plantilla de impuestos",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este tax template.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Impuestos"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:write"
      }
    },
    "/api/v1/treasury/bank-accounts/": {
      "get": {
        "operationId": "treasury_bank_accounts_list",
        "description": "Cuentas bancarias y de caja de la organización. Al crear una se le asigna una subcuenta\ncontable propia (5720xxxx bancos / 5700xxxx caja) para comparar su saldo con el del banco.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Listar cuentas bancarias",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "is_active",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "is_default",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string",
              "enum": [
                "bank",
                "cash"
              ]
            },
            "description": "* `bank` - Cuenta bancaria\n* `cash` - Caja (efectivo)"
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedBankAccountList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      },
      "post": {
        "operationId": "treasury_bank_accounts_create",
        "description": "Cuentas bancarias y de caja de la organización. Al crear una se le asigna una subcuenta\ncontable propia (5720xxxx bancos / 5700xxxx caja) para comparar su saldo con el del banco.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Crear cuenta bancaria",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankAccount"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/bank-accounts/{id}/": {
      "get": {
        "operationId": "treasury_bank_accounts_retrieve",
        "description": "Cuentas bancarias y de caja de la organización. Al crear una se le asigna una subcuenta\ncontable propia (5720xxxx bancos / 5700xxxx caja) para comparar su saldo con el del banco.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Obtener cuenta bancaria",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Cuenta bancaria.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankAccount"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      },
      "put": {
        "operationId": "treasury_bank_accounts_update",
        "description": "Cuentas bancarias y de caja de la organización. Al crear una se le asigna una subcuenta\ncontable propia (5720xxxx bancos / 5700xxxx caja) para comparar su saldo con el del banco.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Reemplazar cuenta bancaria",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Cuenta bancaria.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankAccount"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      },
      "patch": {
        "operationId": "treasury_bank_accounts_partial_update",
        "description": "Cuentas bancarias y de caja de la organización. Al crear una se le asigna una subcuenta\ncontable propia (5720xxxx bancos / 5700xxxx caja) para comparar su saldo con el del banco.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Actualizar cuenta bancaria",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Cuenta bancaria.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedBankAccountRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedBankAccountRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedBankAccountRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankAccount"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      },
      "delete": {
        "operationId": "treasury_bank_accounts_destroy",
        "description": "Cuentas bancarias y de caja de la organización. Al crear una se le asigna una subcuenta\ncontable propia (5720xxxx bancos / 5700xxxx caja) para comparar su saldo con el del banco.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Eliminar cuenta bancaria",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Cuenta bancaria.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/bank-accounts/{id}/summary/": {
      "get": {
        "operationId": "treasury_bank_accounts_summary_retrieve",
        "description": "Saldo del banco (último ``balance_after``), saldo contable de su subcuenta, diferencia,\npendientes e ignorados (número e importe) y última importación.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Resumen de la cuenta (banco frente a contabilidad)",
        "parameters": [
          {
            "in": "query",
            "name": "at",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Saldos a esa fecha."
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Cuenta bancaria.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      }
    },
    "/api/v1/treasury/imports/": {
      "get": {
        "operationId": "treasury_imports_list",
        "description": "Extractos bancarios importados (Norma 43, CSV o XLSX) y su resultado.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Listar importaciones de extractos",
        "parameters": [
          {
            "in": "query",
            "name": "bank_account",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "n43",
                "xlsx"
              ]
            },
            "description": "* `n43` - Norma 43 (AEB)\n* `csv` - CSV\n* `xlsx` - Excel (XLSX)"
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "done",
                "error",
                "pending"
              ]
            },
            "description": "* `pending` - Pendiente\n* `done` - Importado\n* `error` - Error"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedBankStatementImportList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      },
      "post": {
        "operationId": "treasury_imports_create",
        "description": "Multipart con ``file`` (Norma 43 .q43/.n43/.txt, CSV o XLSX), ``bank_account`` y, opcionalmente,\n``mapping`` (JSON con las columnas elegidas en el preview). Deduplica reimportaciones, aplica las\nreglas automáticas y el casado automático y devuelve el resultado con contadores (``rows_new``,\n``rows_duplicate``, ``rows_error``, ``auto_matched``) y avisos (``issues``: continuidad de saldos,\ntotales del fichero). 400 ``validation_error`` si el fichero no se puede interpretar: el cuerpo incluye\n``statement_import`` (id del registro con ``status=error``, que conserva el fichero) para repetir la\nimportación con ``mapping``. Un Norma 43 con varias cuentas se importa sólo por el bloque cuyo CCC coincide\ncon el IBAN de la cuenta.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Importar un extracto bancario",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/StatementImportRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankStatementImport"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatementImportError"
                }
              }
            },
            "description": "Datos no válidos o fichero no interpretable (en ese caso ``statement_import`` trae el id de la importación con status=error que conserva el fichero)."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/imports/{id}/": {
      "get": {
        "operationId": "treasury_imports_retrieve",
        "description": "Extractos bancarios importados (Norma 43, CSV o XLSX) y su resultado.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Obtener importación de extracto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Importación de extracto.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankStatementImport"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      }
    },
    "/api/v1/treasury/imports/{id}/transactions/": {
      "get": {
        "operationId": "treasury_imports_transactions_list",
        "description": "Extractos bancarios importados (Norma 43, CSV o XLSX) y su resultado.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Movimientos de una importación",
        "parameters": [
          {
            "in": "query",
            "name": "bank_account",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "n43",
                "xlsx"
              ]
            },
            "description": "* `n43` - Norma 43 (AEB)\n* `csv` - CSV\n* `xlsx` - Excel (XLSX)"
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Importación de extracto.",
            "required": true
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "done",
                "error",
                "pending"
              ]
            },
            "description": "* `pending` - Pendiente\n* `done` - Importado\n* `error` - Error"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedBankTransactionListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      }
    },
    "/api/v1/treasury/imports/preview/": {
      "post": {
        "operationId": "treasury_imports_preview_create",
        "description": "Detecta el formato, el banco (preset) y las columnas; devuelve hasta 20 filas de muestra,\nla confianza (``high`` / ``medium`` / ``low``) y los avisos. Si algo no se detecta, el usuario\nelige las columnas y las envía como ``mapping`` en la importación:\n``{date, value_date, concept, amount | debit + credit, balance, reference, counterparty,\ncounterparty_iban, date_format, decimal_separator, skip_rows, invert_sign}``.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Previsualizar un extracto antes de importarlo",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/StatementPreviewRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatementPreview"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/revolut/accounts/": {
      "get": {
        "operationId": "treasury_revolut_accounts_list",
        "description": "Cuentas y bolsillos de Revolut con su saldo, IBAN, la cuenta bancaria de tesorería enlazada y la\ncomprobación de saldo (Revolut frente al último movimiento importado y a la contabilidad). Lee lo\nguardado en la última sincronización: para volver a consultar Revolut usa ``POST accounts/refresh/``.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Cuentas de Revolut",
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RevolutAccount"
                  }
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/treasury/revolut/accounts/{id}/": {
      "patch": {
        "operationId": "treasury_revolut_accounts_partial_update",
        "description": "``bank_account`` enlaza la cuenta de Revolut con una cuenta bancaria de tesorería existente (null la\ndesenlaza); ``create_bank_account`` crea una nueva (una por cuenta de Revolut y divisa);\n``is_enabled`` activa o pausa la importación de sus movimientos.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Enlazar o habilitar una cuenta de Revolut",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedRevolutAccountUpdateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedRevolutAccountUpdateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedRevolutAccountUpdateRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutAccount"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/revolut/accounts/refresh/": {
      "post": {
        "operationId": "treasury_revolut_accounts_refresh_create",
        "description": "Vuelve a leer en Revolut las cuentas, sus saldos y datos bancarios (enlaza solas las que\ncomparten IBAN con una cuenta bancaria) y devuelve la lista actualizada. Es una acción de escritura.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Actualizar cuentas y saldos desde Revolut",
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RevolutAccount"
                  }
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/revolut/connection/": {
      "get": {
        "operationId": "treasury_revolut_connection_retrieve",
        "description": "Conexión de la organización con Revolut Business.\n\nMétodo recomendado, ``auth_mode=api_key``: (1) clave de firma: ``POST connection/signing-key/`` genera\nen Billora el par Ed25519 y devuelve la clave PÚBLICA (o, si el usuario ya lo generó con el comando\n``openssl`` de Revolut, ``POST`` con ``signing_private_key`` = su private.pem; la pública sale en\n``signing_public_key``); (2) en Revolut Business → APIs → API Console se crea una API key con permisos\nde lectura de cuentas, transacciones y contrapartes y de escritura de contrapartes, borradores de pago\ny webhooks (sin permiso de ejecutar pagos): como hay permisos de escritura, Revolut pide la clave\npública de firma («Generate signing keys»): se sube la del paso 1; (3) ``POST`` con ``api_key``;\n(4) ``POST connection/test/`` comprueba la clave, la firma y qué permisos tiene; (5) se enlazan las\ncuentas (``accounts/``) y se sincroniza (``sync/``). Una API key de sólo lectura puede no exigir firma:\nentonces basta con los pasos 2 a 5.\n\nMétodo antiguo, ``auth_mode=oauth`` (obsoleto en Revolut; se mantiene para las conexiones\nexistentes): (1) ``POST`` con ``environment`` y ``generate_keys=true`` → la respuesta trae\n``certificate_pem`` y ``redirect_uri``; (2) en Revolut Business → APIs → Business API se añade\nel certificado y la redirect URI y Revolut muestra el ``client_id``; (3) ``POST`` con ese\n``client_id``; (4) ``POST connection/authorize-url/`` y el usuario acepta el consentimiento:\nRevolut redirige al callback, que guarda los tokens; (5) se enlazan las cuentas\n(``accounts/``) y se sincroniza (``sync/``).\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Estado de la conexión con Revolut",
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutConnection"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      },
      "post": {
        "operationId": "treasury_revolut_connection_create",
        "description": "Crea o actualiza la conexión (sólo los campos enviados).\n\nCon ``auth_mode=api_key``: ``api_key`` y, sólo si se aporta una clave de firma propia en lugar de\ngenerarla con ``connection/signing-key/``, ``signing_private_key`` (PEM Ed25519, el private.pem). Con\nclave de firma las peticiones se firman (``signing_enabled`` pasa a true). La clave de firma se puede\nguardar antes que la API key. Cambiar la clave, la firma o el entorno deja la conexión en ``pending``\nhasta probarla con ``connection/test/``.\n\nCon ``auth_mode=oauth``: ``generate_keys`` genera el par RSA y el certificado; ``private_key`` admite\nuna clave propia. Cambiar el entorno, el ``client_id``, la clave o la redirect URI invalida la\nautorización anterior.\n\nLa API key, las claves privadas y los tokens se guardan cifrados y nunca se devuelven. Sólo puede\ngestionarla un propietario o administrador, o una API key de Billora con ``treasury:write``; nunca\nel conector MCP.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Configurar la conexión con Revolut",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevolutConnectionWriteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RevolutConnectionWriteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RevolutConnectionWriteRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutConnection"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      },
      "patch": {
        "operationId": "treasury_revolut_connection_partial_update",
        "description": "Crea o actualiza la conexión (sólo los campos enviados).\n\nCon ``auth_mode=api_key``: ``api_key`` y, sólo si se aporta una clave de firma propia en lugar de\ngenerarla con ``connection/signing-key/``, ``signing_private_key`` (PEM Ed25519, el private.pem). Con\nclave de firma las peticiones se firman (``signing_enabled`` pasa a true). La clave de firma se puede\nguardar antes que la API key. Cambiar la clave, la firma o el entorno deja la conexión en ``pending``\nhasta probarla con ``connection/test/``.\n\nCon ``auth_mode=oauth``: ``generate_keys`` genera el par RSA y el certificado; ``private_key`` admite\nuna clave propia. Cambiar el entorno, el ``client_id``, la clave o la redirect URI invalida la\nautorización anterior.\n\nLa API key, las claves privadas y los tokens se guardan cifrados y nunca se devuelven. Sólo puede\ngestionarla un propietario o administrador, o una API key de Billora con ``treasury:write``; nunca\nel conector MCP.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Configurar la conexión con Revolut",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedRevolutConnectionWriteRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedRevolutConnectionWriteRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedRevolutConnectionWriteRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutConnection"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/revolut/connection/authorize-url/": {
      "post": {
        "operationId": "treasury_revolut_connection_authorize_url_create",
        "description": "Devuelve la URL de Revolut Business en la que el usuario autoriza el acceso (permisos\n``scopes``). Tras aceptar, Revolut redirige a ``redirect_uri`` con el ``code``. Sólo existe en el\nmétodo antiguo (``auth_mode=oauth``): con API key responde 409 ``revolut_auth_mode``.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "URL de consentimiento de Revolut (sólo auth_mode=oauth)",
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutAuthorizeUrl"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "409": {
            "description": "``revolut_auth_mode``: la conexión usa una API key y no hay nada que autorizar; o ``revolut_not_configured``."
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/revolut/connection/callback/": {
      "post": {
        "operationId": "treasury_revolut_connection_callback_create",
        "description": "Sólo en el método antiguo (``auth_mode=oauth``; con API key responde 409 ``revolut_auth_mode``).\nAlternativa al callback automático: intercambia a mano el ``code`` devuelto por Revolut (por\nejemplo, cuando la redirect URI configurada es una página propia). Lee las cuentas y lanza la primera\nsincronización.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Completar la autorización con el código (sólo auth_mode=oauth)",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevolutCallbackRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RevolutCallbackRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RevolutCallbackRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutConnection"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "409": {
            "description": "``revolut_auth_mode``: la conexión usa una API key; ``revolut_auth_error`` o ``revolut_not_configured``."
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/revolut/connection/disconnect/": {
      "post": {
        "operationId": "treasury_revolut_connection_disconnect_create",
        "description": "Elimina el webhook en Revolut, borra la API key (con su clave de firma) y los tokens y, con\n``delete_keys``, también el client_id y las claves del método antiguo. Los movimientos importados y\nlas cuentas enlazadas se conservan.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Desconectar Revolut",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevolutDisconnectRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RevolutDisconnectRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RevolutDisconnectRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutConnection"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/revolut/connection/signing-key/": {
      "post": {
        "operationId": "treasury_revolut_connection_signing_key_create",
        "description": "Genera en Billora el par de claves de firma Ed25519 de la API key, para no tener que usar\n``openssl``. La clave privada se guarda cifrada y nunca se devuelve; la respuesta trae la clave\nPÚBLICA en PEM (``public_key``), que hay que subir a Revolut al crear la API key, donde pide «Enter\nor drag and drop generated public signing key». Es el mismo fichero que el public.pem de\n``openssl genpkey -algorithm ed25519 -out private.pem && openssl pkey -in private.pem -pubout -out\npublic.pem``.\n\nSe puede llamar antes de tener la API key: la conexión se crea en ``pending`` con\n``auth_mode=api_key`` (una conexión existente del método antiguo sigue funcionando sin cambios\nhasta que se guarde la API key con ``auth_mode=api_key``). La clave pública se vuelve a leer cuando haga falta en ``signing_public_key``\nde ``GET connection/``. Si ya hay una clave de firma responde 409 ``revolut_signing_key_exists``;\ncon ``regenerate=true`` la sustituye: la API key creada con la clave anterior deja de funcionar y hay\nque subir la nueva clave pública a Revolut (``message`` lo avisa). Para usar una clave propia, envía\n``signing_private_key`` a ``POST connection/``.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Generar la clave de firma de Revolut",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevolutSigningKeyRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RevolutSigningKeyRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RevolutSigningKeyRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutSigningKey"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "403": {
            "description": "Sólo un propietario o administrador, o una API key de Billora con ``treasury:write``; nunca el conector MCP."
          },
          "409": {
            "description": "``revolut_signing_key_exists``: ya hay una clave de firma (repite con ``regenerate=true``)."
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/revolut/connection/test/": {
      "post": {
        "operationId": "treasury_revolut_connection_test_create",
        "description": "Llama a ``GET /accounts`` de Revolut con las credenciales guardadas y devuelve el número de cuentas\nvisibles.\n\nCon API key comprueba además, uno a uno y con lecturas inocuas, los permisos que usa Billora\n(``permissions``: cuentas, transacciones, contrapartes, borradores de pago y webhooks; ``ok`` =\ntrue / false / null si no se pudo comprobar) y los guarda en la conexión. ``ok`` global = puede leer\ncuentas y transacciones; la conexión pasa entonces a ``connected`` (o a ``error`` si le falta alguno\nde esos dos).\n\nCon firma activada, ``signing`` indica la variante de la cadena firmada en uso. Si Revolut rechaza\n(401/403) la primera llamada, se prueban automáticamente las demás variantes con ``GET /accounts``\n(``signing.tested`` = true y ``signing.attempts`` con el código y el mensaje literal de Revolut de cada\nintento): si una funciona (``signing.detected``) se guarda en la conexión (``signing_variant``) y la\nprueba continúa con ella; si ninguna funciona la respuesta es 200 con ``ok`` = false, ``error`` y la\nconexión en ``expired``.\n\n409 ``revolut_auth_error`` si Revolut rechaza una API key sin firma (la conexión pasa a ``expired``)\no, en el método antiguo, si hay que volver a autorizar; 409 ``revolut_not_configured`` si falta la\nAPI key.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Probar la conexión con Revolut",
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutTestResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "409": {
            "description": "``revolut_auth_error``: Revolut rechaza la API key (o hay que volver a autorizar); ``revolut_not_configured``: faltan credenciales."
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/revolut/counterparties/": {
      "get": {
        "operationId": "treasury_revolut_counterparties_list",
        "description": "Beneficiarios guardados en Revolut (consulta directa).\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Contrapartes de Revolut",
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            },
            "description": "Nombre o IBAN."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RevolutCounterparty"
                  }
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      }
    },
    "/api/v1/treasury/revolut/payment-drafts/": {
      "get": {
        "operationId": "treasury_revolut_payment_drafts_list",
        "description": "Borradores creados desde Billora con sus líneas, los gastos que pagan y si ya se han pagado\n(y conciliado).\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Borradores de pago de Revolut",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            },
            "description": "created | partial | completed | deleted"
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RevolutPaymentDraft"
                  }
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      },
      "post": {
        "operationId": "treasury_revolut_payment_drafts_create",
        "description": "Crea un borrador de pago (``POST /payment-drafts`` de Revolut) con los gastos pendientes indicados\n(se paga el importe pendiente al IBAN del proveedor) y/o pagos libres. Da de alta en Revolut las\ncontrapartes que falten. Billora NO ejecuta el pago: el usuario lo aprueba en la app de Revolut. Cuando\nse completa, la sincronización concilia el movimiento con esos gastos.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Crear un borrador de pago en Revolut",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevolutPaymentDraftCreateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RevolutPaymentDraftCreateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RevolutPaymentDraftCreateRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutPaymentDraft"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/revolut/payment-drafts/{id}/": {
      "delete": {
        "operationId": "treasury_revolut_payment_drafts_destroy",
        "description": "Elimina el borrador en Revolut (si no se ha aprobado) y lo marca como eliminado.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Eliminar un borrador de pago de Revolut",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/revolut/sync/": {
      "post": {
        "operationId": "treasury_revolut_sync_create",
        "description": "Actualiza cuentas y saldos e importa los movimientos completados de las cuentas enlazadas\n(idempotente: no duplica los ya importados por la API ni por un extracto). Después aplica las reglas y\nel casado automático.\n\nLa sincronización real se ejecuta EN SEGUNDO PLANO (una carga histórica puede tardar minutos): la\nrespuesta es 202 con el registro en ``running`` y el resultado se consulta en ``GET sync-logs/{id}/``.\n``dry_run`` simula dentro de la petición y devuelve 200 con ``preview`` sin guardar nada (acota el\nperiodo con ``since`` / ``until`` si la cuenta tiene mucho movimiento).\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Sincronizar movimientos de Revolut",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevolutSyncRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RevolutSyncRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RevolutSyncRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutSyncLog"
                }
              }
            },
            "description": "Simulación (``dry_run``) terminada, con ``preview``; o sincronización real ejecutada en la propia petición porque no hay cola disponible.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutSyncLog"
                }
              }
            },
            "description": "Sincronización encolada: el registro va en ``status=running``; consulta ``GET sync-logs/{id}/`` hasta que termine.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "409": {
            "description": "``revolut_sync_in_progress``, ``revolut_not_configured`` o ``revolut_auth_error``."
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/revolut/sync-logs/": {
      "get": {
        "operationId": "treasury_revolut_sync_logs_list",
        "description": "Últimas sincronizaciones (manuales, periódicas y por webhook) con sus contadores y avisos.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Historial de sincronizaciones con Revolut",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            },
            "description": "Máximo de filas (1-200, por defecto 50)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RevolutSyncLog"
                  }
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      }
    },
    "/api/v1/treasury/revolut/sync-logs/{id}/": {
      "get": {
        "operationId": "treasury_revolut_sync_logs_retrieve",
        "description": "Registro de una sincronización: ``status`` (``running`` mientras se ejecuta; ``done``, ``partial``\no ``error`` al terminar), contadores, avisos y error.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Estado de una sincronización con Revolut",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutSyncLog"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      }
    },
    "/api/v1/treasury/revolut/transactions/": {
      "get": {
        "operationId": "treasury_revolut_transactions_retrieve",
        "description": "Transacciones tal como las devuelve Revolut (estado, comercio, tarjeta, legs con divisa original,\ncomisión y saldo), de la más reciente a la más antigua. No importa nada: para eso está ``sync/``.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Transacciones en Revolut (consulta directa)",
        "parameters": [
          {
            "in": "query",
            "name": "account",
            "schema": {
              "type": "integer"
            },
            "description": "Id de la cuenta de Revolut (accounts/)."
          },
          {
            "in": "query",
            "name": "count",
            "schema": {
              "type": "integer"
            },
            "description": "Máximo de transacciones (1-1000, por defecto 100)."
          },
          {
            "in": "query",
            "name": "since",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Creadas desde esta fecha."
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            },
            "description": "card_payment, card_refund, transfer, topup, fee, exchange, atm, refund, tax…"
          },
          {
            "in": "query",
            "name": "until",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Creadas hasta esta fecha (inclusive)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      }
    },
    "/api/v1/treasury/revolut/transactions/{transaction_id}/": {
      "get": {
        "operationId": "treasury_revolut_transactions_retrieve_2",
        "description": "Detalle crudo de una transacción de Revolut (por su id, el ``external_id`` del movimiento).\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Detalle de una transacción en Revolut",
        "parameters": [
          {
            "in": "path",
            "name": "transaction_id",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9:_\\-]{1,100}$"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      }
    },
    "/api/v1/treasury/revolut/webhook/": {
      "delete": {
        "operationId": "treasury_revolut_webhook_destroy",
        "description": "Eliminar el webhook de Revolut (Tesorería).\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Eliminar el webhook de Revolut",
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/treasury/revolut/webhook/register/": {
      "post": {
        "operationId": "treasury_revolut_webhook_register_create",
        "description": "Registra en Revolut el webhook de transacciones (``TransactionCreated`` y\n``TransactionStateChanged``) apuntando a Billora y guarda cifrado su secreto de firma. Con él los\nmovimientos entran al momento en lugar de esperar a la sincronización periódica.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Registrar el webhook de Revolut",
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevolutWebhookStatus"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/rules/": {
      "get": {
        "operationId": "treasury_rules_list",
        "description": "Reglas de conciliación: condiciones (textos del concepto, contraparte, importe, dirección) y\nacción (gasto, traspaso, contabilizar, ignorar). Con ``auto_apply`` se aplican al importar y en el\nrecálculo nocturno; si no, aparecen como sugerencia.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Listar reglas de conciliación",
        "parameters": [
          {
            "in": "query",
            "name": "action",
            "schema": {
              "type": "string",
              "enum": [
                "book",
                "expense",
                "ignore",
                "transfer"
              ]
            },
            "description": "* `expense` - Registrar gasto (comisión, cuota…)\n* `transfer` - Traspaso a otra cuenta\n* `book` - Contabilizar a una cuenta\n* `ignore` - Ignorar"
          },
          {
            "in": "query",
            "name": "auto_apply",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "direction",
            "schema": {
              "type": "string",
              "enum": [
                "any",
                "in",
                "out"
              ]
            },
            "description": "* `in` - Cobros\n* `out` - Pagos\n* `any` - Ambos"
          },
          {
            "in": "query",
            "name": "is_active",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedReconciliationRuleList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      },
      "post": {
        "operationId": "treasury_rules_create",
        "description": "Reglas de conciliación: condiciones (textos del concepto, contraparte, importe, dirección) y\nacción (gasto, traspaso, contabilizar, ignorar). Con ``auto_apply`` se aplican al importar y en el\nrecálculo nocturno; si no, aparecen como sugerencia.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Crear regla de conciliación",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconciliationRuleRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ReconciliationRuleRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ReconciliationRuleRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconciliationRule"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/rules/{id}/": {
      "get": {
        "operationId": "treasury_rules_retrieve",
        "description": "Reglas de conciliación: condiciones (textos del concepto, contraparte, importe, dirección) y\nacción (gasto, traspaso, contabilizar, ignorar). Con ``auto_apply`` se aplican al importar y en el\nrecálculo nocturno; si no, aparecen como sugerencia.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Obtener regla de conciliación",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Regla de conciliación.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconciliationRule"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      },
      "put": {
        "operationId": "treasury_rules_update",
        "description": "Reglas de conciliación: condiciones (textos del concepto, contraparte, importe, dirección) y\nacción (gasto, traspaso, contabilizar, ignorar). Con ``auto_apply`` se aplican al importar y en el\nrecálculo nocturno; si no, aparecen como sugerencia.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Reemplazar regla de conciliación",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Regla de conciliación.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconciliationRuleRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ReconciliationRuleRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ReconciliationRuleRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconciliationRule"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      },
      "patch": {
        "operationId": "treasury_rules_partial_update",
        "description": "Reglas de conciliación: condiciones (textos del concepto, contraparte, importe, dirección) y\nacción (gasto, traspaso, contabilizar, ignorar). Con ``auto_apply`` se aplican al importar y en el\nrecálculo nocturno; si no, aparecen como sugerencia.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Actualizar regla de conciliación",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Regla de conciliación.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedReconciliationRuleRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedReconciliationRuleRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedReconciliationRuleRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconciliationRule"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      },
      "delete": {
        "operationId": "treasury_rules_destroy",
        "description": "Reglas de conciliación: condiciones (textos del concepto, contraparte, importe, dirección) y\nacción (gasto, traspaso, contabilizar, ignorar). Con ``auto_apply`` se aplican al importar y en el\nrecálculo nocturno; si no, aparecen como sugerencia.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Eliminar regla de conciliación",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Regla de conciliación.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/rules/{id}/apply/": {
      "post": {
        "operationId": "treasury_rules_apply_create",
        "description": "Reglas de conciliación: condiciones (textos del concepto, contraparte, importe, dirección) y\nacción (gasto, traspaso, contabilizar, ignorar). Con ``auto_apply`` se aplican al importar y en el\nrecálculo nocturno; si no, aparecen como sugerencia.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Aplicar la regla a los movimientos pendientes",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Regla de conciliación.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuleApplyResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/settings/": {
      "get": {
        "operationId": "treasury_settings_retrieve",
        "description": "Ajustes del casado automático: umbral de puntuación, ventana de fechas, tolerancia de importe y\naprendizaje de pistas.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Ajustes de tesorería",
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TreasurySettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      },
      "patch": {
        "operationId": "treasury_settings_partial_update",
        "description": "Ajustes del casado automático: umbral de puntuación, ventana de fechas, tolerancia de importe y\naprendizaje de pistas.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Actualizar los ajustes de tesorería",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTreasurySettingsRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTreasurySettingsRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedTreasurySettingsRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TreasurySettings"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/treasury/summary/": {
      "get": {
        "operationId": "treasury_summary_retrieve",
        "description": "Resumen de tesorería: todas las cuentas con saldo banco / contable / diferencia, pendientes,\nignorados, totales, meses con movimientos sin conciliar y alertas.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Resumen de tesorería",
        "parameters": [
          {
            "in": "query",
            "name": "at",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Saldos a esa fecha."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      }
    },
    "/api/v1/treasury/transactions/": {
      "get": {
        "operationId": "treasury_transactions_list",
        "description": "Movimientos bancarios importados. Cada fila trae sus ``suggestions`` (las 5 mejores:\n``kind``, ``id``, ``label``, ``amount``, ``score`` 0-100, ``reasons``, ``params``) y sus\n``allocations``. Las acciones (``match``, ``book``, ``transfer``, ``tax-payment``, ``payroll``,\n``ignore``, ``unmatch``, ``rematch``) son atómicas y generan los asientos contables; responden\n409 ``period_locked`` si la fecha cae en un periodo bloqueado y 409\n``invalid_transaction_state`` si el movimiento no está pendiente.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Listar movimientos bancarios",
        "parameters": [
          {
            "in": "query",
            "name": "amount_max",
            "schema": {
              "type": "number"
            },
            "description": "Importe absoluto máximo"
          },
          {
            "in": "query",
            "name": "amount_min",
            "schema": {
              "type": "number"
            },
            "description": "Importe absoluto mínimo"
          },
          {
            "in": "query",
            "name": "auto_matched",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "bank_account",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "concept_code",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "direction",
            "schema": {
              "type": "string",
              "enum": [
                "in",
                "out"
              ]
            },
            "description": "* `in` - Cobros\n* `out` - Pagos"
          },
          {
            "in": "query",
            "name": "document",
            "schema": {
              "type": "string"
            },
            "description": "Movimientos conciliados con un documento: invoice:<id>, expense:<id>, payment:<id> o expense_payment:<id>"
          },
          {
            "in": "query",
            "name": "external_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "external_state",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "has_suggestions",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            },
            "description": "Concepto, referencia o contraparte"
          },
          {
            "in": "query",
            "name": "source",
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "revolut",
                "statement"
              ]
            },
            "description": "* `statement` - Extracto importado\n* `revolut` - Revolut Business (API)\n* `manual` - Manual"
          },
          {
            "in": "query",
            "name": "statement_import",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "booked",
                "ignored",
                "matched",
                "pending",
                "transfer"
              ]
            },
            "description": "* `pending` - Pendiente de conciliar\n* `matched` - Conciliado (cobro/pago)\n* `booked` - Contabilizado\n* `transfer` - Traspaso\n* `ignored` - Ignorado"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedBankTransactionListList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      }
    },
    "/api/v1/treasury/transactions/{id}/": {
      "get": {
        "operationId": "treasury_transactions_retrieve",
        "description": "Movimientos bancarios importados. Cada fila trae sus ``suggestions`` (las 5 mejores:\n``kind``, ``id``, ``label``, ``amount``, ``score`` 0-100, ``reasons``, ``params``) y sus\n``allocations``. Las acciones (``match``, ``book``, ``transfer``, ``tax-payment``, ``payroll``,\n``ignore``, ``unmatch``, ``rematch``) son atómicas y generan los asientos contables; responden\n409 ``period_locked`` si la fecha cae en un periodo bloqueado y 409\n``invalid_transaction_state`` si el movimiento no está pendiente.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Obtener movimiento bancario",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Movimiento bancario.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      }
    },
    "/api/v1/treasury/transactions/{id}/book/": {
      "post": {
        "operationId": "treasury_transactions_book_create",
        "description": "Asiento ``bank_movement`` banco ↔ ``account`` (626, 669, 769, 551, 555, 4751, 476…). Con\n``as_expense`` se crea además un gasto sin IVA (``document_type``, por defecto ``bank_fee``;\nproveedor = ``supplier`` / ``supplier_name`` o el banco de la cuenta) y su pago. ``remember``\ncrea una regla automática para los movimientos parecidos.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Contabilizar a una cuenta (comisión, interés, socio, impuesto…)",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Movimiento bancario.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/BookRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/BookRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/transactions/{id}/candidates/": {
      "get": {
        "operationId": "treasury_transactions_candidates_list",
        "description": "Facturas / gastos pendientes, clientes, proveedores o nóminas que coinciden con ``q`` para\nelegirlos en el reparto de ``match`` / ``payroll``.\n\n**Scope requerido:** `treasury:read`.",
        "summary": "Buscar candidatos a mano",
        "parameters": [
          {
            "in": "query",
            "name": "amount_max",
            "schema": {
              "type": "number"
            },
            "description": "Importe absoluto máximo"
          },
          {
            "in": "query",
            "name": "amount_min",
            "schema": {
              "type": "number"
            },
            "description": "Importe absoluto mínimo"
          },
          {
            "in": "query",
            "name": "auto_matched",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "bank_account",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "concept_code",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "direction",
            "schema": {
              "type": "string",
              "enum": [
                "in",
                "out"
              ]
            },
            "description": "* `in` - Cobros\n* `out` - Pagos"
          },
          {
            "in": "query",
            "name": "document",
            "schema": {
              "type": "string"
            },
            "description": "Movimientos conciliados con un documento: invoice:<id>, expense:<id>, payment:<id> o expense_payment:<id>"
          },
          {
            "in": "query",
            "name": "external_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "external_state",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "has_suggestions",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Movimiento bancario.",
            "required": true
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string"
            },
            "description": "invoice | expense | customer | supplier | payroll | payment | expense_payment (cobros / pagos ya registrados sin cuenta bancaria; por defecto, según el signo del movimiento)."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "q",
            "schema": {
              "type": "string"
            },
            "description": "Número, nombre, NIF o importe."
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            },
            "description": "Concepto, referencia o contraparte"
          },
          {
            "in": "query",
            "name": "source",
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "revolut",
                "statement"
              ]
            },
            "description": "* `statement` - Extracto importado\n* `revolut` - Revolut Business (API)\n* `manual` - Manual"
          },
          {
            "in": "query",
            "name": "statement_import",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "booked",
                "ignored",
                "matched",
                "pending",
                "transfer"
              ]
            },
            "description": "* `pending` - Pendiente de conciliar\n* `matched` - Conciliado (cobro/pago)\n* `booked` - Contabilizado\n* `transfer` - Traspaso\n* `ignored` - Ignorado"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCandidateList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:read"
      }
    },
    "/api/v1/treasury/transactions/{id}/ignore/": {
      "post": {
        "operationId": "treasury_transactions_ignore_create",
        "description": "Para líneas erróneas, duplicadas o anuladas. Su importe sigue contando en la diferencia\nbanco ↔ contabilidad del resumen.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Ignorar el movimiento (sin asiento)",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Movimiento bancario.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IgnoreRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/IgnoreRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/IgnoreRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/transactions/{id}/match/": {
      "post": {
        "operationId": "treasury_transactions_match_create",
        "description": "``allocations``: lista de ``{kind: invoice|expense|customer_advance|account|payment|expense_payment|\npayroll, id|customer_id|account_id|account_code|payment_id|expense_payment_id|payroll_record_id, amount,\ndescription}``. ``payroll`` paga una nómina por su líquido y puede mezclarse con otras aplicaciones (una\nremesa con dos nóminas y una beca registrada como gasto). En ``payment`` / ``expense_payment`` el\n``amount`` es opcional: con un importe menor que el del cobro/pago se enlaza sólo esa parte y el\ncobro/pago SE DIVIDE: el original se queda con el importe enlazado (y toma la cuenta y la fecha del\nbanco) y el resto pasa a un cobro/pago nuevo del mismo documento, con la fecha original y sin cuenta\nbancaria (``allocation.metadata.split_payment_id`` / ``split_amount``), que se enlaza después con otro\nmovimiento (un pago repartido en varios cargos) o se corrige (p. ej. ``counter_account`` si esa parte la\npagó la financiera). El banco nunca queda cargado por más de lo enlazado. ``unmatch`` vuelve a unir el\nresto si no se ha tocado.\n``payment`` / ``expense_payment`` concilian contra un cobro / pago YA REGISTRADO sin cuenta bancaria\n(apuntado a mano antes de importar el extracto, o cobrado con tarjeta): no crean otro; el existente toma\nla cuenta bancaria y la fecha del banco (su asiento pasa a la subcuenta 572xxxx y a la fecha real; la\nfecha anterior queda en ``allocation.metadata.previous_date`` y ``unmatch`` la restaura sin borrar el\ncobro/pago). La suma debe igualar |importe| del\nmovimiento (una diferencia ≤ tolerancia va a 769/669; con ``difference_as_fee`` la diferencia va a\n626 como comisión retenida). Crea los cobros (``Payment``) / pagos (``ExpensePayment``) con la fecha\ndel banco y la cuenta bancaria, cuyos asientos abonan/cargan la subcuenta 572xxxx de la cuenta. Un cargo\naplicado a una factura es una devolución al cliente (la factura debe tener cobros); facturas en divisa:\nel importe se registra en la divisa de la factura con lo abonado en euros. Con ``remember`` la respuesta\ntrae ``created_rule``.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Conciliar con facturas, gastos, anticipos o cuentas",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Movimiento bancario.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MatchRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/MatchRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/MatchRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/transactions/{id}/payroll/": {
      "post": {
        "operationId": "treasury_transactions_payroll_create",
        "description": "Marca las nóminas (``payroll_record_ids``, cuyos netos deben sumar el importe) como pagadas con\nla fecha del banco (se respeta la fecha de pago si ya la tenían) y enlaza su asiento de pago con\nla subcuenta bancaria.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Pago de nóminas",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Movimiento bancario.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PayrollRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PayrollRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PayrollRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/transactions/{id}/rematch/": {
      "post": {
        "operationId": "treasury_transactions_rematch_create",
        "description": "Vuelve a calcular las sugerencias del movimiento (sin aplicar ninguna).\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Recalcular las sugerencias",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Movimiento bancario.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/transactions/{id}/tax-payment/": {
      "post": {
        "operationId": "treasury_transactions_tax_payment_create",
        "description": "Debe 4750/4751/4752/473 / Haber subcuenta bancaria (o la inversa en devoluciones), con\n``model`` y ``period`` (p. ej. 303 y 2026-1T).\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Pago o devolución de un modelo tributario",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Movimiento bancario.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxPaymentRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TaxPaymentRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TaxPaymentRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/transactions/{id}/transfer/": {
      "post": {
        "operationId": "treasury_transactions_transfer_create",
        "description": "Asiento ``transfer`` 572x ↔ 572y con ``target_bank_account``. Si se indica (o se encuentra) el\nmovimiento espejo en la otra cuenta, los dos quedan como ``transfer`` con el mismo asiento.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Traspaso entre cuentas propias",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Movimiento bancario.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransferRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TransferRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TransferRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/transactions/{id}/unmatch/": {
      "post": {
        "operationId": "treasury_transactions_unmatch_create",
        "description": "Borra los cobros/pagos creados (sus asientos se anulan), extorna los asientos directos,\ndevuelve las nóminas a su estado anterior y deja el movimiento pendiente con sugerencias\nrecalculadas. 409 ``period_locked`` si algún asiento cae en un periodo bloqueado.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Deshacer la conciliación",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Movimiento bancario.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/transactions/accept-suggestions/": {
      "post": {
        "operationId": "treasury_transactions_accept_suggestions_create",
        "description": "Aplica la mejor sugerencia de cada movimiento pendiente (``transaction_ids`` o todos) cuya\npuntuación alcance ``min_score`` (por defecto el umbral de la organización). ``dry_run`` sólo\nenumera. Devuelve el resultado por movimiento (``applied`` / ``would_apply`` / ``skipped`` / ``error``).\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Aceptar en bloque las sugerencias seguras",
        "parameters": [
          {
            "in": "query",
            "name": "amount_max",
            "schema": {
              "type": "number"
            },
            "description": "Importe absoluto máximo"
          },
          {
            "in": "query",
            "name": "amount_min",
            "schema": {
              "type": "number"
            },
            "description": "Importe absoluto mínimo"
          },
          {
            "in": "query",
            "name": "auto_matched",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "bank_account",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "concept_code",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "direction",
            "schema": {
              "type": "string",
              "enum": [
                "in",
                "out"
              ]
            },
            "description": "* `in` - Cobros\n* `out` - Pagos"
          },
          {
            "in": "query",
            "name": "document",
            "schema": {
              "type": "string"
            },
            "description": "Movimientos conciliados con un documento: invoice:<id>, expense:<id>, payment:<id> o expense_payment:<id>"
          },
          {
            "in": "query",
            "name": "external_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "external_state",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "has_suggestions",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            },
            "description": "Concepto, referencia o contraparte"
          },
          {
            "in": "query",
            "name": "source",
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "revolut",
                "statement"
              ]
            },
            "description": "* `statement` - Extracto importado\n* `revolut` - Revolut Business (API)\n* `manual` - Manual"
          },
          {
            "in": "query",
            "name": "statement_import",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "booked",
                "ignored",
                "matched",
                "pending",
                "transfer"
              ]
            },
            "description": "* `pending` - Pendiente de conciliar\n* `matched` - Conciliado (cobro/pago)\n* `booked` - Contabilizado\n* `transfer` - Traspaso\n* `ignored` - Ignorado"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AcceptSuggestionsRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/AcceptSuggestionsRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AcceptSuggestionsRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSuggestionResultList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/transactions/bulk-ignore/": {
      "post": {
        "operationId": "treasury_transactions_bulk_ignore_create",
        "description": "Movimientos bancarios importados. Cada fila trae sus ``suggestions`` (las 5 mejores:\n``kind``, ``id``, ``label``, ``amount``, ``score`` 0-100, ``reasons``, ``params``) y sus\n``allocations``. Las acciones (``match``, ``book``, ``transfer``, ``tax-payment``, ``payroll``,\n``ignore``, ``unmatch``, ``rematch``) son atómicas y generan los asientos contables; responden\n409 ``period_locked`` si la fecha cae en un periodo bloqueado y 409\n``invalid_transaction_state`` si el movimiento no está pendiente.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Ignorar varios movimientos",
        "parameters": [
          {
            "in": "query",
            "name": "amount_max",
            "schema": {
              "type": "number"
            },
            "description": "Importe absoluto máximo"
          },
          {
            "in": "query",
            "name": "amount_min",
            "schema": {
              "type": "number"
            },
            "description": "Importe absoluto mínimo"
          },
          {
            "in": "query",
            "name": "auto_matched",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "bank_account",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "concept_code",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "direction",
            "schema": {
              "type": "string",
              "enum": [
                "in",
                "out"
              ]
            },
            "description": "* `in` - Cobros\n* `out` - Pagos"
          },
          {
            "in": "query",
            "name": "document",
            "schema": {
              "type": "string"
            },
            "description": "Movimientos conciliados con un documento: invoice:<id>, expense:<id>, payment:<id> o expense_payment:<id>"
          },
          {
            "in": "query",
            "name": "external_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "external_state",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "has_suggestions",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            },
            "description": "Concepto, referencia o contraparte"
          },
          {
            "in": "query",
            "name": "source",
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "revolut",
                "statement"
              ]
            },
            "description": "* `statement` - Extracto importado\n* `revolut` - Revolut Business (API)\n* `manual` - Manual"
          },
          {
            "in": "query",
            "name": "statement_import",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "booked",
                "ignored",
                "matched",
                "pending",
                "transfer"
              ]
            },
            "description": "* `pending` - Pendiente de conciliar\n* `matched` - Conciliado (cobro/pago)\n* `booked` - Contabilizado\n* `transfer` - Traspaso\n* `ignored` - Ignorado"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkIgnoreRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/BulkIgnoreRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/BulkIgnoreRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSuggestionResultList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write"
      }
    },
    "/api/v1/treasury/transactions/rematch/": {
      "post": {
        "operationId": "treasury_transactions_rematch_create_2",
        "description": "Vuelve a calcular las sugerencias de TODOS los movimientos pendientes de la organización (o sólo\nlos de ``bank_account``): útil después de registrar facturas, gastos, cobros o pagos nuevos. No\naplica ninguna sugerencia ni concilia nada (para eso, ``accept-suggestions``). Devuelve contadores:\n``pending`` (recalculados), ``with_suggestions`` y ``without_suggestions``. Para un solo movimiento:\n``POST /treasury/transactions/{id}/rematch/``.\n\n**Scope requerido:** `treasury:write`.",
        "summary": "Recalcular las sugerencias de todos los pendientes",
        "tags": [
          "Tesorería"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RematchRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RematchRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RematchRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RematchResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "treasury:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/units/": {
      "get": {
        "operationId": "units_list",
        "description": "Unidades de medida de los productos.\n\n**Scope requerido:** `products:read`.",
        "summary": "Listar unidades",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Unidades"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedUnitList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:read"
      },
      "post": {
        "operationId": "units_create",
        "description": "Unidades de medida de los productos.\n\n**Scope requerido:** `products:write`.",
        "summary": "Crear unidad",
        "tags": [
          "Unidades"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UnitRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/UnitRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/UnitRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unit"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/units/{id}/": {
      "get": {
        "operationId": "units_retrieve",
        "description": "Unidades de medida de los productos.\n\n**Scope requerido:** `products:read`.",
        "summary": "Obtener unidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este unit.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Unidades"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unit"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:read"
      },
      "put": {
        "operationId": "units_update",
        "description": "Unidades de medida de los productos.\n\n**Scope requerido:** `products:write`.",
        "summary": "Reemplazar unidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este unit.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Unidades"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UnitRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/UnitRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/UnitRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unit"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:write"
      },
      "patch": {
        "operationId": "units_partial_update",
        "description": "Unidades de medida de los productos.\n\n**Scope requerido:** `products:write`.",
        "summary": "Actualizar unidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este unit.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Unidades"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedUnitRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedUnitRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedUnitRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unit"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:write"
      },
      "delete": {
        "operationId": "units_destroy",
        "description": "Unidades de medida de los productos.\n\n**Scope requerido:** `products:write`.",
        "summary": "Eliminar unidad",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este unit.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Unidades"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "products:write"
      }
    },
    "/api/v1/usage/": {
      "get": {
        "operationId": "usage_list",
        "description": "Registros de uso de la organización por funcionalidad y periodo (sólo lectura).\n\n**Scope requerido:** `account:read`.",
        "summary": "Listar registros de uso",
        "parameters": [
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedUsageRecordList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read"
      }
    },
    "/api/v1/usage/{id}/": {
      "get": {
        "operationId": "usage_retrieve",
        "description": "Registros de uso de la organización por funcionalidad y periodo (sólo lectura).\n\n**Scope requerido:** `account:read`.",
        "summary": "Obtener registro de uso",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este usage record.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageRecord"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read"
      }
    },
    "/api/v1/usage/feature/": {
      "get": {
        "operationId": "usage_feature_retrieve",
        "description": "Devuelve límites y uso actual de un feature_key.\n\n**Scope requerido:** `account:read`.",
        "summary": "Uso de una funcionalidad",
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeatureUsage"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/usage/summary/": {
      "get": {
        "operationId": "usage_summary_retrieve",
        "description": "Devuelve resumen completo de uso\n\n**Scope requerido:** `account:read`.",
        "summary": "Resumen de uso",
        "tags": [
          "Cuenta"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageSummary"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "account:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/vendor-bills/": {
      "get": {
        "operationId": "vendor_bills_list",
        "description": "Facturas de proveedor (cuentas a pagar): borrador → aprobada (numerada) → pagada.\nEl detalle incluye las líneas (`lines`); en el listado no se incluyen. Para registrar facturas\nrecibidas con desglose de IVA y contabilización usa también los gastos (`/expenses/`).\n\n**Scope requerido:** `purchases:read`.",
        "summary": "Listar facturas de proveedor",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "due_date__gte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "due_date__lte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "issue_date",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "issue_date__gte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "issue_date__lte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "series",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "approved",
                "cancelled",
                "draft",
                "overdue",
                "paid",
                "partially_paid"
              ]
            },
            "description": "* `draft` - Borrador\n* `approved` - Aprobada\n* `paid` - Pagada\n* `partially_paid` - Parcialmente pagada\n* `overdue` - Vencida\n* `cancelled` - Anulada"
          },
          {
            "in": "query",
            "name": "supplier",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas de proveedor"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedVendorBillList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:read"
      },
      "post": {
        "operationId": "vendor_bills_create",
        "description": "Facturas de proveedor (cuentas a pagar): borrador → aprobada (numerada) → pagada.\nEl detalle incluye las líneas (`lines`); en el listado no se incluyen. Para registrar facturas\nrecibidas con desglose de IVA y contabilización usa también los gastos (`/expenses/`).\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Crear factura de proveedor",
        "tags": [
          "Facturas de proveedor"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VendorBillRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/VendorBillRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/VendorBillRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VendorBill"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/vendor-bills/{id}/": {
      "get": {
        "operationId": "vendor_bills_retrieve",
        "description": "Facturas de proveedor (cuentas a pagar): borrador → aprobada (numerada) → pagada.\nEl detalle incluye las líneas (`lines`); en el listado no se incluyen. Para registrar facturas\nrecibidas con desglose de IVA y contabilización usa también los gastos (`/expenses/`).\n\n**Scope requerido:** `purchases:read`.",
        "summary": "Obtener factura de proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este vendor bill.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas de proveedor"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VendorBill"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:read"
      },
      "put": {
        "operationId": "vendor_bills_update",
        "description": "Facturas de proveedor (cuentas a pagar): borrador → aprobada (numerada) → pagada.\nEl detalle incluye las líneas (`lines`); en el listado no se incluyen. Para registrar facturas\nrecibidas con desglose de IVA y contabilización usa también los gastos (`/expenses/`).\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Reemplazar factura de proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este vendor bill.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas de proveedor"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VendorBillRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/VendorBillRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/VendorBillRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VendorBill"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      },
      "patch": {
        "operationId": "vendor_bills_partial_update",
        "description": "Facturas de proveedor (cuentas a pagar): borrador → aprobada (numerada) → pagada.\nEl detalle incluye las líneas (`lines`); en el listado no se incluyen. Para registrar facturas\nrecibidas con desglose de IVA y contabilización usa también los gastos (`/expenses/`).\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Actualizar factura de proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este vendor bill.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas de proveedor"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedVendorBillRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedVendorBillRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedVendorBillRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VendorBill"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      },
      "delete": {
        "operationId": "vendor_bills_destroy",
        "description": "Facturas de proveedor (cuentas a pagar): borrador → aprobada (numerada) → pagada.\nEl detalle incluye las líneas (`lines`); en el listado no se incluyen. Para registrar facturas\nrecibidas con desglose de IVA y contabilización usa también los gastos (`/expenses/`).\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Eliminar factura de proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este vendor bill.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Facturas de proveedor"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      }
    },
    "/api/v1/vendor-bills/{id}/approve/": {
      "post": {
        "operationId": "vendor_bills_approve_create",
        "description": "Aprueba la factura de proveedor: le asigna número de su serie (`series` obligatoria) y\nla deja lista para pagar. Cuerpo opcional: `issue_date` (YYYY-MM-DD).\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Aprobar",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este vendor bill.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas de proveedor"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VendorBillApproveRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/VendorBillApproveRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/VendorBillApproveRequestRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VendorBillApproved"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      }
    },
    "/api/v1/vendor-bills/{id}/cancel/": {
      "post": {
        "operationId": "vendor_bills_cancel_create",
        "description": "Anula la factura de proveedor (no si ya está pagada).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Anular",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este vendor bill.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas de proveedor"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      }
    },
    "/api/v1/vendor-bills/{id}/email/": {
      "post": {
        "operationId": "vendor_bills_email_create",
        "description": "Envía la factura de proveedor por email (`to`: lista de direcciones).\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Enviar por email",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este vendor bill.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas de proveedor"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentEmailRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      }
    },
    "/api/v1/vendor-bills/{id}/pdf/": {
      "post": {
        "operationId": "vendor_bills_pdf_create",
        "description": "Encola la generación del PDF de la factura de proveedor.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Generar el PDF (asíncrono)",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este vendor bill.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Facturas de proveedor"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      }
    },
    "/api/v1/vendor-payments/": {
      "get": {
        "operationId": "vendor_payments_list",
        "description": "Pagos de facturas de proveedor: recalculan el saldo y el estado de la factura.\n\n**Scope requerido:** `purchases:read`.",
        "summary": "Listar pagos a proveedores",
        "parameters": [
          {
            "in": "query",
            "name": "bill",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "date",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date__gte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "date__lte",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "method",
            "schema": {
              "type": "string",
              "enum": [
                "card",
                "cash",
                "direct_debit",
                "transfer"
              ]
            },
            "description": "* `transfer` - Transferencia\n* `card` - Tarjeta\n* `cash` - Efectivo\n* `direct_debit` - Domiciliación (SEPA)"
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Pagos a proveedores"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedVendorPaymentList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:read"
      },
      "post": {
        "operationId": "vendor_payments_create",
        "description": "Pagos de facturas de proveedor: recalculan el saldo y el estado de la factura.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Crear pago a proveedor",
        "tags": [
          "Pagos a proveedores"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VendorPaymentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/VendorPaymentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/VendorPaymentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VendorPayment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/vendor-payments/{id}/": {
      "get": {
        "operationId": "vendor_payments_retrieve",
        "description": "Pagos de facturas de proveedor: recalculan el saldo y el estado de la factura.\n\n**Scope requerido:** `purchases:read`.",
        "summary": "Obtener pago a proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este vendor payment.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Pagos a proveedores"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VendorPayment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:read"
      },
      "put": {
        "operationId": "vendor_payments_update",
        "description": "Pagos de facturas de proveedor: recalculan el saldo y el estado de la factura.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Reemplazar pago a proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este vendor payment.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Pagos a proveedores"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VendorPaymentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/VendorPaymentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/VendorPaymentRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VendorPayment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      },
      "patch": {
        "operationId": "vendor_payments_partial_update",
        "description": "Pagos de facturas de proveedor: recalculan el saldo y el estado de la factura.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Actualizar pago a proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este vendor payment.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Pagos a proveedores"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedVendorPaymentRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedVendorPaymentRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedVendorPaymentRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VendorPayment"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      },
      "delete": {
        "operationId": "vendor_payments_destroy",
        "description": "Pagos de facturas de proveedor: recalculan el saldo y el estado de la factura.\n\n**Scope requerido:** `purchases:write`.",
        "summary": "Eliminar pago a proveedor",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este vendor payment.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Pagos a proveedores"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "purchases:write"
      }
    },
    "/api/v1/verifactu/config/": {
      "get": {
        "operationId": "verifactu_config_list",
        "description": "Retorna la configuración de la organización actual.\n\n**Scope requerido:** `verifactu:read`.",
        "summary": "Listar configuraciones VeriFactu",
        "tags": [
          "VeriFactu"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/OrganizacionConfig"
                  }
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "verifactu:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/verifactu/config/health/": {
      "get": {
        "operationId": "verifactu_config_health_retrieve",
        "description": "Retorna el estado de salud del sistema VeriFactu.\n\n**Scope requerido:** `verifactu:read`.",
        "summary": "Estado de la conexión",
        "tags": [
          "VeriFactu"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VeriFactuHealth"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "verifactu:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/verifactu/config/stats/": {
      "get": {
        "operationId": "verifactu_config_stats_retrieve",
        "description": "Retorna estadísticas VeriFactu para la organización actual.\n\n**Scope requerido:** `verifactu:read`.",
        "summary": "Estadísticas de VeriFactu",
        "tags": [
          "VeriFactu"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VeriFactuStats"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "verifactu:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/verifactu/info/": {
      "get": {
        "operationId": "verifactu_info_retrieve",
        "description": "Retorna información básica del sistema VeriFactu.\n\n**Scope requerido:** `verifactu:read`.",
        "summary": "Sistema informático VeriFactu",
        "tags": [
          "VeriFactu"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SistemaInformatico"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "verifactu:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/verifactu/mi-config/": {
      "get": {
        "operationId": "verifactu_mi_config_retrieve",
        "description": "Retorna la configuración VeriFactu de la organización actual.\n\n**Scope requerido:** `verifactu:read`.",
        "summary": "Configuración VeriFactu de la organización",
        "tags": [
          "VeriFactu"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizacionConfig"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "verifactu:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/verifactu/process/process-invoice/": {
      "post": {
        "operationId": "verifactu_process_process_invoice_create",
        "description": "Procesa una factura específica con VeriFactu.\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `verifactu:write`.",
        "summary": "Registrar una factura en VeriFactu",
        "tags": [
          "VeriFactu"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessInvoiceRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ProcessInvoiceRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ProcessInvoiceRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "verifactu:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/verifactu/process/registro-alta/": {
      "post": {
        "operationId": "verifactu_process_registro_alta_create",
        "description": "API compatible con el sistema original para registro de alta.\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `verifactu:write`.",
        "summary": "Registro de alta (compatibilidad)",
        "tags": [
          "VeriFactu"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegistroAltaApiRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RegistroAltaApiRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RegistroAltaApiRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "verifactu:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/verifactu/registros/": {
      "get": {
        "operationId": "verifactu_registros_list",
        "description": "Registros VeriFactu (altas y anulaciones) de las facturas y su estado de envío a la AEAT.\n\n**Scope requerido:** `verifactu:read`.",
        "summary": "Listar registros VeriFactu",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados desde (inclusive). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Creados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "in": "query",
            "name": "estado_envio",
            "schema": {
              "type": "string",
              "enum": [
                "ACEPTADO",
                "ACEPTADO_CON_ERRORES",
                "COMPLETADO_SIN_ENVIO",
                "ENVIADO",
                "ERROR_ENVIO",
                "PENDIENTE",
                "RECHAZADO"
              ]
            },
            "description": "* `PENDIENTE` - PENDIENTE\n* `ENVIADO` - ENVIADO\n* `ACEPTADO` - ACEPTADO\n* `ACEPTADO_CON_ERRORES` - ACEPTADO_CON_ERRORES\n* `RECHAZADO` - RECHAZADO\n* `ERROR_ENVIO` - ERROR_ENVIO\n* `COMPLETADO_SIN_ENVIO` - COMPLETADO_SIN_ENVIO"
          },
          {
            "in": "query",
            "name": "num_serie_factura",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ordering",
            "required": false,
            "in": "query",
            "description": "Qué campo usar para ordenar los resultados.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Un término de búsqueda.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tipo_registro",
            "schema": {
              "type": "string",
              "enum": [
                "ALTA",
                "ANULACION"
              ]
            },
            "description": "* `ALTA` - ALTA\n* `ANULACION` - ANULACION"
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados desde (inclusive). Úsalo para sincronización incremental."
          },
          {
            "in": "query",
            "name": "updated_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificados antes de (exclusivo). Fecha `YYYY-MM-DD` o fecha-hora ISO 8601."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "VeriFactu"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedRegistroFacturaList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "verifactu:read"
      }
    },
    "/api/v1/verifactu/registros/{id}/": {
      "get": {
        "operationId": "verifactu_registros_retrieve",
        "description": "Registros VeriFactu (altas y anulaciones) de las facturas y su estado de envío a la AEAT.\n\n**Scope requerido:** `verifactu:read`.",
        "summary": "Obtener registro VeriFactu",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este registro factura.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "VeriFactu"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistroFactura"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "verifactu:read"
      }
    },
    "/api/v1/verifactu/registros/{id}/retry/": {
      "post": {
        "operationId": "verifactu_registros_retry_create",
        "description": "Reintenta el envío de un registro rechazado o con error.\n\n**Acción irreversible** (numeración, VeriFactu, envío de emails o cobros): pide confirmación al usuario antes de llamarla.\n\n**Scope requerido:** `verifactu:write`.",
        "summary": "Reintentar el envío a la AEAT",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este registro factura.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "VeriFactu"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VeriFactuRetryResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "verifactu:write"
      }
    },
    "/api/v1/verifactu/sistema/": {
      "get": {
        "operationId": "verifactu_sistema_list",
        "description": "ViewSet para consultar información del sistema informático.\nSolo lectura - solo superusers pueden modificar.\n\n**Scope requerido:** `verifactu:read`.",
        "summary": "Listar sistemas informáticos",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "VeriFactu"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSistemaInformaticoList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "verifactu:read"
      }
    },
    "/api/v1/verifactu/sistema/{id}/": {
      "get": {
        "operationId": "verifactu_sistema_retrieve",
        "description": "ViewSet para consultar información del sistema informático.\nSolo lectura - solo superusers pueden modificar.\n\n**Scope requerido:** `verifactu:read`.",
        "summary": "Obtener sistema informático",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este Sistema Informático (SIF).",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "VeriFactu"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SistemaInformatico"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "verifactu:read"
      }
    },
    "/api/v1/webhooks/deliveries/": {
      "get": {
        "operationId": "webhooks_deliveries_list",
        "description": "Registro de entregas (un evento × un endpoint) con su estado y último resultado.",
        "summary": "Listar entregas",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "endpoint",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "event",
            "schema": {
              "type": "string"
            },
            "description": "Id del evento (evt_…)."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            },
            "description": "pending, retrying, succeeded, failed o cancelled (admite comas)."
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            },
            "description": "Tipo de evento (admite comas)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedWebhookDeliveryList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:read"
      }
    },
    "/api/v1/webhooks/deliveries/{id}/": {
      "get": {
        "operationId": "webhooks_deliveries_retrieve",
        "description": "Incluye el sobre enviado y los intentos (código, duración, extracto de la respuesta y error).",
        "summary": "Detalle de una entrega",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este webhook delivery.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:read"
      }
    },
    "/api/v1/webhooks/deliveries/{id}/redeliver/": {
      "post": {
        "operationId": "webhooks_deliveries_redeliver_create",
        "description": "Reenvía ahora (de forma síncrona) el mismo evento al endpoint: mismo `webhook-id`, nuevo `webhook-timestamp` y firma. Un único intento, sin reintentos automáticos.",
        "summary": "Reenviar una entrega",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este webhook delivery.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:write"
      }
    },
    "/api/v1/webhooks/endpoints/": {
      "get": {
        "operationId": "webhooks_endpoints_list",
        "description": "Endpoints configurados en la organización (paginado). El secreto no se incluye.",
        "summary": "Listar endpoints de webhooks",
        "parameters": [
          {
            "in": "query",
            "name": "enabled",
            "schema": {
              "type": "boolean"
            },
            "description": "Filtrar por activos/inactivos."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedWebhookEndpointList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:read"
      },
      "post": {
        "operationId": "webhooks_endpoints_create",
        "description": "Registra una URL https pública. Billora genera el secreto de firma (`whsec_…`) y lo devuelve SÓLO en esta respuesta (después: `GET /webhooks/endpoints/{id}/secret/`). Se rechazan URL a redes privadas, loopback, link-local o reservadas.",
        "summary": "Crear endpoint",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointCreateRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointCreateRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointCreateRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecret"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/api/v1/webhooks/endpoints/{id}/": {
      "get": {
        "operationId": "webhooks_endpoints_retrieve",
        "description": "Configuración y estado de salud del endpoint (sin el secreto).",
        "summary": "Detalle de un endpoint",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este webhook endpoint.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:read"
      },
      "put": {
        "operationId": "webhooks_endpoints_update",
        "description": "Reemplazar endpoint (Webhooks).\n\n**Scope requerido:** `webhooks:write`.",
        "summary": "Reemplazar endpoint",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este webhook endpoint.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:write"
      },
      "patch": {
        "operationId": "webhooks_endpoints_partial_update",
        "description": "Cambia URL, descripción, eventos, metadata o `enabled`.",
        "summary": "Modificar endpoint",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este webhook endpoint.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedWebhookEndpointRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedWebhookEndpointRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedWebhookEndpointRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:write"
      },
      "delete": {
        "operationId": "webhooks_endpoints_destroy",
        "description": "Elimina el endpoint junto con su historial de entregas.",
        "summary": "Eliminar endpoint",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este webhook endpoint.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:write"
      }
    },
    "/api/v1/webhooks/endpoints/{id}/disable/": {
      "post": {
        "operationId": "webhooks_endpoints_disable_create",
        "description": "Deja de enviar eventos al endpoint. Las entregas pendientes se cancelan.",
        "summary": "Desactivar endpoint",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este webhook endpoint.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:write"
      }
    },
    "/api/v1/webhooks/endpoints/{id}/enable/": {
      "post": {
        "operationId": "webhooks_endpoints_enable_create",
        "description": "Reactiva un endpoint deshabilitado (manualmente, por 410 o por fallos).",
        "summary": "Activar endpoint",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este webhook endpoint.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:write"
      }
    },
    "/api/v1/webhooks/endpoints/{id}/recover/": {
      "post": {
        "operationId": "webhooks_endpoints_recover_create",
        "description": "Vuelve a poner en cola las entregas fallidas o canceladas de este endpoint creadas desde `since` (máx. 30 días). El endpoint debe estar activo.",
        "summary": "Recuperar entregas fallidas",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este webhook endpoint.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecoverRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RecoverRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RecoverRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecoverResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:write"
      }
    },
    "/api/v1/webhooks/endpoints/{id}/rotate-secret/": {
      "post": {
        "operationId": "webhooks_endpoints_rotate_secret_create",
        "description": "Genera un secreto nuevo (o usa el indicado). Durante 24 h las peticiones llevan dos firmas en `webhook-signature` (nueva y anterior) para que puedas actualizar tu servidor sin perder eventos.",
        "summary": "Rotar el secreto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este webhook endpoint.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateSecretRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RotateSecretRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RotateSecretRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSecret"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:write"
      }
    },
    "/api/v1/webhooks/endpoints/{id}/secret/": {
      "get": {
        "operationId": "webhooks_endpoints_secret_retrieve",
        "description": "Devuelve el secreto de firma actual. Sólo propietarios y administradores (o API key con `webhooks:write`).",
        "summary": "Ver el secreto",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este webhook endpoint.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSecret"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:write"
      }
    },
    "/api/v1/webhooks/endpoints/{id}/test/": {
      "post": {
        "operationId": "webhooks_endpoints_test_create",
        "description": "Envía de forma síncrona un evento `webhook.test` firmado SÓLO a este endpoint (aunque no esté suscrito a él ni esté activo) y devuelve el resultado del intento: código HTTP, duración, error y un extracto de la respuesta. No afecta a la salud del endpoint.",
        "summary": "Enviar evento de prueba",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "description": "Un valor de entero único que identifique este webhook endpoint.",
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestResult"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:write"
      }
    },
    "/api/v1/webhooks/event-types/": {
      "get": {
        "operationId": "webhooks_event_types_retrieve",
        "description": "Tipos de evento a los que se puede suscribir un endpoint, con su grupo, descripción y el recurso que viaja en `data.object`.",
        "summary": "Catálogo de tipos de evento",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEventTypeList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ]
      }
    },
    "/api/v1/webhooks/events/": {
      "get": {
        "operationId": "webhooks_events_list",
        "description": "Eventos registrados (últimos 30 días). Sólo se registran eventos con algún endpoint activo suscrito.",
        "summary": "Listar eventos",
        "parameters": [
          {
            "in": "query",
            "name": "created_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "created_before",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "object_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "object_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Un número de página dentro del conjunto de resultados paginado.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "description": "Número de resultados a devolver por página.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            },
            "description": "Tipo (o varios separados por comas)."
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedWebhookEventList"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:read"
      }
    },
    "/api/v1/webhooks/events/{id}/": {
      "get": {
        "operationId": "webhooks_events_retrieve",
        "description": "Incluye el sobre exacto (`payload`) que se envía a los endpoints.",
        "summary": "Detalle de un evento",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_]+$"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/XRequestId"
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEventDetail"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-scope": "webhooks:read"
      }
    }
  },
  "components": {
    "schemas": {
      "AcceptSuggestionsRequestRequest": {
        "type": "object",
        "properties": {
          "transaction_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Vacío = todos los pendientes."
          },
          "min_score": {
            "type": "integer",
            "maximum": 100,
            "minimum": 0,
            "description": "Por defecto el umbral de la organización."
          },
          "dry_run": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "Account": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "code": {
            "type": "string",
            "pattern": "^\\d{1,12}$",
            "maxLength": 12
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "description": {
            "type": "string"
          },
          "account_type": {
            "$ref": "#/components/schemas/AccountTypeEnum"
          },
          "group": {
            "$ref": "#/components/schemas/GroupEnum"
          },
          "parent": {
            "type": "integer",
            "nullable": true
          },
          "is_active": {
            "type": "boolean"
          },
          "is_system": {
            "type": "boolean",
            "readOnly": true,
            "description": "Cuentas del PGC PYMES precargadas (no se eliminan)."
          },
          "is_contra": {
            "type": "boolean",
            "description": "Cuenta compensadora (amortización acumulada, deterioros): saldo acreedor que resta en el activo del balance."
          },
          "party_type": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "party_id": {
            "type": "integer",
            "readOnly": true
          },
          "balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "children_count": {
            "type": "integer",
            "readOnly": true
          },
          "has_movements": {
            "type": "boolean",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "account_type",
          "balance",
          "children_count",
          "code",
          "created_at",
          "group",
          "has_movements",
          "id",
          "is_system",
          "name",
          "party_id",
          "party_type",
          "updated_at"
        ]
      },
      "AccountMember": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Id del usuario (para campos como `assigned_to`)."
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "joined_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "email",
          "first_name",
          "id",
          "joined_at",
          "last_name",
          "role"
        ]
      },
      "AccountModule": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled",
          "key",
          "label"
        ]
      },
      "AccountOrganization": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "vat_id": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "expediente_mode": {
            "type": "string",
            "nullable": true,
            "description": "judicial, clinical, both o null."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "country",
          "created_at",
          "currency",
          "expediente_mode",
          "id",
          "language",
          "name",
          "slug",
          "timezone",
          "vat_id"
        ]
      },
      "AccountOverview": {
        "type": "object",
        "properties": {
          "organization": {
            "$ref": "#/components/schemas/AccountOrganization"
          },
          "subscription": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountSubscription"
              }
            ],
            "nullable": true
          },
          "billing_state": {
            "type": "string",
            "description": "none, trialing, active, past_due, action_required, paused o canceled."
          },
          "access_level": {
            "type": "string",
            "description": "full o read_only."
          },
          "modules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountModule"
            }
          },
          "usage": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountUsage"
            }
          }
        },
        "required": [
          "access_level",
          "billing_state",
          "modules",
          "organization",
          "subscription",
          "usage"
        ]
      },
      "AccountRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "minLength": 1,
            "pattern": "^\\d{1,12}$",
            "maxLength": 12
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string"
          },
          "account_type": {
            "$ref": "#/components/schemas/AccountTypeEnum"
          },
          "group": {
            "$ref": "#/components/schemas/GroupEnum"
          },
          "parent": {
            "type": "integer",
            "nullable": true
          },
          "is_active": {
            "type": "boolean"
          },
          "is_contra": {
            "type": "boolean",
            "description": "Cuenta compensadora (amortización acumulada, deterioros): saldo acreedor que resta en el activo del balance."
          }
        },
        "required": [
          "account_type",
          "code",
          "group",
          "name"
        ]
      },
      "AccountSubscription": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "object",
            "additionalProperties": {},
            "description": "`{slug, name}` del plan."
          },
          "status": {
            "type": "string"
          },
          "billing_cycle": {
            "type": "string"
          },
          "current_period_start": {
            "type": "string",
            "format": "date"
          },
          "current_period_end": {
            "type": "string",
            "format": "date"
          },
          "trial_end": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "cancel_at_period_end": {
            "type": "boolean"
          }
        },
        "required": [
          "billing_cycle",
          "cancel_at_period_end",
          "current_period_end",
          "current_period_start",
          "plan",
          "status",
          "trial_end"
        ]
      },
      "AccountTree": {
        "type": "object",
        "description": "Nodo del árbol de cuentas (construido en memoria por la vista).",
        "properties": {
          "id": {
            "type": "integer"
          },
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "account_type": {
            "type": "string"
          },
          "group": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "is_system": {
            "type": "boolean"
          },
          "is_contra": {
            "type": "boolean"
          },
          "balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "children": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "account_type",
          "balance",
          "children",
          "code",
          "group",
          "id",
          "is_active",
          "is_contra",
          "is_system",
          "name"
        ]
      },
      "AccountTypeEnum": {
        "enum": [
          "asset",
          "liability",
          "equity",
          "income",
          "expense"
        ],
        "type": "string",
        "description": "* `asset` - Activo\n* `liability` - Pasivo\n* `equity` - Patrimonio neto\n* `income` - Ingreso\n* `expense` - Gasto"
      },
      "AccountUsage": {
        "type": "object",
        "properties": {
          "feature": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "limit": {
            "type": "integer",
            "description": "0 = ilimitado."
          },
          "used": {
            "type": "integer"
          },
          "remaining": {
            "type": "integer",
            "nullable": true
          },
          "is_hard_limit": {
            "type": "boolean"
          },
          "unit": {
            "type": "string"
          },
          "period": {
            "type": "string"
          }
        },
        "required": [
          "feature",
          "is_hard_limit",
          "limit",
          "name",
          "period",
          "remaining",
          "unit",
          "used"
        ]
      },
      "AccountingConfiguration": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "auto_generate_entries": {
            "type": "boolean",
            "description": "Generar asientos automáticos al emitir facturas / confirmar gastos."
          },
          "is_initialized": {
            "type": "boolean",
            "readOnly": true,
            "description": "True una vez que el PGC PYMES ha sido cargado."
          },
          "lock_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de bloqueo: no se pueden crear, modificar ni borrar asientos ni documentos fechados en esa fecha o antes."
          },
          "accounting_start_date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true,
            "description": "Inicio de la contabilidad en Billora: no se contabiliza nada con fecha contable anterior (lo llevó un asesor externo; sus saldos entran con el asiento de apertura). Se cambia con POST /accounting/config/accounting-start/."
          },
          "auto_lock_on_vat_settlement": {
            "type": "boolean",
            "description": "Al contabilizar una liquidación de IVA, bloquear automáticamente hasta el fin del periodo."
          },
          "payment_method_accounts": {
            "description": "Cuenta de tesorería por método de pago: {\"invoice:<id>\": account_id, \"expense:<id>\": account_id}. Sin mapeo: 570 si el método es efectivo/caja, si no 572."
          },
          "prior_year_error_threshold": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe a partir del cual un gasto o ingreso fechado en un ejercicio ya cerrado se contabiliza contra 113 Reservas voluntarias (error de ejercicios anteriores, NRV 22ª) en lugar de en 6xx/7xx del ejercicio abierto. Vacío = siempre 6xx/7xx."
          },
          "default_sales_account": {
            "type": "integer",
            "nullable": true,
            "description": "705 – Prestaciones de servicios"
          },
          "default_sales_goods_account": {
            "type": "integer",
            "nullable": true,
            "description": "700 – Ventas de mercaderías"
          },
          "default_purchase_account": {
            "type": "integer",
            "nullable": true,
            "description": "600 – Compras de mercaderías (bienes)"
          },
          "default_services_account": {
            "type": "integer",
            "nullable": true,
            "description": "629 – Otros servicios (gastos sin cuenta propia)"
          },
          "default_customer_account": {
            "type": "integer",
            "nullable": true,
            "description": "430 – Clientes (padre de las subcuentas 4300xxxx)"
          },
          "default_supplier_account": {
            "type": "integer",
            "nullable": true,
            "description": "400 – Proveedores (padre de las subcuentas 4000xxxx)"
          },
          "default_creditor_account": {
            "type": "integer",
            "nullable": true,
            "description": "410 – Acreedores por prestaciones de servicios (4100xxxx)"
          },
          "default_vat_output_account": {
            "type": "integer",
            "nullable": true,
            "description": "477 – HP IVA repercutido"
          },
          "default_vat_input_account": {
            "type": "integer",
            "nullable": true,
            "description": "472 – HP IVA soportado"
          },
          "default_vat_deferred_account": {
            "type": "integer",
            "nullable": true,
            "description": "4729 – HP IVA soportado pendiente de deducir"
          },
          "default_bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "572 – Bancos"
          },
          "default_cash_account": {
            "type": "integer",
            "nullable": true,
            "description": "570 – Caja"
          },
          "default_withholding_account": {
            "type": "integer",
            "nullable": true,
            "description": "4751 – HP acreedora por retenciones practicadas"
          },
          "default_surcharge_account": {
            "type": "integer",
            "nullable": true,
            "description": "4771 – HP recargo de equivalencia repercutido"
          }
        },
        "required": [
          "accounting_start_date",
          "id",
          "is_initialized"
        ]
      },
      "AccountingInitialized": {
        "type": "object",
        "properties": {
          "detail": {
            "type": "string"
          },
          "accounts_created": {
            "type": "integer"
          }
        },
        "required": [
          "accounts_created",
          "detail"
        ]
      },
      "AccountingStartFiscalYear": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date"
          }
        },
        "required": [
          "end_date",
          "id",
          "name",
          "start_date"
        ]
      },
      "AccountingStartRequestRequest": {
        "type": "object",
        "properties": {
          "start_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha desde la que Billora lleva la contabilidad (normalmente el primer día de un ejercicio). null quita el inicio y vuelve a contabilizar el histórico."
          },
          "dry_run": {
            "type": "boolean",
            "default": true,
            "description": "true (por defecto): sólo simula y devuelve lo que se eliminaría."
          }
        },
        "required": [
          "start_date"
        ]
      },
      "AccountingStartResult": {
        "type": "object",
        "properties": {
          "start_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "previous_start_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "dry_run": {
            "type": "boolean"
          },
          "entries_deleted": {
            "type": "integer",
            "description": "Asientos (automáticos y manuales) eliminados."
          },
          "entries_by_kind": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "{tipo de asiento: nº}."
          },
          "fiscal_years_removed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountingStartFiscalYear"
            }
          },
          "fiscal_years_renumbered": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "vat_settlements_removed": {
            "type": "integer"
          },
          "documents_before_start": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Documentos anteriores al inicio (sin asiento): invoices, credit_notes, expenses, payments, expense_payments, payrolls."
          },
          "resync": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true,
            "description": "Resumen del backfill posterior (null en dry_run)."
          }
        },
        "required": [
          "documents_before_start",
          "dry_run",
          "entries_by_kind",
          "entries_deleted",
          "fiscal_years_removed",
          "fiscal_years_renumbered",
          "previous_start_date",
          "resync",
          "start_date",
          "vat_settlements_removed"
        ]
      },
      "Activity": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "activity_type": {
            "type": "integer",
            "nullable": true
          },
          "activity_type_name": {
            "type": "string",
            "readOnly": true
          },
          "activity_type_color": {
            "type": "string",
            "readOnly": true
          },
          "activity_type_icon": {
            "type": "string",
            "readOnly": true
          },
          "subject": {
            "type": "string",
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "scheduled_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "is_completed": {
            "type": "boolean"
          },
          "is_overdue": {
            "type": "boolean",
            "readOnly": true
          },
          "deal": {
            "type": "integer",
            "nullable": true
          },
          "deal_title": {
            "type": "string",
            "readOnly": true
          },
          "lead": {
            "type": "integer",
            "nullable": true
          },
          "lead_name": {
            "type": "string",
            "readOnly": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "customer_name": {
            "type": "string",
            "readOnly": true
          },
          "assigned_to": {
            "type": "integer",
            "nullable": true
          },
          "assigned_to_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "activity_type_color",
          "activity_type_icon",
          "activity_type_name",
          "assigned_to_name",
          "completed_at",
          "created_at",
          "customer_name",
          "deal_title",
          "id",
          "is_overdue",
          "lead_name",
          "subject",
          "updated_at"
        ]
      },
      "ActivityRequest": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "activity_type": {
            "type": "integer",
            "nullable": true
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "scheduled_at": {
            "type": "string",
            "format": "date-time"
          },
          "is_completed": {
            "type": "boolean"
          },
          "deal": {
            "type": "integer",
            "nullable": true
          },
          "lead": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "assigned_to": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "subject"
        ]
      },
      "ActivityType": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "icon": {
            "type": "string",
            "maxLength": 50
          },
          "color": {
            "type": "string",
            "maxLength": 7
          },
          "is_default": {
            "type": "boolean"
          },
          "activity_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "activity_count",
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "ActivityTypeRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "icon": {
            "type": "string",
            "maxLength": 50
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          },
          "is_default": {
            "type": "boolean"
          }
        },
        "required": [
          "name"
        ]
      },
      "Address": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "line1": {
            "type": "string",
            "maxLength": 200
          },
          "line2": {
            "type": "string",
            "maxLength": 200
          },
          "city": {
            "type": "string",
            "maxLength": 100
          },
          "postal_code": {
            "type": "string",
            "pattern": "^[A-Za-z0-9\\-\\s]+$",
            "maxLength": 12
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "country": {
            "type": "string",
            "maxLength": 2
          },
          "attention": {
            "type": "string",
            "maxLength": 100
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "city",
          "created_at",
          "line1",
          "postal_code",
          "updated_at"
        ]
      },
      "AddressList": {
        "type": "object",
        "description": "Dirección del cliente dentro de un documento (listado y detalle): misma forma\nque ``billing_address`` en /customers/ (``line1``, ``line2``, ``city``,\n``postal_code``, ``province``, ``country``, ``attention``).",
        "properties": {
          "line1": {
            "type": "string",
            "maxLength": 200
          },
          "line2": {
            "type": "string",
            "maxLength": 200
          },
          "city": {
            "type": "string",
            "maxLength": 100
          },
          "postal_code": {
            "type": "string",
            "pattern": "^[A-Za-z0-9\\-\\s]+$",
            "maxLength": 12
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "country": {
            "type": "string",
            "maxLength": 2
          },
          "attention": {
            "type": "string",
            "maxLength": 100
          }
        },
        "required": [
          "city",
          "line1",
          "postal_code"
        ]
      },
      "AddressRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "line1": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "line2": {
            "type": "string",
            "maxLength": 200
          },
          "city": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "postal_code": {
            "type": "string",
            "minLength": 1,
            "pattern": "^[A-Za-z0-9\\-\\s]+$",
            "maxLength": 12
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "attention": {
            "type": "string",
            "maxLength": 100
          }
        },
        "required": [
          "city",
          "line1",
          "postal_code"
        ]
      },
      "AgendaSettings": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "booking_page_slug": {
            "type": "string",
            "description": "Slug único global para la URL pública de reserva",
            "maxLength": 100,
            "pattern": "^[-a-zA-Z0-9_]+$"
          },
          "default_timezone": {
            "type": "string",
            "maxLength": 50
          },
          "booking_future_days": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Cuántos días en el futuro se puede reservar"
          },
          "min_notice_hours": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Horas mínimas de antelación para reservar"
          },
          "cancellation_policy": {
            "type": "string",
            "description": "Política de cancelación mostrada al reservar"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "booking_page_slug",
          "created_at",
          "id",
          "updated_at"
        ]
      },
      "AgingBucket": {
        "type": "object",
        "properties": {
          "bucket": {
            "type": "string"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "count": {
            "type": "integer"
          }
        },
        "required": [
          "amount",
          "bucket",
          "count"
        ]
      },
      "AlgorithmEnum": {
        "enum": [
          "ed25519"
        ],
        "type": "string",
        "description": "* `ed25519` - Ed25519"
      },
      "Allocation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "kind": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BankAllocationKindEnum"
              }
            ],
            "readOnly": true
          },
          "kind_display": {
            "type": "string",
            "readOnly": true
          },
          "object_type": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "object_id": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "target_type_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "target_id": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "target_display": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "metadata": {
            "readOnly": true,
            "description": "Lo necesario para deshacer (gasto creado, estado anterior de la nómina…)."
          },
          "entries": {
            "type": "array",
            "items": {},
            "readOnly": true,
            "description": "Asientos contables (id, nº, fecha, descripción)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "amount",
          "created_at",
          "entries",
          "id",
          "kind",
          "kind_display",
          "metadata",
          "object_id",
          "object_type",
          "target_display",
          "target_id",
          "target_type_name"
        ]
      },
      "ApplyAdvanceRequest": {
        "type": "object",
        "description": "``POST /payments/{id}/apply/``: aplica (parcialmente) un anticipo a una factura.",
        "properties": {
          "invoice": {
            "type": "integer"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Por defecto, el menor entre el anticipo pendiente y el saldo de la factura."
          },
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true
          }
        },
        "required": [
          "invoice"
        ]
      },
      "ApplyCreditNoteRequest": {
        "type": "object",
        "description": "``POST /expenses/{id}/apply-credit-note/``: compensa un abono de proveedor con el gasto.",
        "properties": {
          "credit_note": {
            "type": "integer"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true
          }
        },
        "required": [
          "credit_note"
        ]
      },
      "ApplyResultRequest": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResultAllocationRequest"
            }
          },
          "force": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "ApplySupplierAdvanceRequest": {
        "type": "object",
        "description": "``POST /expense-payments/{id}/apply/``: aplica (parcialmente) un anticipo a un gasto.",
        "properties": {
          "expense": {
            "type": "integer"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true
          }
        },
        "required": [
          "expense"
        ]
      },
      "AuditLog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "action": {
            "$ref": "#/components/schemas/AuditLogActionEnum"
          },
          "model": {
            "type": "string",
            "maxLength": 120
          },
          "object_id": {
            "type": "string",
            "maxLength": 64
          },
          "username": {
            "type": "string",
            "maxLength": 150
          },
          "ip": {
            "type": "string",
            "nullable": true
          },
          "changes": {}
        },
        "required": [
          "action",
          "created_at",
          "id",
          "model",
          "object_id"
        ]
      },
      "AuditLogActionEnum": {
        "enum": [
          "CREATE",
          "UPDATE",
          "DELETE",
          "ACCESS"
        ],
        "type": "string",
        "description": "* `CREATE` - Create\n* `UPDATE` - Update\n* `DELETE` - Delete\n* `ACCESS` - Access"
      },
      "AuthModeEnum": {
        "enum": [
          "api_key",
          "oauth"
        ],
        "type": "string",
        "description": "* `api_key` - API key\n* `oauth` - Certificado y OAuth (método antiguo)"
      },
      "AvailabilityOverride": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "is_available": {
            "type": "boolean",
            "description": "False = día libre, True = horario especial"
          },
          "start_time": {
            "type": "string",
            "format": "time",
            "nullable": true
          },
          "end_time": {
            "type": "string",
            "format": "time",
            "nullable": true
          },
          "reason": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "date",
          "id"
        ]
      },
      "AvailabilityOverrideRequest": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "is_available": {
            "type": "boolean",
            "description": "False = día libre, True = horario especial"
          },
          "start_time": {
            "type": "string",
            "format": "time",
            "nullable": true
          },
          "end_time": {
            "type": "string",
            "format": "time",
            "nullable": true
          },
          "reason": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "date"
        ]
      },
      "AvailabilityRule": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "event_type": {
            "type": "integer",
            "nullable": true,
            "description": "NULL = regla global de la organización"
          },
          "day_of_week": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "0=Lunes … 6=Domingo"
          },
          "start_time": {
            "type": "string",
            "format": "time"
          },
          "end_time": {
            "type": "string",
            "format": "time"
          },
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "day_of_week",
          "end_time",
          "id",
          "start_time"
        ]
      },
      "AvailabilityRuleRequest": {
        "type": "object",
        "properties": {
          "event_type": {
            "type": "integer",
            "nullable": true,
            "description": "NULL = regla global de la organización"
          },
          "day_of_week": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "0=Lunes … 6=Domingo"
          },
          "start_time": {
            "type": "string",
            "format": "time"
          },
          "end_time": {
            "type": "string",
            "format": "time"
          },
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "day_of_week",
          "end_time",
          "start_time"
        ]
      },
      "BackfillExpensePaymentsRequest": {
        "type": "object",
        "description": "``POST /expenses/backfill-payments/``: pagos automáticos retroactivos.",
        "properties": {
          "dry_run": {
            "type": "boolean",
            "default": true,
            "description": "Sólo enumerar lo que se pagaría (por defecto)."
          },
          "method": {
            "type": "string",
            "nullable": true,
            "description": "Nombre o id del método de pago a asignar a los gastos sin método.",
            "maxLength": 100
          },
          "infer": {
            "type": "boolean",
            "default": false,
            "description": "Deducir el método de los gastos sin método a partir del proveedor."
          },
          "supplier": {
            "type": "integer",
            "minimum": 1,
            "nullable": true,
            "description": "Limitar a un proveedor (id)."
          },
          "until": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Sólo gastos con fecha ≤ YYYY-MM-DD."
          },
          "include_pending": {
            "type": "boolean",
            "default": false,
            "description": "Confirmar también los gastos pendientes antes de pagarlos."
          },
          "force": {
            "type": "boolean",
            "default": false,
            "description": "Pagar también los gastos cuyo método no se liquida automáticamente (transferencia, efectivo), con la fecha de la factura: sólo si el usuario confirma que ya están pagados."
          }
        }
      },
      "BackfillRequestRequest": {
        "type": "object",
        "description": "Parámetros de ``POST /accounting/backfill/``.",
        "properties": {
          "dry_run": {
            "type": "boolean",
            "default": false
          },
          "resync": {
            "type": "boolean",
            "default": false,
            "description": "Re-sincronizar también los documentos ya contabilizados."
          },
          "since": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Sólo documentos desde esta fecha."
          }
        }
      },
      "BackgroundTypeEnum": {
        "enum": [
          "personal",
          "family",
          "surgical",
          "pharmacological",
          "social",
          "gynecological",
          "allergic"
        ],
        "type": "string",
        "description": "* `personal` - Personal\n* `family` - Familiar\n* `surgical` - Quirúrgico\n* `pharmacological` - Farmacológico\n* `social` - Social\n* `gynecological` - Ginecológico\n* `allergic` - Alérgico"
      },
      "BankAccount": {
        "type": "object",
        "description": "Cuenta bancaria o de caja. ``iban`` se valida (dígitos de control) y se guarda sin\nespacios; ``accounting_account`` es la subcuenta 572xxxx/570xxxx que se crea sola.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "kind": {
            "$ref": "#/components/schemas/BankAccountKindEnum"
          },
          "iban": {
            "type": "string",
            "description": "IBAN normalizado (sin espacios).",
            "maxLength": 34
          },
          "iban_formatted": {
            "type": "string",
            "readOnly": true,
            "description": "IBAN en grupos de 4 para mostrar."
          },
          "bic": {
            "type": "string",
            "maxLength": 11
          },
          "bank_name": {
            "type": "string",
            "maxLength": 120
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "accounting_account": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Subcuenta 572xxxx / 570xxxx de esta cuenta (se crea automáticamente)."
          },
          "accounting_account_code": {
            "type": "string",
            "readOnly": true
          },
          "accounting_account_name": {
            "type": "string",
            "readOnly": true
          },
          "is_default": {
            "type": "boolean"
          },
          "is_active": {
            "type": "boolean"
          },
          "notes": {
            "type": "string"
          },
          "last_statement_balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true
          },
          "last_statement_date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true
          },
          "last_import_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "bank_balance": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "Último saldo conocido del banco."
          },
          "ledger_balance": {
            "type": "string",
            "readOnly": true,
            "description": "Saldo contable de la subcuenta."
          },
          "difference": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "Banco − contabilidad (null sin extracto)."
          },
          "pending_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "accounting_account",
          "accounting_account_code",
          "accounting_account_name",
          "bank_balance",
          "created_at",
          "difference",
          "iban_formatted",
          "id",
          "last_import_at",
          "last_statement_balance",
          "last_statement_date",
          "ledger_balance",
          "name",
          "pending_count",
          "updated_at"
        ]
      },
      "BankAccountKindEnum": {
        "enum": [
          "bank",
          "cash"
        ],
        "type": "string",
        "description": "* `bank` - Cuenta bancaria\n* `cash` - Caja (efectivo)"
      },
      "BankAccountRequest": {
        "type": "object",
        "description": "Cuenta bancaria o de caja. ``iban`` se valida (dígitos de control) y se guarda sin\nespacios; ``accounting_account`` es la subcuenta 572xxxx/570xxxx que se crea sola.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "kind": {
            "$ref": "#/components/schemas/BankAccountKindEnum"
          },
          "iban": {
            "type": "string",
            "description": "IBAN normalizado (sin espacios).",
            "maxLength": 34
          },
          "bic": {
            "type": "string",
            "maxLength": 11
          },
          "bank_name": {
            "type": "string",
            "maxLength": 120
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "is_default": {
            "type": "boolean"
          },
          "is_active": {
            "type": "boolean"
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "BankAllocationKindEnum": {
        "enum": [
          "invoice_payment",
          "expense_payment",
          "customer_advance",
          "tax_payment",
          "payroll_payment",
          "transfer",
          "journal_entry"
        ],
        "type": "string",
        "description": "* `invoice_payment` - Cobro de factura\n* `expense_payment` - Pago de gasto\n* `customer_advance` - Anticipo de cliente\n* `tax_payment` - Pago de impuestos\n* `payroll_payment` - Pago de nómina\n* `transfer` - Traspaso entre cuentas\n* `journal_entry` - Asiento contable"
      },
      "BankStatementFormatEnum": {
        "enum": [
          "n43",
          "csv",
          "xlsx"
        ],
        "type": "string",
        "description": "* `n43` - Norma 43 (AEB)\n* `csv` - CSV\n* `xlsx` - Excel (XLSX)"
      },
      "BankStatementImport": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "bank_account": {
            "type": "integer",
            "readOnly": true
          },
          "bank_account_name": {
            "type": "string",
            "readOnly": true
          },
          "original_filename": {
            "type": "string",
            "readOnly": true
          },
          "format": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BankStatementFormatEnum"
              }
            ],
            "readOnly": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BankStatementStatusEnum"
              }
            ],
            "readOnly": true
          },
          "mapping": {
            "readOnly": true,
            "description": "Columnas usadas al interpretar el fichero."
          },
          "rows_total": {
            "type": "integer",
            "readOnly": true
          },
          "rows_new": {
            "type": "integer",
            "readOnly": true
          },
          "rows_duplicate": {
            "type": "integer",
            "readOnly": true
          },
          "rows_error": {
            "type": "integer",
            "readOnly": true
          },
          "auto_matched": {
            "type": "integer",
            "readOnly": true,
            "description": "Movimientos casados automáticamente."
          },
          "period_start": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true
          },
          "period_end": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true
          },
          "opening_balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true
          },
          "closing_balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true
          },
          "issues": {
            "readOnly": true,
            "description": "Avisos (continuidad de saldos, totales…)."
          },
          "error": {
            "type": "string",
            "readOnly": true
          },
          "created_by": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "created_by_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "auto_matched",
          "bank_account",
          "bank_account_name",
          "closing_balance",
          "created_at",
          "created_by",
          "created_by_name",
          "error",
          "format",
          "id",
          "issues",
          "mapping",
          "opening_balance",
          "original_filename",
          "period_end",
          "period_start",
          "rows_duplicate",
          "rows_error",
          "rows_new",
          "rows_total",
          "status"
        ]
      },
      "BankStatementStatusEnum": {
        "enum": [
          "pending",
          "done",
          "error"
        ],
        "type": "string",
        "description": "* `pending` - Pendiente\n* `done` - Importado\n* `error` - Error"
      },
      "BankTransactionDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "bank_account": {
            "type": "integer",
            "readOnly": true
          },
          "bank_account_name": {
            "type": "string",
            "readOnly": true
          },
          "statement_import": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "description": "Fecha de operación."
          },
          "value_date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Con signo: + cobro, − pago."
          },
          "currency": {
            "type": "string",
            "readOnly": true
          },
          "direction": {
            "type": "string",
            "readOnly": true
          },
          "concept": {
            "type": "string",
            "readOnly": true
          },
          "reference": {
            "type": "string",
            "readOnly": true
          },
          "counterparty_name": {
            "type": "string",
            "readOnly": true
          },
          "counterparty_iban": {
            "type": "string",
            "readOnly": true
          },
          "concept_code": {
            "type": "string",
            "readOnly": true,
            "description": "Concepto común AEB (Norma 43)."
          },
          "balance_after": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BankTransactionStatusEnum"
              }
            ],
            "readOnly": true
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "matched_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "auto_matched": {
            "type": "boolean",
            "readOnly": true
          },
          "suggestions": {
            "type": "array",
            "items": {},
            "readOnly": true,
            "description": "Propuestas del motor (sólo en movimientos pendientes: un movimiento resuelto devuelve [])."
          },
          "top_suggestion": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true,
            "readOnly": true,
            "description": "Mejor sugerencia (o null; siempre null si el movimiento no está pendiente)."
          },
          "allocations_summary": {
            "type": "array",
            "items": {},
            "readOnly": true
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "notes": {
            "type": "string",
            "readOnly": true
          },
          "foreign_currency": {
            "type": "boolean",
            "readOnly": true,
            "description": "La cuenta o el movimiento no están en euros: sin sugerencias ni casado automático, y las acciones contables responden 409 ``foreign_currency_account`` (sólo ``ignore``)."
          },
          "notice": {
            "type": "string",
            "readOnly": true,
            "description": "Aviso para el usuario (cuenta en divisa, revertido…)."
          },
          "source": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BankTransactionSourceEnum"
              }
            ],
            "readOnly": true
          },
          "external_id": {
            "type": "string",
            "readOnly": true,
            "default": "",
            "description": "Identificador del movimiento en el banco (id de la transacción de Revolut; «<id>:fee» para su comisión). Único por cuenta: deduplica entre la API y los extractos."
          },
          "external_state": {
            "type": "string",
            "readOnly": true,
            "description": "Estado en el banco (completed, reverted…)."
          },
          "merchant_name": {
            "type": "string",
            "readOnly": true
          },
          "card_last4": {
            "type": "string",
            "readOnly": true
          },
          "original_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true,
            "description": "Importe en la divisa original de la operación."
          },
          "original_currency": {
            "type": "string",
            "readOnly": true
          },
          "fee_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true,
            "description": "Comisión del banco asociada (se importa como movimiento aparte)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Allocation"
            },
            "readOnly": true
          },
          "resolved_by": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "resolved_by_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "created_rule": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true,
            "readOnly": true,
            "description": "Regla automática creada en esta misma llamada (``remember=true``), si la hay."
          },
          "raw": {
            "readOnly": true,
            "description": "Datos originales reducidos (tipo, comercio, divisa…)."
          }
        },
        "required": [
          "allocations",
          "allocations_summary",
          "amount",
          "auto_matched",
          "balance_after",
          "bank_account",
          "bank_account_name",
          "card_last4",
          "concept",
          "concept_code",
          "counterparty_iban",
          "counterparty_name",
          "created_at",
          "created_rule",
          "currency",
          "date",
          "direction",
          "external_id",
          "external_state",
          "fee_amount",
          "foreign_currency",
          "id",
          "matched_amount",
          "merchant_name",
          "notes",
          "notice",
          "original_amount",
          "original_currency",
          "raw",
          "reference",
          "resolved_at",
          "resolved_by",
          "resolved_by_name",
          "source",
          "statement_import",
          "status",
          "status_display",
          "suggestions",
          "top_suggestion",
          "updated_at",
          "value_date"
        ]
      },
      "BankTransactionList": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "bank_account": {
            "type": "integer",
            "readOnly": true
          },
          "bank_account_name": {
            "type": "string",
            "readOnly": true
          },
          "statement_import": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "description": "Fecha de operación."
          },
          "value_date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Con signo: + cobro, − pago."
          },
          "currency": {
            "type": "string",
            "readOnly": true
          },
          "direction": {
            "type": "string",
            "readOnly": true
          },
          "concept": {
            "type": "string",
            "readOnly": true
          },
          "reference": {
            "type": "string",
            "readOnly": true
          },
          "counterparty_name": {
            "type": "string",
            "readOnly": true
          },
          "counterparty_iban": {
            "type": "string",
            "readOnly": true
          },
          "concept_code": {
            "type": "string",
            "readOnly": true,
            "description": "Concepto común AEB (Norma 43)."
          },
          "balance_after": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BankTransactionStatusEnum"
              }
            ],
            "readOnly": true
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "matched_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "auto_matched": {
            "type": "boolean",
            "readOnly": true
          },
          "suggestions": {
            "type": "array",
            "items": {},
            "readOnly": true,
            "description": "Propuestas del motor (sólo en movimientos pendientes: un movimiento resuelto devuelve [])."
          },
          "top_suggestion": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true,
            "readOnly": true,
            "description": "Mejor sugerencia (o null; siempre null si el movimiento no está pendiente)."
          },
          "allocations_summary": {
            "type": "array",
            "items": {},
            "readOnly": true
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "notes": {
            "type": "string",
            "readOnly": true
          },
          "foreign_currency": {
            "type": "boolean",
            "readOnly": true,
            "description": "La cuenta o el movimiento no están en euros: sin sugerencias ni casado automático, y las acciones contables responden 409 ``foreign_currency_account`` (sólo ``ignore``)."
          },
          "notice": {
            "type": "string",
            "readOnly": true,
            "description": "Aviso para el usuario (cuenta en divisa, revertido…)."
          },
          "source": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BankTransactionSourceEnum"
              }
            ],
            "readOnly": true
          },
          "external_id": {
            "type": "string",
            "readOnly": true,
            "default": "",
            "description": "Identificador del movimiento en el banco (id de la transacción de Revolut; «<id>:fee» para su comisión). Único por cuenta: deduplica entre la API y los extractos."
          },
          "external_state": {
            "type": "string",
            "readOnly": true,
            "description": "Estado en el banco (completed, reverted…)."
          },
          "merchant_name": {
            "type": "string",
            "readOnly": true
          },
          "card_last4": {
            "type": "string",
            "readOnly": true
          },
          "original_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true,
            "description": "Importe en la divisa original de la operación."
          },
          "original_currency": {
            "type": "string",
            "readOnly": true
          },
          "fee_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true,
            "description": "Comisión del banco asociada (se importa como movimiento aparte)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "allocations_summary",
          "amount",
          "auto_matched",
          "balance_after",
          "bank_account",
          "bank_account_name",
          "card_last4",
          "concept",
          "concept_code",
          "counterparty_iban",
          "counterparty_name",
          "created_at",
          "currency",
          "date",
          "direction",
          "external_id",
          "external_state",
          "fee_amount",
          "foreign_currency",
          "id",
          "matched_amount",
          "merchant_name",
          "notes",
          "notice",
          "original_amount",
          "original_currency",
          "reference",
          "resolved_at",
          "source",
          "statement_import",
          "status",
          "status_display",
          "suggestions",
          "top_suggestion",
          "updated_at",
          "value_date"
        ]
      },
      "BankTransactionSourceEnum": {
        "enum": [
          "statement",
          "revolut",
          "manual"
        ],
        "type": "string",
        "description": "* `statement` - Extracto importado\n* `revolut` - Revolut Business (API)\n* `manual` - Manual"
      },
      "BankTransactionStatusEnum": {
        "enum": [
          "pending",
          "matched",
          "booked",
          "transfer",
          "ignored"
        ],
        "type": "string",
        "description": "* `pending` - Pendiente de conciliar\n* `matched` - Conciliado (cobro/pago)\n* `booked` - Contabilizado\n* `transfer` - Traspaso\n* `ignored` - Ignorado"
      },
      "BlankEnum": {
        "enum": [
          ""
        ]
      },
      "BookRequestRequest": {
        "type": "object",
        "properties": {
          "account": {
            "type": "integer",
            "nullable": true
          },
          "account_code": {
            "type": "string",
            "description": "Alternativa a account (626, 669…)."
          },
          "description": {
            "type": "string",
            "maxLength": 200
          },
          "supplier": {
            "type": "integer",
            "nullable": true,
            "description": "Proveedor del gasto (si as_expense)."
          },
          "supplier_name": {
            "type": "string",
            "description": "Crear/usar un proveedor con este nombre (p. ej. el banco).",
            "maxLength": 200
          },
          "as_expense": {
            "type": "boolean",
            "default": false
          },
          "document_type": {
            "type": "string",
            "minLength": 1,
            "default": "bank_fee"
          },
          "expense_category": {
            "type": "integer",
            "nullable": true
          },
          "remember": {
            "type": "boolean",
            "default": false,
            "description": "Crear una regla automática para movimientos parecidos."
          }
        }
      },
      "Booking": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "event_type": {
            "type": "integer"
          },
          "event_type_name": {
            "type": "string",
            "readOnly": true
          },
          "reference": {
            "type": "string",
            "readOnly": true
          },
          "start_datetime": {
            "type": "string",
            "format": "date-time"
          },
          "end_datetime": {
            "type": "string",
            "format": "date-time"
          },
          "timezone": {
            "type": "string",
            "maxLength": 50
          },
          "status": {
            "$ref": "#/components/schemas/BookingStatusEnum"
          },
          "booker_name": {
            "type": "string",
            "default": "",
            "maxLength": 200
          },
          "booker_email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "default": "",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "booker_phone": {
            "type": "string",
            "maxLength": 50
          },
          "patient": {
            "type": "integer",
            "nullable": true
          },
          "patient_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "customer_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "answers": {
            "description": "Respuestas a las preguntas custom del tipo de evento"
          },
          "notes": {
            "type": "string"
          },
          "google_event_id": {
            "type": "string",
            "readOnly": true
          },
          "payment_status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentStatusEnum"
              }
            ],
            "readOnly": true
          },
          "amount_paid": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true
          },
          "cancellation_reason": {
            "type": "string"
          },
          "cancelled_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "reminder_sent": {
            "type": "boolean",
            "readOnly": true
          },
          "confirmation_token": {
            "type": "string",
            "format": "uuid",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "amount_paid",
          "cancelled_at",
          "confirmation_token",
          "created_at",
          "customer_name",
          "event_type",
          "event_type_name",
          "google_event_id",
          "id",
          "patient_name",
          "payment_status",
          "reference",
          "reminder_sent",
          "start_datetime",
          "updated_at"
        ]
      },
      "BookingRequest": {
        "type": "object",
        "properties": {
          "event_type": {
            "type": "integer"
          },
          "start_datetime": {
            "type": "string",
            "format": "date-time"
          },
          "end_datetime": {
            "type": "string",
            "format": "date-time"
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "status": {
            "$ref": "#/components/schemas/BookingStatusEnum"
          },
          "booker_name": {
            "type": "string",
            "default": "",
            "maxLength": 200
          },
          "booker_email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "default": "",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "booker_phone": {
            "type": "string",
            "maxLength": 50
          },
          "patient": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "answers": {
            "description": "Respuestas a las preguntas custom del tipo de evento"
          },
          "notes": {
            "type": "string"
          },
          "cancellation_reason": {
            "type": "string"
          }
        },
        "required": [
          "event_type",
          "start_datetime"
        ]
      },
      "BookingStatusEnum": {
        "enum": [
          "scheduled",
          "confirmed",
          "cancelled",
          "completed",
          "no_show"
        ],
        "type": "string",
        "description": "* `scheduled` - Programada\n* `confirmed` - Confirmada\n* `cancelled` - Cancelada\n* `completed` - Completada\n* `no_show` - No presentado"
      },
      "BulkIgnoreRequestRequest": {
        "type": "object",
        "properties": {
          "transaction_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "minItems": 1
          },
          "reason": {
            "type": "string",
            "maxLength": 2000
          }
        },
        "required": [
          "transaction_ids"
        ]
      },
      "BulkPaymentRequest": {
        "type": "object",
        "properties": {
          "invoice_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "minItems": 1
          },
          "payment_method": {
            "type": "integer",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "use_invoice_date": {
            "type": "boolean",
            "default": false
          },
          "notes": {
            "type": "string",
            "default": ""
          },
          "is_full_payment": {
            "type": "boolean",
            "default": true
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true
          }
        },
        "required": [
          "invoice_ids"
        ]
      },
      "BulkPaymentResult": {
        "type": "object",
        "properties": {
          "detail": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          }
        },
        "required": [
          "count",
          "detail"
        ]
      },
      "CRMSettings": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "default_pipeline": {
            "type": "integer",
            "nullable": true
          },
          "default_currency": {
            "type": "string",
            "maxLength": 3
          },
          "auto_create_customer_on_conversion": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "Candidate": {
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/CandidateKindEnum"
          },
          "id": {
            "type": "integer"
          },
          "label": {
            "type": "string"
          },
          "amount": {
            "type": "string",
            "nullable": true,
            "description": "Pendiente (facturas/gastos) o neto (nóminas)."
          },
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "party": {
            "type": "string"
          }
        },
        "required": [
          "amount",
          "date",
          "id",
          "kind",
          "label",
          "party"
        ]
      },
      "CandidateKindEnum": {
        "enum": [
          "invoice",
          "expense",
          "customer",
          "supplier",
          "payroll",
          "payment",
          "expense_payment"
        ],
        "type": "string",
        "description": "* `invoice` - Facturas\n* `expense` - Gastos\n* `customer` - Clientes\n* `supplier` - Proveedores\n* `payroll` - Nóminas\n* `payment` - Cobros ya registrados sin cuenta bancaria\n* `expense_payment` - Pagos ya registrados sin cuenta bancaria"
      },
      "CaseAction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "case": {
            "type": "integer",
            "readOnly": true
          },
          "title": {
            "type": "string",
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "action_date": {
            "type": "string",
            "format": "date-time"
          },
          "deadline": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/CaseActionStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "priority": {
            "$ref": "#/components/schemas/PriorityEnum"
          },
          "priority_display": {
            "type": "string",
            "readOnly": true
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "is_overdue": {
            "type": "boolean",
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "case",
          "completed_at",
          "created_at",
          "id",
          "is_overdue",
          "priority_display",
          "status_display",
          "title",
          "updated_at"
        ]
      },
      "CaseActionRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "action_date": {
            "type": "string",
            "format": "date-time"
          },
          "deadline": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/CaseActionStatusEnum"
          },
          "priority": {
            "$ref": "#/components/schemas/PriorityEnum"
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "title"
        ]
      },
      "CaseActionStatusEnum": {
        "enum": [
          "pending",
          "in_progress",
          "completed",
          "overdue"
        ],
        "type": "string",
        "description": "* `pending` - Pendiente\n* `in_progress` - En curso\n* `completed` - Completada\n* `overdue` - Vencida"
      },
      "CaseDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "reference": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "case_type": {
            "type": "integer",
            "nullable": true
          },
          "case_type_name": {
            "type": "string",
            "readOnly": true
          },
          "case_type_color": {
            "type": "string",
            "readOnly": true
          },
          "case_type_icon": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "$ref": "#/components/schemas/CaseStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "priority": {
            "$ref": "#/components/schemas/PriorityEnum"
          },
          "priority_display": {
            "type": "string",
            "readOnly": true
          },
          "customer": {
            "type": "integer"
          },
          "customer_name": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "customer_client_number": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "open_date": {
            "type": "string",
            "format": "date"
          },
          "close_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "has_judicial_data": {
            "type": "boolean"
          },
          "court": {
            "type": "integer",
            "nullable": true
          },
          "court_name": {
            "type": "string",
            "readOnly": true
          },
          "court_case_number": {
            "type": "string",
            "maxLength": 100
          },
          "jurisdiction": {
            "type": "integer",
            "nullable": true
          },
          "jurisdiction_name": {
            "type": "string",
            "readOnly": true
          },
          "opposing_party": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "tag_objects": {
            "type": "array",
            "items": {},
            "readOnly": true
          },
          "parties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseParty"
            },
            "readOnly": true
          },
          "action_count": {
            "type": "integer",
            "readOnly": true
          },
          "overdue_count": {
            "type": "integer",
            "readOnly": true
          },
          "linked_document_count": {
            "type": "integer",
            "readOnly": true
          },
          "file_count": {
            "type": "integer",
            "readOnly": true
          },
          "cloud_folder_id": {
            "type": "string",
            "readOnly": true,
            "description": "Cloud provider folder ID/path for this case"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "action_count",
          "case_type_color",
          "case_type_icon",
          "case_type_name",
          "cloud_folder_id",
          "court_name",
          "created_at",
          "customer",
          "customer_client_number",
          "customer_name",
          "file_count",
          "id",
          "jurisdiction_name",
          "linked_document_count",
          "overdue_count",
          "parties",
          "priority_display",
          "status_display",
          "tag_objects",
          "title",
          "updated_at"
        ]
      },
      "CaseDetailRequest": {
        "type": "object",
        "properties": {
          "reference": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "case_type": {
            "type": "integer",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/CaseStatusEnum"
          },
          "priority": {
            "$ref": "#/components/schemas/PriorityEnum"
          },
          "customer": {
            "type": "integer"
          },
          "open_date": {
            "type": "string",
            "format": "date"
          },
          "close_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "has_judicial_data": {
            "type": "boolean"
          },
          "court": {
            "type": "integer",
            "nullable": true
          },
          "court_case_number": {
            "type": "string",
            "maxLength": 100
          },
          "jurisdiction": {
            "type": "integer",
            "nullable": true
          },
          "opposing_party": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "tag_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "writeOnly": true
            },
            "writeOnly": true
          }
        },
        "required": [
          "customer",
          "title"
        ]
      },
      "CaseFile": {
        "type": "object",
        "description": "Limita los FK a modelos SIN campo ``organization`` propio (carpetas de un\nexpediente/paciente, etapas…) a los de la organización activa, a través de\nsu padre: ``org_scoped_related_fields = {\"parent\": \"patient__organization\"}``.\n\nUn id de otra organización responde 400 (``does_not_exist``) en lugar de\naceptarse (fuga entre organizaciones). La coherencia con el padre concreto\n(misma carpeta del mismo paciente) la valida la vista.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "case": {
            "type": "integer",
            "readOnly": true
          },
          "folder": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "file": {
            "type": "string",
            "format": "uri"
          },
          "file_size": {
            "type": "integer",
            "readOnly": true
          },
          "mime_type": {
            "type": "string",
            "readOnly": true
          },
          "download_url": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "cloud_file_id": {
            "type": "string",
            "readOnly": true
          },
          "sync_status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SyncStatusEnum"
              }
            ],
            "readOnly": true
          },
          "version": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "case",
          "cloud_file_id",
          "created_at",
          "download_url",
          "file",
          "file_size",
          "id",
          "mime_type",
          "name",
          "sync_status",
          "updated_at",
          "version"
        ]
      },
      "CaseFileRequest": {
        "type": "object",
        "description": "Limita los FK a modelos SIN campo ``organization`` propio (carpetas de un\nexpediente/paciente, etapas…) a los de la organización activa, a través de\nsu padre: ``org_scoped_related_fields = {\"parent\": \"patient__organization\"}``.\n\nUn id de otra organización responde 400 (``does_not_exist``) en lugar de\naceptarse (fuga entre organizaciones). La coherencia con el padre concreto\n(misma carpeta del mismo paciente) la valida la vista.",
        "properties": {
          "folder": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "file": {
            "type": "string",
            "format": "binary"
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "file",
          "name"
        ]
      },
      "CaseFolder": {
        "type": "object",
        "description": "Limita los FK a modelos SIN campo ``organization`` propio (carpetas de un\nexpediente/paciente, etapas…) a los de la organización activa, a través de\nsu padre: ``org_scoped_related_fields = {\"parent\": \"patient__organization\"}``.\n\nUn id de otra organización responde 400 (``does_not_exist``) en lugar de\naceptarse (fuga entre organizaciones). La coherencia con el padre concreto\n(misma carpeta del mismo paciente) la valida la vista.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "case": {
            "type": "integer",
            "readOnly": true
          },
          "parent": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "file_count": {
            "type": "integer",
            "readOnly": true
          },
          "subfolder_count": {
            "type": "integer",
            "readOnly": true
          },
          "cloud_folder_id": {
            "type": "string",
            "readOnly": true,
            "description": "Cloud provider folder ID/path"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "case",
          "cloud_folder_id",
          "created_at",
          "file_count",
          "id",
          "name",
          "subfolder_count",
          "updated_at"
        ]
      },
      "CaseFolderRequest": {
        "type": "object",
        "description": "Limita los FK a modelos SIN campo ``organization`` propio (carpetas de un\nexpediente/paciente, etapas…) a los de la organización activa, a través de\nsu padre: ``org_scoped_related_fields = {\"parent\": \"patient__organization\"}``.\n\nUn id de otra organización responde 400 (``does_not_exist``) en lugar de\naceptarse (fuga entre organizaciones). La coherencia con el padre concreto\n(misma carpeta del mismo paciente) la valida la vista.",
        "properties": {
          "parent": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          }
        },
        "required": [
          "name"
        ]
      },
      "CaseLinkedDocument": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "case": {
            "type": "integer",
            "readOnly": true
          },
          "document_type": {
            "$ref": "#/components/schemas/CaseLinkedDocumentTypeEnum"
          },
          "document_type_display": {
            "type": "string",
            "readOnly": true
          },
          "quote": {
            "type": "integer",
            "nullable": true
          },
          "proforma": {
            "type": "integer",
            "nullable": true
          },
          "invoice": {
            "type": "integer",
            "nullable": true
          },
          "document_number": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "document_total": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "readOnly": true
          },
          "document_status": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "document_date": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "case",
          "created_at",
          "document_date",
          "document_number",
          "document_status",
          "document_total",
          "document_type",
          "document_type_display",
          "id",
          "updated_at"
        ]
      },
      "CaseLinkedDocumentRequest": {
        "type": "object",
        "properties": {
          "document_type": {
            "$ref": "#/components/schemas/CaseLinkedDocumentTypeEnum"
          },
          "quote": {
            "type": "integer",
            "nullable": true
          },
          "proforma": {
            "type": "integer",
            "nullable": true
          },
          "invoice": {
            "type": "integer",
            "nullable": true
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "document_type"
        ]
      },
      "CaseLinkedDocumentTypeEnum": {
        "enum": [
          "quote",
          "proforma",
          "invoice"
        ],
        "type": "string",
        "description": "* `quote` - Presupuesto\n* `proforma` - Proforma\n* `invoice` - Factura"
      },
      "CaseList": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "reference": {
            "type": "string",
            "maxLength": 50
          },
          "title": {
            "type": "string",
            "maxLength": 300
          },
          "status": {
            "$ref": "#/components/schemas/CaseStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "priority": {
            "$ref": "#/components/schemas/PriorityEnum"
          },
          "priority_display": {
            "type": "string",
            "readOnly": true
          },
          "customer": {
            "type": "integer"
          },
          "customer_name": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "customer_client_number": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "case_type": {
            "type": "integer",
            "nullable": true
          },
          "case_type_name": {
            "type": "string",
            "readOnly": true
          },
          "case_type_color": {
            "type": "string",
            "readOnly": true
          },
          "case_type_icon": {
            "type": "string",
            "readOnly": true
          },
          "open_date": {
            "type": "string",
            "format": "date"
          },
          "close_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "action_count": {
            "type": "integer",
            "readOnly": true
          },
          "overdue_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "action_count",
          "case_type_color",
          "case_type_icon",
          "case_type_name",
          "created_at",
          "customer",
          "customer_client_number",
          "customer_name",
          "id",
          "overdue_count",
          "priority_display",
          "reference",
          "status_display",
          "title"
        ]
      },
      "CaseParty": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "case": {
            "type": "integer",
            "readOnly": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "customer_name": {
            "type": "string",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 300
          },
          "role": {
            "$ref": "#/components/schemas/RoleEnum"
          },
          "role_display": {
            "type": "string",
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "case",
          "created_at",
          "customer_name",
          "id",
          "name",
          "role_display",
          "updated_at"
        ]
      },
      "CasePartyRequest": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "role": {
            "$ref": "#/components/schemas/RoleEnum"
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "CaseStatusEnum": {
        "enum": [
          "open",
          "in_progress",
          "suspended",
          "closed",
          "archived"
        ],
        "type": "string",
        "description": "* `open` - Abierto\n* `in_progress` - En curso\n* `suspended` - Suspendido\n* `closed` - Cerrado\n* `archived` - Archivado"
      },
      "CaseTag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "color": {
            "type": "string",
            "maxLength": 7
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "CaseTagRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          }
        },
        "required": [
          "name"
        ]
      },
      "CaseType": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 150
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "maxLength": 7
          },
          "icon": {
            "type": "string",
            "maxLength": 50
          },
          "is_default": {
            "type": "boolean"
          },
          "reference_prefix": {
            "type": "string",
            "maxLength": 20
          },
          "reference_suffix": {
            "type": "string",
            "maxLength": 20
          },
          "case_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "case_count",
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "CaseTypeRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          },
          "icon": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "is_default": {
            "type": "boolean"
          },
          "reference_prefix": {
            "type": "string",
            "maxLength": 20
          },
          "reference_suffix": {
            "type": "string",
            "maxLength": 20
          }
        },
        "required": [
          "name"
        ]
      },
      "CategoryEnum": {
        "enum": [
          "incremental",
          "retencion"
        ],
        "type": "string",
        "description": "* `incremental` - Incremental (se suma al precio)\n* `retencion` - Retención (se descuenta del precio)"
      },
      "CertificateSourceEnum": {
        "enum": [
          "own",
          "billora"
        ],
        "type": "string",
        "description": "* `own` - Certificado Propio\n* `billora` - Certificado de Billora"
      },
      "ChannelEnum": {
        "enum": [
          "signature",
          "other"
        ],
        "type": "string",
        "description": "* `signature` - Firma digital\n* `other` - Otro"
      },
      "ChartData": {
        "type": "object",
        "properties": {
          "revenue_trend": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevenueTrendItem"
            }
          },
          "expense_trend": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseTrendItem"
            }
          },
          "top_customers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TopCustomer"
            }
          },
          "status_distribution": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatusDistribution"
            }
          },
          "expense_by_category": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseByCategory"
            }
          },
          "aging_buckets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgingBucket"
            }
          },
          "profit_trend": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfitTrendItem"
            }
          },
          "customer_trend": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerTrendItem"
            }
          },
          "period": {
            "type": "string"
          },
          "start_date": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "aging_buckets",
          "customer_trend",
          "expense_by_category",
          "expense_trend",
          "period",
          "profit_trend",
          "revenue_trend",
          "start_date",
          "status_distribution",
          "top_customers"
        ]
      },
      "ClinicaSettings": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "reference_prefix": {
            "type": "string",
            "maxLength": 20
          },
          "reference_suffix": {
            "type": "string",
            "maxLength": 20
          },
          "next_reference_number": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "reference_padding": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "patient_reference_prefix": {
            "type": "string",
            "maxLength": 20
          },
          "next_patient_number": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "default_episode_duration": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Duración por defecto de un episodio en minutos"
          },
          "episode_fields_config": {
            "description": "Campos visibles en la consulta y su orden"
          }
        },
        "required": [
          "id"
        ]
      },
      "ClinicalEpisodeStatusEnum": {
        "enum": [
          "scheduled",
          "in_progress",
          "completed",
          "cancelled",
          "no_show"
        ],
        "type": "string",
        "description": "* `scheduled` - Programado\n* `in_progress` - En curso\n* `completed` - Completado\n* `cancelled` - Cancelado\n* `no_show` - No presentado"
      },
      "ClinicalFile": {
        "type": "object",
        "description": "Limita los FK a modelos SIN campo ``organization`` propio (carpetas de un\nexpediente/paciente, etapas…) a los de la organización activa, a través de\nsu padre: ``org_scoped_related_fields = {\"parent\": \"patient__organization\"}``.\n\nUn id de otra organización responde 400 (``does_not_exist``) en lugar de\naceptarse (fuga entre organizaciones). La coherencia con el padre concreto\n(misma carpeta del mismo paciente) la valida la vista.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "episode": {
            "type": "integer",
            "nullable": true
          },
          "folder": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "file": {
            "type": "string",
            "format": "uri"
          },
          "file_size": {
            "type": "integer",
            "readOnly": true
          },
          "mime_type": {
            "type": "string",
            "readOnly": true
          },
          "document_type": {
            "$ref": "#/components/schemas/ClinicalFileDocumentTypeEnum"
          },
          "document_type_display": {
            "type": "string",
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "download_url": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "cloud_file_id": {
            "type": "string",
            "readOnly": true
          },
          "sync_status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SyncStatusEnum"
              }
            ],
            "readOnly": true
          },
          "version": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "cloud_file_id",
          "created_at",
          "document_type_display",
          "download_url",
          "file",
          "file_size",
          "id",
          "mime_type",
          "name",
          "sync_status",
          "updated_at",
          "version"
        ]
      },
      "ClinicalFileDocumentTypeEnum": {
        "enum": [
          "report",
          "lab_result",
          "imaging",
          "referral",
          "prescription",
          "consent",
          "other"
        ],
        "type": "string",
        "description": "* `report` - Informe\n* `lab_result` - Resultado de laboratorio\n* `imaging` - Imagen diagnóstica\n* `referral` - Derivación\n* `prescription` - Prescripción\n* `consent` - Consentimiento\n* `other` - Otro"
      },
      "ClinicalFileRequest": {
        "type": "object",
        "description": "Limita los FK a modelos SIN campo ``organization`` propio (carpetas de un\nexpediente/paciente, etapas…) a los de la organización activa, a través de\nsu padre: ``org_scoped_related_fields = {\"parent\": \"patient__organization\"}``.\n\nUn id de otra organización responde 400 (``does_not_exist``) en lugar de\naceptarse (fuga entre organizaciones). La coherencia con el padre concreto\n(misma carpeta del mismo paciente) la valida la vista.",
        "properties": {
          "episode": {
            "type": "integer",
            "nullable": true
          },
          "folder": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "file": {
            "type": "string",
            "format": "binary"
          },
          "document_type": {
            "$ref": "#/components/schemas/ClinicalFileDocumentTypeEnum"
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "file",
          "name"
        ]
      },
      "ClinicalFolder": {
        "type": "object",
        "description": "Limita los FK a modelos SIN campo ``organization`` propio (carpetas de un\nexpediente/paciente, etapas…) a los de la organización activa, a través de\nsu padre: ``org_scoped_related_fields = {\"parent\": \"patient__organization\"}``.\n\nUn id de otra organización responde 400 (``does_not_exist``) en lugar de\naceptarse (fuga entre organizaciones). La coherencia con el padre concreto\n(misma carpeta del mismo paciente) la valida la vista.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "parent": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "file_count": {
            "type": "integer",
            "readOnly": true
          },
          "subfolder_count": {
            "type": "integer",
            "readOnly": true
          },
          "cloud_folder_id": {
            "type": "string",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "cloud_folder_id",
          "created_at",
          "file_count",
          "id",
          "name",
          "subfolder_count",
          "updated_at"
        ]
      },
      "ClinicalFolderRequest": {
        "type": "object",
        "description": "Limita los FK a modelos SIN campo ``organization`` propio (carpetas de un\nexpediente/paciente, etapas…) a los de la organización activa, a través de\nsu padre: ``org_scoped_related_fields = {\"parent\": \"patient__organization\"}``.\n\nUn id de otra organización responde 400 (``does_not_exist``) en lugar de\naceptarse (fuga entre organizaciones). La coherencia con el padre concreto\n(misma carpeta del mismo paciente) la valida la vista.",
        "properties": {
          "parent": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          }
        },
        "required": [
          "name"
        ]
      },
      "CloseFiscalYearRequest": {
        "type": "object",
        "properties": {
          "depreciate": {
            "type": "boolean",
            "default": true
          },
          "accrue": {
            "type": "boolean",
            "default": true
          }
        }
      },
      "CloudSyncResult": {
        "type": "object",
        "properties": {
          "detail": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "nullable": true
          },
          "cloud_folder_id": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "cloud_folder_id",
          "detail",
          "provider"
        ]
      },
      "CollectPaymentRequestRequest": {
        "type": "object",
        "properties": {
          "to": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email",
              "minLength": 1
            }
          },
          "message": {
            "type": "string"
          }
        }
      },
      "CollectPaymentResult": {
        "type": "object",
        "properties": {
          "detail": {
            "type": "string"
          },
          "checkout_url": {
            "type": "string",
            "format": "uri"
          },
          "session_id": {
            "type": "string"
          },
          "email_sent": {
            "type": "boolean"
          }
        },
        "required": [
          "checkout_url",
          "detail",
          "email_sent",
          "session_id"
        ]
      },
      "ConsentSignRequestRequest": {
        "type": "object",
        "properties": {
          "signature_data": {
            "type": "string",
            "description": "Firma (imagen en base64 o texto) del paciente."
          }
        }
      },
      "ConsentTemplate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 300
          },
          "content": {
            "type": "string",
            "description": "Texto del consentimiento (HTML)"
          },
          "consent_type": {
            "type": "string",
            "maxLength": 100
          },
          "is_active": {
            "type": "boolean"
          },
          "version": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "content",
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "ConsentTemplateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "description": "Texto del consentimiento (HTML)"
          },
          "consent_type": {
            "type": "string",
            "maxLength": 100
          },
          "is_active": {
            "type": "boolean"
          },
          "version": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          }
        },
        "required": [
          "content",
          "name"
        ]
      },
      "ContactPerson": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "supplier": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "role": {
            "type": "string",
            "maxLength": 80
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "ContactPersonRequest": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "supplier": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "role": {
            "type": "string",
            "maxLength": 80
          }
        },
        "required": [
          "name"
        ]
      },
      "Contract": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "employee": {
            "type": "integer"
          },
          "employee_name": {
            "type": "string",
            "readOnly": true
          },
          "contract_type": {
            "$ref": "#/components/schemas/ContractTypeEnum"
          },
          "contract_type_display": {
            "type": "string",
            "readOnly": true
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "hours_per_week": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "gross_annual_salary": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "gross_monthly_salary": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "number_of_payments": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "Nº pagas anuales (12 o 14)"
          },
          "trial_period_days": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "document": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "is_current": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "contract_type",
          "contract_type_display",
          "created_at",
          "employee",
          "employee_name",
          "id",
          "start_date",
          "updated_at"
        ]
      },
      "ContractRelationEnum": {
        "enum": [
          "1",
          "2",
          "3",
          "4"
        ],
        "type": "string",
        "description": "* `1` - 1 — Contrato o relación de carácter general\n* `2` - 2 — Duración inferior al año (o artistas)\n* `3` - 3 — Otras relaciones laborales especiales de carácter dependiente\n* `4` - 4 — Relación esporádica de trabajadores manuales (peonadas)"
      },
      "ContractRequest": {
        "type": "object",
        "properties": {
          "employee": {
            "type": "integer"
          },
          "contract_type": {
            "$ref": "#/components/schemas/ContractTypeEnum"
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "hours_per_week": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "gross_annual_salary": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "gross_monthly_salary": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "number_of_payments": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "Nº pagas anuales (12 o 14)"
          },
          "trial_period_days": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "document": {
            "type": "string",
            "format": "binary",
            "nullable": true
          },
          "is_current": {
            "type": "boolean"
          }
        },
        "required": [
          "contract_type",
          "employee",
          "start_date"
        ]
      },
      "ContractTypeEnum": {
        "enum": [
          "indefinite",
          "temporary",
          "internship",
          "training",
          "part_time",
          "freelance"
        ],
        "type": "string",
        "description": "* `indefinite` - Indefinido\n* `temporary` - Temporal\n* `internship` - Prácticas\n* `training` - Formación\n* `part_time` - Tiempo parcial\n* `freelance` - Autónomo"
      },
      "ConvertToInvoiceRequestRequest": {
        "type": "object",
        "properties": {
          "series": {
            "type": "integer",
            "description": "Serie de facturas (si no, la del origen)."
          },
          "issue_date": {
            "type": "string",
            "format": "date"
          },
          "due_date": {
            "type": "string",
            "format": "date"
          },
          "payment_terms": {
            "type": "integer"
          }
        }
      },
      "ConvertedInvoice": {
        "type": "object",
        "properties": {
          "invoice_id": {
            "type": "integer"
          }
        },
        "required": [
          "invoice_id"
        ]
      },
      "ConvertedProforma": {
        "type": "object",
        "properties": {
          "proforma_id": {
            "type": "integer"
          }
        },
        "required": [
          "proforma_id"
        ]
      },
      "CorporateTaxRequest": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Cuota del impuesto sobre sociedades (negativa si es a devolver)."
          },
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Por defecto, el último día del ejercicio."
          },
          "description": {
            "type": "string",
            "maxLength": 300
          }
        },
        "required": [
          "amount"
        ]
      },
      "Court": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 300
          },
          "address": {
            "type": "string"
          },
          "city": {
            "type": "string",
            "maxLength": 150
          },
          "province": {
            "type": "string",
            "maxLength": 150
          },
          "phone": {
            "type": "string",
            "maxLength": 50
          },
          "jurisdictions": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "jurisdiction_names": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "readOnly": true
          },
          "jurisdiction_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "jurisdiction_ids",
          "jurisdiction_names",
          "name",
          "updated_at"
        ]
      },
      "CourtRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "address": {
            "type": "string"
          },
          "city": {
            "type": "string",
            "maxLength": 150
          },
          "province": {
            "type": "string",
            "maxLength": 150
          },
          "phone": {
            "type": "string",
            "maxLength": 50
          },
          "jurisdictions": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "CreditNote": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CreditNoteStatusEnum"
              }
            ],
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "tax_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "withholding_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "surcharge_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "sequence_number": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "number": {
            "type": "string",
            "readOnly": true,
            "nullable": true
          },
          "metadata": {},
          "pdf_url": {
            "type": "string",
            "format": "uri",
            "readOnly": true,
            "description": "URL del PDF definitivo (solo facturas emitidas)"
          },
          "draft_pdf_url": {
            "type": "string",
            "format": "uri",
            "readOnly": true,
            "description": "URL del PDF borrador (con marca de agua)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "original_invoice": {
            "type": "integer"
          }
        },
        "required": [
          "balance",
          "created_at",
          "customer",
          "draft_pdf_url",
          "id",
          "issue_date",
          "number",
          "original_invoice",
          "pdf_url",
          "sequence_number",
          "status",
          "subtotal",
          "surcharge_total",
          "tax_total",
          "total",
          "updated_at",
          "withholding_total"
        ]
      },
      "CreditNoteRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLineRequest"
            },
            "writeOnly": true
          },
          "original_invoice": {
            "type": "integer"
          }
        },
        "required": [
          "customer",
          "original_invoice"
        ]
      },
      "CreditNoteStatusEnum": {
        "enum": [
          "draft",
          "sent",
          "cancelled"
        ],
        "type": "string",
        "description": "* `draft` - Borrador\n* `sent` - Emitida/Enviada\n* `cancelled` - Anulada"
      },
      "Customer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "legal_name": {
            "type": "string",
            "maxLength": 200
          },
          "trade_name": {
            "type": "string",
            "maxLength": 200
          },
          "vat_id": {
            "type": "string",
            "maxLength": 20
          },
          "vat_id_type": {
            "description": "Tipo de documento de identificación fiscal (L7 AEAT). Vacío = NIF/CIF español.\n\n* `` - NIF/CIF español\n* `02` - NIF-IVA intracomunitario\n* `03` - Pasaporte\n* `04` - Documento oficial de identificación\n* `05` - Certificado de residencia\n* `06` - Otro documento probatorio\n* `07` - No censado",
            "oneOf": [
              {
                "$ref": "#/components/schemas/VatIdTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "website": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 200
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "party_type": {
            "$ref": "#/components/schemas/PartyTypeEnum"
          },
          "billing_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Address"
              }
            ],
            "nullable": true
          },
          "shipping_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Address"
              }
            ],
            "nullable": true
          },
          "fiscal_country": {
            "type": "string",
            "maxLength": 2
          },
          "fiscal_province": {
            "type": "string",
            "maxLength": 100
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "default_payment_method": {
            "$ref": "#/components/schemas/VendorPaymentMethodEnum"
          },
          "iban": {
            "type": "string",
            "maxLength": 34
          },
          "mandate_reference": {
            "type": "string",
            "maxLength": 64
          },
          "sepa_mandate_signed_at": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "language": {
            "type": "string",
            "maxLength": 10
          },
          "notes": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {},
            "description": "Serializar tags para lectura (GET requests)",
            "readOnly": true
          },
          "previous_names": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            },
            "readOnly": true,
            "description": "Histórico de razones sociales del mismo NIF: [{legal_name, trade_name, until}]. Se rellena solo al cambiar legal_name (y al fusionar duplicados)."
          },
          "warnings": {
            "type": "array",
            "items": {},
            "readOnly": true,
            "description": "Avisos de la ficha ({code, message}): country_mismatch si el país de la dirección de facturación no coincide con el país fiscal."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "client_number": {
            "type": "string",
            "description": "Número de cliente interno asignado por la organización (opcional).",
            "maxLength": 50
          },
          "is_public_entity": {
            "type": "boolean",
            "description": "Indica si es una administración pública u organismo oficial."
          },
          "office_code": {
            "type": "string",
            "description": "Identificador de la unidad administrativa (delegación, secretaría, subdelegación, etc.) para distinguir entidades con el mismo CIF.",
            "maxLength": 150
          },
          "dir3_unit": {
            "type": "string"
          },
          "dir3_organ": {
            "type": "string"
          },
          "dir3_office": {
            "type": "string"
          }
        },
        "required": [
          "created_at",
          "id",
          "legal_name",
          "previous_names",
          "tags",
          "updated_at",
          "warnings"
        ]
      },
      "CustomerList": {
        "type": "object",
        "description": "Serializer ultra-ligero para clientes en listados de documentos.\nSolo incluye los campos que se muestran en la tabla de facturas.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "legal_name": {
            "type": "string",
            "maxLength": 200
          },
          "vat_id": {
            "type": "string",
            "maxLength": 20
          },
          "billing_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AddressList"
              }
            ],
            "readOnly": true
          }
        },
        "required": [
          "billing_address",
          "id",
          "legal_name"
        ]
      },
      "CustomerRequest": {
        "type": "object",
        "properties": {
          "legal_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "trade_name": {
            "type": "string",
            "maxLength": 200
          },
          "vat_id": {
            "type": "string",
            "maxLength": 20
          },
          "vat_id_type": {
            "description": "Tipo de documento de identificación fiscal (L7 AEAT). Vacío = NIF/CIF español.\n\n* `` - NIF/CIF español\n* `02` - NIF-IVA intracomunitario\n* `03` - Pasaporte\n* `04` - Documento oficial de identificación\n* `05` - Certificado de residencia\n* `06` - Otro documento probatorio\n* `07` - No censado",
            "oneOf": [
              {
                "$ref": "#/components/schemas/VatIdTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "website": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 200
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "party_type": {
            "$ref": "#/components/schemas/PartyTypeEnum"
          },
          "billing_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AddressRequest"
              }
            ],
            "nullable": true
          },
          "shipping_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AddressRequest"
              }
            ],
            "nullable": true
          },
          "fiscal_country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "fiscal_province": {
            "type": "string",
            "maxLength": 100
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "default_payment_method": {
            "$ref": "#/components/schemas/VendorPaymentMethodEnum"
          },
          "iban": {
            "type": "string",
            "maxLength": 34
          },
          "mandate_reference": {
            "type": "string",
            "maxLength": 64
          },
          "sepa_mandate_signed_at": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "language": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10
          },
          "notes": {
            "type": "string"
          },
          "client_number": {
            "type": "string",
            "description": "Número de cliente interno asignado por la organización (opcional).",
            "maxLength": 50
          },
          "is_public_entity": {
            "type": "boolean",
            "description": "Indica si es una administración pública u organismo oficial."
          },
          "office_code": {
            "type": "string",
            "description": "Identificador de la unidad administrativa (delegación, secretaría, subdelegación, etc.) para distinguir entidades con el mismo CIF.",
            "maxLength": 150
          },
          "dir3_unit": {
            "type": "string"
          },
          "dir3_organ": {
            "type": "string"
          },
          "dir3_office": {
            "type": "string"
          }
        },
        "required": [
          "legal_name"
        ]
      },
      "CustomerStats": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "new_30_days": {
            "type": "integer"
          },
          "new_7_days": {
            "type": "integer"
          },
          "active": {
            "type": "integer"
          }
        },
        "required": [
          "active",
          "new_30_days",
          "new_7_days",
          "total"
        ]
      },
      "CustomerTrendItem": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "new_customers": {
            "type": "integer"
          }
        },
        "required": [
          "date",
          "new_customers"
        ]
      },
      "DashboardStats": {
        "type": "object",
        "properties": {
          "revenue": {
            "$ref": "#/components/schemas/RevenueStats"
          },
          "invoices": {
            "$ref": "#/components/schemas/InvoiceStats"
          },
          "customers": {
            "$ref": "#/components/schemas/CustomerStats"
          },
          "expenses": {
            "$ref": "#/components/schemas/ExpenseStats"
          },
          "payments": {
            "$ref": "#/components/schemas/PaymentStats"
          },
          "metrics": {
            "$ref": "#/components/schemas/Metrics"
          },
          "suppliers": {
            "$ref": "#/components/schemas/SupplierStats"
          },
          "recurring": {
            "$ref": "#/components/schemas/RecurringStats"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "period": {
            "$ref": "#/components/schemas/Period"
          }
        },
        "required": [
          "customers",
          "expenses",
          "invoices",
          "metrics",
          "payments",
          "period",
          "recurring",
          "revenue",
          "suppliers",
          "updated_at"
        ]
      },
      "DayOfWeekEnum": {
        "enum": [
          0,
          1,
          2,
          3,
          4,
          5,
          6
        ],
        "type": "integer",
        "description": "* `0` - Lunes\n* `1` - Martes\n* `2` - Miércoles\n* `3` - Jueves\n* `4` - Viernes\n* `5` - Sábado\n* `6` - Domingo"
      },
      "DealDetail": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "title": {
            "type": "string",
            "maxLength": 300
          },
          "value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "pipeline": {
            "type": "integer"
          },
          "pipeline_name": {
            "type": "string",
            "readOnly": true
          },
          "stage": {
            "type": "integer"
          },
          "stage_name": {
            "type": "string",
            "readOnly": true
          },
          "stage_color": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "$ref": "#/components/schemas/DealStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "lead": {
            "type": "integer",
            "nullable": true
          },
          "lead_name": {
            "type": "string",
            "readOnly": true
          },
          "customer": {
            "type": "integer"
          },
          "customer_name": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "contact": {
            "type": "integer",
            "nullable": true
          },
          "contact_name": {
            "type": "string",
            "readOnly": true
          },
          "assigned_to": {
            "type": "integer",
            "nullable": true
          },
          "assigned_to_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "expected_close_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "closed_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "probability": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "lost_reason": {
            "type": "string"
          },
          "tag_objects": {
            "type": "array",
            "items": {},
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "activity_count": {
            "type": "integer",
            "readOnly": true
          },
          "note_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "activity_count",
          "assigned_to_name",
          "closed_at",
          "contact_name",
          "created_at",
          "customer",
          "customer_name",
          "id",
          "lead_name",
          "note_count",
          "pipeline",
          "pipeline_name",
          "stage",
          "stage_color",
          "stage_name",
          "status_display",
          "tag_objects",
          "title",
          "updated_at"
        ]
      },
      "DealDetailRequest": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "pipeline": {
            "type": "integer"
          },
          "stage": {
            "type": "integer"
          },
          "status": {
            "$ref": "#/components/schemas/DealStatusEnum"
          },
          "lead": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer"
          },
          "contact": {
            "type": "integer",
            "nullable": true
          },
          "assigned_to": {
            "type": "integer",
            "nullable": true
          },
          "expected_close_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "probability": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "lost_reason": {
            "type": "string"
          },
          "tag_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "writeOnly": true
            },
            "writeOnly": true
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "customer",
          "pipeline",
          "stage",
          "title"
        ]
      },
      "DealList": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "title": {
            "type": "string",
            "maxLength": 300
          },
          "value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "pipeline": {
            "type": "integer"
          },
          "pipeline_name": {
            "type": "string",
            "readOnly": true
          },
          "stage": {
            "type": "integer"
          },
          "stage_name": {
            "type": "string",
            "readOnly": true
          },
          "stage_color": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "$ref": "#/components/schemas/DealStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "customer": {
            "type": "integer"
          },
          "customer_name": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "lead": {
            "type": "integer",
            "nullable": true
          },
          "lead_name": {
            "type": "string",
            "readOnly": true
          },
          "contact": {
            "type": "integer",
            "nullable": true
          },
          "contact_name": {
            "type": "string",
            "readOnly": true
          },
          "assigned_to": {
            "type": "integer",
            "nullable": true
          },
          "assigned_to_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "expected_close_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "closed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "probability": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "activity_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "activity_count",
          "assigned_to_name",
          "contact_name",
          "created_at",
          "customer",
          "customer_name",
          "id",
          "lead_name",
          "pipeline",
          "pipeline_name",
          "stage",
          "stage_color",
          "stage_name",
          "status_display",
          "title"
        ]
      },
      "DealStatusEnum": {
        "enum": [
          "open",
          "won",
          "lost"
        ],
        "type": "string",
        "description": "* `open` - Abierto\n* `won` - Ganado\n* `lost` - Perdido"
      },
      "Declarant": {
        "type": "object",
        "properties": {
          "apellidos": {
            "type": "string",
            "description": "Persona física: primer y segundo apellido (la AEAT los pide separados del nombre).",
            "maxLength": 60
          },
          "nombre": {
            "type": "string",
            "description": "Persona física: nombre.",
            "maxLength": 20
          },
          "persona_contacto": {
            "type": "string",
            "description": "Apellidos y nombre de la persona con quien relacionarse (obligatorio en 180, 190, 193, 347 y 349).",
            "maxLength": 40
          },
          "telefono": {
            "type": "string",
            "description": "Teléfono de contacto (9 dígitos).",
            "maxLength": 15
          },
          "email": {
            "description": "Correo de contacto (190).",
            "oneOf": [
              {
                "type": "string",
                "format": "email"
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "nif_representante_legal": {
            "type": "string",
            "description": "NIF del representante legal (declarantes menores de 14 años).",
            "maxLength": 20
          },
          "cnae": {
            "type": "string",
            "description": "CNAE de la actividad principal (4 dígitos; 202).",
            "maxLength": 4
          },
          "actividad_principal": {
            "type": "string",
            "description": "Descripción de la actividad principal (390).",
            "maxLength": 40
          },
          "clave_actividad": {
            "type": "string",
            "description": "Clave de actividad del 390 (p. ej. A01, A03, B01…).",
            "maxLength": 3
          },
          "epigrafe_iae": {
            "type": "string",
            "description": "Epígrafe del IAE de la actividad principal (390).",
            "maxLength": 4
          }
        }
      },
      "DeclarantPayload": {
        "type": "object",
        "properties": {
          "declarante": {
            "$ref": "#/components/schemas/Declarant"
          },
          "inmuebles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Property"
            },
            "description": "Lista completa de inmuebles arrendados (sustituye a la anterior)."
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "readOnly": true,
            "description": "Datos del declarante que faltan para generar los ficheros (vacía si está completo)."
          }
        },
        "required": [
          "missing"
        ]
      },
      "DeclarantPayloadRequest": {
        "type": "object",
        "properties": {
          "declarante": {
            "$ref": "#/components/schemas/DeclarantRequest"
          },
          "inmuebles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PropertyRequest"
            },
            "description": "Lista completa de inmuebles arrendados (sustituye a la anterior)."
          }
        }
      },
      "DeclarantRequest": {
        "type": "object",
        "properties": {
          "apellidos": {
            "type": "string",
            "description": "Persona física: primer y segundo apellido (la AEAT los pide separados del nombre).",
            "maxLength": 60
          },
          "nombre": {
            "type": "string",
            "description": "Persona física: nombre.",
            "maxLength": 20
          },
          "persona_contacto": {
            "type": "string",
            "description": "Apellidos y nombre de la persona con quien relacionarse (obligatorio en 180, 190, 193, 347 y 349).",
            "maxLength": 40
          },
          "telefono": {
            "type": "string",
            "description": "Teléfono de contacto (9 dígitos).",
            "maxLength": 15
          },
          "email": {
            "description": "Correo de contacto (190).",
            "oneOf": [
              {
                "type": "string",
                "format": "email"
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "nif_representante_legal": {
            "type": "string",
            "description": "NIF del representante legal (declarantes menores de 14 años).",
            "maxLength": 20
          },
          "cnae": {
            "type": "string",
            "description": "CNAE de la actividad principal (4 dígitos; 202).",
            "maxLength": 4
          },
          "actividad_principal": {
            "type": "string",
            "description": "Descripción de la actividad principal (390).",
            "maxLength": 40
          },
          "clave_actividad": {
            "type": "string",
            "description": "Clave de actividad del 390 (p. ej. A01, A03, B01…).",
            "maxLength": 3
          },
          "epigrafe_iae": {
            "type": "string",
            "description": "Epígrafe del IAE de la actividad principal (390).",
            "maxLength": 4
          }
        }
      },
      "DeclarationData": {
        "type": "object",
        "properties": {
          "tipo_presentacion": {
            "description": "Autoliquidaciones: `complementaria` (el 303 desde 2025: `rectificativa`). Informativas: `complementaria` (registros omitidos) o `sustitutiva` (sustituye a otra).\n\n* `` - Normal\n* `complementaria` - Complementaria\n* `sustitutiva` - Sustitutiva\n* `rectificativa` - Rectificativa (303)",
            "oneOf": [
              {
                "$ref": "#/components/schemas/TipoPresentacionEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "justificante_anterior": {
            "description": "Nº de justificante (13 dígitos) de la declaración que se complementa, sustituye o rectifica.",
            "oneOf": [
              {
                "type": "string",
                "pattern": "^\\d{13}$"
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "justificante": {
            "description": "Informativas: número identificativo de esta declaración (13 dígitos que empiezan por el modelo). Por defecto `{modelo}{ejercicio}000001`.",
            "oneOf": [
              {
                "type": "string",
                "pattern": "^\\d{13}$"
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "tipo_declaracion": {
            "description": "Autoliquidaciones 111, 115, 123, 130 y 202: tipo de declaración si el resultado es a ingresar (por defecto I). Se corrige solo si no es válido para el resultado. NO aplica al 303: allí el tipo (I, U, G, C, D, X, V, N) es la casilla de texto `tipo_declaracion` del modelo (PUT …/303/overrides/), con sus opciones válidas en `options`.\n\n* `I` - Ingreso\n* `U` - Domiciliación\n* `G` - Ingreso en CCT\n* `N` - Negativa\n* `B` - A deducir (130)",
            "oneOf": [
              {
                "$ref": "#/components/schemas/TipoDeclaracionEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "iban": {
            "type": "string",
            "description": "IBAN para domiciliar (tipo U). Por defecto, el de la empresa.",
            "maxLength": 34
          },
          "modalidad": {
            "$ref": "#/components/schemas/ModalidadEnum"
          },
          "fecha_inicio_periodo": {
            "type": "string",
            "format": "date",
            "description": "202: inicio del periodo impositivo."
          },
          "cnae": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}$"
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "tipo_gravamen": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$",
            "description": "202: tipo de gravamen del IS del ejercicio (25 por defecto)."
          },
          "tramo_incn": {
            "$ref": "#/components/schemas/TramoIncnEnum"
          },
          "incn_superior_6m": {
            "type": "boolean"
          },
          "incn_inferior_1m": {
            "type": "boolean"
          },
          "erd_tipo_especifico": {
            "type": "boolean"
          },
          "cuota_integra_ultimo": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,13}(?:\\.\\d{0,2})?$",
            "description": "202 modalidad A: cuota íntegra del último IS presentado."
          },
          "deducciones_ultimo": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,13}(?:\\.\\d{0,2})?$"
          },
          "bonificaciones_ultimo": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,13}(?:\\.\\d{0,2})?$"
          },
          "retenciones_ultimo": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,13}(?:\\.\\d{0,2})?$"
          },
          "rentas": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Renta"
            },
            "description": "123: rentas del capital mobiliario manuales."
          },
          "rectificaciones": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Rectification"
            },
            "description": "349: rectificaciones manuales."
          },
          "perceptores": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {}
            },
            "description": "190: datos por NIF del perceptor, p. ej. `{\"12345678Z\": {\"reducciones\": \"1200.00\"}}`."
          },
          "prorrata_porcentaje": {
            "type": "integer",
            "maximum": 100,
            "minimum": 0,
            "description": "303: porcentaje de prorrata general provisional (100 = deducción total)."
          },
          "motivo_rectificacion": {
            "$ref": "#/components/schemas/MotivoRectificacionEnum"
          },
          "baja_domiciliacion": {
            "type": "boolean"
          }
        }
      },
      "DeclarationDataRequest": {
        "type": "object",
        "properties": {
          "tipo_presentacion": {
            "description": "Autoliquidaciones: `complementaria` (el 303 desde 2025: `rectificativa`). Informativas: `complementaria` (registros omitidos) o `sustitutiva` (sustituye a otra).\n\n* `` - Normal\n* `complementaria` - Complementaria\n* `sustitutiva` - Sustitutiva\n* `rectificativa` - Rectificativa (303)",
            "oneOf": [
              {
                "$ref": "#/components/schemas/TipoPresentacionEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "justificante_anterior": {
            "description": "Nº de justificante (13 dígitos) de la declaración que se complementa, sustituye o rectifica.",
            "oneOf": [
              {
                "type": "string",
                "pattern": "^\\d{13}$"
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "justificante": {
            "description": "Informativas: número identificativo de esta declaración (13 dígitos que empiezan por el modelo). Por defecto `{modelo}{ejercicio}000001`.",
            "oneOf": [
              {
                "type": "string",
                "pattern": "^\\d{13}$"
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "tipo_declaracion": {
            "description": "Autoliquidaciones 111, 115, 123, 130 y 202: tipo de declaración si el resultado es a ingresar (por defecto I). Se corrige solo si no es válido para el resultado. NO aplica al 303: allí el tipo (I, U, G, C, D, X, V, N) es la casilla de texto `tipo_declaracion` del modelo (PUT …/303/overrides/), con sus opciones válidas en `options`.\n\n* `I` - Ingreso\n* `U` - Domiciliación\n* `G` - Ingreso en CCT\n* `N` - Negativa\n* `B` - A deducir (130)",
            "oneOf": [
              {
                "$ref": "#/components/schemas/TipoDeclaracionEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "iban": {
            "type": "string",
            "description": "IBAN para domiciliar (tipo U). Por defecto, el de la empresa.",
            "maxLength": 34
          },
          "modalidad": {
            "$ref": "#/components/schemas/ModalidadEnum"
          },
          "fecha_inicio_periodo": {
            "type": "string",
            "format": "date",
            "description": "202: inicio del periodo impositivo."
          },
          "cnae": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}$"
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "tipo_gravamen": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$",
            "description": "202: tipo de gravamen del IS del ejercicio (25 por defecto)."
          },
          "tramo_incn": {
            "$ref": "#/components/schemas/TramoIncnEnum"
          },
          "incn_superior_6m": {
            "type": "boolean"
          },
          "incn_inferior_1m": {
            "type": "boolean"
          },
          "erd_tipo_especifico": {
            "type": "boolean"
          },
          "cuota_integra_ultimo": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,13}(?:\\.\\d{0,2})?$",
            "description": "202 modalidad A: cuota íntegra del último IS presentado."
          },
          "deducciones_ultimo": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,13}(?:\\.\\d{0,2})?$"
          },
          "bonificaciones_ultimo": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,13}(?:\\.\\d{0,2})?$"
          },
          "retenciones_ultimo": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,13}(?:\\.\\d{0,2})?$"
          },
          "rentas": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RentaRequest"
            },
            "description": "123: rentas del capital mobiliario manuales."
          },
          "rectificaciones": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RectificationRequest"
            },
            "description": "349: rectificaciones manuales."
          },
          "perceptores": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {}
            },
            "description": "190: datos por NIF del perceptor, p. ej. `{\"12345678Z\": {\"reducciones\": \"1200.00\"}}`."
          },
          "prorrata_porcentaje": {
            "type": "integer",
            "maximum": 100,
            "minimum": 0,
            "description": "303: porcentaje de prorrata general provisional (100 = deducción total)."
          },
          "motivo_rectificacion": {
            "$ref": "#/components/schemas/MotivoRectificacionEnum"
          },
          "baja_domiciliacion": {
            "type": "boolean"
          }
        }
      },
      "DeclarationPayload": {
        "type": "object",
        "properties": {
          "model_code": {
            "type": "string",
            "readOnly": true
          },
          "period": {
            "type": "string",
            "readOnly": true
          },
          "data": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DeclarationData"
              }
            ],
            "description": "Datos de la declaración (sólo los que aplican al modelo)."
          },
          "applicable_fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "readOnly": true
          }
        },
        "required": [
          "applicable_fields",
          "data",
          "model_code",
          "period"
        ]
      },
      "DefaultOperationClassificationEnum": {
        "enum": [
          "S1",
          "S2",
          "N1",
          "N2"
        ],
        "type": "string",
        "description": "* `S1` - Sujeta no exenta (sin ISP)\n* `S2` - Sujeta no exenta (con ISP)\n* `N1` - No sujeta (art.7/14/otros)\n* `N2` - No sujeta (localización)"
      },
      "DeliveryMethodEnum": {
        "enum": [
          "email",
          "sms",
          "both"
        ],
        "type": "string",
        "description": "* `email` - Email\n* `sms` - SMS\n* `both` - Email + SMS"
      },
      "Department": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 150
          },
          "description": {
            "type": "string"
          },
          "manager": {
            "type": "integer",
            "nullable": true
          },
          "manager_name": {
            "type": "string",
            "readOnly": true
          },
          "parent": {
            "type": "integer",
            "nullable": true
          },
          "parent_name": {
            "type": "string",
            "readOnly": true
          },
          "employee_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "employee_count",
          "id",
          "manager_name",
          "name",
          "parent_name",
          "updated_at"
        ]
      },
      "DepartmentRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "description": {
            "type": "string"
          },
          "manager": {
            "type": "integer",
            "nullable": true
          },
          "parent": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "name"
        ]
      },
      "DepreciateRequest": {
        "type": "object",
        "properties": {
          "until": {
            "type": "string",
            "format": "date",
            "nullable": true
          }
        }
      },
      "Diagnosis": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "icd11_code": {
            "type": "integer",
            "nullable": true
          },
          "icd11_code_display": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "icd11_title": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "code_manual": {
            "type": "string",
            "description": "Código manual si no hay match CIE-11",
            "maxLength": 20
          },
          "title": {
            "type": "string",
            "maxLength": 500
          },
          "description": {
            "type": "string"
          },
          "diagnosis_type": {
            "$ref": "#/components/schemas/DiagnosisTypeEnum"
          },
          "diagnosis_type_display": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "$ref": "#/components/schemas/DiagnosisStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "onset_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "resolution_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "diagnosis_type_display",
          "icd11_code_display",
          "icd11_title",
          "id",
          "status_display",
          "updated_at"
        ]
      },
      "DiagnosisRequest": {
        "type": "object",
        "properties": {
          "icd11_code": {
            "type": "integer",
            "nullable": true
          },
          "code_manual": {
            "type": "string",
            "description": "Código manual si no hay match CIE-11",
            "maxLength": 20
          },
          "title": {
            "type": "string",
            "maxLength": 500
          },
          "description": {
            "type": "string"
          },
          "diagnosis_type": {
            "$ref": "#/components/schemas/DiagnosisTypeEnum"
          },
          "status": {
            "$ref": "#/components/schemas/DiagnosisStatusEnum"
          },
          "onset_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "resolution_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "DiagnosisStatusEnum": {
        "enum": [
          "active",
          "resolved",
          "chronic"
        ],
        "type": "string",
        "description": "* `active` - Activo\n* `resolved` - Resuelto\n* `chronic` - Crónico"
      },
      "DiagnosisTypeEnum": {
        "enum": [
          "principal",
          "secondary"
        ],
        "type": "string",
        "description": "* `principal` - Principal\n* `secondary` - Secundario"
      },
      "DisabilityDegreeEnum": {
        "enum": [
          "0",
          "1",
          "2",
          "3"
        ],
        "type": "string",
        "description": "* `0` - 0 — Sin discapacidad o inferior al 33 %\n* `1` - 1 — Igual o superior al 33 % e inferior al 65 %\n* `2` - 2 — Igual o superior al 33 % e inferior al 65 %, con ayuda de terceros o movilidad reducida\n* `3` - 3 — Igual o superior al 65 %"
      },
      "DisabledReasonEnum": {
        "enum": [
          "manual",
          "gone",
          "failing"
        ],
        "type": "string",
        "description": "* `` - —\n* `manual` - Deshabilitado manualmente\n* `gone` - El endpoint respondió 410 Gone\n* `failing` - Deshabilitado tras 5 días de fallos consecutivos"
      },
      "DisposeAssetRequest": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "default": "0.00"
          },
          "bank_account": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "date"
        ]
      },
      "DocumentEmailRequestRequest": {
        "type": "object",
        "properties": {
          "to": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email",
              "minLength": 1
            },
            "description": "Destinatarios."
          }
        },
        "required": [
          "to"
        ]
      },
      "DocumentIssued": {
        "type": "object",
        "properties": {
          "number": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "issue_date": {
            "type": "string",
            "format": "date"
          }
        },
        "required": [
          "number",
          "status"
        ]
      },
      "DocumentLine": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "product": {
            "type": "integer",
            "nullable": true
          },
          "description": {
            "type": "string",
            "maxLength": 300
          },
          "quantity": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "unit_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,6})?$"
          },
          "discount_percent": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "spanish_taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "tax_template": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "withholding_template": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "surcharge_template": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "line_subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "line_tax": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "line_withholding": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "line_surcharge": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "line_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "description",
          "id",
          "line_subtotal",
          "line_surcharge",
          "line_tax",
          "line_total",
          "line_withholding",
          "surcharge_template",
          "tax_template",
          "updated_at",
          "withholding_template"
        ]
      },
      "DocumentLineRequest": {
        "type": "object",
        "properties": {
          "product": {
            "type": "integer",
            "nullable": true
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "quantity": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "unit_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,6})?$"
          },
          "discount_percent": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "spanish_taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        },
        "required": [
          "description"
        ]
      },
      "DocumentPdfUrls": {
        "type": "object",
        "properties": {
          "pdf_url": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "draft_pdf_url": {
            "type": "string",
            "format": "uri",
            "nullable": true
          }
        }
      },
      "DocumentRequirement": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "case": {
            "type": "integer",
            "readOnly": true
          },
          "title": {
            "type": "string",
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/DocumentRequirementStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "token": {
            "type": "string",
            "format": "uuid",
            "readOnly": true
          },
          "portal_url": {
            "type": "string",
            "readOnly": true
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "fulfilled_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "sent_to_email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          },
          "created_by": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "created_by_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentRequirementFile"
            },
            "readOnly": true
          },
          "file_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "case",
          "created_at",
          "created_by",
          "created_by_name",
          "file_count",
          "files",
          "fulfilled_at",
          "id",
          "portal_url",
          "sent_to_email",
          "status_display",
          "title",
          "token",
          "updated_at"
        ]
      },
      "DocumentRequirementFile": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "file": {
            "type": "string",
            "format": "uri"
          },
          "file_size": {
            "type": "integer",
            "readOnly": true
          },
          "mime_type": {
            "type": "string",
            "readOnly": true
          },
          "download_url": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "download_url",
          "file",
          "file_size",
          "id",
          "mime_type",
          "name",
          "updated_at"
        ]
      },
      "DocumentRequirementFileRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "file": {
            "type": "string",
            "format": "binary"
          }
        },
        "required": [
          "file",
          "name"
        ]
      },
      "DocumentRequirementRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/DocumentRequirementStatusEnum"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "sent_to_email": {
            "type": "string",
            "format": "email",
            "minLength": 1,
            "maxLength": 254
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "sent_to_email",
          "title"
        ]
      },
      "DocumentRequirementStatusEnum": {
        "enum": [
          "pending",
          "fulfilled",
          "expired",
          "cancelled"
        ],
        "type": "string",
        "description": "* `pending` - Pendiente\n* `fulfilled` - Cumplimentado\n* `expired` - Expirado\n* `cancelled` - Cancelado"
      },
      "DocumentSeries": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "type": {
            "$ref": "#/components/schemas/DocumentSeriesTypeEnum"
          },
          "type_display": {
            "type": "string",
            "readOnly": true
          },
          "code": {
            "type": "string",
            "description": "Código corto de la serie (p.ej., F, PRES).",
            "maxLength": 16
          },
          "name": {
            "type": "string",
            "description": "Nombre interno de la serie.",
            "maxLength": 60
          },
          "prefix": {
            "type": "string",
            "description": "Prefijo del número. Soporta {YYYY}, {YY}, {MM}.",
            "maxLength": 40
          },
          "suffix": {
            "type": "string",
            "maxLength": 20
          },
          "pad_length": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 1
          },
          "reset_policy": {
            "$ref": "#/components/schemas/ResetPolicyEnum"
          },
          "next_number": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "last_reset_period": {
            "type": "string",
            "description": "Periodo de último reset según política: '' | YYYY | YYYYMM",
            "maxLength": 6
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "preview": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          }
        },
        "required": [
          "code",
          "created_at",
          "id",
          "name",
          "preview",
          "type",
          "type_display",
          "updated_at"
        ]
      },
      "DocumentSeriesList": {
        "type": "object",
        "description": "Serializer ultra-ligero para series en listados de documentos.\nSolo incluye los campos básicos necesarios.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "description": "Nombre interno de la serie.",
            "maxLength": 60
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "DocumentSeriesRequest": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/DocumentSeriesTypeEnum"
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "description": "Código corto de la serie (p.ej., F, PRES).",
            "maxLength": 16
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "Nombre interno de la serie.",
            "maxLength": 60
          },
          "prefix": {
            "type": "string",
            "description": "Prefijo del número. Soporta {YYYY}, {YY}, {MM}.",
            "maxLength": 40
          },
          "suffix": {
            "type": "string",
            "maxLength": 20
          },
          "pad_length": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 1
          },
          "reset_policy": {
            "$ref": "#/components/schemas/ResetPolicyEnum"
          },
          "next_number": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "last_reset_period": {
            "type": "string",
            "description": "Periodo de último reset según política: '' | YYYY | YYYYMM",
            "maxLength": 6
          }
        },
        "required": [
          "code",
          "name",
          "type"
        ]
      },
      "DocumentSeriesTypeEnum": {
        "enum": [
          "QUOTE",
          "PROFORMA",
          "INVOICE",
          "CREDIT_NOTE",
          "PURCHASE_ORDER",
          "VENDOR_BILL"
        ],
        "type": "string",
        "description": "* `QUOTE` - Presupuesto\n* `PROFORMA` - Proforma\n* `INVOICE` - Factura\n* `CREDIT_NOTE` - Rectificativa/Abono\n* `PURCHASE_ORDER` - Pedido compra\n* `VENDOR_BILL` - Factura recibida"
      },
      "DocumentTemplate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "module": {
            "$ref": "#/components/schemas/ModuleEnum"
          },
          "module_display": {
            "type": "string",
            "readOnly": true
          },
          "file": {
            "type": "string",
            "format": "uri"
          },
          "file_name": {
            "type": "string",
            "readOnly": true
          },
          "is_active": {
            "type": "boolean"
          },
          "download_url": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "download_url",
          "file",
          "file_name",
          "id",
          "module",
          "module_display",
          "name",
          "updated_at"
        ]
      },
      "DocumentTemplateUpload": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "module": {
            "$ref": "#/components/schemas/ModuleEnum"
          },
          "file": {
            "type": "string",
            "format": "uri"
          },
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "file",
          "id",
          "name"
        ]
      },
      "DocumentTemplateUploadRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "module": {
            "$ref": "#/components/schemas/ModuleEnum"
          },
          "file": {
            "type": "string",
            "format": "binary"
          },
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "file",
          "name"
        ]
      },
      "DoubtfulDebtRequest": {
        "type": "object",
        "properties": {
          "invoice": {
            "type": "integer"
          },
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true
          }
        },
        "required": [
          "invoice"
        ]
      },
      "EmailTemplate": {
        "type": "object",
        "description": "Serializador para plantillas de email.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "doc_type": {
            "$ref": "#/components/schemas/EmailTemplateDocTypeEnum"
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "is_default": {
            "type": "boolean"
          },
          "subject": {
            "type": "string",
            "maxLength": 160
          },
          "body_html": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "body_html",
          "created_at",
          "doc_type",
          "id",
          "subject",
          "updated_at"
        ]
      },
      "EmailTemplateDocTypeEnum": {
        "enum": [
          "QUOTE",
          "PROFORMA",
          "INVOICE",
          "CREDIT_NOTE",
          "VENDOR_BILL"
        ],
        "type": "string",
        "description": "* `QUOTE` - Presupuesto\n* `PROFORMA` - Proforma\n* `INVOICE` - Factura\n* `CREDIT_NOTE` - Rectificativa\n* `VENDOR_BILL` - Factura recibida"
      },
      "EmailTemplateRequest": {
        "type": "object",
        "description": "Serializador para plantillas de email.",
        "properties": {
          "doc_type": {
            "$ref": "#/components/schemas/EmailTemplateDocTypeEnum"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "is_default": {
            "type": "boolean"
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "body_html": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "body_html",
          "doc_type",
          "subject"
        ]
      },
      "EmployeeDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "user": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "user_email": {
            "type": "string",
            "format": "email",
            "readOnly": true
          },
          "has_user": {
            "type": "boolean",
            "readOnly": true
          },
          "first_name": {
            "type": "string",
            "maxLength": 150
          },
          "last_name": {
            "type": "string",
            "maxLength": 150
          },
          "full_name": {
            "type": "string",
            "readOnly": true
          },
          "dni_nie": {
            "type": "string",
            "title": "DNI/NIE",
            "maxLength": 20
          },
          "ss_number": {
            "type": "string",
            "title": "Nº Seguridad Social",
            "maxLength": 20
          },
          "birth_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "nationality": {
            "type": "string",
            "maxLength": 50
          },
          "gender": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/EmployeeGenderEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "gender_display": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "marital_status": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MaritalStatusEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "marital_status_display": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "personal_email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "personal_phone": {
            "type": "string",
            "maxLength": 20
          },
          "emergency_contact_name": {
            "type": "string",
            "maxLength": 200
          },
          "emergency_contact_phone": {
            "type": "string",
            "maxLength": 20
          },
          "address_street": {
            "type": "string",
            "maxLength": 200
          },
          "address_city": {
            "type": "string",
            "maxLength": 100
          },
          "address_province": {
            "type": "string",
            "maxLength": 100
          },
          "address_postal_code": {
            "type": "string",
            "maxLength": 10
          },
          "address_country": {
            "type": "string",
            "maxLength": 2
          },
          "photo": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "employee_code": {
            "type": "string",
            "maxLength": 30
          },
          "hire_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "termination_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "department": {
            "type": "integer",
            "nullable": true
          },
          "department_name": {
            "type": "string",
            "readOnly": true
          },
          "position": {
            "type": "integer",
            "nullable": true
          },
          "position_title": {
            "type": "string",
            "readOnly": true
          },
          "work_center": {
            "type": "integer",
            "nullable": true
          },
          "work_center_name": {
            "type": "string",
            "readOnly": true
          },
          "work_schedule": {
            "type": "integer",
            "nullable": true
          },
          "work_schedule_name": {
            "type": "string",
            "readOnly": true
          },
          "professional_category": {
            "type": "string",
            "maxLength": 100
          },
          "seniority_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "iban": {
            "type": "string",
            "maxLength": 34
          },
          "irpf_key": {
            "allOf": [
              {
                "$ref": "#/components/schemas/IrpfKeyEnum"
              }
            ],
            "title": "Clave de percepción (modelo 190)",
            "description": "Clave con la que se declaran sus retribuciones en el modelo 190: «A» rendimientos del trabajo de empleados; «E» retribuciones de administradores y consejeros (retención del 35 %, o del 19 % si la cifra de negocios de la entidad es inferior a 100.000 €).\n\n* `A` - A — Empleado por cuenta ajena\n* `E` - E — Consejero o administrador"
          },
          "irpf_subkey": {
            "title": "Subclave (modelo 190)",
            "description": "Sólo para la clave E (administradores): subclave del modelo 190. Vacía = E.01.\n\n* `` - Automática (E.01)\n* `01` - E.01 — Régimen general de la S. S. (asimilado)\n* `02` - E.02 — Régimen general, entidad con cifra de negocios < 100.000 €\n* `03` - E.03 — RETA, entidad con cifra de negocios < 100.000 €\n* `04` - E.04 — Resto de consejeros y administradores",
            "oneOf": [
              {
                "$ref": "#/components/schemas/IrpfSubkeyEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "family_situation": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FamilySituationEnum"
              }
            ],
            "title": "Situación familiar (modelo 190)"
          },
          "spouse_nif": {
            "type": "string",
            "title": "NIF del cónyuge",
            "description": "Sólo con situación familiar 2 (casado/a con cónyuge sin rentas superiores a 1.500 €).",
            "maxLength": 20
          },
          "disability_degree": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DisabilityDegreeEnum"
              }
            ],
            "title": "Discapacidad (modelo 190)"
          },
          "contract_relation": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ContractRelationEnum"
              }
            ],
            "title": "Contrato o relación (modelo 190)"
          },
          "geographic_mobility": {
            "type": "boolean",
            "title": "Movilidad geográfica (art. 19.2.f LIRPF)",
            "description": "Aceptó un puesto que exige cambiar de municipio de residencia (incremento de gastos deducibles)."
          },
          "housing_loan": {
            "type": "boolean",
            "title": "Comunicó pagos por préstamo de vivienda habitual",
            "description": "Reducción del tipo de retención del art. 86.1 RIRPF (adquisición de vivienda antes de 2013)."
          },
          "irpf_dependants": {
            "description": "Hijos y ascendientes comunicados por el empleado (modelo 145), para el modelo 190: `{\"hijos_menores3_total\": 1, \"hijos_menores3_entero\": 1, \"hijos_resto_total\": 0, …}`. Claves admitidas: asc_disc33_entero, asc_disc33_total, asc_disc65_entero, asc_disc65_total, asc_mayor75_entero, asc_mayor75_total, asc_menor75_entero, asc_menor75_total, asc_movred_entero, asc_movred_total, desc_disc33_entero, desc_disc33_total, desc_disc65_entero, desc_disc65_total, desc_movred_entero, desc_movred_total, hijo1_entero, hijo2_entero, hijo3_entero, hijos_menores3_entero, hijos_menores3_total, hijos_resto_entero, hijos_resto_total. Enteros de 0 a 9 (0 a 99 en hijos_resto y descendientes con discapacidad); «_entero» no puede superar «_total»."
          },
          "status": {
            "$ref": "#/components/schemas/EmployeeStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "department_name",
          "first_name",
          "full_name",
          "gender_display",
          "has_user",
          "id",
          "last_name",
          "marital_status_display",
          "position_title",
          "status_display",
          "updated_at",
          "user",
          "user_email",
          "work_center_name",
          "work_schedule_name"
        ]
      },
      "EmployeeDetailRequest": {
        "type": "object",
        "properties": {
          "first_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "last_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "dni_nie": {
            "type": "string",
            "title": "DNI/NIE",
            "maxLength": 20
          },
          "ss_number": {
            "type": "string",
            "title": "Nº Seguridad Social",
            "maxLength": 20
          },
          "birth_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "nationality": {
            "type": "string",
            "maxLength": 50
          },
          "gender": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/EmployeeGenderEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "marital_status": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MaritalStatusEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "personal_email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "personal_phone": {
            "type": "string",
            "maxLength": 20
          },
          "emergency_contact_name": {
            "type": "string",
            "maxLength": 200
          },
          "emergency_contact_phone": {
            "type": "string",
            "maxLength": 20
          },
          "address_street": {
            "type": "string",
            "maxLength": 200
          },
          "address_city": {
            "type": "string",
            "maxLength": 100
          },
          "address_province": {
            "type": "string",
            "maxLength": 100
          },
          "address_postal_code": {
            "type": "string",
            "maxLength": 10
          },
          "address_country": {
            "type": "string",
            "maxLength": 2
          },
          "photo": {
            "type": "string",
            "format": "binary",
            "nullable": true
          },
          "employee_code": {
            "type": "string",
            "maxLength": 30
          },
          "hire_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "termination_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "department": {
            "type": "integer",
            "nullable": true
          },
          "position": {
            "type": "integer",
            "nullable": true
          },
          "work_center": {
            "type": "integer",
            "nullable": true
          },
          "work_schedule": {
            "type": "integer",
            "nullable": true
          },
          "professional_category": {
            "type": "string",
            "maxLength": 100
          },
          "seniority_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "iban": {
            "type": "string",
            "maxLength": 34
          },
          "irpf_key": {
            "allOf": [
              {
                "$ref": "#/components/schemas/IrpfKeyEnum"
              }
            ],
            "title": "Clave de percepción (modelo 190)",
            "description": "Clave con la que se declaran sus retribuciones en el modelo 190: «A» rendimientos del trabajo de empleados; «E» retribuciones de administradores y consejeros (retención del 35 %, o del 19 % si la cifra de negocios de la entidad es inferior a 100.000 €).\n\n* `A` - A — Empleado por cuenta ajena\n* `E` - E — Consejero o administrador"
          },
          "irpf_subkey": {
            "title": "Subclave (modelo 190)",
            "description": "Sólo para la clave E (administradores): subclave del modelo 190. Vacía = E.01.\n\n* `` - Automática (E.01)\n* `01` - E.01 — Régimen general de la S. S. (asimilado)\n* `02` - E.02 — Régimen general, entidad con cifra de negocios < 100.000 €\n* `03` - E.03 — RETA, entidad con cifra de negocios < 100.000 €\n* `04` - E.04 — Resto de consejeros y administradores",
            "oneOf": [
              {
                "$ref": "#/components/schemas/IrpfSubkeyEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "family_situation": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FamilySituationEnum"
              }
            ],
            "title": "Situación familiar (modelo 190)"
          },
          "spouse_nif": {
            "type": "string",
            "title": "NIF del cónyuge",
            "description": "Sólo con situación familiar 2 (casado/a con cónyuge sin rentas superiores a 1.500 €).",
            "maxLength": 20
          },
          "disability_degree": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DisabilityDegreeEnum"
              }
            ],
            "title": "Discapacidad (modelo 190)"
          },
          "contract_relation": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ContractRelationEnum"
              }
            ],
            "title": "Contrato o relación (modelo 190)"
          },
          "geographic_mobility": {
            "type": "boolean",
            "title": "Movilidad geográfica (art. 19.2.f LIRPF)",
            "description": "Aceptó un puesto que exige cambiar de municipio de residencia (incremento de gastos deducibles)."
          },
          "housing_loan": {
            "type": "boolean",
            "title": "Comunicó pagos por préstamo de vivienda habitual",
            "description": "Reducción del tipo de retención del art. 86.1 RIRPF (adquisición de vivienda antes de 2013)."
          },
          "irpf_dependants": {
            "description": "Hijos y ascendientes comunicados por el empleado (modelo 145), para el modelo 190: `{\"hijos_menores3_total\": 1, \"hijos_menores3_entero\": 1, \"hijos_resto_total\": 0, …}`. Claves admitidas: asc_disc33_entero, asc_disc33_total, asc_disc65_entero, asc_disc65_total, asc_mayor75_entero, asc_mayor75_total, asc_menor75_entero, asc_menor75_total, asc_movred_entero, asc_movred_total, desc_disc33_entero, desc_disc33_total, desc_disc65_entero, desc_disc65_total, desc_movred_entero, desc_movred_total, hijo1_entero, hijo2_entero, hijo3_entero, hijos_menores3_entero, hijos_menores3_total, hijos_resto_entero, hijos_resto_total. Enteros de 0 a 9 (0 a 99 en hijos_resto y descendientes con discapacidad); «_entero» no puede superar «_total»."
          },
          "status": {
            "$ref": "#/components/schemas/EmployeeStatusEnum"
          }
        },
        "required": [
          "first_name",
          "last_name"
        ]
      },
      "EmployeeDocument": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "employee": {
            "type": "integer"
          },
          "employee_name": {
            "type": "string",
            "readOnly": true
          },
          "doc_type": {
            "$ref": "#/components/schemas/EmployeeDocumentTypeEnum"
          },
          "doc_type_display": {
            "type": "string",
            "readOnly": true
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "file": {
            "type": "string",
            "format": "uri"
          },
          "period_month": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "nullable": true
          },
          "period_year": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "nullable": true
          },
          "visible_to_employee": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "doc_type",
          "doc_type_display",
          "employee",
          "employee_name",
          "file",
          "id",
          "title",
          "updated_at"
        ]
      },
      "EmployeeDocumentRequest": {
        "type": "object",
        "properties": {
          "employee": {
            "type": "integer"
          },
          "doc_type": {
            "$ref": "#/components/schemas/EmployeeDocumentTypeEnum"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "file": {
            "type": "string",
            "format": "binary"
          },
          "period_month": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "nullable": true
          },
          "period_year": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "nullable": true
          },
          "visible_to_employee": {
            "type": "boolean"
          }
        },
        "required": [
          "doc_type",
          "employee",
          "file",
          "title"
        ]
      },
      "EmployeeDocumentTypeEnum": {
        "enum": [
          "contract",
          "payslip",
          "certificate",
          "id_document",
          "medical",
          "other"
        ],
        "type": "string",
        "description": "* `contract` - Contrato\n* `payslip` - Nómina\n* `certificate` - Certificado\n* `id_document` - Documento de identidad\n* `medical` - Certificado médico\n* `other` - Otro"
      },
      "EmployeeGenderEnum": {
        "enum": [
          "M",
          "F",
          "O"
        ],
        "type": "string",
        "description": "* `M` - Masculino\n* `F` - Femenino\n* `O` - Otro"
      },
      "EmployeeList": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "employee_code": {
            "type": "string",
            "maxLength": 30
          },
          "first_name": {
            "type": "string",
            "maxLength": 150
          },
          "last_name": {
            "type": "string",
            "maxLength": 150
          },
          "full_name": {
            "type": "string",
            "readOnly": true
          },
          "photo": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "department": {
            "type": "integer",
            "nullable": true
          },
          "department_name": {
            "type": "string",
            "readOnly": true
          },
          "position": {
            "type": "integer",
            "nullable": true
          },
          "position_title": {
            "type": "string",
            "readOnly": true
          },
          "work_center": {
            "type": "integer",
            "nullable": true
          },
          "work_center_name": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "$ref": "#/components/schemas/EmployeeStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "hire_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "has_user": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "required": [
          "department_name",
          "first_name",
          "full_name",
          "has_user",
          "id",
          "last_name",
          "position_title",
          "status_display",
          "work_center_name"
        ]
      },
      "EmployeeStatusEnum": {
        "enum": [
          "active",
          "on_leave",
          "terminated"
        ],
        "type": "string",
        "description": "* `active` - Activo\n* `on_leave` - De baja\n* `terminated` - Dado de baja"
      },
      "EntornoEnum": {
        "enum": [
          "TEST",
          "PROD"
        ],
        "type": "string",
        "description": "* `TEST` - TEST\n* `PROD` - PROD"
      },
      "EntryTypeEnum": {
        "enum": [
          "regular",
          "overtime"
        ],
        "type": "string",
        "description": "* `regular` - Regular\n* `overtime` - Horas extra"
      },
      "EpisodeDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "reference": {
            "type": "string",
            "readOnly": true
          },
          "patient": {
            "type": "integer"
          },
          "patient_name": {
            "type": "string",
            "readOnly": true
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "practitioner_name": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "episode_type": {
            "$ref": "#/components/schemas/EpisodeTypeEnum"
          },
          "episode_type_display": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "$ref": "#/components/schemas/ClinicalEpisodeStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "chief_complaint": {
            "type": "string",
            "description": "Motivo de consulta"
          },
          "anamnesis": {
            "type": "string",
            "description": "Antecedentes de la consulta"
          },
          "diagnostic_impression": {
            "type": "string",
            "description": "Impresión diagnóstica (texto libre o referencia CIE-11)"
          },
          "treatment_plan": {
            "type": "string",
            "description": "Plan de tratamiento"
          },
          "recommendations": {
            "type": "string",
            "description": "Recomendaciones"
          },
          "notes": {
            "type": "string",
            "description": "Notas adicionales (texto enriquecido)"
          },
          "duration_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true
          },
          "custom_fields": {
            "description": "Datos de campos de especialidad"
          },
          "is_signed": {
            "type": "boolean"
          },
          "signed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "episode_type_display",
          "id",
          "patient_name",
          "practitioner_name",
          "reference",
          "status_display",
          "updated_at"
        ]
      },
      "EpisodeDetailRequest": {
        "type": "object",
        "properties": {
          "patient": {
            "type": "integer"
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "episode_type": {
            "$ref": "#/components/schemas/EpisodeTypeEnum"
          },
          "status": {
            "$ref": "#/components/schemas/ClinicalEpisodeStatusEnum"
          },
          "chief_complaint": {
            "type": "string",
            "description": "Motivo de consulta"
          },
          "anamnesis": {
            "type": "string",
            "description": "Antecedentes de la consulta"
          },
          "diagnostic_impression": {
            "type": "string",
            "description": "Impresión diagnóstica (texto libre o referencia CIE-11)"
          },
          "treatment_plan": {
            "type": "string",
            "description": "Plan de tratamiento"
          },
          "recommendations": {
            "type": "string",
            "description": "Recomendaciones"
          },
          "notes": {
            "type": "string",
            "description": "Notas adicionales (texto enriquecido)"
          },
          "duration_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true
          },
          "custom_fields": {
            "description": "Datos de campos de especialidad"
          },
          "is_signed": {
            "type": "boolean"
          },
          "signed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "EpisodeList": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "reference": {
            "type": "string",
            "maxLength": 50
          },
          "patient": {
            "type": "integer"
          },
          "patient_name": {
            "type": "string",
            "readOnly": true
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "practitioner_name": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "episode_type": {
            "$ref": "#/components/schemas/EpisodeTypeEnum"
          },
          "episode_type_display": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "$ref": "#/components/schemas/ClinicalEpisodeStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "chief_complaint": {
            "type": "string",
            "description": "Motivo de consulta"
          },
          "duration_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true
          },
          "is_signed": {
            "type": "boolean"
          },
          "diagnosis_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "diagnosis_count",
          "episode_type_display",
          "id",
          "patient",
          "patient_name",
          "practitioner_name",
          "reference",
          "status_display",
          "updated_at"
        ]
      },
      "EpisodeTypeEnum": {
        "enum": [
          "first_visit",
          "follow_up",
          "emergency",
          "review",
          "discharge"
        ],
        "type": "string",
        "description": "* `first_visit` - Primera visita\n* `follow_up` - Seguimiento\n* `emergency` - Urgencia\n* `review` - Revisión\n* `discharge` - Alta"
      },
      "EstadoEnvioEnum": {
        "enum": [
          "PENDIENTE",
          "ENVIADO",
          "ACEPTADO",
          "ACEPTADO_CON_ERRORES",
          "RECHAZADO",
          "ERROR_ENVIO",
          "COMPLETADO_SIN_ENVIO"
        ],
        "type": "string",
        "description": "* `PENDIENTE` - PENDIENTE\n* `ENVIADO` - ENVIADO\n* `ACEPTADO` - ACEPTADO\n* `ACEPTADO_CON_ERRORES` - ACEPTADO_CON_ERRORES\n* `RECHAZADO` - RECHAZADO\n* `ERROR_ENVIO` - ERROR_ENVIO\n* `COMPLETADO_SIN_ENVIO` - COMPLETADO_SIN_ENVIO"
      },
      "EventType": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "maxLength": 100,
            "pattern": "^[-a-zA-Z0-9_]+$"
          },
          "description": {
            "type": "string"
          },
          "duration_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "buffer_before_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "buffer_after_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "color": {
            "type": "string",
            "maxLength": 7
          },
          "is_active": {
            "type": "boolean"
          },
          "price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Precio en la moneda indicada. NULL = gratuito"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "requires_payment": {
            "type": "boolean"
          },
          "max_bookings_per_day": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true
          },
          "confirmation_message": {
            "type": "string",
            "description": "Mensaje mostrado tras confirmar la reserva"
          },
          "link_to": {
            "allOf": [
              {
                "$ref": "#/components/schemas/LinkToEnum"
              }
            ],
            "description": "A qué entidad vincular automáticamente al reservar\n\n* `none` - Sin vincular\n* `patient` - Paciente\n* `customer` - Cliente\n* `both` - Ambos"
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "assigned_user": {
            "type": "integer",
            "nullable": true
          },
          "custom_questions": {
            "description": "Preguntas adicionales para el formulario de reserva"
          },
          "location": {
            "type": "string",
            "description": "Ubicación o enlace de videollamada",
            "maxLength": 300
          },
          "booking_url": {
            "type": "string",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "booking_url",
          "created_at",
          "id",
          "name",
          "slug",
          "updated_at"
        ]
      },
      "EventTypeRequest": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[-a-zA-Z0-9_]+$"
          },
          "description": {
            "type": "string"
          },
          "duration_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "buffer_before_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "buffer_after_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          },
          "is_active": {
            "type": "boolean"
          },
          "price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Precio en la moneda indicada. NULL = gratuito"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "requires_payment": {
            "type": "boolean"
          },
          "max_bookings_per_day": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true
          },
          "confirmation_message": {
            "type": "string",
            "description": "Mensaje mostrado tras confirmar la reserva"
          },
          "link_to": {
            "allOf": [
              {
                "$ref": "#/components/schemas/LinkToEnum"
              }
            ],
            "description": "A qué entidad vincular automáticamente al reservar\n\n* `none` - Sin vincular\n* `patient` - Paciente\n* `customer` - Cliente\n* `both` - Ambos"
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "assigned_user": {
            "type": "integer",
            "nullable": true
          },
          "custom_questions": {
            "description": "Preguntas adicionales para el formulario de reserva"
          },
          "location": {
            "type": "string",
            "description": "Ubicación o enlace de videollamada",
            "maxLength": 300
          }
        },
        "required": [
          "name",
          "slug"
        ]
      },
      "ExchangeRateSourceEnum": {
        "enum": [
          "ecb",
          "manual",
          "bank_charge"
        ],
        "type": "string",
        "description": "* `ecb` - Cambio de referencia del BCE\n* `manual` - Indicado a mano\n* `bank_charge` - Derivado del cargo real en euros"
      },
      "ExemptionTypeEnum": {
        "enum": [
          "E1",
          "E2",
          "E3",
          "E4",
          "E5",
          "E6"
        ],
        "type": "string",
        "description": "* `E1` - Exenta art. 20\n* `E2` - Exenta art. 21\n* `E3` - Exenta art. 22\n* `E4` - Exenta arts. 23 y 24\n* `E5` - Exenta art. 25\n* `E6` - Exenta otros"
      },
      "ExpedienteModeEnum": {
        "enum": [
          "judicial",
          "clinical",
          "both"
        ],
        "type": "string",
        "description": "* `judicial` - Expedientes Judiciales\n* `clinical` - Historias Clínicas\n* `both` - Ambos"
      },
      "ExpedientesSettings": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "reference_prefix": {
            "type": "string",
            "maxLength": 20
          },
          "reference_suffix": {
            "type": "string",
            "maxLength": 20
          },
          "next_reference_number": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "reference_padding": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          }
        },
        "required": [
          "id"
        ]
      },
      "Expense": {
        "type": "object",
        "description": "Gasto (factura recibida u otro justificante) con su desglose de IVA.\n\nDivisa: ``amount`` se envía en la divisa de ``currency`` y se guarda en euros;\n``exchange_rate`` = EUR por 1 unidad de divisa (BCE automático si falta).",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "supplier": {
            "type": "integer",
            "nullable": true
          },
          "supplier_display": {
            "type": "string",
            "readOnly": true
          },
          "supplier_cif": {
            "type": "string",
            "readOnly": true
          },
          "supplier_fiscal_address": {
            "type": "string",
            "nullable": true,
            "description": "Get supplier's billing address formatted as two-line string.",
            "readOnly": true
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Vencimiento del pago (opcional)."
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Base imponible. Si currency ≠ EUR es el importe EN LA DIVISA indicada: Billora lo convierte y guarda en euros (amount en las respuestas siempre está en EUR; original_amount conserva el importe en divisa). exchange_rate = euros por 1 unidad de divisa; si no se indica se usa el cambio del BCE del día (exchange_rate_source = ecb). Alternativamente envía amount_eur (el cargo real en euros) y el cambio se deduce."
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,6})?$",
            "nullable": true,
            "description": "Euros por 1 unidad de la divisa (sólo si currency ≠ EUR). Vacío = cambio del BCE del día."
          },
          "exchange_rate_source": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExchangeRateSourceEnum"
              }
            ],
            "readOnly": true,
            "description": "Origen del tipo de cambio: ecb (automático), manual o bank_charge (derivado del cargo en euros).\n\n* `ecb` - Cambio de referencia del BCE\n* `manual` - Indicado a mano\n* `bank_charge` - Derivado del cargo real en euros"
          },
          "original_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true,
            "description": "Base imponible en la divisa original de la factura."
          },
          "original_total": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "Total a pagar en la divisa ORIGINAL de la factura (currency), o null si el gasto es en euros. amount/total_amount están siempre en euros; original_amount es la base en divisa."
          },
          "numero_factura": {
            "type": "string",
            "description": "Número de factura del proveedor",
            "maxLength": 50
          },
          "document_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpenseDocumentTypeEnum"
              }
            ],
            "description": "Documento que justifica el gasto. Sólo «invoice», «simplified_invoice» y «supplier_credit_note» (abono de proveedor: importes en positivo que restan) entran en los libros de IVA, el 303, el 349 y el 347; el resto no deduce IVA (coste íntegro: 629/625/626/631, 678 sanciones, 669 intereses, 555 suplidos).\n\n* `invoice` - Factura recibida\n* `simplified_invoice` - Factura simplificada / ticket\n* `receipt` - Recibo o justificante (sin factura)\n* `settlement` - Liquidación (kilometraje, dietas, hoja de gastos)\n* `insurance_receipt` - Recibo de seguro\n* `bank_fee` - Comisión bancaria o de pasarela de pago\n* `tax_or_fee` - Tributo o tasa\n* `penalty` - Sanción o recargo (gasto excepcional)\n* `financial_interest` - Intereses de demora o financieros\n* `pass_through` - Suplido (pagado por cuenta del cliente)\n* `supplier_credit_note` - Abono / rectificativa de proveedor\n* `other` - Otro documento (no factura)"
          },
          "document_type_display": {
            "type": "string",
            "readOnly": true
          },
          "category": {
            "type": "integer",
            "nullable": true
          },
          "category_display": {
            "type": "string",
            "readOnly": true
          },
          "category_color": {
            "type": "string",
            "readOnly": true
          },
          "tax_templates": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Impuestos aplicables (IVA, retenciones, etc.) - LEGACY"
          },
          "spanish_taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Impuestos españoles aplicables"
          },
          "tax_lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseTaxLine"
            }
          },
          "other_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseOtherTax"
            },
            "description": "Otros tributos no deducibles que son coste (IPS 8 % de los seguros, hidrocarburos, aranceles/DUA, tasas). Se suman al total a pagar."
          },
          "status": {
            "$ref": "#/components/schemas/ExpenseStatusEnum"
          },
          "operation_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpenseOperationTypeEnum"
              }
            ],
            "description": "Tipo de operación a efectos de IVA (interior, intracomunitaria, ISP, importación...).\n\n* `domestic` - Operación interior\n* `intra_eu` - Adquisición intracomunitaria de bienes o servicios (UE)\n* `foreign_services` - Servicios de empresario no establecido en la UE (ISP)\n* `domestic_reverse_charge` - Inversión del sujeto pasivo interior (art. 84.Uno.2º)\n* `import` - Importación (DUA)\n* `not_subject` - No sujeta a IVA\n* `non_deductible` - IVA soportado no deducible"
          },
          "operation_type_display": {
            "type": "string",
            "readOnly": true
          },
          "is_investment_good": {
            "type": "boolean",
            "description": "Bien de inversión (casillas 30/31, 34/35 o 38/39 del 303)."
          },
          "import_vat_deferred": {
            "type": "boolean",
            "description": "Sólo importaciones (operation_type=import): el IVA del DUA NO se paga en la aduana, se liquida en el 303 (IVA diferido, art. 167.Dos LIVA: casilla 77) y se deduce a la vez (casillas 32-35). Sin marcar, el IVA de importación se paga a la aduana / al transitario."
          },
          "operation_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de la operación (entrega o servicio) si es distinta de la de la factura (date). Sale en el libro de facturas recibidas y decide el periodo de devengo del IVA autorrepercutido (inversión del sujeto pasivo: casillas 10-13 del 303 y modelo 349)."
          },
          "deduction_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de deducción (periodo del 303): si la factura llegó tarde y el IVA se deduce en un periodo posterior (art. 99 LIVA). Vacía = el periodo de date. El libro de facturas recibidas usa siempre date."
          },
          "vat_deductible_percent": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$",
            "description": "Porcentaje del IVA soportado que se deduce (100 por defecto). Deducción parcial: p. ej. 50 en turismos y sus gastos (art. 95.Tres LIVA) o el porcentaje de afectación. La parte no deducible es mayor coste del gasto. Con 0 no se deduce nada (equivale a «IVA soportado no deducible»)."
          },
          "withholding_key": {
            "title": "Clave de la retención (modelos 111 y 190)",
            "description": "Clave y subclave del modelo 190 de la retención de esta factura. Vacía = automática (profesionales G.01, o G.03 si la retención es del 7 %; retenciones especiales K.01).\n\n* `` - Automática\n* `F01` - F.01 — Premios literarios, artísticos o científicos (trabajo)\n* `F02` - F.02 — Cursos, conferencias, coloquios y similares (trabajo)\n* `F03` - F.03 — Elaboración de obras literarias, artísticas o científicas, tipo general\n* `F04` - F.04 — Elaboración de obras literarias, artísticas o científicas, tipo reducido\n* `F05` - F.05 — Propiedad intelectual (trabajo), tipo general\n* `F06` - F.06 — Propiedad intelectual (trabajo), tipo reducido\n* `G01` - G.01 — Actividades profesionales, tipo general\n* `G02` - G.02 — Recaudadores municipales, mediadores de seguros y delegados comerciales\n* `G03` - G.03 — Actividades profesionales, tipo reducido de inicio de actividad (7 %)\n* `G04` - G.04 — Actividades profesionales, tipo del art. 95.1.d) RIRPF\n* `G05` - G.05 — Propiedad intelectual (actividad), tipo general\n* `G06` - G.06 — Propiedad intelectual (actividad), tipo reducido\n* `G07` - G.07 — Anticipos a cuenta de derechos de autor\n* `G08` - G.08 — Cesión del derecho de imagen (actividad profesional)\n* `H01` - H.01 — Actividades agrícolas, ganaderas o forestales (tipo general)\n* `H02` - H.02 — Engorde de porcino y avicultura\n* `H03` - H.03 — Actividades forestales\n* `H04` - H.04 — Actividades en estimación objetiva (art. 95.6.2.º RIRPF)\n* `J` - J — Imputación de rentas por cesión de derechos de imagen (art. 92.8 LIRPF)\n* `K01` - K.01 — Premios de juegos sin fines publicitarios\n* `K02` - K.02 — Ganancias por aprovechamientos forestales de vecinos en montes públicos\n* `K03` - K.03 — Premios de concursos con fines publicitarios",
            "oneOf": [
              {
                "$ref": "#/components/schemas/WithholdingKeyEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "supply_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SupplyTypeEnum"
              }
            ],
            "description": "Bienes o servicios: decide la clave del 349 (A/I) y las casillas del 390 en las adquisiciones intracomunitarias.\n\n* `services` - Servicios\n* `goods` - Bienes"
          },
          "service_period_start": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Inicio del periodo de servicio cubierto (seguro anual, suscripción…). Con service_period_end; si el periodo cruza el cierre del ejercicio la contabilidad periodifica (480)."
          },
          "service_period_end": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fin del periodo de servicio cubierto."
          },
          "recipient_name": {
            "type": "string",
            "description": "Destinatario que figura en el documento (lo extrae el escáner). Si no es la organización, el gasto recibe el aviso fiscal recipient_mismatch.",
            "maxLength": 200
          },
          "recipient_vat_id": {
            "type": "string",
            "description": "NIF del destinatario que figura en el documento (lo extrae el escáner).",
            "maxLength": 20
          },
          "recipient_mismatch_accepted": {
            "type": "boolean",
            "description": "El usuario ha revisado el aviso recipient_mismatch y lo da por bueno (p. ej. el destinatario es el nombre comercial de la organización)."
          },
          "payment_method": {
            "type": "integer",
            "nullable": true,
            "description": "Método de pago previsto; si tiene auto_mark_paid el gasto se marca pagado al confirmarlo."
          },
          "payment_method_display": {
            "type": "string",
            "readOnly": true
          },
          "duplicate_of": {
            "type": "integer",
            "nullable": true,
            "description": "Gasto del que este es un posible duplicado (se rellena al crear con ?force=true)."
          },
          "rectifies": {
            "type": "integer",
            "nullable": true,
            "description": "Sólo abonos de proveedor (document_type=supplier_credit_note): factura recibida que rectifica. Si es de un periodo anterior, el 303 lo declara en las casillas 40/41."
          },
          "is_credit_note": {
            "type": "boolean",
            "readOnly": true,
            "description": "Abono de proveedor: sus importes (positivos) restan en libros, 303 y contabilidad."
          },
          "attachment": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "Archivo escaneado del gasto (factura, ticket, etc.)"
          },
          "attachment_url": {
            "type": "string",
            "nullable": true,
            "description": "Enlace firmado temporal al justificante (sólo en el detalle; el listado devuelve attachment: bool).",
            "readOnly": true
          },
          "attachment_filename": {
            "type": "string",
            "nullable": true,
            "description": "Get display filename for the attachment.",
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "is_vat_book_document": {
            "type": "boolean",
            "readOnly": true,
            "description": "True si entra en el libro de facturas recibidas (invoice / simplified_invoice / supplier_credit_note)."
          },
          "fiscal_warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "readOnly": true,
            "description": "Códigos de aviso fiscal: foreign_supplier_domestic, missing_invoice_number, supplier_vat_unverified, vat_on_non_invoice, missing_exchange_rate, duplicate_kept…"
          },
          "fiscal_notes": {
            "type": "string",
            "readOnly": true,
            "description": "Notas de auditoría (p. ej. cambios aplicados por migraciones de datos)."
          },
          "warnings": {
            "type": "array",
            "items": {},
            "readOnly": true,
            "description": "Avisos con mensaje ({code, message}): los fiscales del gasto y accounting_disabled si la contabilidad no está activada."
          },
          "tax_breakdown": {
            "type": "object",
            "additionalProperties": {},
            "description": "Totales de IVA/retenciones y desglose por tipo; incluye other_taxes_total y cost_total.",
            "readOnly": true
          },
          "total_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Importe a pagar al proveedor (EUR): base + IVA + otros tributos − retenciones."
          },
          "paid_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Suma de los pagos registrados (EUR)."
          },
          "remaining_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "total_amount − paid_amount."
          },
          "other_taxes_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Suma de los otros tributos (IPS, hidrocarburos, aranceles, tasas)."
          },
          "cost_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Coste contable: base + IVA no deducible + otros tributos."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpensePayment"
            },
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "attachment_filename",
          "attachment_url",
          "category_color",
          "category_display",
          "cost_total",
          "created_at",
          "document_type_display",
          "exchange_rate_source",
          "fiscal_notes",
          "fiscal_warnings",
          "id",
          "is_credit_note",
          "is_vat_book_document",
          "operation_type_display",
          "original_amount",
          "original_total",
          "other_taxes_total",
          "paid_amount",
          "payment_method_display",
          "payments",
          "remaining_amount",
          "supplier_cif",
          "supplier_display",
          "supplier_fiscal_address",
          "tax_breakdown",
          "total_amount",
          "updated_at",
          "warnings"
        ]
      },
      "ExpenseBulkPaymentRequestRequest": {
        "type": "object",
        "properties": {
          "expense_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "payment_data": {
            "type": "object",
            "additionalProperties": {},
            "description": "Campos del pago (date, payment_method, reference, is_full_payment, amount…)."
          }
        },
        "required": [
          "expense_ids",
          "payment_data"
        ]
      },
      "ExpenseBulkPaymentResult": {
        "type": "object",
        "properties": {
          "created_payments": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "created_payments",
          "errors"
        ]
      },
      "ExpenseByCategory": {
        "type": "object",
        "properties": {
          "category": {
            "type": "string"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "count": {
            "type": "integer"
          },
          "color": {
            "type": "string"
          }
        },
        "required": [
          "amount",
          "category",
          "count"
        ]
      },
      "ExpenseCategory": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "description": "Color hexadecimal para la categoría",
            "maxLength": 7
          },
          "is_active": {
            "type": "boolean"
          },
          "default_accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de gasto (6xx) por defecto de los gastos de esta categoría."
          },
          "default_document_type": {
            "nullable": true,
            "description": "Tipo de documento por defecto de los gastos de esta categoría.\n\n* `invoice` - Factura recibida\n* `simplified_invoice` - Factura simplificada / ticket\n* `receipt` - Recibo o justificante (sin factura)\n* `settlement` - Liquidación (kilometraje, dietas, hoja de gastos)\n* `insurance_receipt` - Recibo de seguro\n* `bank_fee` - Comisión bancaria o de pasarela de pago\n* `tax_or_fee` - Tributo o tasa\n* `penalty` - Sanción o recargo (gasto excepcional)\n* `financial_interest` - Intereses de demora o financieros\n* `pass_through` - Suplido (pagado por cuenta del cliente)\n* `supplier_credit_note` - Abono / rectificativa de proveedor\n* `other` - Otro documento (no factura)",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExpenseDocumentTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "ExpenseCategoryRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "description": "Color hexadecimal para la categoría",
            "maxLength": 7
          },
          "is_active": {
            "type": "boolean"
          },
          "default_accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de gasto (6xx) por defecto de los gastos de esta categoría."
          },
          "default_document_type": {
            "nullable": true,
            "description": "Tipo de documento por defecto de los gastos de esta categoría.\n\n* `invoice` - Factura recibida\n* `simplified_invoice` - Factura simplificada / ticket\n* `receipt` - Recibo o justificante (sin factura)\n* `settlement` - Liquidación (kilometraje, dietas, hoja de gastos)\n* `insurance_receipt` - Recibo de seguro\n* `bank_fee` - Comisión bancaria o de pasarela de pago\n* `tax_or_fee` - Tributo o tasa\n* `penalty` - Sanción o recargo (gasto excepcional)\n* `financial_interest` - Intereses de demora o financieros\n* `pass_through` - Suplido (pagado por cuenta del cliente)\n* `supplier_credit_note` - Abono / rectificativa de proveedor\n* `other` - Otro documento (no factura)",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExpenseDocumentTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          }
        },
        "required": [
          "name"
        ]
      },
      "ExpenseDocumentTypeEnum": {
        "enum": [
          "invoice",
          "simplified_invoice",
          "receipt",
          "settlement",
          "insurance_receipt",
          "bank_fee",
          "tax_or_fee",
          "penalty",
          "financial_interest",
          "pass_through",
          "supplier_credit_note",
          "other"
        ],
        "type": "string",
        "description": "* `invoice` - Factura recibida\n* `simplified_invoice` - Factura simplificada / ticket\n* `receipt` - Recibo o justificante (sin factura)\n* `settlement` - Liquidación (kilometraje, dietas, hoja de gastos)\n* `insurance_receipt` - Recibo de seguro\n* `bank_fee` - Comisión bancaria o de pasarela de pago\n* `tax_or_fee` - Tributo o tasa\n* `penalty` - Sanción o recargo (gasto excepcional)\n* `financial_interest` - Intereses de demora o financieros\n* `pass_through` - Suplido (pagado por cuenta del cliente)\n* `supplier_credit_note` - Abono / rectificativa de proveedor\n* `other` - Otro documento (no factura)"
      },
      "ExpenseList": {
        "type": "object",
        "description": "Gasto en el listado: compacto (sin pagos, sin desglose de líneas ni enlaces firmados).\n``attachment`` indica si hay justificante; el enlace está en el detalle.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "supplier": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "supplier_display": {
            "type": "string",
            "readOnly": true
          },
          "supplier_cif": {
            "type": "string",
            "readOnly": true
          },
          "supplier_fiscal_address": {
            "type": "string",
            "nullable": true,
            "description": "Get supplier's billing address formatted as two-line string.",
            "readOnly": true
          },
          "date": {
            "type": "string",
            "format": "date",
            "readOnly": true
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true,
            "description": "Vencimiento del pago (opcional)."
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Base imponible. Si currency ≠ EUR es el importe EN LA DIVISA indicada: Billora lo convierte y guarda en euros (amount en las respuestas siempre está en EUR; original_amount conserva el importe en divisa). exchange_rate = euros por 1 unidad de divisa; si no se indica se usa el cambio del BCE del día (exchange_rate_source = ecb). Alternativamente envía amount_eur (el cargo real en euros) y el cambio se deduce."
          },
          "currency": {
            "type": "string",
            "readOnly": true
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,6})?$",
            "readOnly": true,
            "nullable": true,
            "description": "Euros por 1 unidad de la divisa (sólo si currency ≠ EUR). Vacío = cambio del BCE del día."
          },
          "exchange_rate_source": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExchangeRateSourceEnum"
              }
            ],
            "readOnly": true,
            "description": "Origen del tipo de cambio: ecb (automático), manual o bank_charge (derivado del cargo en euros).\n\n* `ecb` - Cambio de referencia del BCE\n* `manual` - Indicado a mano\n* `bank_charge` - Derivado del cargo real en euros"
          },
          "original_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true,
            "description": "Base imponible en la divisa original de la factura."
          },
          "original_total": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "Total a pagar en la divisa ORIGINAL de la factura (currency), o null si el gasto es en euros. amount/total_amount están siempre en euros; original_amount es la base en divisa."
          },
          "numero_factura": {
            "type": "string",
            "readOnly": true,
            "description": "Número de factura del proveedor"
          },
          "document_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpenseDocumentTypeEnum"
              }
            ],
            "readOnly": true,
            "description": "Documento que justifica el gasto. Sólo «invoice», «simplified_invoice» y «supplier_credit_note» (abono de proveedor: importes en positivo que restan) entran en los libros de IVA, el 303, el 349 y el 347; el resto no deduce IVA (coste íntegro: 629/625/626/631, 678 sanciones, 669 intereses, 555 suplidos).\n\n* `invoice` - Factura recibida\n* `simplified_invoice` - Factura simplificada / ticket\n* `receipt` - Recibo o justificante (sin factura)\n* `settlement` - Liquidación (kilometraje, dietas, hoja de gastos)\n* `insurance_receipt` - Recibo de seguro\n* `bank_fee` - Comisión bancaria o de pasarela de pago\n* `tax_or_fee` - Tributo o tasa\n* `penalty` - Sanción o recargo (gasto excepcional)\n* `financial_interest` - Intereses de demora o financieros\n* `pass_through` - Suplido (pagado por cuenta del cliente)\n* `supplier_credit_note` - Abono / rectificativa de proveedor\n* `other` - Otro documento (no factura)"
          },
          "document_type_display": {
            "type": "string",
            "readOnly": true
          },
          "category": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "category_display": {
            "type": "string",
            "readOnly": true
          },
          "category_color": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpenseStatusEnum"
              }
            ],
            "readOnly": true
          },
          "operation_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpenseOperationTypeEnum"
              }
            ],
            "readOnly": true,
            "description": "Tipo de operación a efectos de IVA (interior, intracomunitaria, ISP, importación...).\n\n* `domestic` - Operación interior\n* `intra_eu` - Adquisición intracomunitaria de bienes o servicios (UE)\n* `foreign_services` - Servicios de empresario no establecido en la UE (ISP)\n* `domestic_reverse_charge` - Inversión del sujeto pasivo interior (art. 84.Uno.2º)\n* `import` - Importación (DUA)\n* `not_subject` - No sujeta a IVA\n* `non_deductible` - IVA soportado no deducible"
          },
          "operation_type_display": {
            "type": "string",
            "readOnly": true
          },
          "is_investment_good": {
            "type": "boolean",
            "readOnly": true,
            "description": "Bien de inversión (casillas 30/31, 34/35 o 38/39 del 303)."
          },
          "operation_date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true,
            "description": "Fecha de la operación (entrega o servicio) si es distinta de la de la factura (date). Sale en el libro de facturas recibidas y decide el periodo de devengo del IVA autorrepercutido (inversión del sujeto pasivo: casillas 10-13 del 303 y modelo 349)."
          },
          "import_vat_deferred": {
            "type": "boolean",
            "readOnly": true,
            "description": "Sólo importaciones (operation_type=import): el IVA del DUA NO se paga en la aduana, se liquida en el 303 (IVA diferido, art. 167.Dos LIVA: casilla 77) y se deduce a la vez (casillas 32-35). Sin marcar, el IVA de importación se paga a la aduana / al transitario."
          },
          "recipient_name": {
            "type": "string",
            "readOnly": true,
            "description": "Destinatario que figura en el documento (lo extrae el escáner). Si no es la organización, el gasto recibe el aviso fiscal recipient_mismatch."
          },
          "recipient_vat_id": {
            "type": "string",
            "readOnly": true,
            "description": "NIF del destinatario que figura en el documento (lo extrae el escáner)."
          },
          "recipient_mismatch_accepted": {
            "type": "boolean",
            "readOnly": true,
            "description": "El usuario ha revisado el aviso recipient_mismatch y lo da por bueno (p. ej. el destinatario es el nombre comercial de la organización)."
          },
          "deduction_date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true,
            "description": "Fecha de deducción (periodo del 303): si la factura llegó tarde y el IVA se deduce en un periodo posterior (art. 99 LIVA). Vacía = el periodo de date. El libro de facturas recibidas usa siempre date."
          },
          "vat_deductible_percent": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Porcentaje del IVA soportado que se deduce (100 por defecto). Deducción parcial: p. ej. 50 en turismos y sus gastos (art. 95.Tres LIVA) o el porcentaje de afectación. La parte no deducible es mayor coste del gasto. Con 0 no se deduce nada (equivale a «IVA soportado no deducible»)."
          },
          "withholding_key": {
            "readOnly": true,
            "title": "Clave de la retención (modelos 111 y 190)",
            "description": "Clave y subclave del modelo 190 de la retención de esta factura. Vacía = automática (profesionales G.01, o G.03 si la retención es del 7 %; retenciones especiales K.01).\n\n* `` - Automática\n* `F01` - F.01 — Premios literarios, artísticos o científicos (trabajo)\n* `F02` - F.02 — Cursos, conferencias, coloquios y similares (trabajo)\n* `F03` - F.03 — Elaboración de obras literarias, artísticas o científicas, tipo general\n* `F04` - F.04 — Elaboración de obras literarias, artísticas o científicas, tipo reducido\n* `F05` - F.05 — Propiedad intelectual (trabajo), tipo general\n* `F06` - F.06 — Propiedad intelectual (trabajo), tipo reducido\n* `G01` - G.01 — Actividades profesionales, tipo general\n* `G02` - G.02 — Recaudadores municipales, mediadores de seguros y delegados comerciales\n* `G03` - G.03 — Actividades profesionales, tipo reducido de inicio de actividad (7 %)\n* `G04` - G.04 — Actividades profesionales, tipo del art. 95.1.d) RIRPF\n* `G05` - G.05 — Propiedad intelectual (actividad), tipo general\n* `G06` - G.06 — Propiedad intelectual (actividad), tipo reducido\n* `G07` - G.07 — Anticipos a cuenta de derechos de autor\n* `G08` - G.08 — Cesión del derecho de imagen (actividad profesional)\n* `H01` - H.01 — Actividades agrícolas, ganaderas o forestales (tipo general)\n* `H02` - H.02 — Engorde de porcino y avicultura\n* `H03` - H.03 — Actividades forestales\n* `H04` - H.04 — Actividades en estimación objetiva (art. 95.6.2.º RIRPF)\n* `J` - J — Imputación de rentas por cesión de derechos de imagen (art. 92.8 LIRPF)\n* `K01` - K.01 — Premios de juegos sin fines publicitarios\n* `K02` - K.02 — Ganancias por aprovechamientos forestales de vecinos en montes públicos\n* `K03` - K.03 — Premios de concursos con fines publicitarios",
            "oneOf": [
              {
                "$ref": "#/components/schemas/WithholdingKeyEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "supply_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SupplyTypeEnum"
              }
            ],
            "readOnly": true,
            "description": "Bienes o servicios: decide la clave del 349 (A/I) y las casillas del 390 en las adquisiciones intracomunitarias.\n\n* `services` - Servicios\n* `goods` - Bienes"
          },
          "service_period_start": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true,
            "description": "Inicio del periodo de servicio cubierto (seguro anual, suscripción…). Con service_period_end; si el periodo cruza el cierre del ejercicio la contabilidad periodifica (480)."
          },
          "service_period_end": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true,
            "description": "Fin del periodo de servicio cubierto."
          },
          "payment_method": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Método de pago previsto; si tiene auto_mark_paid el gasto se marca pagado al confirmarlo."
          },
          "payment_method_display": {
            "type": "string",
            "readOnly": true
          },
          "duplicate_of": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Gasto del que este es un posible duplicado (se rellena al crear con ?force=true)."
          },
          "attachment": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "readOnly": true,
            "description": "Archivo escaneado del gasto (factura, ticket, etc.)"
          },
          "attachment_filename": {
            "type": "string",
            "nullable": true,
            "description": "Get display filename for the attachment.",
            "readOnly": true
          },
          "accounting_account": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "is_vat_book_document": {
            "type": "boolean",
            "readOnly": true,
            "description": "True si entra en el libro de facturas recibidas (invoice / simplified_invoice / supplier_credit_note)."
          },
          "fiscal_warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "readOnly": true,
            "description": "Códigos de aviso fiscal: foreign_supplier_domestic, missing_invoice_number, supplier_vat_unverified, vat_on_non_invoice, missing_exchange_rate, duplicate_kept…"
          },
          "warnings": {
            "type": "array",
            "items": {},
            "readOnly": true,
            "description": "Avisos con mensaje ({code, message}): los fiscales del gasto y accounting_disabled si la contabilidad no está activada."
          },
          "tax_breakdown": {
            "type": "object",
            "additionalProperties": {},
            "description": "Totales de IVA/retenciones y desglose por tipo; incluye other_taxes_total y cost_total.",
            "readOnly": true
          },
          "total_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Importe a pagar al proveedor (EUR): base + IVA + otros tributos − retenciones."
          },
          "paid_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Suma de los pagos registrados (EUR)."
          },
          "remaining_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "total_amount − paid_amount."
          },
          "other_taxes_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Suma de los otros tributos (IPS, hidrocarburos, aranceles, tasas)."
          },
          "cost_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Coste contable: base + IVA no deducible + otros tributos."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "accounting_account",
          "attachment",
          "attachment_filename",
          "category",
          "category_color",
          "category_display",
          "cost_total",
          "created_at",
          "currency",
          "date",
          "deduction_date",
          "document_type",
          "document_type_display",
          "due_date",
          "duplicate_of",
          "exchange_rate",
          "exchange_rate_source",
          "fiscal_warnings",
          "id",
          "import_vat_deferred",
          "is_investment_good",
          "is_vat_book_document",
          "numero_factura",
          "operation_date",
          "operation_type",
          "operation_type_display",
          "original_amount",
          "original_total",
          "other_taxes_total",
          "paid_amount",
          "payment_method",
          "payment_method_display",
          "recipient_mismatch_accepted",
          "recipient_name",
          "recipient_vat_id",
          "remaining_amount",
          "service_period_end",
          "service_period_start",
          "status",
          "supplier",
          "supplier_cif",
          "supplier_display",
          "supplier_fiscal_address",
          "supply_type",
          "tax_breakdown",
          "total_amount",
          "updated_at",
          "vat_deductible_percent",
          "warnings",
          "withholding_key"
        ]
      },
      "ExpenseOperationTypeEnum": {
        "enum": [
          "domestic",
          "intra_eu",
          "foreign_services",
          "domestic_reverse_charge",
          "import",
          "not_subject",
          "non_deductible"
        ],
        "type": "string",
        "description": "* `domestic` - Operación interior\n* `intra_eu` - Adquisición intracomunitaria de bienes o servicios (UE)\n* `foreign_services` - Servicios de empresario no establecido en la UE (ISP)\n* `domestic_reverse_charge` - Inversión del sujeto pasivo interior (art. 84.Uno.2º)\n* `import` - Importación (DUA)\n* `not_subject` - No sujeta a IVA\n* `non_deductible` - IVA soportado no deducible"
      },
      "ExpenseOtherTax": {
        "type": "object",
        "description": "Otro tributo del gasto (IPS, hidrocarburos, aranceles, tasas…): es coste, no IVA.\nIndica ``amount`` o bien ``base`` + ``rate`` (se calcula el importe).",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "kind": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpenseOtherTaxKindEnum"
              }
            ],
            "description": "ips (impuesto sobre primas de seguros), ieh (hidrocarburos), duty (aranceles del DUA), fee (tasa), tax_other (otro impuesto no deducible; alias aceptado: other) o pass_through (suplido: importe pagado por el proveedor en nombre de la empresa, sin IVA ni retención).\n\n* `ips` - Impuesto sobre primas de seguros (IPS)\n* `ieh` - Impuesto especial sobre hidrocarburos\n* `tax_other` - Otro impuesto no deducible\n* `duty` - Aranceles / derechos de aduana (DUA)\n* `fee` - Tasa\n* `pass_through` - Suplido (pagado por el proveedor en nombre de la empresa)"
          },
          "label": {
            "type": "string",
            "description": "Descripción (p. ej. «IPS 8 %»).",
            "maxLength": 120
          },
          "base": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Base sobre la que se calcula (opcional)."
          },
          "rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Porcentaje (opcional; p. ej. 8 para el IPS)."
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          }
        },
        "required": [
          "id"
        ]
      },
      "ExpenseOtherTaxKindEnum": {
        "enum": [
          "ips",
          "ieh",
          "tax_other",
          "duty",
          "fee",
          "pass_through"
        ],
        "type": "string",
        "description": "* `ips` - Impuesto sobre primas de seguros (IPS)\n* `ieh` - Impuesto especial sobre hidrocarburos\n* `tax_other` - Otro impuesto no deducible\n* `duty` - Aranceles / derechos de aduana (DUA)\n* `fee` - Tasa\n* `pass_through` - Suplido (pagado por el proveedor en nombre de la empresa)"
      },
      "ExpenseOtherTaxRequest": {
        "type": "object",
        "description": "Otro tributo del gasto (IPS, hidrocarburos, aranceles, tasas…): es coste, no IVA.\nIndica ``amount`` o bien ``base`` + ``rate`` (se calcula el importe).",
        "properties": {
          "kind": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpenseOtherTaxKindEnum"
              }
            ],
            "description": "ips (impuesto sobre primas de seguros), ieh (hidrocarburos), duty (aranceles del DUA), fee (tasa), tax_other (otro impuesto no deducible; alias aceptado: other) o pass_through (suplido: importe pagado por el proveedor en nombre de la empresa, sin IVA ni retención).\n\n* `ips` - Impuesto sobre primas de seguros (IPS)\n* `ieh` - Impuesto especial sobre hidrocarburos\n* `tax_other` - Otro impuesto no deducible\n* `duty` - Aranceles / derechos de aduana (DUA)\n* `fee` - Tasa\n* `pass_through` - Suplido (pagado por el proveedor en nombre de la empresa)"
          },
          "label": {
            "type": "string",
            "description": "Descripción (p. ej. «IPS 8 %»).",
            "maxLength": 120
          },
          "base": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Base sobre la que se calcula (opcional)."
          },
          "rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Porcentaje (opcional; p. ej. 8 para el IPS)."
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          }
        }
      },
      "ExpensePayment": {
        "type": "object",
        "description": "Pago de un gasto (``kind=expense``) o anticipo a un proveedor (``kind=advance`` con\n``supplier`` y sin ``expense``; se aplica con ``POST /expense-payments/{id}/apply/``).\nPago que NO sale de la tesorería de la empresa («pagado con…»: lo paga la financiera con un\npréstamo, el socio de su bolsillo…): indica ``counter_account`` (id) o ``counter_account_code``\n(551 socio, 170 préstamo a largo plazo, 520 deuda a corto) y el asiento será Debe proveedor /\nHaber esa cuenta; no admite ``bank_account`` ni se concilia con el banco.\n``amount`` siempre se guarda en euros. Gasto en otra divisa: con ``currency`` = divisa del\ngasto, ``amount`` va en esa divisa y ``amount_eur`` (o ``exchange_rate``) fija lo cargado en\neuros; la diferencia con lo contabilizado va a 668/768. El «pago» de un abono de proveedor\nes el reembolso recibido.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "expense": {
            "type": "integer",
            "nullable": true
          },
          "expense_display": {
            "type": "string",
            "readOnly": true
          },
          "supplier": {
            "type": "integer",
            "nullable": true,
            "description": "Proveedor del anticipo (kind=advance, sin gasto)."
          },
          "kind": {
            "$ref": "#/components/schemas/ExpensePaymentKindEnum"
          },
          "applied_from": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Anticipo que se aplica (sólo kind=advance_application)."
          },
          "credit_note": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Abono de proveedor compensado con este gasto (kind=credit_note_application)."
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Importe en euros."
          },
          "amount_eur": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe cargado en euros cuando el pago se registró en la divisa del gasto (= amount)."
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,6})?$",
            "nullable": true,
            "description": "Euros por 1 unidad de la divisa del pago (sólo pagos en divisa)."
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "payment_method": {
            "type": "integer",
            "nullable": true
          },
          "payment_method_display": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta bancaria (tesorería) desde la que se pagó."
          },
          "bank_account_display": {
            "type": "string",
            "readOnly": true
          },
          "counter_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de contrapartida (id de la cuenta contable) cuando el cobro/pago NO pasa por tesorería: el asiento la usa en lugar de la 572 (pagos: Debe proveedor / Haber contrapartida; cobros: Debe contrapartida / Haber cliente). Grupos 1, 4 o 5 excepto 57x (p. ej. 551 socio, 170 préstamo a largo plazo, 520 deuda a corto). Incompatible con bank_account; estos cobros/pagos no se concilian con el banco ni cuentan en el flujo de caja. null para quitarla."
          },
          "counter_account_code": {
            "type": "string",
            "nullable": true,
            "description": "Código de la cuenta de contrapartida (alternativa a counter_account): 551, 170, 520… En lectura, el código de la cuenta enlazada.",
            "maxLength": 12
          },
          "counter_account_name": {
            "type": "string",
            "readOnly": true,
            "description": "Nombre de la cuenta de contrapartida."
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "notes": {
            "type": "string"
          },
          "remaining_advance": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "Sólo anticipos: importe aún no aplicado."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "amount",
          "applied_from",
          "bank_account_display",
          "counter_account_name",
          "created_at",
          "credit_note",
          "expense_display",
          "id",
          "payment_method_display",
          "remaining_advance",
          "updated_at"
        ]
      },
      "ExpensePaymentKindEnum": {
        "enum": [
          "expense",
          "advance",
          "advance_application",
          "credit_note_application"
        ],
        "type": "string",
        "description": "* `expense` - Pago de gasto\n* `advance` - Anticipo a proveedor\n* `advance_application` - Aplicación de anticipo\n* `credit_note_application` - Aplicación de abono de proveedor"
      },
      "ExpensePaymentMethod": {
        "type": "object",
        "description": "Medio de pago de gastos. Puede llevar su propia cuenta: ``bank_account`` (cuenta de\ntesorería de la que salen sus pagos, p. ej. «Tarjeta Revolut SL» → cuenta Revolut) o\n``counter_account`` / ``counter_account_code`` (el dinero NO sale de la empresa, p. ej.\n«Tarjeta personal del socio» → 551). Al registrar un pago con el método se aplica\nautomáticamente si el pago no indica otra cuenta.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "auto_mark_paid": {
            "type": "boolean",
            "description": "Al confirmar un gasto con este método se registra el pago completo y pasa a pagado (tarjeta, domiciliación, PayPal, Stripe…). Desactivado para transferencias pendientes o efectivo."
          },
          "settles_on": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpensePaymentSettlesOnEnum"
              }
            ],
            "description": "Fecha del pago automático: la de la factura, la de vencimiento o manual (no se marca pagado).\n\n* `invoice_date` - Fecha de la factura\n* `due_date` - Fecha de vencimiento\n* `manual` - Manual (no se marca pagado)"
          },
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta bancaria (tesorería) de la que salen los pagos hechos con este medio (p. ej. «Tarjeta Revolut SL» → cuenta Revolut): se aplica como bank_account del pago si no se indica otra."
          },
          "bank_account_display": {
            "type": "string",
            "readOnly": true
          },
          "counter_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de contrapartida (id) de los pagos con este medio cuando NO salen de tesorería (grupos 1, 4 o 5 salvo 57x; p. ej. 551 socio). Incompatible con bank_account."
          },
          "counter_account_code": {
            "type": "string",
            "nullable": true,
            "description": "Código de la cuenta de contrapartida (alternativa a counter_account): 551, 170, 520… En lectura, el código de la cuenta enlazada.",
            "maxLength": 12
          },
          "counter_account_name": {
            "type": "string",
            "readOnly": true
          },
          "settlement": {
            "type": "string",
            "readOnly": true,
            "description": "Cómo se contabilizan sus pagos: bank_account (cuenta de tesorería enlazada), counter_account (no pasa por tesorería) o default (572/570 por defecto)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "bank_account_display",
          "counter_account_name",
          "created_at",
          "id",
          "name",
          "settlement",
          "updated_at"
        ]
      },
      "ExpensePaymentMethodRequest": {
        "type": "object",
        "description": "Medio de pago de gastos. Puede llevar su propia cuenta: ``bank_account`` (cuenta de\ntesorería de la que salen sus pagos, p. ej. «Tarjeta Revolut SL» → cuenta Revolut) o\n``counter_account`` / ``counter_account_code`` (el dinero NO sale de la empresa, p. ej.\n«Tarjeta personal del socio» → 551). Al registrar un pago con el método se aplica\nautomáticamente si el pago no indica otra cuenta.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "auto_mark_paid": {
            "type": "boolean",
            "description": "Al confirmar un gasto con este método se registra el pago completo y pasa a pagado (tarjeta, domiciliación, PayPal, Stripe…). Desactivado para transferencias pendientes o efectivo."
          },
          "settles_on": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpensePaymentSettlesOnEnum"
              }
            ],
            "description": "Fecha del pago automático: la de la factura, la de vencimiento o manual (no se marca pagado).\n\n* `invoice_date` - Fecha de la factura\n* `due_date` - Fecha de vencimiento\n* `manual` - Manual (no se marca pagado)"
          },
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta bancaria (tesorería) de la que salen los pagos hechos con este medio (p. ej. «Tarjeta Revolut SL» → cuenta Revolut): se aplica como bank_account del pago si no se indica otra."
          },
          "counter_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de contrapartida (id) de los pagos con este medio cuando NO salen de tesorería (grupos 1, 4 o 5 salvo 57x; p. ej. 551 socio). Incompatible con bank_account."
          },
          "counter_account_code": {
            "type": "string",
            "nullable": true,
            "description": "Código de la cuenta de contrapartida (alternativa a counter_account): 551, 170, 520… En lectura, el código de la cuenta enlazada.",
            "maxLength": 12
          }
        },
        "required": [
          "name"
        ]
      },
      "ExpensePaymentRequest": {
        "type": "object",
        "description": "Pago de un gasto (``kind=expense``) o anticipo a un proveedor (``kind=advance`` con\n``supplier`` y sin ``expense``; se aplica con ``POST /expense-payments/{id}/apply/``).\nPago que NO sale de la tesorería de la empresa («pagado con…»: lo paga la financiera con un\npréstamo, el socio de su bolsillo…): indica ``counter_account`` (id) o ``counter_account_code``\n(551 socio, 170 préstamo a largo plazo, 520 deuda a corto) y el asiento será Debe proveedor /\nHaber esa cuenta; no admite ``bank_account`` ni se concilia con el banco.\n``amount`` siempre se guarda en euros. Gasto en otra divisa: con ``currency`` = divisa del\ngasto, ``amount`` va en esa divisa y ``amount_eur`` (o ``exchange_rate``) fija lo cargado en\neuros; la diferencia con lo contabilizado va a 668/768. El «pago» de un abono de proveedor\nes el reembolso recibido.",
        "properties": {
          "expense": {
            "type": "integer",
            "nullable": true
          },
          "supplier": {
            "type": "integer",
            "nullable": true,
            "description": "Proveedor del anticipo (kind=advance, sin gasto)."
          },
          "kind": {
            "$ref": "#/components/schemas/ExpensePaymentKindEnum"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Importe en euros."
          },
          "amount_eur": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe cargado en euros cuando el pago se registró en la divisa del gasto (= amount)."
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,6})?$",
            "nullable": true,
            "description": "Euros por 1 unidad de la divisa del pago (sólo pagos en divisa)."
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "payment_method": {
            "type": "integer",
            "nullable": true
          },
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta bancaria (tesorería) desde la que se pagó."
          },
          "counter_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de contrapartida (id de la cuenta contable) cuando el cobro/pago NO pasa por tesorería: el asiento la usa en lugar de la 572 (pagos: Debe proveedor / Haber contrapartida; cobros: Debe contrapartida / Haber cliente). Grupos 1, 4 o 5 excepto 57x (p. ej. 551 socio, 170 préstamo a largo plazo, 520 deuda a corto). Incompatible con bank_account; estos cobros/pagos no se concilian con el banco ni cuentan en el flujo de caja. null para quitarla."
          },
          "counter_account_code": {
            "type": "string",
            "nullable": true,
            "description": "Código de la cuenta de contrapartida (alternativa a counter_account): 551, 170, 520… En lectura, el código de la cuenta enlazada.",
            "maxLength": 12
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "amount"
        ]
      },
      "ExpensePaymentSettlesOnEnum": {
        "enum": [
          "invoice_date",
          "due_date",
          "manual"
        ],
        "type": "string",
        "description": "* `invoice_date` - Fecha de la factura\n* `due_date` - Fecha de vencimiento\n* `manual` - Manual (no se marca pagado)"
      },
      "ExpenseRequest": {
        "type": "object",
        "description": "Gasto (factura recibida u otro justificante) con su desglose de IVA.\n\nDivisa: ``amount`` se envía en la divisa de ``currency`` y se guarda en euros;\n``exchange_rate`` = EUR por 1 unidad de divisa (BCE automático si falta).",
        "properties": {
          "supplier": {
            "type": "integer",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Vencimiento del pago (opcional)."
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Base imponible. Si currency ≠ EUR es el importe EN LA DIVISA indicada: Billora lo convierte y guarda en euros (amount en las respuestas siempre está en EUR; original_amount conserva el importe en divisa). exchange_rate = euros por 1 unidad de divisa; si no se indica se usa el cambio del BCE del día (exchange_rate_source = ecb). Alternativamente envía amount_eur (el cargo real en euros) y el cambio se deduce."
          },
          "amount_eur": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "writeOnly": true,
            "description": "Sólo con currency ≠ EUR: base realmente cargada en euros (extracto bancario). Se guarda como amount y exchange_rate se deduce (exchange_rate_source = bank_charge)."
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,6})?$",
            "nullable": true,
            "description": "Euros por 1 unidad de la divisa (sólo si currency ≠ EUR). Vacío = cambio del BCE del día."
          },
          "numero_factura": {
            "type": "string",
            "description": "Número de factura del proveedor",
            "maxLength": 50
          },
          "document_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpenseDocumentTypeEnum"
              }
            ],
            "description": "Documento que justifica el gasto. Sólo «invoice», «simplified_invoice» y «supplier_credit_note» (abono de proveedor: importes en positivo que restan) entran en los libros de IVA, el 303, el 349 y el 347; el resto no deduce IVA (coste íntegro: 629/625/626/631, 678 sanciones, 669 intereses, 555 suplidos).\n\n* `invoice` - Factura recibida\n* `simplified_invoice` - Factura simplificada / ticket\n* `receipt` - Recibo o justificante (sin factura)\n* `settlement` - Liquidación (kilometraje, dietas, hoja de gastos)\n* `insurance_receipt` - Recibo de seguro\n* `bank_fee` - Comisión bancaria o de pasarela de pago\n* `tax_or_fee` - Tributo o tasa\n* `penalty` - Sanción o recargo (gasto excepcional)\n* `financial_interest` - Intereses de demora o financieros\n* `pass_through` - Suplido (pagado por cuenta del cliente)\n* `supplier_credit_note` - Abono / rectificativa de proveedor\n* `other` - Otro documento (no factura)"
          },
          "category": {
            "type": "integer",
            "nullable": true
          },
          "tax_templates": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Impuestos aplicables (IVA, retenciones, etc.) - LEGACY"
          },
          "spanish_taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Impuestos españoles aplicables"
          },
          "tax_lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseTaxLineRequest"
            }
          },
          "other_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseOtherTaxRequest"
            },
            "description": "Otros tributos no deducibles que son coste (IPS 8 % de los seguros, hidrocarburos, aranceles/DUA, tasas). Se suman al total a pagar."
          },
          "expected_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "writeOnly": true,
            "description": "Total de la factura (en la divisa del gasto) para comprobar el cuadre: si no coincide con el total calculado (±0,01) la petición falla con 400."
          },
          "status": {
            "$ref": "#/components/schemas/ExpenseStatusEnum"
          },
          "operation_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpenseOperationTypeEnum"
              }
            ],
            "description": "Tipo de operación a efectos de IVA (interior, intracomunitaria, ISP, importación...).\n\n* `domestic` - Operación interior\n* `intra_eu` - Adquisición intracomunitaria de bienes o servicios (UE)\n* `foreign_services` - Servicios de empresario no establecido en la UE (ISP)\n* `domestic_reverse_charge` - Inversión del sujeto pasivo interior (art. 84.Uno.2º)\n* `import` - Importación (DUA)\n* `not_subject` - No sujeta a IVA\n* `non_deductible` - IVA soportado no deducible"
          },
          "is_investment_good": {
            "type": "boolean",
            "description": "Bien de inversión (casillas 30/31, 34/35 o 38/39 del 303)."
          },
          "import_vat_deferred": {
            "type": "boolean",
            "description": "Sólo importaciones (operation_type=import): el IVA del DUA NO se paga en la aduana, se liquida en el 303 (IVA diferido, art. 167.Dos LIVA: casilla 77) y se deduce a la vez (casillas 32-35). Sin marcar, el IVA de importación se paga a la aduana / al transitario."
          },
          "operation_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de la operación (entrega o servicio) si es distinta de la de la factura (date). Sale en el libro de facturas recibidas y decide el periodo de devengo del IVA autorrepercutido (inversión del sujeto pasivo: casillas 10-13 del 303 y modelo 349)."
          },
          "deduction_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de deducción (periodo del 303): si la factura llegó tarde y el IVA se deduce en un periodo posterior (art. 99 LIVA). Vacía = el periodo de date. El libro de facturas recibidas usa siempre date."
          },
          "confirm_period_change": {
            "type": "boolean",
            "writeOnly": true,
            "default": false,
            "description": "Sólo al modificar un gasto ya contabilizado: true confirma que el cambio de date / deduction_date lo mueve a otro trimestre de IVA o de retenciones (si no, 409 period_change_requires_confirmation). Queda registrado en la auditoría."
          },
          "vat_deductible_percent": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$",
            "description": "Porcentaje del IVA soportado que se deduce (100 por defecto). Deducción parcial: p. ej. 50 en turismos y sus gastos (art. 95.Tres LIVA) o el porcentaje de afectación. La parte no deducible es mayor coste del gasto. Con 0 no se deduce nada (equivale a «IVA soportado no deducible»)."
          },
          "withholding_key": {
            "title": "Clave de la retención (modelos 111 y 190)",
            "description": "Clave y subclave del modelo 190 de la retención de esta factura. Vacía = automática (profesionales G.01, o G.03 si la retención es del 7 %; retenciones especiales K.01).\n\n* `` - Automática\n* `F01` - F.01 — Premios literarios, artísticos o científicos (trabajo)\n* `F02` - F.02 — Cursos, conferencias, coloquios y similares (trabajo)\n* `F03` - F.03 — Elaboración de obras literarias, artísticas o científicas, tipo general\n* `F04` - F.04 — Elaboración de obras literarias, artísticas o científicas, tipo reducido\n* `F05` - F.05 — Propiedad intelectual (trabajo), tipo general\n* `F06` - F.06 — Propiedad intelectual (trabajo), tipo reducido\n* `G01` - G.01 — Actividades profesionales, tipo general\n* `G02` - G.02 — Recaudadores municipales, mediadores de seguros y delegados comerciales\n* `G03` - G.03 — Actividades profesionales, tipo reducido de inicio de actividad (7 %)\n* `G04` - G.04 — Actividades profesionales, tipo del art. 95.1.d) RIRPF\n* `G05` - G.05 — Propiedad intelectual (actividad), tipo general\n* `G06` - G.06 — Propiedad intelectual (actividad), tipo reducido\n* `G07` - G.07 — Anticipos a cuenta de derechos de autor\n* `G08` - G.08 — Cesión del derecho de imagen (actividad profesional)\n* `H01` - H.01 — Actividades agrícolas, ganaderas o forestales (tipo general)\n* `H02` - H.02 — Engorde de porcino y avicultura\n* `H03` - H.03 — Actividades forestales\n* `H04` - H.04 — Actividades en estimación objetiva (art. 95.6.2.º RIRPF)\n* `J` - J — Imputación de rentas por cesión de derechos de imagen (art. 92.8 LIRPF)\n* `K01` - K.01 — Premios de juegos sin fines publicitarios\n* `K02` - K.02 — Ganancias por aprovechamientos forestales de vecinos en montes públicos\n* `K03` - K.03 — Premios de concursos con fines publicitarios",
            "oneOf": [
              {
                "$ref": "#/components/schemas/WithholdingKeyEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "supply_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SupplyTypeEnum"
              }
            ],
            "description": "Bienes o servicios: decide la clave del 349 (A/I) y las casillas del 390 en las adquisiciones intracomunitarias.\n\n* `services` - Servicios\n* `goods` - Bienes"
          },
          "service_period_start": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Inicio del periodo de servicio cubierto (seguro anual, suscripción…). Con service_period_end; si el periodo cruza el cierre del ejercicio la contabilidad periodifica (480)."
          },
          "service_period_end": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fin del periodo de servicio cubierto."
          },
          "recipient_name": {
            "type": "string",
            "description": "Destinatario que figura en el documento (lo extrae el escáner). Si no es la organización, el gasto recibe el aviso fiscal recipient_mismatch.",
            "maxLength": 200
          },
          "recipient_vat_id": {
            "type": "string",
            "description": "NIF del destinatario que figura en el documento (lo extrae el escáner).",
            "maxLength": 20
          },
          "recipient_mismatch_accepted": {
            "type": "boolean",
            "description": "El usuario ha revisado el aviso recipient_mismatch y lo da por bueno (p. ej. el destinatario es el nombre comercial de la organización)."
          },
          "payment_method": {
            "type": "integer",
            "nullable": true,
            "description": "Método de pago previsto; si tiene auto_mark_paid el gasto se marca pagado al confirmarlo."
          },
          "duplicate_of": {
            "type": "integer",
            "nullable": true,
            "description": "Gasto del que este es un posible duplicado (se rellena al crear con ?force=true)."
          },
          "rectifies": {
            "type": "integer",
            "nullable": true,
            "description": "Sólo abonos de proveedor (document_type=supplier_credit_note): factura recibida que rectifica. Si es de un periodo anterior, el 303 lo declara en las casillas 40/41."
          },
          "attachment": {
            "type": "string",
            "format": "binary",
            "nullable": true,
            "description": "Archivo escaneado del gasto (factura, ticket, etc.)"
          },
          "notes": {
            "type": "string"
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          }
        }
      },
      "ExpenseStats": {
        "type": "object",
        "properties": {
          "total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "last_30_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "last_7_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "count_30_days": {
            "type": "integer"
          },
          "period_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          }
        },
        "required": [
          "count_30_days",
          "last_30_days",
          "last_7_days",
          "period_value",
          "total"
        ]
      },
      "ExpenseStatusChangeRequestRequest": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "status"
        ]
      },
      "ExpenseStatusEnum": {
        "enum": [
          "pending",
          "confirmed",
          "paid",
          "partially_paid",
          "cancelled"
        ],
        "type": "string",
        "description": "* `pending` - Pendiente\n* `confirmed` - Confirmado\n* `paid` - Pagado\n* `partially_paid` - Parcialmente pagado\n* `cancelled` - Anulado"
      },
      "ExpenseTaxLine": {
        "type": "object",
        "description": "Una base imponible del gasto con su(s) impuesto(s) (p. ej. base al 10 %).",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "description": {
            "type": "string",
            "maxLength": 200
          },
          "base": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        },
        "required": [
          "base",
          "id"
        ]
      },
      "ExpenseTaxLineRequest": {
        "type": "object",
        "description": "Una base imponible del gasto con su(s) impuesto(s) (p. ej. base al 10 %).",
        "properties": {
          "description": {
            "type": "string",
            "maxLength": 200
          },
          "base": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        },
        "required": [
          "base"
        ]
      },
      "ExpenseTrendItem": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "expenses": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "count": {
            "type": "integer"
          }
        },
        "required": [
          "count",
          "date",
          "expenses"
        ]
      },
      "ExternalInvoice": {
        "type": "object",
        "description": "Registro de una factura de ingreso emitida por el cliente o un tercero.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/InvoiceStatusEnum"
              }
            ],
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "tax_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "withholding_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "surcharge_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "series": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "sequence_number": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "number": {
            "type": "string",
            "maxLength": 64
          },
          "metadata": {},
          "pdf_url": {
            "type": "string",
            "format": "uri",
            "readOnly": true,
            "description": "URL del PDF definitivo (solo facturas emitidas)"
          },
          "draft_pdf_url": {
            "type": "string",
            "format": "uri",
            "readOnly": true,
            "description": "URL del PDF borrador (con marca de agua)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "invoice_type": {
            "type": "string",
            "readOnly": true,
            "description": "Tipo de factura (clave VeriFactu): F1 completa (también la simplificada cualificada, con NIF del destinatario), F2 simplificada, F3 emitida en sustitución de una simplificada (canje), R1–R4 rectificativa de factura completa según el motivo y R5 rectificativa de simplificada."
          },
          "substitutes": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Factura simplificada a la que sustituye esta factura completa (canje, F3 en VeriFactu)."
          },
          "substituted_by": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true,
            "readOnly": true,
            "description": "Factura completa (F3) que sustituyó a esta simplificada en un canje: `{id, number}` o null. La simplificada figura entonces como anulada (`status = cancelled`) sin anulación en VeriFactu."
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "is_rectifying": {
            "type": "boolean"
          },
          "rectifies": {
            "type": "integer",
            "nullable": true
          },
          "is_simplified": {
            "type": "boolean",
            "readOnly": true,
            "description": "Factura simplificada (F2 VeriFactu). Marcar para tickets y facturas sin NIF del destinatario."
          },
          "verifactu_status": {
            "type": "string",
            "readOnly": true
          },
          "verifactu_qr_url": {
            "type": "string",
            "format": "uri",
            "readOnly": true,
            "nullable": true,
            "description": "URL de verificación de VeriFactu que apunta a la página de Hacienda"
          },
          "has_verifactu_qr": {
            "type": "boolean",
            "readOnly": true,
            "default": false
          },
          "verifactu_mode": {
            "readOnly": true,
            "nullable": true,
            "description": "Modo VeriFactu que estaba configurado cuando se emitió esta factura\n\n* `VERI` - VeriFactu Activado\n* `NO_VERI` - VeriFactu Desactivado\n* `None` - No definido",
            "oneOf": [
              {
                "$ref": "#/components/schemas/VerifactuModeEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "issuer_type": {
            "$ref": "#/components/schemas/ExternalIssuerTypeEnum"
          },
          "external_issuer_name": {
            "type": "string",
            "maxLength": 200
          },
          "operation_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de la operación (entrega o servicio) si es distinta de la de expedición. Aparece en la factura y en el registro VeriFactu (FechaOperacion)."
          },
          "prices_include_tax": {
            "type": "boolean",
            "description": "Los precios de las líneas incluyen el IVA (venta a consumidores): la base se obtiene del precio final para que el total cuadre al céntimo."
          },
          "external_reference": {
            "type": "string",
            "description": "Referencia externa (p. ej. nº de pedido de Shopify) para no duplicar importaciones.",
            "maxLength": 100
          },
          "fixed_asset": {
            "type": "integer",
            "nullable": true,
            "description": "Venta de inmovilizado: ficha del bien vendido (obligatoria si accounting_account es 2xx). La contabilidad da de baja coste y amortización y lleva la diferencia a 671/771."
          },
          "is_imported": {
            "type": "boolean",
            "readOnly": true,
            "description": "Factura propia importada como emitida desde otro programa (su número no lo asignó una serie de Billora): admite ``correct-imported`` y un documento original adjunto (``original-document``)."
          },
          "has_original_document": {
            "type": "boolean",
            "readOnly": true,
            "description": "Tiene adjunto el documento original (``GET /invoices/{id}/original-document/``)."
          },
          "original_document_url": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "original_document_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          }
        },
        "required": [
          "balance",
          "created_at",
          "draft_pdf_url",
          "has_original_document",
          "has_verifactu_qr",
          "id",
          "invoice_type",
          "is_imported",
          "is_simplified",
          "issue_date",
          "issuer_type",
          "number",
          "original_document_name",
          "original_document_url",
          "pdf_url",
          "sequence_number",
          "series",
          "status",
          "substituted_by",
          "substitutes",
          "subtotal",
          "surcharge_total",
          "tax_total",
          "total",
          "updated_at",
          "verifactu_mode",
          "verifactu_qr_url",
          "verifactu_status",
          "withholding_total"
        ]
      },
      "ExternalInvoiceRequest": {
        "type": "object",
        "description": "Registro de una factura de ingreso emitida por el cliente o un tercero.",
        "properties": {
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "number": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLineRequest"
            },
            "writeOnly": true
          },
          "rectification_code": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RectificationCodeEnum"
              }
            ],
            "writeOnly": true,
            "description": "Sólo rectificativas de facturas completas: motivo de la rectificación (R1 por defecto). Las rectificativas de facturas simplificadas son siempre R5.\n\n* `R1` - R1 — Error fundado en derecho y art. 80 Uno, Dos y Seis LIVA\n* `R2` - R2 — Art. 80.Tres LIVA (concurso)\n* `R3` - R3 — Art. 80.Cuatro LIVA (incobrables)\n* `R4` - R4 — Resto de causas"
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "is_rectifying": {
            "type": "boolean"
          },
          "rectifies": {
            "type": "integer",
            "nullable": true
          },
          "issuer_type": {
            "$ref": "#/components/schemas/ExternalIssuerTypeEnum"
          },
          "external_issuer_name": {
            "type": "string",
            "maxLength": 200
          },
          "operation_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de la operación (entrega o servicio) si es distinta de la de expedición. Aparece en la factura y en el registro VeriFactu (FechaOperacion)."
          },
          "prices_include_tax": {
            "type": "boolean",
            "description": "Los precios de las líneas incluyen el IVA (venta a consumidores): la base se obtiene del precio final para que el total cuadre al céntimo."
          },
          "external_reference": {
            "type": "string",
            "description": "Referencia externa (p. ej. nº de pedido de Shopify) para no duplicar importaciones.",
            "maxLength": 100
          },
          "fixed_asset": {
            "type": "integer",
            "nullable": true,
            "description": "Venta de inmovilizado: ficha del bien vendido (obligatoria si accounting_account es 2xx). La contabilidad da de baja coste y amortización y lleva la diferencia a 671/771."
          },
          "original_document": {
            "type": "string",
            "format": "binary",
            "writeOnly": true,
            "nullable": true
          },
          "declared_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "writeOnly": true,
            "description": "Total que figura en el documento original: si no cuadra con las líneas, se rechaza."
          }
        },
        "required": [
          "issue_date",
          "issuer_type",
          "lines",
          "number"
        ]
      },
      "ExternalIssuerTypeEnum": {
        "enum": [
          "recipient",
          "third_party"
        ],
        "type": "string",
        "description": "* `recipient` - Autofacturación (emitida por el cliente/destinatario)\n* `third_party` - Emitida por un tercero en nombre de la organización"
      },
      "FamilySituationEnum": {
        "enum": [
          "1",
          "2",
          "3"
        ],
        "type": "string",
        "description": "* `1` - 1 — Monoparental con hijos a cargo\n* `2` - 2 — Casado/a con cónyuge sin rentas superiores a 1.500 €\n* `3` - 3 — Otras situaciones (o no comunicada)"
      },
      "Feature": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "key": {
            "type": "string",
            "maxLength": 50,
            "pattern": "^[-a-zA-Z0-9_]+$"
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "description": {
            "type": "string"
          },
          "unit": {
            "type": "string",
            "maxLength": 20
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "key",
          "name",
          "updated_at"
        ]
      },
      "FeatureUsage": {
        "type": "object",
        "properties": {
          "feature": {
            "type": "string"
          },
          "period": {
            "type": "string"
          },
          "limit": {
            "type": "integer"
          },
          "unlimited": {
            "type": "boolean"
          },
          "blocked": {
            "type": "boolean"
          },
          "available": {
            "type": "boolean"
          },
          "used": {
            "type": "integer"
          },
          "remaining": {
            "type": "integer",
            "nullable": true
          },
          "percentage": {
            "type": "number",
            "format": "double"
          },
          "is_hard_limit": {
            "type": "boolean"
          }
        },
        "required": [
          "available",
          "blocked",
          "feature",
          "is_hard_limit",
          "limit",
          "percentage",
          "period",
          "remaining",
          "unlimited",
          "used"
        ]
      },
      "FileCheck": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean",
            "description": "El fichero se ha generado y supera la validación del diseño."
          },
          "filename": {
            "type": "string",
            "nullable": true
          },
          "size": {
            "type": "integer",
            "nullable": true
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Datos que faltan para generar el fichero (NIF del perceptor, referencia catastral, IBAN…)."
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Errores de validación del diseño."
          },
          "layout": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true,
            "description": "Diseño de registro oficial usado (modelo, ejercicio, fuente)."
          },
          "records": {
            "type": "integer",
            "nullable": true,
            "description": "Informativas: número de registros."
          }
        },
        "required": [
          "errors",
          "filename",
          "layout",
          "missing",
          "records",
          "size",
          "valid"
        ]
      },
      "FiscalYear": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "description": "Ej. '2026'",
            "maxLength": 30
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date"
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FiscalYearStatusEnum"
              }
            ],
            "readOnly": true
          },
          "closed_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "closed_by": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "reopened_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "result_applied_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true,
            "description": "Cuándo se aplicó el resultado (129 → 120/121/11x)."
          },
          "entries_count": {
            "type": "integer",
            "readOnly": true
          },
          "draft_entries_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "closed_at",
          "closed_by",
          "created_at",
          "draft_entries_count",
          "end_date",
          "entries_count",
          "id",
          "name",
          "reopened_at",
          "result_applied_at",
          "start_date",
          "status",
          "updated_at"
        ]
      },
      "FiscalYearRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "Ej. '2026'",
            "maxLength": 30
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date"
          }
        },
        "required": [
          "end_date",
          "name",
          "start_date"
        ]
      },
      "FiscalYearStatusEnum": {
        "enum": [
          "open",
          "closed"
        ],
        "type": "string",
        "description": "* `open` - Abierto\n* `closed` - Cerrado"
      },
      "FixedAsset": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "expense": {
            "type": "integer",
            "nullable": true,
            "description": "Gasto (bien de inversión) del que procede."
          },
          "expense_number": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "description": {
            "type": "string"
          },
          "account": {
            "type": "integer",
            "description": "Cuenta de inmovilizado (20x/21x/22x)."
          },
          "account_code": {
            "type": "string",
            "readOnly": true
          },
          "depreciation_account": {
            "type": "integer",
            "description": "Cuenta de amortización acumulada (280/281/282)."
          },
          "expense_account": {
            "type": "integer",
            "description": "Cuenta de dotación (680/681/682)."
          },
          "cost": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "residual_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "description": "Puesta en funcionamiento (inicio de la amortización)."
          },
          "useful_life_months": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "method": {
            "$ref": "#/components/schemas/FixedAssetMethodEnum"
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FixedAssetStatusEnum"
              }
            ],
            "readOnly": true
          },
          "accumulated_depreciation": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "depreciated_until": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true,
            "description": "Último día ya amortizado (fin de mes)."
          },
          "net_book_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "monthly_depreciation": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "disposal_date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true
          },
          "disposal_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true,
            "description": "Importe obtenido en la venta/baja (0 si se desecha)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "account",
          "account_code",
          "accumulated_depreciation",
          "cost",
          "created_at",
          "depreciated_until",
          "disposal_amount",
          "disposal_date",
          "expense_number",
          "id",
          "monthly_depreciation",
          "name",
          "net_book_value",
          "start_date",
          "status",
          "updated_at"
        ]
      },
      "FixedAssetMethodEnum": {
        "enum": [
          "linear"
        ],
        "type": "string",
        "description": "* `linear` - Lineal"
      },
      "FixedAssetRequest": {
        "type": "object",
        "properties": {
          "expense": {
            "type": "integer",
            "nullable": true,
            "description": "Gasto (bien de inversión) del que procede."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string"
          },
          "account": {
            "type": "integer",
            "description": "Cuenta de inmovilizado (20x/21x/22x)."
          },
          "depreciation_account": {
            "type": "integer",
            "description": "Cuenta de amortización acumulada (280/281/282)."
          },
          "expense_account": {
            "type": "integer",
            "description": "Cuenta de dotación (680/681/682)."
          },
          "cost": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "residual_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "description": "Puesta en funcionamiento (inicio de la amortización)."
          },
          "useful_life_months": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "method": {
            "$ref": "#/components/schemas/FixedAssetMethodEnum"
          }
        },
        "required": [
          "account",
          "cost",
          "name",
          "start_date"
        ]
      },
      "FixedAssetStatusEnum": {
        "enum": [
          "active",
          "fully_depreciated",
          "disposed"
        ],
        "type": "string",
        "description": "* `active` - En uso\n* `fully_depreciated` - Totalmente amortizado\n* `disposed` - Dado de baja"
      },
      "GenerateConsentDocumentRequest": {
        "type": "object",
        "properties": {
          "template_id": {
            "type": "integer",
            "nullable": true,
            "description": "Plantilla de consentimientos; si no, la plantilla por defecto."
          },
          "output_format": {
            "allOf": [
              {
                "$ref": "#/components/schemas/OutputFormatEnum"
              }
            ],
            "default": "pdf"
          }
        }
      },
      "GenerateDocumentRequest": {
        "type": "object",
        "properties": {
          "template_id": {
            "type": "integer"
          },
          "output_format": {
            "allOf": [
              {
                "$ref": "#/components/schemas/OutputFormatEnum"
              }
            ],
            "default": "pdf"
          }
        },
        "required": [
          "template_id"
        ]
      },
      "GeneratePatientDocumentRequest": {
        "type": "object",
        "properties": {
          "template_id": {
            "type": "integer"
          },
          "output_format": {
            "allOf": [
              {
                "$ref": "#/components/schemas/OutputFormatEnum"
              }
            ],
            "default": "pdf"
          },
          "episode_id": {
            "type": "integer",
            "nullable": true,
            "description": "Episodio cuyos datos se incluyen (opcional)."
          }
        },
        "required": [
          "template_id"
        ]
      },
      "GroupEnum": {
        "enum": [
          "1",
          "2",
          "3",
          "4",
          "5",
          "6",
          "7",
          "8",
          "9"
        ],
        "type": "string",
        "description": "* `1` - 1\n* `2` - 2\n* `3` - 3\n* `4` - 4\n* `5` - 5\n* `6` - 6\n* `7` - 7\n* `8` - 8\n* `9` - 9"
      },
      "HRDashboard": {
        "type": "object",
        "properties": {
          "active_employees": {
            "type": "integer"
          },
          "on_leave_employees": {
            "type": "integer"
          },
          "pending_leave_requests": {
            "type": "integer"
          },
          "today_clock_ins": {
            "type": "integer"
          },
          "currently_working": {
            "type": "integer"
          }
        },
        "required": [
          "active_employees",
          "currently_working",
          "on_leave_employees",
          "pending_leave_requests",
          "today_clock_ins"
        ]
      },
      "HRSettings": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "tracking_method": {
            "$ref": "#/components/schemas/TrackingMethodEnum"
          },
          "tracking_method_display": {
            "type": "string",
            "readOnly": true
          },
          "require_geolocation": {
            "type": "boolean"
          },
          "geofence_radius_meters": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "Radio en metros para geofence"
          },
          "qr_auto_renew": {
            "type": "boolean"
          },
          "qr_renew_interval_hours": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648
          },
          "max_clock_in_hours": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "Máx. horas sin fichar salida antes de alerta"
          },
          "default_leave_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$",
            "description": "Días vacaciones por defecto al año"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "tracking_method_display",
          "updated_at"
        ]
      },
      "Holiday": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "holiday_type": {
            "$ref": "#/components/schemas/HolidayTypeEnum"
          },
          "holiday_type_display": {
            "type": "string",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "date",
          "holiday_type_display",
          "id",
          "name",
          "updated_at"
        ]
      },
      "HolidayRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "holiday_type": {
            "$ref": "#/components/schemas/HolidayTypeEnum"
          }
        },
        "required": [
          "date",
          "name"
        ]
      },
      "HolidayTypeEnum": {
        "enum": [
          "national",
          "regional",
          "local",
          "company"
        ],
        "type": "string",
        "description": "* `national` - Nacional\n* `regional` - Autonómico\n* `local` - Local\n* `company` - Empresa"
      },
      "ICD11Code": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "code": {
            "type": "string",
            "maxLength": 20
          },
          "title": {
            "type": "string",
            "maxLength": 500
          },
          "title_es": {
            "type": "string",
            "maxLength": 500
          },
          "parent_code": {
            "type": "string",
            "maxLength": 20
          },
          "chapter": {
            "type": "string",
            "maxLength": 10
          },
          "block_id": {
            "type": "string",
            "maxLength": 50
          },
          "definition": {
            "type": "string"
          },
          "is_leaf": {
            "type": "boolean"
          },
          "who_uri": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 300
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "browser_url": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 300
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          }
        },
        "required": [
          "code",
          "id",
          "title"
        ]
      },
      "IdDocumentTypeEnum": {
        "enum": [
          "dni",
          "nie",
          "passport",
          "other"
        ],
        "type": "string",
        "description": "* `dni` - DNI\n* `nie` - NIE\n* `passport` - Pasaporte\n* `other` - Otro"
      },
      "IgnoreRequestRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 2000
          },
          "remember": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "ImportJob": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "import_type": {
            "$ref": "#/components/schemas/ImportTypeEnum"
          },
          "import_type_display": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ImportJobStatusEnum"
              }
            ],
            "readOnly": true
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "original_filename": {
            "type": "string",
            "maxLength": 255
          },
          "total_rows": {
            "type": "integer",
            "readOnly": true
          },
          "processed_rows": {
            "type": "integer",
            "readOnly": true
          },
          "success_count": {
            "type": "integer",
            "readOnly": true
          },
          "error_count": {
            "type": "integer",
            "readOnly": true
          },
          "skipped_count": {
            "type": "integer",
            "readOnly": true
          },
          "validation_errors": {
            "readOnly": true
          },
          "preview_data": {
            "readOnly": true
          },
          "options": {
            "description": "Opciones de importación: update_existing, skip_duplicates, etc."
          },
          "progress": {
            "type": "integer",
            "readOnly": true
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "created_by_email": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          }
        },
        "required": [
          "completed_at",
          "created_at",
          "created_by_email",
          "error_count",
          "id",
          "import_type",
          "import_type_display",
          "original_filename",
          "preview_data",
          "processed_rows",
          "progress",
          "skipped_count",
          "started_at",
          "status",
          "status_display",
          "success_count",
          "total_rows",
          "validation_errors"
        ]
      },
      "ImportJobRequest": {
        "type": "object",
        "properties": {
          "import_type": {
            "$ref": "#/components/schemas/ImportTypeEnum"
          },
          "original_filename": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "options": {
            "description": "Opciones de importación: update_existing, skip_duplicates, etc."
          }
        },
        "required": [
          "import_type",
          "original_filename"
        ]
      },
      "ImportJobStatusEnum": {
        "enum": [
          "pending",
          "validating",
          "validated",
          "validation_error",
          "processing",
          "completed",
          "completed_with_errors",
          "failed"
        ],
        "type": "string",
        "description": "* `pending` - Pendiente\n* `validating` - Validando\n* `validated` - Validado\n* `validation_error` - Error de validación\n* `processing` - Procesando\n* `completed` - Completado\n* `completed_with_errors` - Completado con errores\n* `failed` - Fallido"
      },
      "ImportJobUploadRequest": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary"
          },
          "import_type": {
            "$ref": "#/components/schemas/ImportTypeEnum"
          },
          "update_existing": {
            "type": "boolean",
            "default": false
          },
          "skip_duplicates": {
            "type": "boolean",
            "default": true
          },
          "import_as_issued": {
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "file",
          "import_type"
        ]
      },
      "ImportProcessRequestRequest": {
        "type": "object",
        "properties": {
          "update_existing": {
            "type": "boolean",
            "description": "Actualizar registros existentes."
          },
          "skip_duplicates": {
            "type": "boolean",
            "description": "Omitir duplicados."
          },
          "import_as_issued": {
            "type": "boolean",
            "description": "Facturas: importarlas ya emitidas."
          }
        }
      },
      "ImportRow": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "row_number": {
            "type": "integer",
            "readOnly": true
          },
          "raw_data": {
            "readOnly": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ImportRowStatusEnum"
              }
            ],
            "readOnly": true
          },
          "error_message": {
            "type": "string",
            "readOnly": true
          },
          "created_object_id": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "created_object_type": {
            "type": "string",
            "readOnly": true
          }
        },
        "required": [
          "created_object_id",
          "created_object_type",
          "error_message",
          "id",
          "raw_data",
          "row_number",
          "status"
        ]
      },
      "ImportRowStatusEnum": {
        "enum": [
          "pending",
          "success",
          "error",
          "skipped"
        ],
        "type": "string",
        "description": "* `pending` - Pendiente\n* `success` - Éxito\n* `error` - Error\n* `skipped` - Omitido"
      },
      "ImportType": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            },
            "description": "`[{name, example, required}]`."
          }
        },
        "required": [
          "columns",
          "label",
          "value"
        ]
      },
      "ImportTypeEnum": {
        "enum": [
          "customers",
          "suppliers",
          "products",
          "invoices",
          "expenses",
          "contacts",
          "external_invoices"
        ],
        "type": "string",
        "description": "* `customers` - Clientes\n* `suppliers` - Proveedores\n* `products` - Productos\n* `invoices` - Facturas\n* `expenses` - Gastos\n* `contacts` - Personas de contacto\n* `external_invoices` - Facturas emitidas por clientes/terceros (autofacturación)"
      },
      "ImportedInvoiceCorrectionRequest": {
        "type": "object",
        "description": "Corrección de una factura importada «como emitida» (expedida fuera de Billora, sin\nVeriFactu). Sólo se cambian los campos enviados; hace falta al menos uno.",
        "properties": {
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLineRequest"
            },
            "description": "Líneas correctas (sustituyen a TODAS las actuales)."
          },
          "issue_date": {
            "type": "string",
            "format": "date",
            "description": "Fecha de expedición correcta (YYYY-MM-DD)."
          },
          "number": {
            "type": "string",
            "minLength": 1,
            "description": "Número correcto de la factura (el del documento original).",
            "maxLength": 50
          },
          "customer": {
            "type": "integer",
            "description": "Cliente correcto."
          },
          "adjust_payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportedInvoicePaymentAdjustmentRequest"
            },
            "description": "Cobros de la factura cuyo importe hay que ajustar al total corregido."
          },
          "reason": {
            "type": "string",
            "description": "Motivo de la corrección (queda en la traza).",
            "maxLength": 500
          }
        }
      },
      "ImportedInvoicePaymentAdjustmentRequest": {
        "type": "object",
        "properties": {
          "payment": {
            "type": "integer",
            "description": "Id de un cobro de esta factura."
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Importe correcto del cobro (0 = eliminar el cobro)."
          }
        },
        "required": [
          "amount",
          "payment"
        ]
      },
      "IncomeCategory": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "description": "Color hexadecimal para la categoría",
            "maxLength": 7
          },
          "is_active": {
            "type": "boolean"
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de ingresos (grupo 7) de las ventas de las facturas de esta categoría."
          },
          "accounting_account_code": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "Código de la cuenta de ingresos asociada; null si la categoría no tiene cuenta."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "accounting_account_code",
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "IncomeCategoryRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "description": "Color hexadecimal para la categoría",
            "maxLength": 7
          },
          "is_active": {
            "type": "boolean"
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de ingresos (grupo 7) de las ventas de las facturas de esta categoría."
          }
        },
        "required": [
          "name"
        ]
      },
      "InformedConsent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "template": {
            "type": "integer",
            "nullable": true
          },
          "template_name": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "practitioner_name": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "consent_type": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string"
          },
          "signed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signature_data": {
            "type": "string",
            "description": "Datos de firma (base64)"
          },
          "is_signed": {
            "type": "boolean"
          },
          "revoked_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signed_content": {
            "type": "string",
            "readOnly": true,
            "description": "Copia del texto del consentimiento en el momento de la firma"
          },
          "signed_template_version": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Versión de la plantilla en el momento de la firma"
          },
          "notes": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "practitioner_name",
          "signed_content",
          "signed_template_version",
          "template_name",
          "updated_at"
        ]
      },
      "InformedConsentRequest": {
        "type": "object",
        "properties": {
          "template": {
            "type": "integer",
            "nullable": true
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "consent_type": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string"
          },
          "signed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signature_data": {
            "type": "string",
            "description": "Datos de firma (base64)"
          },
          "is_signed": {
            "type": "boolean"
          },
          "revoked_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "IntervalEnum": {
        "enum": [
          "days",
          "weeks",
          "months"
        ],
        "type": "string",
        "description": "* `days` - Días\n* `weeks` - Semanas\n* `months` - Meses"
      },
      "Invoice": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/InvoiceStatusEnum"
              }
            ],
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "tax_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "withholding_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "surcharge_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "sequence_number": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "number": {
            "type": "string",
            "readOnly": true,
            "nullable": true
          },
          "metadata": {},
          "pdf_url": {
            "type": "string",
            "format": "uri",
            "readOnly": true,
            "description": "URL del PDF definitivo (solo facturas emitidas)"
          },
          "draft_pdf_url": {
            "type": "string",
            "format": "uri",
            "readOnly": true,
            "description": "URL del PDF borrador (con marca de agua)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "invoice_type": {
            "type": "string",
            "readOnly": true,
            "description": "Tipo de factura (clave VeriFactu): F1 completa (también la simplificada cualificada, con NIF del destinatario), F2 simplificada, F3 emitida en sustitución de una simplificada (canje), R1–R4 rectificativa de factura completa según el motivo y R5 rectificativa de simplificada."
          },
          "substitutes": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Factura simplificada a la que sustituye esta factura completa (canje, F3 en VeriFactu)."
          },
          "substituted_by": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true,
            "readOnly": true,
            "description": "Factura completa (F3) que sustituyó a esta simplificada en un canje: `{id, number}` o null. La simplificada figura entonces como anulada (`status = cancelled`) sin anulación en VeriFactu."
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "is_rectifying": {
            "type": "boolean"
          },
          "rectifies": {
            "type": "integer",
            "nullable": true
          },
          "is_simplified": {
            "type": "boolean",
            "description": "Factura simplificada (F2 VeriFactu). Marcar para tickets y facturas sin NIF del destinatario."
          },
          "verifactu_status": {
            "type": "string",
            "readOnly": true
          },
          "verifactu_qr_url": {
            "type": "string",
            "format": "uri",
            "readOnly": true,
            "nullable": true,
            "description": "URL de verificación de VeriFactu que apunta a la página de Hacienda"
          },
          "has_verifactu_qr": {
            "type": "boolean",
            "readOnly": true,
            "default": false
          },
          "verifactu_mode": {
            "readOnly": true,
            "nullable": true,
            "description": "Modo VeriFactu que estaba configurado cuando se emitió esta factura\n\n* `VERI` - VeriFactu Activado\n* `NO_VERI` - VeriFactu Desactivado\n* `None` - No definido",
            "oneOf": [
              {
                "$ref": "#/components/schemas/VerifactuModeEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "issuer_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/InvoiceIssuerTypeEnum"
              }
            ],
            "readOnly": true
          },
          "external_issuer_name": {
            "type": "string",
            "readOnly": true,
            "description": "Quién expidió materialmente la factura si es un tercero distinto del cliente."
          },
          "operation_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de la operación (entrega o servicio) si es distinta de la de expedición. Aparece en la factura y en el registro VeriFactu (FechaOperacion)."
          },
          "prices_include_tax": {
            "type": "boolean",
            "description": "Los precios de las líneas incluyen el IVA (venta a consumidores): la base se obtiene del precio final para que el total cuadre al céntimo."
          },
          "external_reference": {
            "type": "string",
            "description": "Referencia externa (p. ej. nº de pedido de Shopify) para no duplicar importaciones.",
            "maxLength": 100
          },
          "fixed_asset": {
            "type": "integer",
            "nullable": true,
            "description": "Venta de inmovilizado: ficha del bien vendido (obligatoria si accounting_account es 2xx). La contabilidad da de baja coste y amortización y lleva la diferencia a 671/771."
          },
          "is_imported": {
            "type": "boolean",
            "readOnly": true,
            "description": "Factura propia importada como emitida desde otro programa (su número no lo asignó una serie de Billora): admite ``correct-imported`` y un documento original adjunto (``original-document``)."
          },
          "has_original_document": {
            "type": "boolean",
            "readOnly": true,
            "description": "Tiene adjunto el documento original (``GET /invoices/{id}/original-document/``)."
          }
        },
        "required": [
          "balance",
          "created_at",
          "draft_pdf_url",
          "external_issuer_name",
          "has_original_document",
          "has_verifactu_qr",
          "id",
          "invoice_type",
          "is_imported",
          "issue_date",
          "issuer_type",
          "number",
          "pdf_url",
          "sequence_number",
          "status",
          "substituted_by",
          "substitutes",
          "subtotal",
          "surcharge_total",
          "tax_total",
          "total",
          "updated_at",
          "verifactu_mode",
          "verifactu_qr_url",
          "verifactu_status",
          "withholding_total"
        ]
      },
      "InvoiceConvertToFullRequestRequest": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "integer",
            "description": "Cliente destinatario (con NIF y domicilio)."
          },
          "series": {
            "type": "integer",
            "description": "Serie de la factura completa (por defecto, la de la simplificada)."
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "customer"
        ]
      },
      "InvoiceConvertToFullResponse": {
        "type": "object",
        "properties": {
          "invoice_id": {
            "type": "integer"
          },
          "substitutes": {
            "type": "integer"
          },
          "invoice_type": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "detail",
          "invoice_id",
          "invoice_type",
          "substitutes"
        ]
      },
      "InvoiceDesign": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "recommended_for": {
            "type": "string"
          },
          "fonts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "default_primary_color": {
            "type": "string"
          },
          "default_secondary_color": {
            "type": "string"
          }
        },
        "required": [
          "category",
          "default_primary_color",
          "default_secondary_color",
          "description",
          "fonts",
          "label",
          "recommended_for",
          "value"
        ]
      },
      "InvoiceIssued": {
        "type": "object",
        "properties": {
          "number": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "verifactu_processed": {
            "type": "boolean"
          },
          "verifactu_modo": {
            "type": "string",
            "nullable": true
          },
          "xml_generated": {
            "type": "boolean"
          },
          "sent_to_aeat": {
            "type": "boolean"
          },
          "verifactu_registro_id": {
            "type": "integer"
          }
        },
        "required": [
          "message",
          "number",
          "sent_to_aeat",
          "status",
          "verifactu_modo",
          "verifactu_processed",
          "xml_generated"
        ]
      },
      "InvoiceIssuerTypeEnum": {
        "enum": [
          "own",
          "recipient",
          "third_party"
        ],
        "type": "string",
        "description": "* `own` - Emitida por la organización\n* `recipient` - Autofacturación (emitida por el cliente/destinatario)\n* `third_party` - Emitida por un tercero en nombre de la organización"
      },
      "InvoiceList": {
        "type": "object",
        "description": "Serializer ultra-ligero para listado de facturas.\n\nIMPORTANTE: Este serializador está específicamente diseñado para el\nlistado de facturas del frontend (/sales/invoices/page.tsx).\n\nSolo incluye los campos que se muestran en la tabla:\n- Número de factura\n- Cliente (nombre y CIF)\n- Fechas de emisión y vencimiento\n- Totales (subtotal, impuestos, total)\n- Estado\n- Líneas con impuestos españoles (solo para indicador VeriFactu)\n\nNO incluye: direcciones completas, términos, notas, metadata, etc.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "number": {
            "type": "string",
            "nullable": true,
            "maxLength": 64
          },
          "customer": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerList"
              }
            ],
            "readOnly": true
          },
          "series": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DocumentSeriesList"
              }
            ],
            "readOnly": true
          },
          "issue_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/InvoiceStatusEnum"
          },
          "subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "tax_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "withholding_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "paid_amount": {
            "type": "string",
            "readOnly": true,
            "description": "Importe cobrado (cobros menos devoluciones)."
          },
          "remaining_amount": {
            "type": "string",
            "readOnly": true,
            "description": "Pendiente de cobro: total − cobrado − rectificativas expedidas (nunca negativo)."
          },
          "income_category": {
            "allOf": [
              {
                "$ref": "#/components/schemas/IncomeCategory"
              }
            ],
            "readOnly": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "verifactu_status": {
            "type": "string",
            "readOnly": true
          },
          "verifactu_mode": {
            "nullable": true,
            "description": "Modo VeriFactu que estaba configurado cuando se emitió esta factura\n\n* `VERI` - VeriFactu Activado\n* `NO_VERI` - VeriFactu Desactivado\n* `None` - No definido",
            "oneOf": [
              {
                "$ref": "#/components/schemas/VerifactuModeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "issuer_type": {
            "$ref": "#/components/schemas/InvoiceIssuerTypeEnum"
          },
          "external_issuer_name": {
            "type": "string",
            "description": "Quién expidió materialmente la factura si es un tercero distinto del cliente.",
            "maxLength": 200
          },
          "is_rectifying": {
            "type": "boolean"
          },
          "is_simplified": {
            "type": "boolean",
            "description": "Factura simplificada (F2 VeriFactu). Marcar para tickets y facturas sin NIF del destinatario."
          },
          "substituted_by": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true,
            "readOnly": true,
            "description": "Factura completa (F3) que sustituye a esta simplificada canjeada: {id, number}; null si no hay canje."
          }
        },
        "required": [
          "created_at",
          "customer",
          "id",
          "income_category",
          "paid_amount",
          "remaining_amount",
          "series",
          "substituted_by",
          "verifactu_status"
        ]
      },
      "InvoiceOriginalDocument": {
        "type": "object",
        "description": "Documento original (PDF del programa anterior) de una factura importada o de terceros.",
        "properties": {
          "invoice": {
            "type": "integer",
            "description": "Id de la factura."
          },
          "number": {
            "type": "string",
            "nullable": true
          },
          "is_imported": {
            "type": "boolean",
            "description": "Factura propia importada como emitida (número no asignado por una serie de Billora)."
          },
          "is_external": {
            "type": "boolean",
            "description": "Factura expedida por el cliente o un tercero."
          },
          "has_document": {
            "type": "boolean"
          },
          "filename": {
            "type": "string",
            "nullable": true,
            "description": "Nombre original del archivo."
          },
          "content_type": {
            "type": "string",
            "nullable": true
          },
          "size": {
            "type": "integer",
            "nullable": true,
            "description": "Tamaño en bytes."
          },
          "uploaded_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "uploaded_by": {
            "type": "integer",
            "nullable": true,
            "description": "Id del usuario que lo adjuntó."
          },
          "download_url": {
            "type": "string",
            "nullable": true,
            "description": "URL firmada y temporal (4 h) del archivo."
          },
          "document_url": {
            "type": "string",
            "nullable": true,
            "description": "Ruta de la API que devuelve el archivo (``GET …/original-document/download/``, autenticada)."
          }
        },
        "required": [
          "content_type",
          "document_url",
          "download_url",
          "filename",
          "has_document",
          "invoice",
          "is_external",
          "is_imported",
          "number",
          "size",
          "uploaded_at",
          "uploaded_by"
        ]
      },
      "InvoiceOriginalDocumentUploadRequest": {
        "type": "object",
        "properties": {
          "original_document": {
            "type": "string",
            "format": "binary",
            "description": "PDF, JPG, PNG o WEBP de hasta 10 MB (también se acepta el campo ``file``)."
          }
        },
        "required": [
          "original_document"
        ]
      },
      "InvoicePaymentMethod": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "InvoicePaymentMethodRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "name"
        ]
      },
      "InvoiceRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLineRequest"
            },
            "writeOnly": true
          },
          "rectification_code": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RectificationCodeEnum"
              }
            ],
            "writeOnly": true,
            "description": "Sólo rectificativas de facturas completas: motivo de la rectificación (R1 por defecto). Las rectificativas de facturas simplificadas son siempre R5.\n\n* `R1` - R1 — Error fundado en derecho y art. 80 Uno, Dos y Seis LIVA\n* `R2` - R2 — Art. 80.Tres LIVA (concurso)\n* `R3` - R3 — Art. 80.Cuatro LIVA (incobrables)\n* `R4` - R4 — Resto de causas"
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "is_rectifying": {
            "type": "boolean"
          },
          "rectifies": {
            "type": "integer",
            "nullable": true
          },
          "is_simplified": {
            "type": "boolean",
            "description": "Factura simplificada (F2 VeriFactu). Marcar para tickets y facturas sin NIF del destinatario."
          },
          "operation_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de la operación (entrega o servicio) si es distinta de la de expedición. Aparece en la factura y en el registro VeriFactu (FechaOperacion)."
          },
          "prices_include_tax": {
            "type": "boolean",
            "description": "Los precios de las líneas incluyen el IVA (venta a consumidores): la base se obtiene del precio final para que el total cuadre al céntimo."
          },
          "external_reference": {
            "type": "string",
            "description": "Referencia externa (p. ej. nº de pedido de Shopify) para no duplicar importaciones.",
            "maxLength": 100
          },
          "fixed_asset": {
            "type": "integer",
            "nullable": true,
            "description": "Venta de inmovilizado: ficha del bien vendido (obligatoria si accounting_account es 2xx). La contabilidad da de baja coste y amortización y lleva la diferencia a 671/771."
          }
        }
      },
      "InvoiceStats": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "current_month": {
            "type": "integer"
          },
          "last_30_days": {
            "type": "integer"
          },
          "last_7_days": {
            "type": "integer"
          },
          "period_value": {
            "type": "integer"
          },
          "draft": {
            "type": "integer"
          },
          "sent": {
            "type": "integer"
          },
          "paid": {
            "type": "integer"
          },
          "overdue": {
            "type": "integer"
          },
          "overdue_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "delinquency_rate": {
            "type": "number",
            "format": "double"
          },
          "avg_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "conversion_rate": {
            "type": "number",
            "format": "double"
          }
        },
        "required": [
          "avg_amount",
          "conversion_rate",
          "current_month",
          "delinquency_rate",
          "draft",
          "last_30_days",
          "last_7_days",
          "overdue",
          "overdue_amount",
          "paid",
          "period_value",
          "sent",
          "total"
        ]
      },
      "InvoiceStatusEnum": {
        "enum": [
          "draft",
          "posted",
          "sent",
          "partially_paid",
          "paid",
          "overdue",
          "rectified",
          "cancelled",
          "verifactu_pending",
          "verifactu_error"
        ],
        "type": "string",
        "description": "* `draft` - Borrador\n* `posted` - Emitida (sin remisión)\n* `sent` - Emitida/Enviada (remitida a AEAT)\n* `partially_paid` - Parcialmente pagada\n* `paid` - Pagada\n* `overdue` - Vencida\n* `rectified` - Rectificada\n* `cancelled` - Anulada\n* `verifactu_pending` - VeriFactu Pendiente\n* `verifactu_error` - VeriFactu Error"
      },
      "InvoiceTemplate": {
        "type": "object",
        "description": "Serializador para plantillas de facturas.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "template_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TemplateTypeEnum"
              }
            ],
            "description": "Diseño del documento (ver facturo/documents/designs.py)\n\n* `modern` - Moderna\n* `classic` - Clásica\n* `minimal` - Minimalista\n* `professional` - Profesional\n* `elegant` - Elegante\n* `bold` - Audaz\n* `stripe` - Tech\n* `compact` - Compacta\n* `corporate` - Corporativa\n* `executive` - Ejecutiva\n* `legal` - Despacho\n* `nordic` - Nórdica\n* `atelier` - Atelier\n* `monochrome` - Monocromo\n* `ledger` - Libro mayor\n* `geometric` - Geométrica\n* `sidebar` - Lateral\n* `letterhead` - Membrete\n* `banner` - Banda\n* `editorial` - Editorial\n* `startup` - Startup\n* `clinic` - Clínica\n* `industrial` - Industrial\n* `luxe` - Luxe\n* `eco` - Natural\n* `consulting` - Consultoría\n* `creative` - Agencia"
          },
          "is_active": {
            "type": "boolean",
            "description": "Solo una plantilla puede estar activa por organización"
          },
          "logo_url": {
            "nullable": true,
            "description": "URL del logo de la empresa (se mostrará en el encabezado)",
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 200
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "header_text": {
            "type": "string",
            "description": "Texto que aparece encima de la tabla de conceptos"
          },
          "footer_text": {
            "type": "string",
            "description": "Texto legal que aparece al pie del documento"
          },
          "primary_color": {
            "type": "string",
            "description": "Color principal de la plantilla (formato hex: #1890ff)",
            "maxLength": 7
          },
          "secondary_color": {
            "type": "string",
            "description": "Color secundario para fondos y bordes (formato hex: #f0f2f5)",
            "maxLength": 7
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "template_type",
          "updated_at"
        ]
      },
      "InvoiceTemplateRequest": {
        "type": "object",
        "description": "Serializador para plantillas de facturas.",
        "properties": {
          "template_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TemplateTypeEnum"
              }
            ],
            "description": "Diseño del documento (ver facturo/documents/designs.py)\n\n* `modern` - Moderna\n* `classic` - Clásica\n* `minimal` - Minimalista\n* `professional` - Profesional\n* `elegant` - Elegante\n* `bold` - Audaz\n* `stripe` - Tech\n* `compact` - Compacta\n* `corporate` - Corporativa\n* `executive` - Ejecutiva\n* `legal` - Despacho\n* `nordic` - Nórdica\n* `atelier` - Atelier\n* `monochrome` - Monocromo\n* `ledger` - Libro mayor\n* `geometric` - Geométrica\n* `sidebar` - Lateral\n* `letterhead` - Membrete\n* `banner` - Banda\n* `editorial` - Editorial\n* `startup` - Startup\n* `clinic` - Clínica\n* `industrial` - Industrial\n* `luxe` - Luxe\n* `eco` - Natural\n* `consulting` - Consultoría\n* `creative` - Agencia"
          },
          "is_active": {
            "type": "boolean",
            "description": "Solo una plantilla puede estar activa por organización"
          },
          "logo_url": {
            "nullable": true,
            "description": "URL del logo de la empresa (se mostrará en el encabezado)",
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 200
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "header_text": {
            "type": "string",
            "description": "Texto que aparece encima de la tabla de conceptos"
          },
          "footer_text": {
            "type": "string",
            "description": "Texto legal que aparece al pie del documento"
          },
          "primary_color": {
            "type": "string",
            "minLength": 1,
            "description": "Color principal de la plantilla (formato hex: #1890ff)",
            "maxLength": 7
          },
          "secondary_color": {
            "type": "string",
            "minLength": 1,
            "description": "Color secundario para fondos y bordes (formato hex: #f0f2f5)",
            "maxLength": 7
          }
        },
        "required": [
          "template_type"
        ]
      },
      "IrpfKeyEnum": {
        "enum": [
          "A",
          "E"
        ],
        "type": "string",
        "description": "* `A` - A — Empleado por cuenta ajena\n* `E` - E — Consejero o administrador"
      },
      "IrpfSubkeyEnum": {
        "enum": [
          "01",
          "02",
          "03",
          "04"
        ],
        "type": "string",
        "description": "* `` - Automática (E.01)\n* `01` - E.01 — Régimen general de la S. S. (asimilado)\n* `02` - E.02 — Régimen general, entidad con cifra de negocios < 100.000 €\n* `03` - E.03 — RETA, entidad con cifra de negocios < 100.000 €\n* `04` - E.04 — Resto de consejeros y administradores"
      },
      "JobAccepted": {
        "type": "object",
        "properties": {
          "job_id": {
            "type": "string",
            "nullable": true
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "detail",
          "job_id"
        ]
      },
      "JournalEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "fiscal_year": {
            "type": "integer"
          },
          "fiscal_year_name": {
            "type": "string",
            "readOnly": true
          },
          "entry_number": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Número cronológico dentro del ejercicio (se renumera al cerrar)."
          },
          "posting_sequence": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Orden real de confirmación dentro del ejercicio."
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "description": {
            "type": "string",
            "maxLength": 300
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/JournalEntryStatusEnum"
              }
            ],
            "readOnly": true
          },
          "kind": {
            "allOf": [
              {
                "$ref": "#/components/schemas/JournalEntryKindEnum"
              }
            ],
            "readOnly": true
          },
          "kind_display": {
            "type": "string",
            "readOnly": true
          },
          "is_closing": {
            "type": "boolean",
            "readOnly": true,
            "description": "Asiento de regularización o cierre de ejercicio."
          },
          "is_opening": {
            "type": "boolean",
            "readOnly": true,
            "description": "Asiento de apertura del ejercicio."
          },
          "is_sourced": {
            "type": "boolean",
            "readOnly": true
          },
          "source_content_type": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "source_object_id": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "source_type": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "source_type_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "source_display": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "reversal_of": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Asiento que este contra-asiento anula."
          },
          "reversals": {
            "type": "array",
            "items": {},
            "readOnly": true
          },
          "metadata": {
            "readOnly": true
          },
          "unposted_reason": {
            "type": "string",
            "readOnly": true,
            "description": "Por qué un asiento automático quedó en borrador (descuadre, cuenta inactiva…)."
          },
          "is_balanced": {
            "type": "boolean",
            "readOnly": true
          },
          "total_debit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "total_credit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JournalEntryLine"
            }
          },
          "created_by": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "posted_by": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "posted_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "created_by",
          "date",
          "description",
          "entry_number",
          "fiscal_year",
          "fiscal_year_name",
          "id",
          "is_balanced",
          "is_closing",
          "is_opening",
          "is_sourced",
          "kind",
          "kind_display",
          "lines",
          "metadata",
          "posted_at",
          "posted_by",
          "posting_sequence",
          "reversal_of",
          "reversals",
          "source_content_type",
          "source_display",
          "source_object_id",
          "source_type",
          "source_type_name",
          "status",
          "total_credit",
          "total_debit",
          "unposted_reason",
          "updated_at"
        ]
      },
      "JournalEntryKindEnum": {
        "enum": [
          "manual",
          "invoice",
          "credit_note",
          "expense",
          "payment",
          "expense_payment",
          "payment_fee",
          "fx_difference",
          "vat_transfer",
          "vat_settlement",
          "tax_payment",
          "payroll",
          "payroll_payment",
          "depreciation",
          "asset_disposal",
          "accrual",
          "doubtful",
          "regularisation",
          "closing",
          "opening",
          "result_application",
          "corporate_tax",
          "bank_movement",
          "transfer"
        ],
        "type": "string",
        "description": "* `manual` - Manual\n* `invoice` - Factura emitida\n* `credit_note` - Factura rectificativa / abono\n* `expense` - Gasto / factura recibida\n* `payment` - Cobro de factura\n* `expense_payment` - Pago de gasto\n* `payment_fee` - Comisión de cobro\n* `fx_difference` - Diferencia de cambio\n* `vat_transfer` - Traspaso IVA pendiente de deducir\n* `vat_settlement` - Liquidación de IVA\n* `tax_payment` - Pago / devolución de impuestos\n* `payroll` - Nómina\n* `payroll_payment` - Pago de nómina\n* `depreciation` - Amortización\n* `asset_disposal` - Baja de inmovilizado\n* `accrual` - Periodificación\n* `doubtful` - Deudor de dudoso cobro\n* `regularisation` - Regularización de resultado\n* `closing` - Asiento de cierre\n* `opening` - Asiento de apertura\n* `result_application` - Aplicación del resultado\n* `corporate_tax` - Impuesto sobre beneficios\n* `bank_movement` - Movimiento bancario\n* `transfer` - Traspaso de tesorería"
      },
      "JournalEntryLine": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "account": {
            "type": "integer"
          },
          "account_code": {
            "type": "string",
            "readOnly": true
          },
          "account_name": {
            "type": "string",
            "readOnly": true
          },
          "debit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "credit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "description": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "account",
          "account_code",
          "account_name",
          "id"
        ]
      },
      "JournalEntryLineRequest": {
        "type": "object",
        "properties": {
          "account": {
            "type": "integer"
          },
          "debit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "credit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "description": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "account"
        ]
      },
      "JournalEntryList": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "fiscal_year": {
            "type": "integer"
          },
          "fiscal_year_name": {
            "type": "string",
            "readOnly": true
          },
          "entry_number": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "Número cronológico dentro del ejercicio (se renumera al cerrar)."
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "description": {
            "type": "string",
            "maxLength": 300
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "status": {
            "$ref": "#/components/schemas/JournalEntryStatusEnum"
          },
          "kind": {
            "$ref": "#/components/schemas/JournalEntryKindEnum"
          },
          "kind_display": {
            "type": "string",
            "readOnly": true
          },
          "is_closing": {
            "type": "boolean",
            "description": "Asiento de regularización o cierre de ejercicio."
          },
          "is_opening": {
            "type": "boolean",
            "description": "Asiento de apertura del ejercicio."
          },
          "is_sourced": {
            "type": "boolean",
            "readOnly": true
          },
          "source_type": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "source_object_id": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true
          },
          "source_display": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "reversal_of": {
            "type": "integer",
            "nullable": true,
            "description": "Asiento que este contra-asiento anula."
          },
          "unposted_reason": {
            "type": "string",
            "description": "Por qué un asiento automático quedó en borrador (descuadre, cuenta inactiva…).",
            "maxLength": 200
          },
          "is_balanced": {
            "type": "boolean",
            "readOnly": true
          },
          "total_debit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "total_credit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "date",
          "description",
          "fiscal_year",
          "fiscal_year_name",
          "id",
          "is_balanced",
          "is_sourced",
          "kind_display",
          "source_display",
          "source_type",
          "total_credit",
          "total_debit"
        ]
      },
      "JournalEntryRequest": {
        "type": "object",
        "properties": {
          "fiscal_year": {
            "type": "integer"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JournalEntryLineRequest"
            }
          }
        },
        "required": [
          "date",
          "description",
          "fiscal_year",
          "lines"
        ]
      },
      "JournalEntryStatusEnum": {
        "enum": [
          "draft",
          "posted"
        ],
        "type": "string",
        "description": "* `draft` - Borrador\n* `posted` - Confirmado"
      },
      "Jurisdiction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 150
          },
          "code": {
            "type": "string",
            "maxLength": 20
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "KeyEnum": {
        "enum": [
          "accounts_read",
          "transactions_read",
          "counterparties_read",
          "payment_drafts",
          "webhooks"
        ],
        "type": "string",
        "description": "* `accounts_read` - Leer cuentas y saldos\n* `transactions_read` - Leer transacciones\n* `counterparties_read` - Contrapartes (beneficiarios)\n* `payment_drafts` - Borradores de pago\n* `webhooks` - Webhooks"
      },
      "LeadDetail": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "company_name": {
            "type": "string",
            "maxLength": 200
          },
          "position": {
            "type": "string",
            "maxLength": 100
          },
          "website": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 200
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "source": {
            "type": "integer",
            "nullable": true
          },
          "source_name": {
            "type": "string",
            "readOnly": true
          },
          "source_color": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "$ref": "#/components/schemas/LeadStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "assigned_to": {
            "type": "integer",
            "nullable": true
          },
          "assigned_to_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "customer_name": {
            "type": "string",
            "readOnly": true
          },
          "tag_objects": {
            "type": "array",
            "items": {},
            "readOnly": true
          },
          "estimated_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "notes": {
            "type": "string"
          },
          "lost_reason": {
            "type": "string"
          },
          "converted_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "activity_count": {
            "type": "integer",
            "readOnly": true
          },
          "deal_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "activity_count",
          "assigned_to_name",
          "converted_at",
          "created_at",
          "customer_name",
          "deal_count",
          "id",
          "name",
          "source_color",
          "source_name",
          "status_display",
          "tag_objects",
          "updated_at"
        ]
      },
      "LeadDetailRequest": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "company_name": {
            "type": "string",
            "maxLength": 200
          },
          "position": {
            "type": "string",
            "maxLength": 100
          },
          "website": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 200
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "source": {
            "type": "integer",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/LeadStatusEnum"
          },
          "assigned_to": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "tag_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "writeOnly": true
            },
            "writeOnly": true
          },
          "estimated_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "notes": {
            "type": "string"
          },
          "lost_reason": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "LeadList": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "company_name": {
            "type": "string",
            "maxLength": 200
          },
          "position": {
            "type": "string",
            "maxLength": 100
          },
          "status": {
            "$ref": "#/components/schemas/LeadStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "source": {
            "type": "integer",
            "nullable": true
          },
          "source_name": {
            "type": "string",
            "readOnly": true
          },
          "source_color": {
            "type": "string",
            "readOnly": true
          },
          "assigned_to": {
            "type": "integer",
            "nullable": true
          },
          "assigned_to_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "customer_name": {
            "type": "string",
            "readOnly": true
          },
          "estimated_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "activity_count": {
            "type": "integer",
            "readOnly": true
          },
          "deal_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "activity_count",
          "assigned_to_name",
          "created_at",
          "customer_name",
          "deal_count",
          "id",
          "name",
          "source_color",
          "source_name",
          "status_display"
        ]
      },
      "LeadSource": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "icon": {
            "type": "string",
            "maxLength": 50
          },
          "color": {
            "type": "string",
            "maxLength": 7
          },
          "lead_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "lead_count",
          "name",
          "updated_at"
        ]
      },
      "LeadSourceRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "icon": {
            "type": "string",
            "maxLength": 50
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          }
        },
        "required": [
          "name"
        ]
      },
      "LeadStatusEnum": {
        "enum": [
          "new",
          "contacted",
          "qualified",
          "unqualified",
          "converted",
          "lost"
        ],
        "type": "string",
        "description": "* `new` - Nuevo\n* `contacted` - Contactado\n* `qualified` - Cualificado\n* `unqualified` - No cualificado\n* `converted` - Convertido\n* `lost` - Perdido"
      },
      "LeaveBalance": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "employee": {
            "type": "integer"
          },
          "employee_name": {
            "type": "string",
            "readOnly": true
          },
          "leave_type": {
            "type": "integer"
          },
          "leave_type_name": {
            "type": "string",
            "readOnly": true
          },
          "leave_type_color": {
            "type": "string",
            "readOnly": true
          },
          "year": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648
          },
          "total_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$"
          },
          "used_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$"
          },
          "pending_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$"
          },
          "remaining_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "employee",
          "employee_name",
          "id",
          "leave_type",
          "leave_type_color",
          "leave_type_name",
          "remaining_days",
          "updated_at",
          "year"
        ]
      },
      "LeaveBalanceRequest": {
        "type": "object",
        "properties": {
          "employee": {
            "type": "integer"
          },
          "leave_type": {
            "type": "integer"
          },
          "year": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648
          },
          "total_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$"
          },
          "used_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$"
          },
          "pending_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$"
          }
        },
        "required": [
          "employee",
          "leave_type",
          "year"
        ]
      },
      "LeaveRejectRequestRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Motivo del rechazo."
          }
        }
      },
      "LeaveRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "employee": {
            "type": "integer"
          },
          "employee_name": {
            "type": "string",
            "readOnly": true
          },
          "leave_type": {
            "type": "integer"
          },
          "leave_type_name": {
            "type": "string",
            "readOnly": true
          },
          "leave_type_color": {
            "type": "string",
            "readOnly": true
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date"
          },
          "business_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$",
            "readOnly": true,
            "description": "Días laborables calculados"
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/LeaveRequestStatusEnum"
              }
            ],
            "readOnly": true
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "approved_by": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "approved_by_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "approved_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "rejection_reason": {
            "type": "string",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "approved_at",
          "approved_by",
          "approved_by_name",
          "business_days",
          "created_at",
          "employee",
          "employee_name",
          "end_date",
          "id",
          "leave_type",
          "leave_type_color",
          "leave_type_name",
          "rejection_reason",
          "start_date",
          "status",
          "status_display",
          "updated_at"
        ]
      },
      "LeaveRequestRequest": {
        "type": "object",
        "properties": {
          "employee": {
            "type": "integer"
          },
          "leave_type": {
            "type": "integer"
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date"
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "employee",
          "end_date",
          "leave_type",
          "start_date"
        ]
      },
      "LeaveRequestStatusEnum": {
        "enum": [
          "pending",
          "approved",
          "rejected",
          "cancelled"
        ],
        "type": "string",
        "description": "* `pending` - Pendiente\n* `approved` - Aprobada\n* `rejected` - Rechazada\n* `cancelled` - Cancelada"
      },
      "LeaveType": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string"
          },
          "days_per_year": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$"
          },
          "requires_approval": {
            "type": "boolean"
          },
          "paid": {
            "type": "boolean"
          },
          "color": {
            "type": "string",
            "maxLength": 7
          },
          "is_active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "LeaveTypeRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "type": "string"
          },
          "days_per_year": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$"
          },
          "requires_approval": {
            "type": "boolean"
          },
          "paid": {
            "type": "boolean"
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          },
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "name"
        ]
      },
      "LinkToEnum": {
        "enum": [
          "none",
          "patient",
          "customer",
          "both"
        ],
        "type": "string",
        "description": "* `none` - Sin vincular\n* `patient` - Paciente\n* `customer` - Cliente\n* `both` - Ambos"
      },
      "MaritalStatusEnum": {
        "enum": [
          "single",
          "married",
          "divorced",
          "widowed",
          "partner"
        ],
        "type": "string",
        "description": "* `single` - Soltero/a\n* `married` - Casado/a\n* `divorced` - Divorciado/a\n* `widowed` - Viudo/a\n* `partner` - Pareja de hecho"
      },
      "MatchAllocationKindEnum": {
        "enum": [
          "invoice",
          "expense",
          "customer_advance",
          "account",
          "payment",
          "expense_payment",
          "payroll"
        ],
        "type": "string",
        "description": "* `invoice` - Cobro / devolución de factura\n* `expense` - Pago de gasto / reembolso de abono\n* `customer_advance` - Anticipo de cliente\n* `account` - Cuenta contable\n* `payment` - Cobro ya registrado sin cuenta bancaria (se enlaza, no se duplica)\n* `expense_payment` - Pago de gasto ya registrado sin cuenta bancaria (se enlaza, no se duplica)\n* `payroll` - Pago de una nómina (importe = su líquido)"
      },
      "MatchAllocationRequest": {
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/MatchAllocationKindEnum"
          },
          "id": {
            "type": "integer",
            "description": "Id de la factura / gasto (según kind)."
          },
          "customer_id": {
            "type": "integer",
            "description": "kind=customer_advance."
          },
          "account_id": {
            "type": "integer",
            "description": "kind=account."
          },
          "account_code": {
            "type": "string",
            "description": "kind=account (alternativa al id)."
          },
          "payment_id": {
            "type": "integer",
            "description": "kind=payment: cobro ya registrado (sin cuenta bancaria ni de contrapartida) que se enlaza al movimiento; toma la cuenta y la fecha del banco."
          },
          "expense_payment_id": {
            "type": "integer",
            "description": "kind=expense_payment: pago de gasto ya registrado (sin cuenta bancaria ni de contrapartida) que se enlaza al movimiento; toma la cuenta y la fecha del banco."
          },
          "payroll_record_id": {
            "type": "integer",
            "description": "kind=payroll: nómina confirmada que se paga con este movimiento (puede combinarse con gastos, pagos ya registrados o cuentas en la misma remesa)."
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Importe aplicado (positivo). En kind=payment / expense_payment es opcional: por defecto, todo el cobro o pago; con un importe menor se enlaza sólo esa parte y el cobro/pago se divide: el resto pasa a uno nuevo sin cuenta bancaria (allocation.metadata.split_payment_id) que puede enlazarse con otro movimiento. En kind=payroll se ignora (líquido)."
          },
          "description": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "kind"
        ]
      },
      "MatchRequestRequest": {
        "type": "object",
        "properties": {
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MatchAllocationRequest"
            }
          },
          "payment_method": {
            "type": "string",
            "nullable": true,
            "description": "Id o nombre del método de cobro/pago (por defecto según el código Norma 43: tarjeta, domiciliación o transferencia)."
          },
          "difference_as_fee": {
            "type": "boolean",
            "default": false,
            "description": "Llevar la diferencia a 626 (comisión retenida)."
          },
          "remember": {
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "allocations"
        ]
      },
      "Metrics": {
        "type": "object",
        "properties": {
          "profit_margin": {
            "type": "number",
            "format": "double"
          },
          "avg_collection_days": {
            "type": "integer",
            "nullable": true
          },
          "cash_flow": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          }
        },
        "required": [
          "avg_collection_days",
          "cash_flow",
          "profit_margin"
        ]
      },
      "ModalidadEnum": {
        "enum": [
          "A",
          "B"
        ],
        "type": "string",
        "description": "* `A` - Art. 40.2 LIS\n* `B` - Art. 40.3 LIS"
      },
      "ModoEnum": {
        "enum": [
          "VERI",
          "NO_VERI"
        ],
        "type": "string",
        "description": "* `VERI` - VERI\n* `NO_VERI` - NO_VERI"
      },
      "ModuleEnum": {
        "enum": [
          "expedientes",
          "clinica",
          "consentimientos"
        ],
        "type": "string",
        "description": "* `expedientes` - Expedientes\n* `clinica` - Historias Clínicas\n* `consentimientos` - Consentimientos"
      },
      "MotivoRectificacionEnum": {
        "enum": [
          "rectificaciones",
          "discrepancia"
        ],
        "type": "string",
        "description": "* `rectificaciones` - Rectificaciones\n* `discrepancia` - Discrepancia de criterio"
      },
      "NextCaseReference": {
        "type": "object",
        "properties": {
          "reference": {
            "type": "string"
          }
        },
        "required": [
          "reference"
        ]
      },
      "Note": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "content": {
            "type": "string"
          },
          "deal": {
            "type": "integer",
            "nullable": true
          },
          "deal_title": {
            "type": "string",
            "readOnly": true
          },
          "lead": {
            "type": "integer",
            "nullable": true
          },
          "lead_name": {
            "type": "string",
            "readOnly": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "created_by": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "created_by_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "content",
          "created_at",
          "created_by",
          "created_by_name",
          "deal_title",
          "id",
          "lead_name",
          "updated_at"
        ]
      },
      "NoteRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "minLength": 1
          },
          "deal": {
            "type": "integer",
            "nullable": true
          },
          "lead": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "content"
        ]
      },
      "NullEnum": {
        "enum": [
          null
        ]
      },
      "OpeningBalanceRow": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "source_code": {
            "type": "string",
            "description": "Código de la cuenta tal como viene en el fichero."
          },
          "source_name": {
            "type": "string",
            "description": "Nombre de la cuenta en el fichero."
          },
          "debit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "credit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "account_exists": {
            "type": "boolean"
          },
          "account_id": {
            "type": "integer",
            "nullable": true
          },
          "account_name": {
            "type": "string",
            "nullable": true
          },
          "will_create": {
            "type": "boolean"
          },
          "link_party": {
            "type": "string",
            "nullable": true,
            "description": "Tercero de Billora con el mismo nombre al que se enlazará la subcuenta nueva (customer:<id>…)."
          },
          "link_party_name": {
            "type": "string",
            "nullable": true
          },
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta bancaria destino de un saldo 57x."
          },
          "bank_account_name": {
            "type": "string",
            "nullable": true
          },
          "target": {
            "type": "string",
            "nullable": true,
            "description": "Destino aplicado: código de cuenta, customer:<id>, supplier:<id>, employee:<id>, bank:<id> o skip."
          },
          "target_account_code": {
            "type": "string",
            "description": "Cuenta contable en la que se contabilizará el saldo (vacío si se omite la fila)."
          },
          "target_label": {
            "type": "string",
            "description": "Nombre de la cuenta, tercero o banco de destino."
          },
          "suggested_target": {
            "type": "string",
            "nullable": true,
            "description": "Destino propuesto por Billora."
          },
          "suggested_reason": {
            "nullable": true,
            "description": "Por qué se propone: exact (misma cuenta), prefix (prefijo significativo de un código largo con ceros de relleno), name / vat_id (tercero por nombre o NIF), bank_account, new_account (se creará con el código del fichero) o regularize (cuenta 6/7 → 129).\n\n* `exact` - exact\n* `prefix` - prefix\n* `name` - name\n* `vat_id` - vat_id\n* `bank_account` - bank_account\n* `new_account` - new_account\n* `regularize` - regularize",
            "oneOf": [
              {
                "$ref": "#/components/schemas/SuggestedReasonEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "skipped": {
            "type": "boolean"
          },
          "error": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "account_exists",
          "account_id",
          "account_name",
          "bank_account",
          "bank_account_name",
          "code",
          "credit",
          "debit",
          "error",
          "link_party",
          "link_party_name",
          "name",
          "skipped",
          "source_code",
          "source_name",
          "suggested_reason",
          "suggested_target",
          "target",
          "target_account_code",
          "target_label",
          "will_create"
        ]
      },
      "OpeningBalancesImportRequestRequest": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "Balance de sumas y saldos (CSV o XLSX; también un .XLS cuyo contenido es xlsx): código/cuenta, nombre y saldo deudor/acreedor (o debe saldo/haber saldo, o debe/haber, o un único saldo con signo). Admite filas de título antes de la cabecera y fila de totales. Máximo 10 MB."
          },
          "account_mapping": {
            "description": "{código del fichero: destino}. Destino: código de una cuenta existente (\"4751\"), \"customer:<id>\", \"supplier:<id>\" o \"employee:<id>\" (subcuenta del tercero, se crea si no existe), \"bank:<id>\" (subcuenta de la cuenta bancaria) o \"skip\" (no importar la fila; sólo si no rompe el cuadre). Varias filas pueden compartir destino (se agregan). Lo no indicado usa la sugerencia del preview (suggested_target)."
          },
          "regularize": {
            "type": "boolean",
            "default": false,
            "description": "El balance trae cuentas de gasto/ingreso (6/7) con saldo (antes de regularizar): en vez de rechazarlas, lleva su saldo neto (resultado del ejercicio) a la cuenta 129."
          },
          "bank_account_mapping": {
            "description": "{código del fichero: id de cuenta bancaria} para llevar los saldos 57x a la subcuenta de cada cuenta bancaria (por defecto, la sugerencia del preview)."
          },
          "fiscal_year": {
            "type": "integer"
          },
          "replace": {
            "type": "boolean",
            "default": true,
            "description": "Sustituir el asiento de apertura existente del ejercicio."
          }
        },
        "required": [
          "file",
          "fiscal_year"
        ]
      },
      "OpeningBalancesImportResult": {
        "type": "object",
        "properties": {
          "entry": {
            "$ref": "#/components/schemas/JournalEntry"
          },
          "accounts_created": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "replaced_entries": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "rows": {
            "type": "integer"
          },
          "total_debit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "total_credit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "bank_account_mapping": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "account_mapping": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "regularize": {
            "type": "boolean"
          },
          "result_to_129": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "account_mapping",
          "accounts_created",
          "bank_account_mapping",
          "entry",
          "regularize",
          "replaced_entries",
          "result_to_129",
          "rows",
          "total_credit",
          "total_debit",
          "warnings"
        ]
      },
      "OpeningBalancesPreview": {
        "type": "object",
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OpeningBalanceRow"
            }
          },
          "total_debit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "total_credit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "difference": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "balanced": {
            "type": "boolean"
          },
          "accounts_to_create": {
            "type": "integer"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "can_import": {
            "type": "boolean"
          },
          "bank_accounts": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            },
            "description": "Cuentas bancarias de tesorería disponibles para el mapeo."
          },
          "bank_account_mapping": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Mapeo aplicado {código: id de cuenta bancaria}."
          },
          "account_mapping": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Mapeo aplicado {código del fichero: destino}."
          },
          "suggested_mapping": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Mapeo sugerido {código del fichero: destino}."
          },
          "unmapped": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Códigos sin destino claro en Billora (se crearían con su propio código)."
          },
          "regularize": {
            "type": "boolean"
          },
          "result_to_129": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Resultado neto de las cuentas 6/7 llevado a la 129 (positivo = beneficio); null sin regularize."
          },
          "accounting_start_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          }
        },
        "required": [
          "account_mapping",
          "accounting_start_date",
          "accounts_to_create",
          "balanced",
          "bank_account_mapping",
          "bank_accounts",
          "can_import",
          "difference",
          "errors",
          "regularize",
          "result_to_129",
          "rows",
          "suggested_mapping",
          "total_credit",
          "total_debit",
          "unmapped",
          "warnings"
        ]
      },
      "OpeningBalancesPreviewRequestRequest": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "Balance de sumas y saldos (CSV o XLSX; también un .XLS cuyo contenido es xlsx): código/cuenta, nombre y saldo deudor/acreedor (o debe saldo/haber saldo, o debe/haber, o un único saldo con signo). Admite filas de título antes de la cabecera y fila de totales. Máximo 10 MB."
          },
          "account_mapping": {
            "description": "{código del fichero: destino}. Destino: código de una cuenta existente (\"4751\"), \"customer:<id>\", \"supplier:<id>\" o \"employee:<id>\" (subcuenta del tercero, se crea si no existe), \"bank:<id>\" (subcuenta de la cuenta bancaria) o \"skip\" (no importar la fila; sólo si no rompe el cuadre). Varias filas pueden compartir destino (se agregan). Lo no indicado usa la sugerencia del preview (suggested_target)."
          },
          "regularize": {
            "type": "boolean",
            "default": false,
            "description": "El balance trae cuentas de gasto/ingreso (6/7) con saldo (antes de regularizar): en vez de rechazarlas, lleva su saldo neto (resultado del ejercicio) a la cuenta 129."
          },
          "bank_account_mapping": {
            "description": "{código del fichero: id de cuenta bancaria} para llevar los saldos 57x a la subcuenta de cada cuenta bancaria (por defecto, la sugerencia del preview)."
          }
        },
        "required": [
          "file"
        ]
      },
      "OrganizacionConfig": {
        "type": "object",
        "description": "Serializer para la configuración VeriFactu por organización.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "organization": {
            "type": "integer",
            "readOnly": true,
            "description": "Organización a la que aplica esta configuración"
          },
          "organization_name": {
            "type": "string",
            "readOnly": true
          },
          "organization_slug": {
            "type": "string",
            "readOnly": true
          },
          "modo": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ModoEnum"
              }
            ],
            "description": "Modo VeriFactu: VERI (envío inmediato) o NO_VERI (conservar y cumplir)\n\n* `VERI` - VERI\n* `NO_VERI` - NO_VERI"
          },
          "habilitado": {
            "type": "boolean",
            "description": "¿Está habilitado VeriFactu para esta organización?"
          },
          "certificate_source": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CertificateSourceEnum"
              }
            ],
            "description": "Origen del certificado digital para modo VERI\n\n* `own` - Certificado Propio\n* `billora` - Certificado de Billora"
          },
          "certificate_info": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true,
            "description": "Retorna información del certificado.",
            "readOnly": true
          },
          "facturas_procesadas": {
            "type": "integer",
            "readOnly": true,
            "description": "Total de facturas procesadas con VeriFactu"
          },
          "facturas_enviadas_aeat": {
            "type": "integer",
            "readOnly": true,
            "description": "Total de facturas enviadas a AEAT (solo modo VERI)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "certificate_info",
          "created_at",
          "facturas_enviadas_aeat",
          "facturas_procesadas",
          "id",
          "organization",
          "organization_name",
          "organization_slug",
          "updated_at"
        ]
      },
      "Organization": {
        "type": "object",
        "properties": {
          "setup_warnings": {
            "type": "array",
            "items": {},
            "readOnly": true
          },
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "maxLength": 50,
            "pattern": "^[-a-zA-Z0-9_]+$"
          },
          "vat_id": {
            "type": "string",
            "description": "NIF/CIF/NIE de la organización",
            "maxLength": 20
          },
          "fiscal_address": {
            "type": "string",
            "description": "Dirección completa (campo legacy)",
            "maxLength": 255
          },
          "fiscal_street": {
            "type": "string",
            "description": "Calle y número",
            "maxLength": 200
          },
          "fiscal_city": {
            "type": "string",
            "description": "Localidad",
            "maxLength": 100
          },
          "fiscal_province": {
            "type": "string",
            "description": "Provincia",
            "maxLength": 100
          },
          "fiscal_postal_code": {
            "type": "string",
            "description": "Código postal",
            "maxLength": 10
          },
          "fiscal_country": {
            "type": "string",
            "description": "País (ISO-3166-1 alpha-2)",
            "maxLength": 2
          },
          "country": {
            "type": "string",
            "maxLength": 2
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "default_vat_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "language": {
            "type": "string",
            "maxLength": 10
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "logo": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "preferences": {},
          "iban": {
            "type": "string",
            "maxLength": 34
          },
          "swift": {
            "type": "string",
            "maxLength": 11
          },
          "regime": {
            "$ref": "#/components/schemas/RegimeEnum"
          },
          "timezone": {
            "type": "string",
            "maxLength": 50
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "expediente_mode": {
            "nullable": true,
            "description": "Tipo de expedientes habilitados para esta organización\n\n* `judicial` - Expedientes Judiciales\n* `clinical` - Historias Clínicas\n* `both` - Ambos",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExpedienteModeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "roi_registered": {
            "type": "boolean",
            "description": "La empresa está inscrita en el Registro de Operadores Intracomunitarios (ROI, modelo 036). Sin el alta, los modelos 303 y 349 y los gastos intracomunitarios avisan."
          },
          "roi_since": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de alta en el ROI. Las operaciones con proveedores o clientes de la UE anteriores a esa fecha no se tratan como intracomunitarias (sin inversión del sujeto pasivo ni modelo 349). Indicarla marca roi_registered."
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "setup_warnings"
        ]
      },
      "OrganizationEnabledTax": {
        "type": "object",
        "description": "Serializer para impuestos habilitados por organización.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "tax_rate": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SpanishTaxRate"
              }
            ],
            "readOnly": true
          },
          "is_default_for_sales": {
            "type": "boolean"
          },
          "is_default_for_purchases": {
            "type": "boolean"
          },
          "custom_regime": {
            "type": "integer",
            "nullable": true,
            "description": "Régimen personalizado para esta organización"
          }
        },
        "required": [
          "id",
          "tax_rate"
        ]
      },
      "OrganizationEnabledTaxRequest": {
        "type": "object",
        "description": "Serializer para impuestos habilitados por organización.",
        "properties": {
          "tax_rate_id": {
            "type": "integer",
            "writeOnly": true
          },
          "is_default_for_sales": {
            "type": "boolean"
          },
          "is_default_for_purchases": {
            "type": "boolean"
          },
          "custom_regime": {
            "type": "integer",
            "nullable": true,
            "description": "Régimen personalizado para esta organización"
          }
        },
        "required": [
          "tax_rate_id"
        ]
      },
      "OrganizationRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "pattern": "^[-a-zA-Z0-9_]+$"
          },
          "vat_id": {
            "type": "string",
            "description": "NIF/CIF/NIE de la organización",
            "maxLength": 20
          },
          "fiscal_address": {
            "type": "string",
            "description": "Dirección completa (campo legacy)",
            "maxLength": 255
          },
          "fiscal_street": {
            "type": "string",
            "description": "Calle y número",
            "maxLength": 200
          },
          "fiscal_city": {
            "type": "string",
            "description": "Localidad",
            "maxLength": 100
          },
          "fiscal_province": {
            "type": "string",
            "description": "Provincia",
            "maxLength": 100
          },
          "fiscal_postal_code": {
            "type": "string",
            "description": "Código postal",
            "maxLength": 10
          },
          "fiscal_country": {
            "type": "string",
            "minLength": 1,
            "description": "País (ISO-3166-1 alpha-2)",
            "maxLength": 2
          },
          "country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "default_vat_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "language": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "logo": {
            "type": "string",
            "format": "binary",
            "nullable": true
          },
          "preferences": {},
          "iban": {
            "type": "string",
            "maxLength": 34
          },
          "swift": {
            "type": "string",
            "maxLength": 11
          },
          "regime": {
            "$ref": "#/components/schemas/RegimeEnum"
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "expediente_mode": {
            "nullable": true,
            "description": "Tipo de expedientes habilitados para esta organización\n\n* `judicial` - Expedientes Judiciales\n* `clinical` - Historias Clínicas\n* `both` - Ambos",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExpedienteModeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "confirm_duplicate_vat_id": {
            "type": "boolean",
            "writeOnly": true,
            "default": false,
            "description": "Confirmación explícita para guardar un NIF que ya usa otra organización. Sólo se acepta si quien lo guarda es propietario o administrador de esa otra organización (p. ej. una organización de pruebas de la misma empresa); en cualquier otro caso el NIF duplicado se rechaza."
          },
          "roi_registered": {
            "type": "boolean",
            "description": "La empresa está inscrita en el Registro de Operadores Intracomunitarios (ROI, modelo 036). Sin el alta, los modelos 303 y 349 y los gastos intracomunitarios avisan."
          },
          "roi_since": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de alta en el ROI. Las operaciones con proveedores o clientes de la UE anteriores a esa fecha no se tratan como intracomunitarias (sin inversión del sujeto pasivo ni modelo 349). Indicarla marca roi_registered."
          }
        },
        "required": [
          "name"
        ]
      },
      "OrganizationTaxConfig": {
        "type": "object",
        "description": "Serializer para configuración de impuestos por organización.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "organization": {
            "type": "integer",
            "readOnly": true
          },
          "organization_name": {
            "type": "string",
            "readOnly": true
          },
          "default_sales_tax": {
            "type": "integer",
            "description": "Impuesto por defecto para ventas"
          },
          "default_sales_tax_detail": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SpanishTaxRate"
              }
            ],
            "readOnly": true
          },
          "default_purchase_tax": {
            "type": "integer",
            "description": "Impuesto por defecto para compras"
          },
          "default_purchase_tax_detail": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SpanishTaxRate"
              }
            ],
            "readOnly": true
          },
          "default_tax_regime": {
            "type": "integer",
            "description": "Régimen fiscal por defecto para VeriFactu"
          },
          "default_tax_regime_detail": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SpanishTaxRegime"
              }
            ],
            "readOnly": true
          },
          "enabled_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrganizationEnabledTax"
            },
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "default_purchase_tax",
          "default_purchase_tax_detail",
          "default_sales_tax",
          "default_sales_tax_detail",
          "default_tax_regime",
          "default_tax_regime_detail",
          "enabled_taxes",
          "id",
          "organization",
          "organization_name",
          "updated_at"
        ]
      },
      "OrganizationTaxConfigRequest": {
        "type": "object",
        "description": "Serializer para configuración de impuestos por organización.",
        "properties": {
          "default_sales_tax": {
            "type": "integer",
            "description": "Impuesto por defecto para ventas"
          },
          "default_purchase_tax": {
            "type": "integer",
            "description": "Impuesto por defecto para compras"
          },
          "default_tax_regime": {
            "type": "integer",
            "description": "Régimen fiscal por defecto para VeriFactu"
          }
        },
        "required": [
          "default_purchase_tax",
          "default_sales_tax",
          "default_tax_regime"
        ]
      },
      "OutputFormatEnum": {
        "enum": [
          "pdf",
          "docx"
        ],
        "type": "string",
        "description": "* `pdf` - pdf\n* `docx` - docx"
      },
      "PaginatedAccountList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Account"
            }
          }
        }
      },
      "PaginatedAccountMemberList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountMember"
            }
          }
        }
      },
      "PaginatedAccountTreeList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountTree"
            }
          }
        }
      },
      "PaginatedActivityList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Activity"
            }
          }
        }
      },
      "PaginatedActivityTypeList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActivityType"
            }
          }
        }
      },
      "PaginatedAddressList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          }
        }
      },
      "PaginatedAuditLogList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuditLog"
            }
          }
        }
      },
      "PaginatedAvailabilityOverrideList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AvailabilityOverride"
            }
          }
        }
      },
      "PaginatedAvailabilityRuleList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AvailabilityRule"
            }
          }
        }
      },
      "PaginatedBankAccountList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BankAccount"
            }
          }
        }
      },
      "PaginatedBankStatementImportList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BankStatementImport"
            }
          }
        }
      },
      "PaginatedBankTransactionListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BankTransactionList"
            }
          }
        }
      },
      "PaginatedBookingList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Booking"
            }
          }
        }
      },
      "PaginatedCandidateList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Candidate"
            }
          }
        }
      },
      "PaginatedCaseActionList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseAction"
            }
          }
        }
      },
      "PaginatedCaseFileList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseFile"
            }
          }
        }
      },
      "PaginatedCaseFolderList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseFolder"
            }
          }
        }
      },
      "PaginatedCaseLinkedDocumentList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseLinkedDocument"
            }
          }
        }
      },
      "PaginatedCaseListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseList"
            }
          }
        }
      },
      "PaginatedCasePartyList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseParty"
            }
          }
        }
      },
      "PaginatedCaseTagList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseTag"
            }
          }
        }
      },
      "PaginatedCaseTypeList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseType"
            }
          }
        }
      },
      "PaginatedClinicalFileList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClinicalFile"
            }
          }
        }
      },
      "PaginatedClinicalFolderList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClinicalFolder"
            }
          }
        }
      },
      "PaginatedConsentTemplateList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConsentTemplate"
            }
          }
        }
      },
      "PaginatedContactPersonList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactPerson"
            }
          }
        }
      },
      "PaginatedContractList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Contract"
            }
          }
        }
      },
      "PaginatedCourtList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Court"
            }
          }
        }
      },
      "PaginatedCreditNoteList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNote"
            }
          }
        }
      },
      "PaginatedCustomerList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Customer"
            }
          }
        }
      },
      "PaginatedDealListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DealList"
            }
          }
        }
      },
      "PaginatedDepartmentList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Department"
            }
          }
        }
      },
      "PaginatedDiagnosisList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Diagnosis"
            }
          }
        }
      },
      "PaginatedDocumentLineList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLine"
            }
          }
        }
      },
      "PaginatedDocumentRequirementList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentRequirement"
            }
          }
        }
      },
      "PaginatedDocumentSeriesList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentSeries"
            }
          }
        }
      },
      "PaginatedDocumentTemplateList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentTemplate"
            }
          }
        }
      },
      "PaginatedEmailTemplateList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailTemplate"
            }
          }
        }
      },
      "PaginatedEmployeeDocumentList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmployeeDocument"
            }
          }
        }
      },
      "PaginatedEmployeeListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmployeeList"
            }
          }
        }
      },
      "PaginatedEpisodeListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EpisodeList"
            }
          }
        }
      },
      "PaginatedEventTypeList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          }
        }
      },
      "PaginatedExpenseCategoryList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseCategory"
            }
          }
        }
      },
      "PaginatedExpenseListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseList"
            }
          }
        }
      },
      "PaginatedExpensePaymentList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpensePayment"
            }
          }
        }
      },
      "PaginatedExpensePaymentMethodList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpensePaymentMethod"
            }
          }
        }
      },
      "PaginatedExternalInvoiceList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalInvoice"
            }
          }
        }
      },
      "PaginatedFeatureList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Feature"
            }
          }
        }
      },
      "PaginatedFiscalYearList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FiscalYear"
            }
          }
        }
      },
      "PaginatedFixedAssetList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FixedAsset"
            }
          }
        }
      },
      "PaginatedHolidayList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Holiday"
            }
          }
        }
      },
      "PaginatedImportJobList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportJob"
            }
          }
        }
      },
      "PaginatedImportRowList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportRow"
            }
          }
        }
      },
      "PaginatedImportTypeList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportType"
            }
          }
        }
      },
      "PaginatedIncomeCategoryList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IncomeCategory"
            }
          }
        }
      },
      "PaginatedInformedConsentList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InformedConsent"
            }
          }
        }
      },
      "PaginatedInvoiceDesignList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDesign"
            }
          }
        }
      },
      "PaginatedInvoiceListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceList"
            }
          }
        }
      },
      "PaginatedInvoicePaymentMethodList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoicePaymentMethod"
            }
          }
        }
      },
      "PaginatedInvoiceTemplateList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceTemplate"
            }
          }
        }
      },
      "PaginatedJournalEntryListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JournalEntryList"
            }
          }
        }
      },
      "PaginatedJurisdictionList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Jurisdiction"
            }
          }
        }
      },
      "PaginatedLeadListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadList"
            }
          }
        }
      },
      "PaginatedLeadSourceList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadSource"
            }
          }
        }
      },
      "PaginatedLeaveBalanceList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeaveBalance"
            }
          }
        }
      },
      "PaginatedLeaveRequestList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeaveRequest"
            }
          }
        }
      },
      "PaginatedLeaveTypeList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeaveType"
            }
          }
        }
      },
      "PaginatedNoteList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Note"
            }
          }
        }
      },
      "PaginatedOrganizationTaxConfigList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrganizationTaxConfig"
            }
          }
        }
      },
      "PaginatedPatientAllergyList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PatientAllergy"
            }
          }
        }
      },
      "PaginatedPatientBackgroundList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PatientBackground"
            }
          }
        }
      },
      "PaginatedPatientListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PatientList"
            }
          }
        }
      },
      "PaginatedPaymentList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Payment"
            }
          }
        }
      },
      "PaginatedPaymentTermList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentTerm"
            }
          }
        }
      },
      "PaginatedPayrollRecordList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PayrollRecord"
            }
          }
        }
      },
      "PaginatedPipelineList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Pipeline"
            }
          }
        }
      },
      "PaginatedPipelineStageList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PipelineStage"
            }
          }
        }
      },
      "PaginatedPlanListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanList"
            }
          }
        }
      },
      "PaginatedPositionList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Position"
            }
          }
        }
      },
      "PaginatedPractitionerList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Practitioner"
            }
          }
        }
      },
      "PaginatedProductList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Product"
            }
          }
        }
      },
      "PaginatedProformaList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Proforma"
            }
          }
        }
      },
      "PaginatedPurchaseOrderList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrder"
            }
          }
        }
      },
      "PaginatedQuoteList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Quote"
            }
          }
        }
      },
      "PaginatedReconciliationRuleList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReconciliationRule"
            }
          }
        }
      },
      "PaginatedRecurringInvoiceList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecurringInvoice"
            }
          }
        }
      },
      "PaginatedRegistroFacturaList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegistroFactura"
            }
          }
        }
      },
      "PaginatedScanJobListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScanJobList"
            }
          }
        }
      },
      "PaginatedScanResultList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScanResult"
            }
          }
        }
      },
      "PaginatedSignatureRequestListList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SignatureRequestList"
            }
          }
        }
      },
      "PaginatedSistemaInformaticoList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SistemaInformatico"
            }
          }
        }
      },
      "PaginatedSmsCreditBundleList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SmsCreditBundle"
            }
          }
        }
      },
      "PaginatedSmsUsageLogList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SmsUsageLog"
            }
          }
        }
      },
      "PaginatedSpanishTaxRateList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SpanishTaxRate"
            }
          }
        }
      },
      "PaginatedSpanishTaxRegimeList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SpanishTaxRegime"
            }
          }
        }
      },
      "PaginatedSpecialtyList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Specialty"
            }
          }
        }
      },
      "PaginatedSuggestionResultList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SuggestionResult"
            }
          }
        }
      },
      "PaginatedSupplierList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Supplier"
            }
          }
        }
      },
      "PaginatedTagList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tag"
            }
          }
        }
      },
      "PaginatedTaxTemplateList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaxTemplate"
            }
          }
        }
      },
      "PaginatedTimeEntryList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TimeEntry"
            }
          }
        }
      },
      "PaginatedTimeTrackingQRList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TimeTrackingQR"
            }
          }
        }
      },
      "PaginatedTreatmentList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Treatment"
            }
          }
        }
      },
      "PaginatedUnitList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Unit"
            }
          }
        }
      },
      "PaginatedUsageRecordList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageRecord"
            }
          }
        }
      },
      "PaginatedVatSettlementList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VatSettlement"
            }
          }
        }
      },
      "PaginatedVendorBillList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VendorBill"
            }
          }
        }
      },
      "PaginatedVendorPaymentList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VendorPayment"
            }
          }
        }
      },
      "PaginatedVitalSignsList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VitalSigns"
            }
          }
        }
      },
      "PaginatedWebhookDeliveryList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookDelivery"
            }
          }
        }
      },
      "PaginatedWebhookEndpointList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEndpoint"
            }
          }
        }
      },
      "PaginatedWebhookEventList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEvent"
            }
          }
        }
      },
      "PaginatedWorkCenterList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkCenter"
            }
          }
        }
      },
      "PaginatedWorkScheduleList": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "example": 123
          },
          "next": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=4"
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "format": "uri",
            "example": "http://api.example.org/accounts/?page=2"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkSchedule"
            }
          }
        }
      },
      "PartyTypeEnum": {
        "enum": [
          "person",
          "company"
        ],
        "type": "string",
        "description": "* `person` - Persona física\n* `company` - Persona jurídica"
      },
      "PatchedAccountRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "minLength": 1,
            "pattern": "^\\d{1,12}$",
            "maxLength": 12
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string"
          },
          "account_type": {
            "$ref": "#/components/schemas/AccountTypeEnum"
          },
          "group": {
            "$ref": "#/components/schemas/GroupEnum"
          },
          "parent": {
            "type": "integer",
            "nullable": true
          },
          "is_active": {
            "type": "boolean"
          },
          "is_contra": {
            "type": "boolean",
            "description": "Cuenta compensadora (amortización acumulada, deterioros): saldo acreedor que resta en el activo del balance."
          }
        }
      },
      "PatchedAccountingConfigurationRequest": {
        "type": "object",
        "properties": {
          "auto_generate_entries": {
            "type": "boolean",
            "description": "Generar asientos automáticos al emitir facturas / confirmar gastos."
          },
          "lock_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de bloqueo: no se pueden crear, modificar ni borrar asientos ni documentos fechados en esa fecha o antes."
          },
          "auto_lock_on_vat_settlement": {
            "type": "boolean",
            "description": "Al contabilizar una liquidación de IVA, bloquear automáticamente hasta el fin del periodo."
          },
          "payment_method_accounts": {
            "description": "Cuenta de tesorería por método de pago: {\"invoice:<id>\": account_id, \"expense:<id>\": account_id}. Sin mapeo: 570 si el método es efectivo/caja, si no 572."
          },
          "prior_year_error_threshold": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe a partir del cual un gasto o ingreso fechado en un ejercicio ya cerrado se contabiliza contra 113 Reservas voluntarias (error de ejercicios anteriores, NRV 22ª) en lugar de en 6xx/7xx del ejercicio abierto. Vacío = siempre 6xx/7xx."
          },
          "default_sales_account": {
            "type": "integer",
            "nullable": true,
            "description": "705 – Prestaciones de servicios"
          },
          "default_sales_goods_account": {
            "type": "integer",
            "nullable": true,
            "description": "700 – Ventas de mercaderías"
          },
          "default_purchase_account": {
            "type": "integer",
            "nullable": true,
            "description": "600 – Compras de mercaderías (bienes)"
          },
          "default_services_account": {
            "type": "integer",
            "nullable": true,
            "description": "629 – Otros servicios (gastos sin cuenta propia)"
          },
          "default_customer_account": {
            "type": "integer",
            "nullable": true,
            "description": "430 – Clientes (padre de las subcuentas 4300xxxx)"
          },
          "default_supplier_account": {
            "type": "integer",
            "nullable": true,
            "description": "400 – Proveedores (padre de las subcuentas 4000xxxx)"
          },
          "default_creditor_account": {
            "type": "integer",
            "nullable": true,
            "description": "410 – Acreedores por prestaciones de servicios (4100xxxx)"
          },
          "default_vat_output_account": {
            "type": "integer",
            "nullable": true,
            "description": "477 – HP IVA repercutido"
          },
          "default_vat_input_account": {
            "type": "integer",
            "nullable": true,
            "description": "472 – HP IVA soportado"
          },
          "default_vat_deferred_account": {
            "type": "integer",
            "nullable": true,
            "description": "4729 – HP IVA soportado pendiente de deducir"
          },
          "default_bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "572 – Bancos"
          },
          "default_cash_account": {
            "type": "integer",
            "nullable": true,
            "description": "570 – Caja"
          },
          "default_withholding_account": {
            "type": "integer",
            "nullable": true,
            "description": "4751 – HP acreedora por retenciones practicadas"
          },
          "default_surcharge_account": {
            "type": "integer",
            "nullable": true,
            "description": "4771 – HP recargo de equivalencia repercutido"
          }
        }
      },
      "PatchedActivityRequest": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "activity_type": {
            "type": "integer",
            "nullable": true
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "scheduled_at": {
            "type": "string",
            "format": "date-time"
          },
          "is_completed": {
            "type": "boolean"
          },
          "deal": {
            "type": "integer",
            "nullable": true
          },
          "lead": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "assigned_to": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "PatchedActivityTypeRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "icon": {
            "type": "string",
            "maxLength": 50
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          },
          "is_default": {
            "type": "boolean"
          }
        }
      },
      "PatchedAddressRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "line1": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "line2": {
            "type": "string",
            "maxLength": 200
          },
          "city": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "postal_code": {
            "type": "string",
            "minLength": 1,
            "pattern": "^[A-Za-z0-9\\-\\s]+$",
            "maxLength": 12
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "attention": {
            "type": "string",
            "maxLength": 100
          }
        }
      },
      "PatchedAgendaSettingsRequest": {
        "type": "object",
        "properties": {
          "booking_page_slug": {
            "type": "string",
            "minLength": 1,
            "description": "Slug único global para la URL pública de reserva",
            "maxLength": 100,
            "pattern": "^[-a-zA-Z0-9_]+$"
          },
          "default_timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "booking_future_days": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Cuántos días en el futuro se puede reservar"
          },
          "min_notice_hours": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Horas mínimas de antelación para reservar"
          },
          "cancellation_policy": {
            "type": "string",
            "description": "Política de cancelación mostrada al reservar"
          }
        }
      },
      "PatchedAvailabilityOverrideRequest": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "is_available": {
            "type": "boolean",
            "description": "False = día libre, True = horario especial"
          },
          "start_time": {
            "type": "string",
            "format": "time",
            "nullable": true
          },
          "end_time": {
            "type": "string",
            "format": "time",
            "nullable": true
          },
          "reason": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "PatchedAvailabilityRuleRequest": {
        "type": "object",
        "properties": {
          "event_type": {
            "type": "integer",
            "nullable": true,
            "description": "NULL = regla global de la organización"
          },
          "day_of_week": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "0=Lunes … 6=Domingo"
          },
          "start_time": {
            "type": "string",
            "format": "time"
          },
          "end_time": {
            "type": "string",
            "format": "time"
          },
          "is_active": {
            "type": "boolean"
          }
        }
      },
      "PatchedBankAccountRequest": {
        "type": "object",
        "description": "Cuenta bancaria o de caja. ``iban`` se valida (dígitos de control) y se guarda sin\nespacios; ``accounting_account`` es la subcuenta 572xxxx/570xxxx que se crea sola.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "kind": {
            "$ref": "#/components/schemas/BankAccountKindEnum"
          },
          "iban": {
            "type": "string",
            "description": "IBAN normalizado (sin espacios).",
            "maxLength": 34
          },
          "bic": {
            "type": "string",
            "maxLength": 11
          },
          "bank_name": {
            "type": "string",
            "maxLength": 120
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "is_default": {
            "type": "boolean"
          },
          "is_active": {
            "type": "boolean"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedBookingRequest": {
        "type": "object",
        "properties": {
          "event_type": {
            "type": "integer"
          },
          "start_datetime": {
            "type": "string",
            "format": "date-time"
          },
          "end_datetime": {
            "type": "string",
            "format": "date-time"
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "status": {
            "$ref": "#/components/schemas/BookingStatusEnum"
          },
          "booker_name": {
            "type": "string",
            "default": "",
            "maxLength": 200
          },
          "booker_email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "default": "",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "booker_phone": {
            "type": "string",
            "maxLength": 50
          },
          "patient": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "answers": {
            "description": "Respuestas a las preguntas custom del tipo de evento"
          },
          "notes": {
            "type": "string"
          },
          "cancellation_reason": {
            "type": "string"
          }
        }
      },
      "PatchedCRMSettingsRequest": {
        "type": "object",
        "properties": {
          "default_pipeline": {
            "type": "integer",
            "nullable": true
          },
          "default_currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "auto_create_customer_on_conversion": {
            "type": "boolean"
          }
        }
      },
      "PatchedCaseActionRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "action_date": {
            "type": "string",
            "format": "date-time"
          },
          "deadline": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/CaseActionStatusEnum"
          },
          "priority": {
            "$ref": "#/components/schemas/PriorityEnum"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedCaseDetailRequest": {
        "type": "object",
        "properties": {
          "reference": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "case_type": {
            "type": "integer",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/CaseStatusEnum"
          },
          "priority": {
            "$ref": "#/components/schemas/PriorityEnum"
          },
          "customer": {
            "type": "integer"
          },
          "open_date": {
            "type": "string",
            "format": "date"
          },
          "close_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "has_judicial_data": {
            "type": "boolean"
          },
          "court": {
            "type": "integer",
            "nullable": true
          },
          "court_case_number": {
            "type": "string",
            "maxLength": 100
          },
          "jurisdiction": {
            "type": "integer",
            "nullable": true
          },
          "opposing_party": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "tag_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "writeOnly": true
            },
            "writeOnly": true
          }
        }
      },
      "PatchedCaseFileRequest": {
        "type": "object",
        "description": "Limita los FK a modelos SIN campo ``organization`` propio (carpetas de un\nexpediente/paciente, etapas…) a los de la organización activa, a través de\nsu padre: ``org_scoped_related_fields = {\"parent\": \"patient__organization\"}``.\n\nUn id de otra organización responde 400 (``does_not_exist``) en lugar de\naceptarse (fuga entre organizaciones). La coherencia con el padre concreto\n(misma carpeta del mismo paciente) la valida la vista.",
        "properties": {
          "folder": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "file": {
            "type": "string",
            "format": "binary"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedCaseFolderRequest": {
        "type": "object",
        "description": "Limita los FK a modelos SIN campo ``organization`` propio (carpetas de un\nexpediente/paciente, etapas…) a los de la organización activa, a través de\nsu padre: ``org_scoped_related_fields = {\"parent\": \"patient__organization\"}``.\n\nUn id de otra organización responde 400 (``does_not_exist``) en lugar de\naceptarse (fuga entre organizaciones). La coherencia con el padre concreto\n(misma carpeta del mismo paciente) la valida la vista.",
        "properties": {
          "parent": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          }
        }
      },
      "PatchedCaseLinkedDocumentRequest": {
        "type": "object",
        "properties": {
          "document_type": {
            "$ref": "#/components/schemas/CaseLinkedDocumentTypeEnum"
          },
          "quote": {
            "type": "integer",
            "nullable": true
          },
          "proforma": {
            "type": "integer",
            "nullable": true
          },
          "invoice": {
            "type": "integer",
            "nullable": true
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedCasePartyRequest": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "role": {
            "$ref": "#/components/schemas/RoleEnum"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedCaseTagRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          }
        }
      },
      "PatchedCaseTypeRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          },
          "icon": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "is_default": {
            "type": "boolean"
          },
          "reference_prefix": {
            "type": "string",
            "maxLength": 20
          },
          "reference_suffix": {
            "type": "string",
            "maxLength": 20
          }
        }
      },
      "PatchedClinicaSettingsRequest": {
        "type": "object",
        "properties": {
          "reference_prefix": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "reference_suffix": {
            "type": "string",
            "maxLength": 20
          },
          "next_reference_number": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "reference_padding": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "patient_reference_prefix": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "next_patient_number": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "default_episode_duration": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Duración por defecto de un episodio en minutos"
          },
          "episode_fields_config": {
            "description": "Campos visibles en la consulta y su orden"
          }
        }
      },
      "PatchedClinicalFileRequest": {
        "type": "object",
        "description": "Limita los FK a modelos SIN campo ``organization`` propio (carpetas de un\nexpediente/paciente, etapas…) a los de la organización activa, a través de\nsu padre: ``org_scoped_related_fields = {\"parent\": \"patient__organization\"}``.\n\nUn id de otra organización responde 400 (``does_not_exist``) en lugar de\naceptarse (fuga entre organizaciones). La coherencia con el padre concreto\n(misma carpeta del mismo paciente) la valida la vista.",
        "properties": {
          "episode": {
            "type": "integer",
            "nullable": true
          },
          "folder": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "file": {
            "type": "string",
            "format": "binary"
          },
          "document_type": {
            "$ref": "#/components/schemas/ClinicalFileDocumentTypeEnum"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedClinicalFolderRequest": {
        "type": "object",
        "description": "Limita los FK a modelos SIN campo ``organization`` propio (carpetas de un\nexpediente/paciente, etapas…) a los de la organización activa, a través de\nsu padre: ``org_scoped_related_fields = {\"parent\": \"patient__organization\"}``.\n\nUn id de otra organización responde 400 (``does_not_exist``) en lugar de\naceptarse (fuga entre organizaciones). La coherencia con el padre concreto\n(misma carpeta del mismo paciente) la valida la vista.",
        "properties": {
          "parent": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          }
        }
      },
      "PatchedConsentTemplateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "description": "Texto del consentimiento (HTML)"
          },
          "consent_type": {
            "type": "string",
            "maxLength": 100
          },
          "is_active": {
            "type": "boolean"
          },
          "version": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          }
        }
      },
      "PatchedContactPersonRequest": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "supplier": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "role": {
            "type": "string",
            "maxLength": 80
          }
        }
      },
      "PatchedContractRequest": {
        "type": "object",
        "properties": {
          "employee": {
            "type": "integer"
          },
          "contract_type": {
            "$ref": "#/components/schemas/ContractTypeEnum"
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "hours_per_week": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "gross_annual_salary": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "gross_monthly_salary": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "number_of_payments": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "Nº pagas anuales (12 o 14)"
          },
          "trial_period_days": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "document": {
            "type": "string",
            "format": "binary",
            "nullable": true
          },
          "is_current": {
            "type": "boolean"
          }
        }
      },
      "PatchedCourtRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "address": {
            "type": "string"
          },
          "city": {
            "type": "string",
            "maxLength": 150
          },
          "province": {
            "type": "string",
            "maxLength": 150
          },
          "phone": {
            "type": "string",
            "maxLength": 50
          },
          "jurisdictions": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedCreditNoteRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLineRequest"
            },
            "writeOnly": true
          },
          "original_invoice": {
            "type": "integer"
          }
        }
      },
      "PatchedCustomerRequest": {
        "type": "object",
        "properties": {
          "legal_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "trade_name": {
            "type": "string",
            "maxLength": 200
          },
          "vat_id": {
            "type": "string",
            "maxLength": 20
          },
          "vat_id_type": {
            "description": "Tipo de documento de identificación fiscal (L7 AEAT). Vacío = NIF/CIF español.\n\n* `` - NIF/CIF español\n* `02` - NIF-IVA intracomunitario\n* `03` - Pasaporte\n* `04` - Documento oficial de identificación\n* `05` - Certificado de residencia\n* `06` - Otro documento probatorio\n* `07` - No censado",
            "oneOf": [
              {
                "$ref": "#/components/schemas/VatIdTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "website": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 200
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "party_type": {
            "$ref": "#/components/schemas/PartyTypeEnum"
          },
          "billing_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AddressRequest"
              }
            ],
            "nullable": true
          },
          "shipping_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AddressRequest"
              }
            ],
            "nullable": true
          },
          "fiscal_country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "fiscal_province": {
            "type": "string",
            "maxLength": 100
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "default_payment_method": {
            "$ref": "#/components/schemas/VendorPaymentMethodEnum"
          },
          "iban": {
            "type": "string",
            "maxLength": 34
          },
          "mandate_reference": {
            "type": "string",
            "maxLength": 64
          },
          "sepa_mandate_signed_at": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "language": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10
          },
          "notes": {
            "type": "string"
          },
          "client_number": {
            "type": "string",
            "description": "Número de cliente interno asignado por la organización (opcional).",
            "maxLength": 50
          },
          "is_public_entity": {
            "type": "boolean",
            "description": "Indica si es una administración pública u organismo oficial."
          },
          "office_code": {
            "type": "string",
            "description": "Identificador de la unidad administrativa (delegación, secretaría, subdelegación, etc.) para distinguir entidades con el mismo CIF.",
            "maxLength": 150
          },
          "dir3_unit": {
            "type": "string"
          },
          "dir3_organ": {
            "type": "string"
          },
          "dir3_office": {
            "type": "string"
          }
        }
      },
      "PatchedDealDetailRequest": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "pipeline": {
            "type": "integer"
          },
          "stage": {
            "type": "integer"
          },
          "status": {
            "$ref": "#/components/schemas/DealStatusEnum"
          },
          "lead": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer"
          },
          "contact": {
            "type": "integer",
            "nullable": true
          },
          "assigned_to": {
            "type": "integer",
            "nullable": true
          },
          "expected_close_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "probability": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "lost_reason": {
            "type": "string"
          },
          "tag_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "writeOnly": true
            },
            "writeOnly": true
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedDepartmentRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "description": {
            "type": "string"
          },
          "manager": {
            "type": "integer",
            "nullable": true
          },
          "parent": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "PatchedDiagnosisRequest": {
        "type": "object",
        "properties": {
          "icd11_code": {
            "type": "integer",
            "nullable": true
          },
          "code_manual": {
            "type": "string",
            "description": "Código manual si no hay match CIE-11",
            "maxLength": 20
          },
          "title": {
            "type": "string",
            "maxLength": 500
          },
          "description": {
            "type": "string"
          },
          "diagnosis_type": {
            "$ref": "#/components/schemas/DiagnosisTypeEnum"
          },
          "status": {
            "$ref": "#/components/schemas/DiagnosisStatusEnum"
          },
          "onset_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "resolution_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedDocumentRequirementRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/DocumentRequirementStatusEnum"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "sent_to_email": {
            "type": "string",
            "format": "email",
            "minLength": 1,
            "maxLength": 254
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedDocumentSeriesRequest": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/DocumentSeriesTypeEnum"
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "description": "Código corto de la serie (p.ej., F, PRES).",
            "maxLength": 16
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "Nombre interno de la serie.",
            "maxLength": 60
          },
          "prefix": {
            "type": "string",
            "description": "Prefijo del número. Soporta {YYYY}, {YY}, {MM}.",
            "maxLength": 40
          },
          "suffix": {
            "type": "string",
            "maxLength": 20
          },
          "pad_length": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 1
          },
          "reset_policy": {
            "$ref": "#/components/schemas/ResetPolicyEnum"
          },
          "next_number": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "last_reset_period": {
            "type": "string",
            "description": "Periodo de último reset según política: '' | YYYY | YYYYMM",
            "maxLength": 6
          }
        }
      },
      "PatchedDocumentTemplateUploadRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "module": {
            "$ref": "#/components/schemas/ModuleEnum"
          },
          "file": {
            "type": "string",
            "format": "binary"
          },
          "is_active": {
            "type": "boolean"
          }
        }
      },
      "PatchedEmailTemplateRequest": {
        "type": "object",
        "description": "Serializador para plantillas de email.",
        "properties": {
          "doc_type": {
            "$ref": "#/components/schemas/EmailTemplateDocTypeEnum"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "is_default": {
            "type": "boolean"
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "body_html": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "PatchedEmployeeDetailRequest": {
        "type": "object",
        "properties": {
          "first_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "last_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "dni_nie": {
            "type": "string",
            "title": "DNI/NIE",
            "maxLength": 20
          },
          "ss_number": {
            "type": "string",
            "title": "Nº Seguridad Social",
            "maxLength": 20
          },
          "birth_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "nationality": {
            "type": "string",
            "maxLength": 50
          },
          "gender": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/EmployeeGenderEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "marital_status": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MaritalStatusEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "personal_email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "personal_phone": {
            "type": "string",
            "maxLength": 20
          },
          "emergency_contact_name": {
            "type": "string",
            "maxLength": 200
          },
          "emergency_contact_phone": {
            "type": "string",
            "maxLength": 20
          },
          "address_street": {
            "type": "string",
            "maxLength": 200
          },
          "address_city": {
            "type": "string",
            "maxLength": 100
          },
          "address_province": {
            "type": "string",
            "maxLength": 100
          },
          "address_postal_code": {
            "type": "string",
            "maxLength": 10
          },
          "address_country": {
            "type": "string",
            "maxLength": 2
          },
          "photo": {
            "type": "string",
            "format": "binary",
            "nullable": true
          },
          "employee_code": {
            "type": "string",
            "maxLength": 30
          },
          "hire_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "termination_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "department": {
            "type": "integer",
            "nullable": true
          },
          "position": {
            "type": "integer",
            "nullable": true
          },
          "work_center": {
            "type": "integer",
            "nullable": true
          },
          "work_schedule": {
            "type": "integer",
            "nullable": true
          },
          "professional_category": {
            "type": "string",
            "maxLength": 100
          },
          "seniority_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "iban": {
            "type": "string",
            "maxLength": 34
          },
          "irpf_key": {
            "allOf": [
              {
                "$ref": "#/components/schemas/IrpfKeyEnum"
              }
            ],
            "title": "Clave de percepción (modelo 190)",
            "description": "Clave con la que se declaran sus retribuciones en el modelo 190: «A» rendimientos del trabajo de empleados; «E» retribuciones de administradores y consejeros (retención del 35 %, o del 19 % si la cifra de negocios de la entidad es inferior a 100.000 €).\n\n* `A` - A — Empleado por cuenta ajena\n* `E` - E — Consejero o administrador"
          },
          "irpf_subkey": {
            "title": "Subclave (modelo 190)",
            "description": "Sólo para la clave E (administradores): subclave del modelo 190. Vacía = E.01.\n\n* `` - Automática (E.01)\n* `01` - E.01 — Régimen general de la S. S. (asimilado)\n* `02` - E.02 — Régimen general, entidad con cifra de negocios < 100.000 €\n* `03` - E.03 — RETA, entidad con cifra de negocios < 100.000 €\n* `04` - E.04 — Resto de consejeros y administradores",
            "oneOf": [
              {
                "$ref": "#/components/schemas/IrpfSubkeyEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "family_situation": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FamilySituationEnum"
              }
            ],
            "title": "Situación familiar (modelo 190)"
          },
          "spouse_nif": {
            "type": "string",
            "title": "NIF del cónyuge",
            "description": "Sólo con situación familiar 2 (casado/a con cónyuge sin rentas superiores a 1.500 €).",
            "maxLength": 20
          },
          "disability_degree": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DisabilityDegreeEnum"
              }
            ],
            "title": "Discapacidad (modelo 190)"
          },
          "contract_relation": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ContractRelationEnum"
              }
            ],
            "title": "Contrato o relación (modelo 190)"
          },
          "geographic_mobility": {
            "type": "boolean",
            "title": "Movilidad geográfica (art. 19.2.f LIRPF)",
            "description": "Aceptó un puesto que exige cambiar de municipio de residencia (incremento de gastos deducibles)."
          },
          "housing_loan": {
            "type": "boolean",
            "title": "Comunicó pagos por préstamo de vivienda habitual",
            "description": "Reducción del tipo de retención del art. 86.1 RIRPF (adquisición de vivienda antes de 2013)."
          },
          "irpf_dependants": {
            "description": "Hijos y ascendientes comunicados por el empleado (modelo 145), para el modelo 190: `{\"hijos_menores3_total\": 1, \"hijos_menores3_entero\": 1, \"hijos_resto_total\": 0, …}`. Claves admitidas: asc_disc33_entero, asc_disc33_total, asc_disc65_entero, asc_disc65_total, asc_mayor75_entero, asc_mayor75_total, asc_menor75_entero, asc_menor75_total, asc_movred_entero, asc_movred_total, desc_disc33_entero, desc_disc33_total, desc_disc65_entero, desc_disc65_total, desc_movred_entero, desc_movred_total, hijo1_entero, hijo2_entero, hijo3_entero, hijos_menores3_entero, hijos_menores3_total, hijos_resto_entero, hijos_resto_total. Enteros de 0 a 9 (0 a 99 en hijos_resto y descendientes con discapacidad); «_entero» no puede superar «_total»."
          },
          "status": {
            "$ref": "#/components/schemas/EmployeeStatusEnum"
          }
        }
      },
      "PatchedEmployeeDocumentRequest": {
        "type": "object",
        "properties": {
          "employee": {
            "type": "integer"
          },
          "doc_type": {
            "$ref": "#/components/schemas/EmployeeDocumentTypeEnum"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "file": {
            "type": "string",
            "format": "binary"
          },
          "period_month": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "nullable": true
          },
          "period_year": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "nullable": true
          },
          "visible_to_employee": {
            "type": "boolean"
          }
        }
      },
      "PatchedEpisodeDetailRequest": {
        "type": "object",
        "properties": {
          "patient": {
            "type": "integer"
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "episode_type": {
            "$ref": "#/components/schemas/EpisodeTypeEnum"
          },
          "status": {
            "$ref": "#/components/schemas/ClinicalEpisodeStatusEnum"
          },
          "chief_complaint": {
            "type": "string",
            "description": "Motivo de consulta"
          },
          "anamnesis": {
            "type": "string",
            "description": "Antecedentes de la consulta"
          },
          "diagnostic_impression": {
            "type": "string",
            "description": "Impresión diagnóstica (texto libre o referencia CIE-11)"
          },
          "treatment_plan": {
            "type": "string",
            "description": "Plan de tratamiento"
          },
          "recommendations": {
            "type": "string",
            "description": "Recomendaciones"
          },
          "notes": {
            "type": "string",
            "description": "Notas adicionales (texto enriquecido)"
          },
          "duration_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true
          },
          "custom_fields": {
            "description": "Datos de campos de especialidad"
          },
          "is_signed": {
            "type": "boolean"
          },
          "signed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "PatchedEventTypeRequest": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[-a-zA-Z0-9_]+$"
          },
          "description": {
            "type": "string"
          },
          "duration_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "buffer_before_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "buffer_after_minutes": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          },
          "is_active": {
            "type": "boolean"
          },
          "price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Precio en la moneda indicada. NULL = gratuito"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "requires_payment": {
            "type": "boolean"
          },
          "max_bookings_per_day": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true
          },
          "confirmation_message": {
            "type": "string",
            "description": "Mensaje mostrado tras confirmar la reserva"
          },
          "link_to": {
            "allOf": [
              {
                "$ref": "#/components/schemas/LinkToEnum"
              }
            ],
            "description": "A qué entidad vincular automáticamente al reservar\n\n* `none` - Sin vincular\n* `patient` - Paciente\n* `customer` - Cliente\n* `both` - Ambos"
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "assigned_user": {
            "type": "integer",
            "nullable": true
          },
          "custom_questions": {
            "description": "Preguntas adicionales para el formulario de reserva"
          },
          "location": {
            "type": "string",
            "description": "Ubicación o enlace de videollamada",
            "maxLength": 300
          }
        }
      },
      "PatchedExpedientesSettingsRequest": {
        "type": "object",
        "properties": {
          "reference_prefix": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "reference_suffix": {
            "type": "string",
            "maxLength": 20
          },
          "next_reference_number": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "reference_padding": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          }
        }
      },
      "PatchedExpenseCategoryRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "description": "Color hexadecimal para la categoría",
            "maxLength": 7
          },
          "is_active": {
            "type": "boolean"
          },
          "default_accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de gasto (6xx) por defecto de los gastos de esta categoría."
          },
          "default_document_type": {
            "nullable": true,
            "description": "Tipo de documento por defecto de los gastos de esta categoría.\n\n* `invoice` - Factura recibida\n* `simplified_invoice` - Factura simplificada / ticket\n* `receipt` - Recibo o justificante (sin factura)\n* `settlement` - Liquidación (kilometraje, dietas, hoja de gastos)\n* `insurance_receipt` - Recibo de seguro\n* `bank_fee` - Comisión bancaria o de pasarela de pago\n* `tax_or_fee` - Tributo o tasa\n* `penalty` - Sanción o recargo (gasto excepcional)\n* `financial_interest` - Intereses de demora o financieros\n* `pass_through` - Suplido (pagado por cuenta del cliente)\n* `supplier_credit_note` - Abono / rectificativa de proveedor\n* `other` - Otro documento (no factura)",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExpenseDocumentTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          }
        }
      },
      "PatchedExpensePaymentMethodRequest": {
        "type": "object",
        "description": "Medio de pago de gastos. Puede llevar su propia cuenta: ``bank_account`` (cuenta de\ntesorería de la que salen sus pagos, p. ej. «Tarjeta Revolut SL» → cuenta Revolut) o\n``counter_account`` / ``counter_account_code`` (el dinero NO sale de la empresa, p. ej.\n«Tarjeta personal del socio» → 551). Al registrar un pago con el método se aplica\nautomáticamente si el pago no indica otra cuenta.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "auto_mark_paid": {
            "type": "boolean",
            "description": "Al confirmar un gasto con este método se registra el pago completo y pasa a pagado (tarjeta, domiciliación, PayPal, Stripe…). Desactivado para transferencias pendientes o efectivo."
          },
          "settles_on": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpensePaymentSettlesOnEnum"
              }
            ],
            "description": "Fecha del pago automático: la de la factura, la de vencimiento o manual (no se marca pagado).\n\n* `invoice_date` - Fecha de la factura\n* `due_date` - Fecha de vencimiento\n* `manual` - Manual (no se marca pagado)"
          },
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta bancaria (tesorería) de la que salen los pagos hechos con este medio (p. ej. «Tarjeta Revolut SL» → cuenta Revolut): se aplica como bank_account del pago si no se indica otra."
          },
          "counter_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de contrapartida (id) de los pagos con este medio cuando NO salen de tesorería (grupos 1, 4 o 5 salvo 57x; p. ej. 551 socio). Incompatible con bank_account."
          },
          "counter_account_code": {
            "type": "string",
            "nullable": true,
            "description": "Código de la cuenta de contrapartida (alternativa a counter_account): 551, 170, 520… En lectura, el código de la cuenta enlazada.",
            "maxLength": 12
          }
        }
      },
      "PatchedExpensePaymentRequest": {
        "type": "object",
        "description": "Pago de un gasto (``kind=expense``) o anticipo a un proveedor (``kind=advance`` con\n``supplier`` y sin ``expense``; se aplica con ``POST /expense-payments/{id}/apply/``).\nPago que NO sale de la tesorería de la empresa («pagado con…»: lo paga la financiera con un\npréstamo, el socio de su bolsillo…): indica ``counter_account`` (id) o ``counter_account_code``\n(551 socio, 170 préstamo a largo plazo, 520 deuda a corto) y el asiento será Debe proveedor /\nHaber esa cuenta; no admite ``bank_account`` ni se concilia con el banco.\n``amount`` siempre se guarda en euros. Gasto en otra divisa: con ``currency`` = divisa del\ngasto, ``amount`` va en esa divisa y ``amount_eur`` (o ``exchange_rate``) fija lo cargado en\neuros; la diferencia con lo contabilizado va a 668/768. El «pago» de un abono de proveedor\nes el reembolso recibido.",
        "properties": {
          "expense": {
            "type": "integer",
            "nullable": true
          },
          "supplier": {
            "type": "integer",
            "nullable": true,
            "description": "Proveedor del anticipo (kind=advance, sin gasto)."
          },
          "kind": {
            "$ref": "#/components/schemas/ExpensePaymentKindEnum"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Importe en euros."
          },
          "amount_eur": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe cargado en euros cuando el pago se registró en la divisa del gasto (= amount)."
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,6})?$",
            "nullable": true,
            "description": "Euros por 1 unidad de la divisa del pago (sólo pagos en divisa)."
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "payment_method": {
            "type": "integer",
            "nullable": true
          },
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta bancaria (tesorería) desde la que se pagó."
          },
          "counter_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de contrapartida (id de la cuenta contable) cuando el cobro/pago NO pasa por tesorería: el asiento la usa en lugar de la 572 (pagos: Debe proveedor / Haber contrapartida; cobros: Debe contrapartida / Haber cliente). Grupos 1, 4 o 5 excepto 57x (p. ej. 551 socio, 170 préstamo a largo plazo, 520 deuda a corto). Incompatible con bank_account; estos cobros/pagos no se concilian con el banco ni cuentan en el flujo de caja. null para quitarla."
          },
          "counter_account_code": {
            "type": "string",
            "nullable": true,
            "description": "Código de la cuenta de contrapartida (alternativa a counter_account): 551, 170, 520… En lectura, el código de la cuenta enlazada.",
            "maxLength": 12
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedExpenseRequest": {
        "type": "object",
        "description": "Gasto (factura recibida u otro justificante) con su desglose de IVA.\n\nDivisa: ``amount`` se envía en la divisa de ``currency`` y se guarda en euros;\n``exchange_rate`` = EUR por 1 unidad de divisa (BCE automático si falta).",
        "properties": {
          "supplier": {
            "type": "integer",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Vencimiento del pago (opcional)."
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Base imponible. Si currency ≠ EUR es el importe EN LA DIVISA indicada: Billora lo convierte y guarda en euros (amount en las respuestas siempre está en EUR; original_amount conserva el importe en divisa). exchange_rate = euros por 1 unidad de divisa; si no se indica se usa el cambio del BCE del día (exchange_rate_source = ecb). Alternativamente envía amount_eur (el cargo real en euros) y el cambio se deduce."
          },
          "amount_eur": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "writeOnly": true,
            "description": "Sólo con currency ≠ EUR: base realmente cargada en euros (extracto bancario). Se guarda como amount y exchange_rate se deduce (exchange_rate_source = bank_charge)."
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,6})?$",
            "nullable": true,
            "description": "Euros por 1 unidad de la divisa (sólo si currency ≠ EUR). Vacío = cambio del BCE del día."
          },
          "numero_factura": {
            "type": "string",
            "description": "Número de factura del proveedor",
            "maxLength": 50
          },
          "document_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpenseDocumentTypeEnum"
              }
            ],
            "description": "Documento que justifica el gasto. Sólo «invoice», «simplified_invoice» y «supplier_credit_note» (abono de proveedor: importes en positivo que restan) entran en los libros de IVA, el 303, el 349 y el 347; el resto no deduce IVA (coste íntegro: 629/625/626/631, 678 sanciones, 669 intereses, 555 suplidos).\n\n* `invoice` - Factura recibida\n* `simplified_invoice` - Factura simplificada / ticket\n* `receipt` - Recibo o justificante (sin factura)\n* `settlement` - Liquidación (kilometraje, dietas, hoja de gastos)\n* `insurance_receipt` - Recibo de seguro\n* `bank_fee` - Comisión bancaria o de pasarela de pago\n* `tax_or_fee` - Tributo o tasa\n* `penalty` - Sanción o recargo (gasto excepcional)\n* `financial_interest` - Intereses de demora o financieros\n* `pass_through` - Suplido (pagado por cuenta del cliente)\n* `supplier_credit_note` - Abono / rectificativa de proveedor\n* `other` - Otro documento (no factura)"
          },
          "category": {
            "type": "integer",
            "nullable": true
          },
          "tax_templates": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Impuestos aplicables (IVA, retenciones, etc.) - LEGACY"
          },
          "spanish_taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Impuestos españoles aplicables"
          },
          "tax_lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseTaxLineRequest"
            }
          },
          "other_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseOtherTaxRequest"
            },
            "description": "Otros tributos no deducibles que son coste (IPS 8 % de los seguros, hidrocarburos, aranceles/DUA, tasas). Se suman al total a pagar."
          },
          "expected_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "writeOnly": true,
            "description": "Total de la factura (en la divisa del gasto) para comprobar el cuadre: si no coincide con el total calculado (±0,01) la petición falla con 400."
          },
          "status": {
            "$ref": "#/components/schemas/ExpenseStatusEnum"
          },
          "operation_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExpenseOperationTypeEnum"
              }
            ],
            "description": "Tipo de operación a efectos de IVA (interior, intracomunitaria, ISP, importación...).\n\n* `domestic` - Operación interior\n* `intra_eu` - Adquisición intracomunitaria de bienes o servicios (UE)\n* `foreign_services` - Servicios de empresario no establecido en la UE (ISP)\n* `domestic_reverse_charge` - Inversión del sujeto pasivo interior (art. 84.Uno.2º)\n* `import` - Importación (DUA)\n* `not_subject` - No sujeta a IVA\n* `non_deductible` - IVA soportado no deducible"
          },
          "is_investment_good": {
            "type": "boolean",
            "description": "Bien de inversión (casillas 30/31, 34/35 o 38/39 del 303)."
          },
          "import_vat_deferred": {
            "type": "boolean",
            "description": "Sólo importaciones (operation_type=import): el IVA del DUA NO se paga en la aduana, se liquida en el 303 (IVA diferido, art. 167.Dos LIVA: casilla 77) y se deduce a la vez (casillas 32-35). Sin marcar, el IVA de importación se paga a la aduana / al transitario."
          },
          "operation_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de la operación (entrega o servicio) si es distinta de la de la factura (date). Sale en el libro de facturas recibidas y decide el periodo de devengo del IVA autorrepercutido (inversión del sujeto pasivo: casillas 10-13 del 303 y modelo 349)."
          },
          "deduction_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de deducción (periodo del 303): si la factura llegó tarde y el IVA se deduce en un periodo posterior (art. 99 LIVA). Vacía = el periodo de date. El libro de facturas recibidas usa siempre date."
          },
          "confirm_period_change": {
            "type": "boolean",
            "writeOnly": true,
            "default": false,
            "description": "Sólo al modificar un gasto ya contabilizado: true confirma que el cambio de date / deduction_date lo mueve a otro trimestre de IVA o de retenciones (si no, 409 period_change_requires_confirmation). Queda registrado en la auditoría."
          },
          "vat_deductible_percent": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$",
            "description": "Porcentaje del IVA soportado que se deduce (100 por defecto). Deducción parcial: p. ej. 50 en turismos y sus gastos (art. 95.Tres LIVA) o el porcentaje de afectación. La parte no deducible es mayor coste del gasto. Con 0 no se deduce nada (equivale a «IVA soportado no deducible»)."
          },
          "withholding_key": {
            "title": "Clave de la retención (modelos 111 y 190)",
            "description": "Clave y subclave del modelo 190 de la retención de esta factura. Vacía = automática (profesionales G.01, o G.03 si la retención es del 7 %; retenciones especiales K.01).\n\n* `` - Automática\n* `F01` - F.01 — Premios literarios, artísticos o científicos (trabajo)\n* `F02` - F.02 — Cursos, conferencias, coloquios y similares (trabajo)\n* `F03` - F.03 — Elaboración de obras literarias, artísticas o científicas, tipo general\n* `F04` - F.04 — Elaboración de obras literarias, artísticas o científicas, tipo reducido\n* `F05` - F.05 — Propiedad intelectual (trabajo), tipo general\n* `F06` - F.06 — Propiedad intelectual (trabajo), tipo reducido\n* `G01` - G.01 — Actividades profesionales, tipo general\n* `G02` - G.02 — Recaudadores municipales, mediadores de seguros y delegados comerciales\n* `G03` - G.03 — Actividades profesionales, tipo reducido de inicio de actividad (7 %)\n* `G04` - G.04 — Actividades profesionales, tipo del art. 95.1.d) RIRPF\n* `G05` - G.05 — Propiedad intelectual (actividad), tipo general\n* `G06` - G.06 — Propiedad intelectual (actividad), tipo reducido\n* `G07` - G.07 — Anticipos a cuenta de derechos de autor\n* `G08` - G.08 — Cesión del derecho de imagen (actividad profesional)\n* `H01` - H.01 — Actividades agrícolas, ganaderas o forestales (tipo general)\n* `H02` - H.02 — Engorde de porcino y avicultura\n* `H03` - H.03 — Actividades forestales\n* `H04` - H.04 — Actividades en estimación objetiva (art. 95.6.2.º RIRPF)\n* `J` - J — Imputación de rentas por cesión de derechos de imagen (art. 92.8 LIRPF)\n* `K01` - K.01 — Premios de juegos sin fines publicitarios\n* `K02` - K.02 — Ganancias por aprovechamientos forestales de vecinos en montes públicos\n* `K03` - K.03 — Premios de concursos con fines publicitarios",
            "oneOf": [
              {
                "$ref": "#/components/schemas/WithholdingKeyEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "supply_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SupplyTypeEnum"
              }
            ],
            "description": "Bienes o servicios: decide la clave del 349 (A/I) y las casillas del 390 en las adquisiciones intracomunitarias.\n\n* `services` - Servicios\n* `goods` - Bienes"
          },
          "service_period_start": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Inicio del periodo de servicio cubierto (seguro anual, suscripción…). Con service_period_end; si el periodo cruza el cierre del ejercicio la contabilidad periodifica (480)."
          },
          "service_period_end": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fin del periodo de servicio cubierto."
          },
          "recipient_name": {
            "type": "string",
            "description": "Destinatario que figura en el documento (lo extrae el escáner). Si no es la organización, el gasto recibe el aviso fiscal recipient_mismatch.",
            "maxLength": 200
          },
          "recipient_vat_id": {
            "type": "string",
            "description": "NIF del destinatario que figura en el documento (lo extrae el escáner).",
            "maxLength": 20
          },
          "recipient_mismatch_accepted": {
            "type": "boolean",
            "description": "El usuario ha revisado el aviso recipient_mismatch y lo da por bueno (p. ej. el destinatario es el nombre comercial de la organización)."
          },
          "payment_method": {
            "type": "integer",
            "nullable": true,
            "description": "Método de pago previsto; si tiene auto_mark_paid el gasto se marca pagado al confirmarlo."
          },
          "duplicate_of": {
            "type": "integer",
            "nullable": true,
            "description": "Gasto del que este es un posible duplicado (se rellena al crear con ?force=true)."
          },
          "rectifies": {
            "type": "integer",
            "nullable": true,
            "description": "Sólo abonos de proveedor (document_type=supplier_credit_note): factura recibida que rectifica. Si es de un periodo anterior, el 303 lo declara en las casillas 40/41."
          },
          "attachment": {
            "type": "string",
            "format": "binary",
            "nullable": true,
            "description": "Archivo escaneado del gasto (factura, ticket, etc.)"
          },
          "notes": {
            "type": "string"
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          }
        }
      },
      "PatchedExternalInvoiceRequest": {
        "type": "object",
        "description": "Registro de una factura de ingreso emitida por el cliente o un tercero.",
        "properties": {
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "number": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLineRequest"
            },
            "writeOnly": true
          },
          "rectification_code": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RectificationCodeEnum"
              }
            ],
            "writeOnly": true,
            "description": "Sólo rectificativas de facturas completas: motivo de la rectificación (R1 por defecto). Las rectificativas de facturas simplificadas son siempre R5.\n\n* `R1` - R1 — Error fundado en derecho y art. 80 Uno, Dos y Seis LIVA\n* `R2` - R2 — Art. 80.Tres LIVA (concurso)\n* `R3` - R3 — Art. 80.Cuatro LIVA (incobrables)\n* `R4` - R4 — Resto de causas"
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "is_rectifying": {
            "type": "boolean"
          },
          "rectifies": {
            "type": "integer",
            "nullable": true
          },
          "issuer_type": {
            "$ref": "#/components/schemas/ExternalIssuerTypeEnum"
          },
          "external_issuer_name": {
            "type": "string",
            "maxLength": 200
          },
          "operation_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de la operación (entrega o servicio) si es distinta de la de expedición. Aparece en la factura y en el registro VeriFactu (FechaOperacion)."
          },
          "prices_include_tax": {
            "type": "boolean",
            "description": "Los precios de las líneas incluyen el IVA (venta a consumidores): la base se obtiene del precio final para que el total cuadre al céntimo."
          },
          "external_reference": {
            "type": "string",
            "description": "Referencia externa (p. ej. nº de pedido de Shopify) para no duplicar importaciones.",
            "maxLength": 100
          },
          "fixed_asset": {
            "type": "integer",
            "nullable": true,
            "description": "Venta de inmovilizado: ficha del bien vendido (obligatoria si accounting_account es 2xx). La contabilidad da de baja coste y amortización y lleva la diferencia a 671/771."
          },
          "original_document": {
            "type": "string",
            "format": "binary",
            "writeOnly": true,
            "nullable": true
          },
          "declared_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "writeOnly": true,
            "description": "Total que figura en el documento original: si no cuadra con las líneas, se rechaza."
          }
        }
      },
      "PatchedFiscalYearRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "Ej. '2026'",
            "maxLength": 30
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date"
          }
        }
      },
      "PatchedFixedAssetRequest": {
        "type": "object",
        "properties": {
          "expense": {
            "type": "integer",
            "nullable": true,
            "description": "Gasto (bien de inversión) del que procede."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string"
          },
          "account": {
            "type": "integer",
            "description": "Cuenta de inmovilizado (20x/21x/22x)."
          },
          "depreciation_account": {
            "type": "integer",
            "description": "Cuenta de amortización acumulada (280/281/282)."
          },
          "expense_account": {
            "type": "integer",
            "description": "Cuenta de dotación (680/681/682)."
          },
          "cost": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "residual_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "description": "Puesta en funcionamiento (inicio de la amortización)."
          },
          "useful_life_months": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "method": {
            "$ref": "#/components/schemas/FixedAssetMethodEnum"
          }
        }
      },
      "PatchedHRSettingsRequest": {
        "type": "object",
        "properties": {
          "tracking_method": {
            "$ref": "#/components/schemas/TrackingMethodEnum"
          },
          "require_geolocation": {
            "type": "boolean"
          },
          "geofence_radius_meters": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "Radio en metros para geofence"
          },
          "qr_auto_renew": {
            "type": "boolean"
          },
          "qr_renew_interval_hours": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648
          },
          "max_clock_in_hours": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "Máx. horas sin fichar salida antes de alerta"
          },
          "default_leave_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$",
            "description": "Días vacaciones por defecto al año"
          }
        }
      },
      "PatchedHolidayRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "holiday_type": {
            "$ref": "#/components/schemas/HolidayTypeEnum"
          }
        }
      },
      "PatchedIncomeCategoryRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "description": "Color hexadecimal para la categoría",
            "maxLength": 7
          },
          "is_active": {
            "type": "boolean"
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de ingresos (grupo 7) de las ventas de las facturas de esta categoría."
          }
        }
      },
      "PatchedInformedConsentRequest": {
        "type": "object",
        "properties": {
          "template": {
            "type": "integer",
            "nullable": true
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "consent_type": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string"
          },
          "signed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signature_data": {
            "type": "string",
            "description": "Datos de firma (base64)"
          },
          "is_signed": {
            "type": "boolean"
          },
          "revoked_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedInvoicePaymentMethodRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          }
        }
      },
      "PatchedInvoiceRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLineRequest"
            },
            "writeOnly": true
          },
          "rectification_code": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RectificationCodeEnum"
              }
            ],
            "writeOnly": true,
            "description": "Sólo rectificativas de facturas completas: motivo de la rectificación (R1 por defecto). Las rectificativas de facturas simplificadas son siempre R5.\n\n* `R1` - R1 — Error fundado en derecho y art. 80 Uno, Dos y Seis LIVA\n* `R2` - R2 — Art. 80.Tres LIVA (concurso)\n* `R3` - R3 — Art. 80.Cuatro LIVA (incobrables)\n* `R4` - R4 — Resto de causas"
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "is_rectifying": {
            "type": "boolean"
          },
          "rectifies": {
            "type": "integer",
            "nullable": true
          },
          "is_simplified": {
            "type": "boolean",
            "description": "Factura simplificada (F2 VeriFactu). Marcar para tickets y facturas sin NIF del destinatario."
          },
          "operation_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de la operación (entrega o servicio) si es distinta de la de expedición. Aparece en la factura y en el registro VeriFactu (FechaOperacion)."
          },
          "prices_include_tax": {
            "type": "boolean",
            "description": "Los precios de las líneas incluyen el IVA (venta a consumidores): la base se obtiene del precio final para que el total cuadre al céntimo."
          },
          "external_reference": {
            "type": "string",
            "description": "Referencia externa (p. ej. nº de pedido de Shopify) para no duplicar importaciones.",
            "maxLength": 100
          },
          "fixed_asset": {
            "type": "integer",
            "nullable": true,
            "description": "Venta de inmovilizado: ficha del bien vendido (obligatoria si accounting_account es 2xx). La contabilidad da de baja coste y amortización y lleva la diferencia a 671/771."
          }
        }
      },
      "PatchedInvoiceTemplateRequest": {
        "type": "object",
        "description": "Serializador para plantillas de facturas.",
        "properties": {
          "template_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TemplateTypeEnum"
              }
            ],
            "description": "Diseño del documento (ver facturo/documents/designs.py)\n\n* `modern` - Moderna\n* `classic` - Clásica\n* `minimal` - Minimalista\n* `professional` - Profesional\n* `elegant` - Elegante\n* `bold` - Audaz\n* `stripe` - Tech\n* `compact` - Compacta\n* `corporate` - Corporativa\n* `executive` - Ejecutiva\n* `legal` - Despacho\n* `nordic` - Nórdica\n* `atelier` - Atelier\n* `monochrome` - Monocromo\n* `ledger` - Libro mayor\n* `geometric` - Geométrica\n* `sidebar` - Lateral\n* `letterhead` - Membrete\n* `banner` - Banda\n* `editorial` - Editorial\n* `startup` - Startup\n* `clinic` - Clínica\n* `industrial` - Industrial\n* `luxe` - Luxe\n* `eco` - Natural\n* `consulting` - Consultoría\n* `creative` - Agencia"
          },
          "is_active": {
            "type": "boolean",
            "description": "Solo una plantilla puede estar activa por organización"
          },
          "logo_url": {
            "nullable": true,
            "description": "URL del logo de la empresa (se mostrará en el encabezado)",
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 200
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "header_text": {
            "type": "string",
            "description": "Texto que aparece encima de la tabla de conceptos"
          },
          "footer_text": {
            "type": "string",
            "description": "Texto legal que aparece al pie del documento"
          },
          "primary_color": {
            "type": "string",
            "minLength": 1,
            "description": "Color principal de la plantilla (formato hex: #1890ff)",
            "maxLength": 7
          },
          "secondary_color": {
            "type": "string",
            "minLength": 1,
            "description": "Color secundario para fondos y bordes (formato hex: #f0f2f5)",
            "maxLength": 7
          }
        }
      },
      "PatchedJournalEntryRequest": {
        "type": "object",
        "properties": {
          "fiscal_year": {
            "type": "integer"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JournalEntryLineRequest"
            }
          }
        }
      },
      "PatchedLeadDetailRequest": {
        "type": "object",
        "description": "Restringe los campos FK a usuario (``assigned_to``…) a los miembros activos\nde la organización activa: un id de un usuario de otra organización responde\n400 (``does_not_exist``) en lugar de aceptarse y exponer su nombre/email.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "company_name": {
            "type": "string",
            "maxLength": 200
          },
          "position": {
            "type": "string",
            "maxLength": 100
          },
          "website": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 200
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "source": {
            "type": "integer",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/LeadStatusEnum"
          },
          "assigned_to": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          },
          "tag_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "writeOnly": true
            },
            "writeOnly": true
          },
          "estimated_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "notes": {
            "type": "string"
          },
          "lost_reason": {
            "type": "string"
          }
        }
      },
      "PatchedLeadSourceRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "icon": {
            "type": "string",
            "maxLength": 50
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          }
        }
      },
      "PatchedLeaveBalanceRequest": {
        "type": "object",
        "properties": {
          "employee": {
            "type": "integer"
          },
          "leave_type": {
            "type": "integer"
          },
          "year": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648
          },
          "total_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$"
          },
          "used_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$"
          },
          "pending_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$"
          }
        }
      },
      "PatchedLeaveRequestRequest": {
        "type": "object",
        "properties": {
          "employee": {
            "type": "integer"
          },
          "leave_type": {
            "type": "integer"
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedLeaveTypeRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "type": "string"
          },
          "days_per_year": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$"
          },
          "requires_approval": {
            "type": "boolean"
          },
          "paid": {
            "type": "boolean"
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          },
          "is_active": {
            "type": "boolean"
          }
        }
      },
      "PatchedNoteRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "minLength": 1
          },
          "deal": {
            "type": "integer",
            "nullable": true
          },
          "lead": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "PatchedOrganizationRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "pattern": "^[-a-zA-Z0-9_]+$"
          },
          "vat_id": {
            "type": "string",
            "description": "NIF/CIF/NIE de la organización",
            "maxLength": 20
          },
          "fiscal_address": {
            "type": "string",
            "description": "Dirección completa (campo legacy)",
            "maxLength": 255
          },
          "fiscal_street": {
            "type": "string",
            "description": "Calle y número",
            "maxLength": 200
          },
          "fiscal_city": {
            "type": "string",
            "description": "Localidad",
            "maxLength": 100
          },
          "fiscal_province": {
            "type": "string",
            "description": "Provincia",
            "maxLength": 100
          },
          "fiscal_postal_code": {
            "type": "string",
            "description": "Código postal",
            "maxLength": 10
          },
          "fiscal_country": {
            "type": "string",
            "minLength": 1,
            "description": "País (ISO-3166-1 alpha-2)",
            "maxLength": 2
          },
          "country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "default_vat_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "language": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "logo": {
            "type": "string",
            "format": "binary",
            "nullable": true
          },
          "preferences": {},
          "iban": {
            "type": "string",
            "maxLength": 34
          },
          "swift": {
            "type": "string",
            "maxLength": 11
          },
          "regime": {
            "$ref": "#/components/schemas/RegimeEnum"
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "expediente_mode": {
            "nullable": true,
            "description": "Tipo de expedientes habilitados para esta organización\n\n* `judicial` - Expedientes Judiciales\n* `clinical` - Historias Clínicas\n* `both` - Ambos",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExpedienteModeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "confirm_duplicate_vat_id": {
            "type": "boolean",
            "writeOnly": true,
            "default": false,
            "description": "Confirmación explícita para guardar un NIF que ya usa otra organización. Sólo se acepta si quien lo guarda es propietario o administrador de esa otra organización (p. ej. una organización de pruebas de la misma empresa); en cualquier otro caso el NIF duplicado se rechaza."
          },
          "roi_registered": {
            "type": "boolean",
            "description": "La empresa está inscrita en el Registro de Operadores Intracomunitarios (ROI, modelo 036). Sin el alta, los modelos 303 y 349 y los gastos intracomunitarios avisan."
          },
          "roi_since": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de alta en el ROI. Las operaciones con proveedores o clientes de la UE anteriores a esa fecha no se tratan como intracomunitarias (sin inversión del sujeto pasivo ni modelo 349). Indicarla marca roi_registered."
          }
        }
      },
      "PatchedOrganizationTaxConfigRequest": {
        "type": "object",
        "description": "Serializer para configuración de impuestos por organización.",
        "properties": {
          "default_sales_tax": {
            "type": "integer",
            "description": "Impuesto por defecto para ventas"
          },
          "default_purchase_tax": {
            "type": "integer",
            "description": "Impuesto por defecto para compras"
          },
          "default_tax_regime": {
            "type": "integer",
            "description": "Régimen fiscal por defecto para VeriFactu"
          }
        }
      },
      "PatchedPatientAllergyRequest": {
        "type": "object",
        "properties": {
          "substance": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "reaction": {
            "type": "string"
          },
          "severity": {
            "$ref": "#/components/schemas/SeverityEnum"
          },
          "diagnosed_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          }
        }
      },
      "PatchedPatientBackgroundRequest": {
        "type": "object",
        "properties": {
          "background_type": {
            "$ref": "#/components/schemas/BackgroundTypeEnum"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          }
        }
      },
      "PatchedPatientDetailRequest": {
        "type": "object",
        "properties": {
          "first_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "last_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "date_of_birth": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "gender": {
            "$ref": "#/components/schemas/PatientGenderEnum"
          },
          "id_document_type": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/IdDocumentTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "id_document_number": {
            "type": "string",
            "maxLength": 30
          },
          "phone": {
            "type": "string",
            "maxLength": 50
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "address": {
            "type": "string",
            "maxLength": 255
          },
          "city": {
            "type": "string",
            "maxLength": 100
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "postal_code": {
            "type": "string",
            "maxLength": 10
          },
          "emergency_contact_name": {
            "type": "string",
            "maxLength": 200
          },
          "emergency_contact_phone": {
            "type": "string",
            "maxLength": 50
          },
          "emergency_contact_relation": {
            "type": "string",
            "maxLength": 100
          },
          "insurance_provider": {
            "type": "string",
            "maxLength": 200
          },
          "insurance_number": {
            "type": "string",
            "maxLength": 100
          },
          "blood_type": {
            "type": "string",
            "maxLength": 5
          },
          "occupation": {
            "type": "string",
            "maxLength": 200
          },
          "notes": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "customer": {
            "type": "integer",
            "nullable": true,
            "description": "Vínculo con cliente de facturación"
          },
          "professionals": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        }
      },
      "PatchedPaymentRequest": {
        "type": "object",
        "description": "Cobro de factura (``kind=invoice``, por defecto) o anticipo de cliente\n(``kind=advance`` con ``customer`` y sin ``invoice``).\n\nCobro que NO entra en la tesorería de la empresa («cobrado con…»: compensación con la\ncuenta del socio, con un préstamo…): indica ``counter_account`` (id) o\n``counter_account_code`` (551, 170, 520…) y el asiento será Debe esa cuenta / Haber\ncliente; no admite ``bank_account`` ni se concilia con el banco.\n\nFacturas en otra divisa: ``amount`` va en la divisa de la factura; ``amount_eur``\n(o ``exchange_rate``) indica lo abonado realmente en euros y la diferencia con lo\ncontabilizado va a 768/668. Alternativa: ``currency=\"EUR\"`` con ``amount`` en euros\n(Billora calcula el importe en divisa: el pendiente si liquida la factura, o\namount / cambio de la factura). Las devoluciones (``is_refund``) y las aplicaciones\nde anticipo (``kind=advance_application``) las crean ``/invoices/{id}/cancel/?refund=true``\ny ``/payments/{id}/apply/``.",
        "properties": {
          "invoice": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer",
            "nullable": true,
            "description": "Cliente del anticipo (kind=advance, sin factura)."
          },
          "kind": {
            "$ref": "#/components/schemas/PaymentKindEnum"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "amount_eur": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe realmente abonado en euros cuando la factura está en otra divisa (vacío = EUR)."
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,6})?$",
            "nullable": true,
            "description": "Euros por 1 unidad de la divisa del cobro (sólo facturas en divisa)."
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "payment_method": {
            "type": "integer",
            "nullable": true
          },
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta bancaria (tesorería) en la que se recibió el cobro."
          },
          "counter_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de contrapartida (id de la cuenta contable) cuando el cobro/pago NO pasa por tesorería: el asiento la usa en lugar de la 572 (pagos: Debe proveedor / Haber contrapartida; cobros: Debe contrapartida / Haber cliente). Grupos 1, 4 o 5 excepto 57x (p. ej. 551 socio, 170 préstamo a largo plazo, 520 deuda a corto). Incompatible con bank_account; estos cobros/pagos no se concilian con el banco ni cuentan en el flujo de caja. null para quitarla."
          },
          "counter_account_code": {
            "type": "string",
            "nullable": true,
            "description": "Código de la cuenta de contrapartida (alternativa a counter_account): 551, 170, 520… En lectura, el código de la cuenta enlazada.",
            "maxLength": 12
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedPaymentTermRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "days": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Días al vencimiento desde issue_date"
          },
          "month_end": {
            "type": "boolean",
            "description": "Vence a fin de mes"
          },
          "custom_schedule": {
            "description": "Lista de días relativos [0,30,60]"
          }
        }
      },
      "PatchedPayrollRecordRequest": {
        "type": "object",
        "description": "``net_salary`` y ``total_cost`` son derivados (solo lectura):\n\nnet_salary = gross_salary - ss_employee - irpf - other_deductions\ntotal_cost = gross_salary + ss_employer",
        "properties": {
          "employee": {
            "type": "integer"
          },
          "period_month": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "1-12"
          },
          "period_year": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648
          },
          "gross_salary": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$"
          },
          "ss_employee": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "SS Empleado"
          },
          "irpf": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$"
          },
          "other_deductions": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$"
          },
          "ss_employer": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "SS Empresa"
          },
          "status": {
            "$ref": "#/components/schemas/PayrollStatusEnum"
          },
          "payment_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "in_kind_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "Retribución en especie (valoración)",
            "description": "Valoración de las retribuciones en especie del mes (seguro médico, vehículo, vivienda…)."
          },
          "in_kind_payment_on_account": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "Ingreso a cuenta de la retribución en especie",
            "description": "Ingreso a cuenta de la retribución en especie (casilla [06] del modelo 111)."
          },
          "in_kind_payment_passed_on": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "Ingreso a cuenta repercutido al empleado",
            "description": "Parte del ingreso a cuenta que se descuenta al empleado (inclúyela también en otras deducciones)."
          },
          "exempt_allowances": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "Dietas exceptuadas de gravamen",
            "description": "Dietas y gastos de viaje exentos (art. 9 RIRPF), fuera del salario bruto: clave L.01 del 190."
          }
        }
      },
      "PatchedPipelineRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "is_default": {
            "type": "boolean"
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          }
        }
      },
      "PatchedPipelineStageRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "probability": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Probabilidad de cierre (0-100)"
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          },
          "is_won": {
            "type": "boolean"
          },
          "is_lost": {
            "type": "boolean"
          }
        }
      },
      "PatchedPositionRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "department": {
            "type": "integer",
            "nullable": true
          },
          "description": {
            "type": "string"
          }
        }
      },
      "PatchedPractitionerRequest": {
        "type": "object",
        "properties": {
          "user": {
            "type": "integer",
            "nullable": true
          },
          "first_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "last_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "license_number": {
            "type": "string",
            "description": "Número de colegiado",
            "maxLength": 50
          },
          "specialty": {
            "type": "integer",
            "nullable": true
          },
          "professional_title": {
            "type": "string",
            "maxLength": 200
          },
          "phone": {
            "type": "string",
            "maxLength": 50
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "is_active": {
            "type": "boolean"
          }
        }
      },
      "PatchedProductRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "maxLength": 48
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/ProductTypeEnum"
          },
          "unit": {
            "type": "integer",
            "nullable": true
          },
          "barcode": {
            "type": "string",
            "maxLength": 64
          },
          "sale_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "sale_price_includes_tax": {
            "type": "boolean",
            "description": "El precio de venta es el PVP con impuestos incluidos (venta a particulares). La base se obtiene del PVP; úsalo en documentos con «precios con IVA incluido» para que el total cuadre al céntimo."
          },
          "purchase_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "tax_template": {
            "type": "integer",
            "nullable": true
          },
          "spanish_taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "discount_allowed": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          },
          "inventory_tracking": {
            "type": "boolean"
          },
          "stock_quantity": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "reorder_point": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          }
        }
      },
      "PatchedProformaRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLineRequest"
            },
            "writeOnly": true
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "PatchedPurchaseOrderRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "supplier": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/PurchaseOrderStatusEnum"
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "vendor_reference": {
            "type": "string",
            "description": "Número/factura del proveedor",
            "maxLength": 100
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseDocumentLineRequest"
            },
            "writeOnly": true
          }
        }
      },
      "PatchedQuoteRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLineRequest"
            },
            "writeOnly": true
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "PatchedReconciliationRuleRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "is_active": {
            "type": "boolean"
          },
          "priority": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Menor = se evalúa antes."
          },
          "concept_contains": {
            "description": "Textos (basta con uno) que debe contener el concepto."
          },
          "counterparty_contains": {
            "type": "string",
            "maxLength": 200
          },
          "amount_min": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe absoluto mínimo."
          },
          "amount_max": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "direction": {
            "$ref": "#/components/schemas/ReconciliationRuleDirectionEnum"
          },
          "action": {
            "$ref": "#/components/schemas/ReconciliationRuleActionEnum"
          },
          "supplier": {
            "type": "integer",
            "nullable": true
          },
          "expense_category": {
            "type": "integer",
            "nullable": true
          },
          "document_type": {
            "type": "string",
            "minLength": 1,
            "description": "Tipo de documento del gasto creado (por defecto comisión bancaria).",
            "maxLength": 20
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true
          },
          "target_bank_account": {
            "type": "integer",
            "nullable": true
          },
          "description": {
            "type": "string",
            "maxLength": 200
          },
          "auto_apply": {
            "type": "boolean",
            "description": "Aplicar sin confirmación al importar."
          }
        }
      },
      "PatchedRecurringInvoiceRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "series": {
            "type": "integer"
          },
          "interval": {
            "$ref": "#/components/schemas/IntervalEnum"
          },
          "every": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 1
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "is_active": {
            "type": "boolean"
          },
          "auto_send_pdf": {
            "type": "boolean"
          },
          "auto_charge": {
            "type": "boolean"
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecurringLineRequest"
            },
            "writeOnly": true
          }
        }
      },
      "PatchedRevolutAccountUpdateRequest": {
        "type": "object",
        "properties": {
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta bancaria de tesorería que recibe los movimientos (null = desenlazar)."
          },
          "create_bank_account": {
            "type": "boolean",
            "default": false,
            "description": "Crear una cuenta bancaria nueva para esta cuenta de Revolut."
          },
          "is_enabled": {
            "type": "boolean"
          }
        }
      },
      "PatchedRevolutConnectionWriteRequest": {
        "type": "object",
        "properties": {
          "environment": {
            "$ref": "#/components/schemas/RevolutEnvironmentEnum"
          },
          "auth_mode": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AuthModeEnum"
              }
            ],
            "description": "Método de autenticación. ``api_key`` (recomendado y por defecto en las conexiones nuevas) u ``oauth`` (certificado + consentimiento: obsoleto en Revolut). Cambiarlo obliga a volver a probar o autorizar la conexión.\n\n* `api_key` - API key\n* `oauth` - Certificado y OAuth (método antiguo)"
          },
          "api_key": {
            "type": "string",
            "writeOnly": true,
            "description": "API key creada en Revolut Business → APIs → API Console. Se guarda cifrada y nunca se devuelve (sólo ``api_key_last4``). Sustituye a la anterior.",
            "maxLength": 2000
          },
          "signing_private_key": {
            "type": "string",
            "writeOnly": true,
            "description": "Clave de firma PROPIA, alternativa a generarla con ``connection/signing-key/``: clave privada Ed25519 (contenido del fichero private.pem que crea el comando de Revolut, PKCS8 sin contraseña). Se guarda cifrada y nunca se devuelve; la respuesta trae su clave pública en ``signing_public_key``. Se puede enviar antes de tener la API key. 400 si es un certificado, la clave pública (public.pem) o una clave RSA.",
            "maxLength": 20000
          },
          "signing_enabled": {
            "type": "boolean",
            "nullable": true,
            "description": "Firmar cada petición (cabeceras ``Revolut-Api-Timestamp`` y ``Revolut-Api-Signature``). Se activa solo cuando hay clave de firma; sólo hace falta enviarlo (``false``) para dejar de firmar con una API key que no lo exige."
          },
          "client_id": {
            "type": "string",
            "description": "Client ID que muestra Revolut tras subir el certificado.",
            "maxLength": 120
          },
          "generate_keys": {
            "type": "boolean",
            "default": false,
            "description": "Generar en Billora el par de claves RSA 2048 y el certificado X509 (la respuesta trae ``certificate_pem`` para pegarlo en Revolut). Sustituye a las claves anteriores."
          },
          "private_key": {
            "type": "string",
            "writeOnly": true,
            "description": "Clave privada RSA propia (PEM sin contraseña), alternativa a generate_keys. Se guarda cifrada y nunca se devuelve.",
            "maxLength": 20000
          },
          "certificate": {
            "type": "string",
            "description": "Certificado X509 (PEM) de esa clave; si se omite se genera uno.",
            "maxLength": 20000
          },
          "redirect_uri": {
            "type": "string",
            "description": "Sólo si la redirect URI configurada en Revolut no es la de Billora (vacío = la de Billora).",
            "maxLength": 500
          },
          "scopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevolutScopeEnum"
            },
            "description": "Permisos a solicitar (por defecto READ y WRITE)."
          },
          "auto_sync": {
            "type": "boolean"
          },
          "auto_reconcile": {
            "type": "boolean"
          },
          "sync_from": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "No importar movimientos anteriores a esta fecha."
          }
        }
      },
      "PatchedScanJobRequest": {
        "type": "object",
        "description": "Serializer completo para los trabajos de escaneo.",
        "properties": {
          "original_file": {
            "type": "string",
            "format": "binary",
            "description": "Archivo original (imagen o PDF)"
          },
          "original_filename": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        }
      },
      "PatchedSignatureRequestDetailRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "document_type": {
            "$ref": "#/components/schemas/SignatureDocumentTypeEnum"
          },
          "pdf_file": {
            "type": "string",
            "format": "binary"
          },
          "signer_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "signer_email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "signer_phone": {
            "type": "string",
            "maxLength": 30
          },
          "delivery_method": {
            "$ref": "#/components/schemas/DeliveryMethodEnum"
          },
          "message": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "case": {
            "type": "integer",
            "nullable": true
          },
          "patient": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "PatchedSpecialtyRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "code": {
            "type": "string",
            "maxLength": 20
          },
          "description": {
            "type": "string"
          },
          "icon": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          },
          "custom_fields": {
            "description": "Definición de campos adicionales por especialidad"
          },
          "is_active": {
            "type": "boolean"
          }
        }
      },
      "PatchedSupplierExpenseDefaultsRequest": {
        "type": "object",
        "description": "Valores por defecto de los gastos de un proveedor (cuenta, categoría, tipo de\ndocumento y de operación) y avisos de proveedor recurrente.",
        "properties": {
          "default_accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de gasto (6xx) por defecto de las facturas de este proveedor."
          },
          "default_category": {
            "type": "integer",
            "nullable": true,
            "description": "Categoría de gasto por defecto."
          },
          "default_document_type": {
            "nullable": true,
            "description": "Tipo de documento por defecto (factura, recibo de seguro, comisión bancaria…).\n\n* `invoice` - Factura recibida\n* `simplified_invoice` - Factura simplificada / ticket\n* `receipt` - Recibo o justificante (sin factura)\n* `settlement` - Liquidación (kilometraje, dietas, hoja de gastos)\n* `insurance_receipt` - Recibo de seguro\n* `bank_fee` - Comisión bancaria o de pasarela de pago\n* `tax_or_fee` - Tributo o tasa\n* `penalty` - Sanción o recargo (gasto excepcional)\n* `financial_interest` - Intereses de demora o financieros\n* `pass_through` - Suplido (pagado por cuenta del cliente)\n* `supplier_credit_note` - Abono / rectificativa de proveedor\n* `other` - Otro documento (no factura)",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExpenseDocumentTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "default_operation_type": {
            "nullable": true,
            "description": "Tipo de operación a efectos de IVA por defecto; vacío = se deduce del país fiscal (ES → interior, UE → intracomunitaria, resto → servicios ISP).\n\n* `domestic` - Operación interior\n* `intra_eu` - Adquisición intracomunitaria de bienes o servicios (UE)\n* `foreign_services` - Servicios de empresario no establecido en la UE (ISP)\n* `domestic_reverse_charge` - Inversión del sujeto pasivo interior (art. 84.Uno.2º)\n* `import` - Importación (DUA)\n* `not_subject` - No sujeta a IVA\n* `non_deductible` - IVA soportado no deducible",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExpenseOperationTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "expected_frequency": {
            "nullable": true,
            "description": "Frecuencia con la que factura este proveedor (para avisar de facturas que faltan).\n\n* `monthly` - Mensual\n* `quarterly` - Trimestral\n* `yearly` - Anual",
            "oneOf": [
              {
                "$ref": "#/components/schemas/SupplierExpectedFrequencyEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "recurring_alerts": {
            "type": "boolean",
            "description": "Avisar de los meses sin factura y de los saltos de numeración de este proveedor."
          }
        }
      },
      "PatchedSupplierRequest": {
        "type": "object",
        "properties": {
          "legal_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "trade_name": {
            "type": "string",
            "maxLength": 200
          },
          "vat_id": {
            "type": "string",
            "maxLength": 20
          },
          "vat_id_type": {
            "description": "Tipo de documento de identificación fiscal (L7 AEAT). Vacío = NIF/CIF español.\n\n* `` - NIF/CIF español\n* `02` - NIF-IVA intracomunitario\n* `03` - Pasaporte\n* `04` - Documento oficial de identificación\n* `05` - Certificado de residencia\n* `06` - Otro documento probatorio\n* `07` - No censado",
            "oneOf": [
              {
                "$ref": "#/components/schemas/VatIdTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "website": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 200
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "party_type": {
            "$ref": "#/components/schemas/PartyTypeEnum"
          },
          "billing_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AddressRequest"
              }
            ],
            "nullable": true
          },
          "shipping_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AddressRequest"
              }
            ],
            "nullable": true
          },
          "fiscal_country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "fiscal_province": {
            "type": "string",
            "maxLength": 100
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "default_payment_method": {
            "$ref": "#/components/schemas/VendorPaymentMethodEnum"
          },
          "iban": {
            "type": "string",
            "maxLength": 34
          },
          "mandate_reference": {
            "type": "string",
            "maxLength": 64
          },
          "sepa_mandate_signed_at": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "language": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10
          },
          "notes": {
            "type": "string"
          },
          "is_public_entity": {
            "type": "boolean",
            "description": "Indica si es una administración pública u organismo oficial."
          },
          "office_code": {
            "type": "string",
            "description": "Identificador de la unidad administrativa (delegación, secretaría, subdelegación, etc.) para distinguir entidades con el mismo CIF.",
            "maxLength": 150
          },
          "dir3_unit": {
            "type": "string"
          },
          "dir3_organ": {
            "type": "string"
          },
          "dir3_office": {
            "type": "string"
          }
        }
      },
      "PatchedTagRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "slug": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^[-a-zA-Z0-9_]+$"
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          }
        }
      },
      "PatchedTaxSettingsPatchRequest": {
        "type": "object",
        "properties": {
          "withholding_criterion": {
            "$ref": "#/components/schemas/WithholdingCriterionPatchRequest"
          }
        }
      },
      "PatchedTaxTemplateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,3})?$",
            "description": "Porcentaje, p.ej. 21.000"
          },
          "kind": {
            "$ref": "#/components/schemas/TaxTemplateKindEnum"
          },
          "scope": {
            "$ref": "#/components/schemas/TaxTemplateScopeEnum"
          },
          "country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "is_compound": {
            "type": "boolean"
          },
          "components": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          "active": {
            "type": "boolean"
          }
        }
      },
      "PatchedTimeEntryRequest": {
        "type": "object",
        "properties": {
          "employee": {
            "type": "integer"
          },
          "clock_in": {
            "type": "string",
            "format": "date-time"
          },
          "clock_out": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "source": {
            "$ref": "#/components/schemas/SourceEnum"
          },
          "entry_type": {
            "$ref": "#/components/schemas/EntryTypeEnum"
          },
          "latitude": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,6})?$",
            "nullable": true
          },
          "longitude": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,6})?$",
            "nullable": true
          },
          "ip_address": {
            "type": "string",
            "nullable": true,
            "minLength": 1
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedTimeTrackingQRRequest": {
        "type": "object",
        "properties": {
          "work_center": {
            "type": "integer",
            "nullable": true
          },
          "label": {
            "type": "string",
            "maxLength": 100
          },
          "is_active": {
            "type": "boolean"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "auto_renew": {
            "type": "boolean"
          },
          "auto_renew_hours": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648
          }
        }
      },
      "PatchedTreasurySettingsRequest": {
        "type": "object",
        "properties": {
          "auto_match_threshold": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Puntuación mínima (0-100) para casar automáticamente."
          },
          "date_window_days": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Días tras la fecha de la factura/gasto en los que se buscan candidatos."
          },
          "amount_tolerance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,2})?$"
          },
          "existing_payment_days_before": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Días anteriores a la fecha del banco en los que se buscan cobros/pagos ya registrados a mano (sin cuenta bancaria) para conciliarlos en lugar de duplicarlos."
          },
          "existing_payment_days_after": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Días posteriores a la fecha del banco en los que se buscan cobros/pagos ya registrados (p. ej. pagos cargados en bloque semanas después). Los que distan más de 10 días puntúan menos y no se casan solos salvo que el concepto cite el número."
          },
          "learn_rules": {
            "type": "boolean",
            "description": "Guardar pistas al resolver movimientos a mano."
          }
        }
      },
      "PatchedTreatmentRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "treatment_type": {
            "$ref": "#/components/schemas/TreatmentTypeEnum"
          },
          "status": {
            "$ref": "#/components/schemas/TreatmentStatusEnum"
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedUnitRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "minLength": 1,
            "pattern": "^[\\w\\-\\.\\%]+$",
            "maxLength": 10
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "active": {
            "type": "boolean"
          }
        }
      },
      "PatchedVendorBillRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "supplier": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/VendorBillStatusEnum"
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "vendor_reference": {
            "type": "string",
            "description": "Número/factura del proveedor",
            "maxLength": 100
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseDocumentLineRequest"
            },
            "writeOnly": true
          }
        }
      },
      "PatchedVendorPaymentRequest": {
        "type": "object",
        "properties": {
          "bill": {
            "type": "integer"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "method": {
            "$ref": "#/components/schemas/VendorPaymentMethodEnum"
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedVitalSignsRequest": {
        "type": "object",
        "properties": {
          "patient": {
            "type": "integer"
          },
          "episode": {
            "type": "integer",
            "nullable": true
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          },
          "systolic_bp": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "mmHg"
          },
          "diastolic_bp": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "mmHg"
          },
          "heart_rate": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "bpm"
          },
          "temperature": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,1})?$",
            "nullable": true,
            "description": "°C"
          },
          "respiratory_rate": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "rpm"
          },
          "weight": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "kg"
          },
          "height": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$",
            "nullable": true,
            "description": "cm"
          },
          "oxygen_saturation": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "%"
          },
          "blood_glucose": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "mg/dL"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "PatchedWebhookEndpointRequest": {
        "type": "object",
        "description": "Endpoint SIN el secreto (el secreto sólo sale al crear, al rotar y en ``/secret/``).",
        "properties": {
          "url": {
            "type": "string",
            "minLength": 1,
            "description": "URL https pública que recibirá los eventos (POST).",
            "maxLength": 2048
          },
          "description": {
            "type": "string",
            "maxLength": 255
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "description": "Tipos de evento suscritos (ver /webhooks/event-types/) o [\"*\"] para todos."
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "metadata": {}
        }
      },
      "PatchedWorkCenterRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "address": {
            "type": "string",
            "maxLength": 300
          },
          "city": {
            "type": "string",
            "maxLength": 100
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "postal_code": {
            "type": "string",
            "maxLength": 10
          },
          "country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "latitude": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,6})?$",
            "nullable": true
          },
          "longitude": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,6})?$",
            "nullable": true
          }
        }
      },
      "PatchedWorkScheduleWriteRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "description": {
            "type": "string"
          },
          "is_default": {
            "type": "boolean"
          },
          "weekly_hours": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "days": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkScheduleDayRequest"
            }
          }
        }
      },
      "PatientAllergy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "substance": {
            "type": "string",
            "maxLength": 300
          },
          "reaction": {
            "type": "string"
          },
          "severity": {
            "$ref": "#/components/schemas/SeverityEnum"
          },
          "severity_display": {
            "type": "string",
            "readOnly": true
          },
          "diagnosed_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "severity_display",
          "substance",
          "updated_at"
        ]
      },
      "PatientAllergyRequest": {
        "type": "object",
        "properties": {
          "substance": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "reaction": {
            "type": "string"
          },
          "severity": {
            "$ref": "#/components/schemas/SeverityEnum"
          },
          "diagnosed_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "substance"
        ]
      },
      "PatientBackground": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "background_type": {
            "$ref": "#/components/schemas/BackgroundTypeEnum"
          },
          "background_type_display": {
            "type": "string",
            "readOnly": true
          },
          "title": {
            "type": "string",
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "background_type",
          "background_type_display",
          "created_at",
          "id",
          "title",
          "updated_at"
        ]
      },
      "PatientBackgroundRequest": {
        "type": "object",
        "properties": {
          "background_type": {
            "$ref": "#/components/schemas/BackgroundTypeEnum"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "background_type",
          "title"
        ]
      },
      "PatientDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "reference": {
            "type": "string",
            "readOnly": true
          },
          "first_name": {
            "type": "string",
            "maxLength": 150
          },
          "last_name": {
            "type": "string",
            "maxLength": 150
          },
          "full_name": {
            "type": "string",
            "readOnly": true
          },
          "date_of_birth": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "age": {
            "type": "integer",
            "nullable": true,
            "readOnly": true
          },
          "gender": {
            "$ref": "#/components/schemas/PatientGenderEnum"
          },
          "id_document_type": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/IdDocumentTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "id_document_number": {
            "type": "string",
            "maxLength": 30
          },
          "phone": {
            "type": "string",
            "maxLength": 50
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "address": {
            "type": "string",
            "maxLength": 255
          },
          "city": {
            "type": "string",
            "maxLength": 100
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "postal_code": {
            "type": "string",
            "maxLength": 10
          },
          "emergency_contact_name": {
            "type": "string",
            "maxLength": 200
          },
          "emergency_contact_phone": {
            "type": "string",
            "maxLength": 50
          },
          "emergency_contact_relation": {
            "type": "string",
            "maxLength": 100
          },
          "insurance_provider": {
            "type": "string",
            "maxLength": 200
          },
          "insurance_number": {
            "type": "string",
            "maxLength": 100
          },
          "blood_type": {
            "type": "string",
            "maxLength": 5
          },
          "occupation": {
            "type": "string",
            "maxLength": 200
          },
          "notes": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "customer": {
            "type": "integer",
            "nullable": true,
            "description": "Vínculo con cliente de facturación"
          },
          "customer_name": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "professionals": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "professionals_detail": {
            "type": "array",
            "items": {},
            "readOnly": true
          },
          "cloud_folder_id": {
            "type": "string",
            "readOnly": true,
            "description": "Cloud provider folder ID/path for this patient"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "age",
          "cloud_folder_id",
          "created_at",
          "customer_name",
          "first_name",
          "full_name",
          "id",
          "last_name",
          "professionals_detail",
          "reference",
          "updated_at"
        ]
      },
      "PatientDetailRequest": {
        "type": "object",
        "properties": {
          "first_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "last_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "date_of_birth": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "gender": {
            "$ref": "#/components/schemas/PatientGenderEnum"
          },
          "id_document_type": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/IdDocumentTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "id_document_number": {
            "type": "string",
            "maxLength": 30
          },
          "phone": {
            "type": "string",
            "maxLength": 50
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "address": {
            "type": "string",
            "maxLength": 255
          },
          "city": {
            "type": "string",
            "maxLength": 100
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "postal_code": {
            "type": "string",
            "maxLength": 10
          },
          "emergency_contact_name": {
            "type": "string",
            "maxLength": 200
          },
          "emergency_contact_phone": {
            "type": "string",
            "maxLength": 50
          },
          "emergency_contact_relation": {
            "type": "string",
            "maxLength": 100
          },
          "insurance_provider": {
            "type": "string",
            "maxLength": 200
          },
          "insurance_number": {
            "type": "string",
            "maxLength": 100
          },
          "blood_type": {
            "type": "string",
            "maxLength": 5
          },
          "occupation": {
            "type": "string",
            "maxLength": 200
          },
          "notes": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "customer": {
            "type": "integer",
            "nullable": true,
            "description": "Vínculo con cliente de facturación"
          },
          "professionals": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        },
        "required": [
          "first_name",
          "last_name"
        ]
      },
      "PatientGenderEnum": {
        "enum": [
          "male",
          "female",
          "other",
          "unknown"
        ],
        "type": "string",
        "description": "* `male` - Masculino\n* `female` - Femenino\n* `other` - Otro\n* `unknown` - No especificado"
      },
      "PatientHistory": {
        "type": "object",
        "properties": {
          "episodes": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          },
          "vital_signs": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          },
          "consents": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "consents",
          "episodes",
          "vital_signs"
        ]
      },
      "PatientList": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "reference": {
            "type": "string",
            "maxLength": 50
          },
          "first_name": {
            "type": "string",
            "maxLength": 150
          },
          "last_name": {
            "type": "string",
            "maxLength": 150
          },
          "full_name": {
            "type": "string",
            "readOnly": true
          },
          "date_of_birth": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "age": {
            "type": "integer",
            "nullable": true,
            "readOnly": true
          },
          "gender": {
            "$ref": "#/components/schemas/PatientGenderEnum"
          },
          "phone": {
            "type": "string",
            "maxLength": 50
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "customer": {
            "type": "integer",
            "nullable": true,
            "description": "Vínculo con cliente de facturación"
          },
          "customer_name": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "is_active": {
            "type": "boolean"
          },
          "professionals": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "readOnly": true
          },
          "episode_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "age",
          "created_at",
          "customer_name",
          "episode_count",
          "first_name",
          "full_name",
          "id",
          "last_name",
          "professionals",
          "reference",
          "updated_at"
        ]
      },
      "Payment": {
        "type": "object",
        "description": "Cobro de factura (``kind=invoice``, por defecto) o anticipo de cliente\n(``kind=advance`` con ``customer`` y sin ``invoice``).\n\nCobro que NO entra en la tesorería de la empresa («cobrado con…»: compensación con la\ncuenta del socio, con un préstamo…): indica ``counter_account`` (id) o\n``counter_account_code`` (551, 170, 520…) y el asiento será Debe esa cuenta / Haber\ncliente; no admite ``bank_account`` ni se concilia con el banco.\n\nFacturas en otra divisa: ``amount`` va en la divisa de la factura; ``amount_eur``\n(o ``exchange_rate``) indica lo abonado realmente en euros y la diferencia con lo\ncontabilizado va a 768/668. Alternativa: ``currency=\"EUR\"`` con ``amount`` en euros\n(Billora calcula el importe en divisa: el pendiente si liquida la factura, o\namount / cambio de la factura). Las devoluciones (``is_refund``) y las aplicaciones\nde anticipo (``kind=advance_application``) las crean ``/invoices/{id}/cancel/?refund=true``\ny ``/payments/{id}/apply/``.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "invoice": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer",
            "nullable": true,
            "description": "Cliente del anticipo (kind=advance, sin factura)."
          },
          "kind": {
            "$ref": "#/components/schemas/PaymentKindEnum"
          },
          "is_refund": {
            "type": "boolean",
            "readOnly": true,
            "description": "Devolución al cliente (importe negativo) de una factura cobrada y anulada."
          },
          "applied_from": {
            "type": "integer",
            "readOnly": true,
            "nullable": true,
            "description": "Anticipo que se aplica (sólo kind=advance_application)."
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "amount_eur": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe realmente abonado en euros cuando la factura está en otra divisa (vacío = EUR)."
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,6})?$",
            "nullable": true,
            "description": "Euros por 1 unidad de la divisa del cobro (sólo facturas en divisa)."
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "payment_method": {
            "type": "integer",
            "nullable": true
          },
          "payment_method_display": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta bancaria (tesorería) en la que se recibió el cobro."
          },
          "bank_account_display": {
            "type": "string",
            "readOnly": true
          },
          "counter_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de contrapartida (id de la cuenta contable) cuando el cobro/pago NO pasa por tesorería: el asiento la usa en lugar de la 572 (pagos: Debe proveedor / Haber contrapartida; cobros: Debe contrapartida / Haber cliente). Grupos 1, 4 o 5 excepto 57x (p. ej. 551 socio, 170 préstamo a largo plazo, 520 deuda a corto). Incompatible con bank_account; estos cobros/pagos no se concilian con el banco ni cuentan en el flujo de caja. null para quitarla."
          },
          "counter_account_code": {
            "type": "string",
            "nullable": true,
            "description": "Código de la cuenta de contrapartida (alternativa a counter_account): 551, 170, 520… En lectura, el código de la cuenta enlazada.",
            "maxLength": 12
          },
          "counter_account_name": {
            "type": "string",
            "readOnly": true,
            "description": "Nombre de la cuenta de contrapartida."
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "notes": {
            "type": "string"
          },
          "remaining_advance": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "Sólo anticipos: importe aún no aplicado a facturas."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "amount",
          "applied_from",
          "bank_account_display",
          "counter_account_name",
          "created_at",
          "id",
          "is_refund",
          "payment_method_display",
          "remaining_advance",
          "updated_at"
        ]
      },
      "PaymentKindEnum": {
        "enum": [
          "invoice",
          "advance",
          "advance_application"
        ],
        "type": "string",
        "description": "* `invoice` - Cobro de factura\n* `advance` - Anticipo de cliente\n* `advance_application` - Aplicación de anticipo"
      },
      "PaymentRequest": {
        "type": "object",
        "description": "Cobro de factura (``kind=invoice``, por defecto) o anticipo de cliente\n(``kind=advance`` con ``customer`` y sin ``invoice``).\n\nCobro que NO entra en la tesorería de la empresa («cobrado con…»: compensación con la\ncuenta del socio, con un préstamo…): indica ``counter_account`` (id) o\n``counter_account_code`` (551, 170, 520…) y el asiento será Debe esa cuenta / Haber\ncliente; no admite ``bank_account`` ni se concilia con el banco.\n\nFacturas en otra divisa: ``amount`` va en la divisa de la factura; ``amount_eur``\n(o ``exchange_rate``) indica lo abonado realmente en euros y la diferencia con lo\ncontabilizado va a 768/668. Alternativa: ``currency=\"EUR\"`` con ``amount`` en euros\n(Billora calcula el importe en divisa: el pendiente si liquida la factura, o\namount / cambio de la factura). Las devoluciones (``is_refund``) y las aplicaciones\nde anticipo (``kind=advance_application``) las crean ``/invoices/{id}/cancel/?refund=true``\ny ``/payments/{id}/apply/``.",
        "properties": {
          "invoice": {
            "type": "integer",
            "nullable": true
          },
          "customer": {
            "type": "integer",
            "nullable": true,
            "description": "Cliente del anticipo (kind=advance, sin factura)."
          },
          "kind": {
            "$ref": "#/components/schemas/PaymentKindEnum"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "amount_eur": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe realmente abonado en euros cuando la factura está en otra divisa (vacío = EUR)."
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,6})?$",
            "nullable": true,
            "description": "Euros por 1 unidad de la divisa del cobro (sólo facturas en divisa)."
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "payment_method": {
            "type": "integer",
            "nullable": true
          },
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta bancaria (tesorería) en la que se recibió el cobro."
          },
          "counter_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de contrapartida (id de la cuenta contable) cuando el cobro/pago NO pasa por tesorería: el asiento la usa en lugar de la 572 (pagos: Debe proveedor / Haber contrapartida; cobros: Debe contrapartida / Haber cliente). Grupos 1, 4 o 5 excepto 57x (p. ej. 551 socio, 170 préstamo a largo plazo, 520 deuda a corto). Incompatible con bank_account; estos cobros/pagos no se concilian con el banco ni cuentan en el flujo de caja. null para quitarla."
          },
          "counter_account_code": {
            "type": "string",
            "nullable": true,
            "description": "Código de la cuenta de contrapartida (alternativa a counter_account): 551, 170, 520… En lectura, el código de la cuenta enlazada.",
            "maxLength": 12
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "amount"
        ]
      },
      "PaymentStats": {
        "type": "object",
        "properties": {
          "total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "last_30_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "last_7_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          }
        },
        "required": [
          "last_30_days",
          "last_7_days",
          "total"
        ]
      },
      "PaymentStatusEnum": {
        "enum": [
          "not_required",
          "pending",
          "paid",
          "refunded",
          "failed"
        ],
        "type": "string",
        "description": "* `not_required` - No requerido\n* `pending` - Pendiente\n* `paid` - Pagado\n* `refunded` - Reembolsado\n* `failed` - Fallido"
      },
      "PaymentTerm": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "days": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Días al vencimiento desde issue_date"
          },
          "month_end": {
            "type": "boolean",
            "description": "Vence a fin de mes"
          },
          "custom_schedule": {
            "description": "Lista de días relativos [0,30,60]"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "PaymentTermRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "days": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Días al vencimiento desde issue_date"
          },
          "month_end": {
            "type": "boolean",
            "description": "Vence a fin de mes"
          },
          "custom_schedule": {
            "description": "Lista de días relativos [0,30,60]"
          }
        },
        "required": [
          "name"
        ]
      },
      "PayrollRecord": {
        "type": "object",
        "description": "``net_salary`` y ``total_cost`` son derivados (solo lectura):\n\nnet_salary = gross_salary - ss_employee - irpf - other_deductions\ntotal_cost = gross_salary + ss_employer",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "employee": {
            "type": "integer"
          },
          "employee_name": {
            "type": "string",
            "readOnly": true
          },
          "period_month": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "1-12"
          },
          "period_year": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648
          },
          "gross_salary": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$"
          },
          "ss_employee": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "SS Empleado"
          },
          "irpf": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$"
          },
          "other_deductions": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$"
          },
          "net_salary": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "ss_employer": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "SS Empresa"
          },
          "total_cost": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "title": "Coste total empresa"
          },
          "status": {
            "$ref": "#/components/schemas/PayrollStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "payment_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "in_kind_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "Retribución en especie (valoración)",
            "description": "Valoración de las retribuciones en especie del mes (seguro médico, vehículo, vivienda…)."
          },
          "in_kind_payment_on_account": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "Ingreso a cuenta de la retribución en especie",
            "description": "Ingreso a cuenta de la retribución en especie (casilla [06] del modelo 111)."
          },
          "in_kind_payment_passed_on": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "Ingreso a cuenta repercutido al empleado",
            "description": "Parte del ingreso a cuenta que se descuenta al empleado (inclúyela también en otras deducciones)."
          },
          "exempt_allowances": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "Dietas exceptuadas de gravamen",
            "description": "Dietas y gastos de viaje exentos (art. 9 RIRPF), fuera del salario bruto: clave L.01 del 190."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "employee",
          "employee_name",
          "id",
          "net_salary",
          "period_month",
          "period_year",
          "status_display",
          "total_cost",
          "updated_at"
        ]
      },
      "PayrollRecordRequest": {
        "type": "object",
        "description": "``net_salary`` y ``total_cost`` son derivados (solo lectura):\n\nnet_salary = gross_salary - ss_employee - irpf - other_deductions\ntotal_cost = gross_salary + ss_employer",
        "properties": {
          "employee": {
            "type": "integer"
          },
          "period_month": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648,
            "description": "1-12"
          },
          "period_year": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648
          },
          "gross_salary": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$"
          },
          "ss_employee": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "SS Empleado"
          },
          "irpf": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$"
          },
          "other_deductions": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$"
          },
          "ss_employer": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "SS Empresa"
          },
          "status": {
            "$ref": "#/components/schemas/PayrollStatusEnum"
          },
          "payment_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "in_kind_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "Retribución en especie (valoración)",
            "description": "Valoración de las retribuciones en especie del mes (seguro médico, vehículo, vivienda…)."
          },
          "in_kind_payment_on_account": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "Ingreso a cuenta de la retribución en especie",
            "description": "Ingreso a cuenta de la retribución en especie (casilla [06] del modelo 111)."
          },
          "in_kind_payment_passed_on": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "Ingreso a cuenta repercutido al empleado",
            "description": "Parte del ingreso a cuenta que se descuenta al empleado (inclúyela también en otras deducciones)."
          },
          "exempt_allowances": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "title": "Dietas exceptuadas de gravamen",
            "description": "Dietas y gastos de viaje exentos (art. 9 RIRPF), fuera del salario bruto: clave L.01 del 190."
          }
        },
        "required": [
          "employee",
          "period_month",
          "period_year"
        ]
      },
      "PayrollRequestRequest": {
        "type": "object",
        "properties": {
          "payroll_record_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "minItems": 1
          }
        },
        "required": [
          "payroll_record_ids"
        ]
      },
      "PayrollStatusEnum": {
        "enum": [
          "draft",
          "confirmed",
          "paid"
        ],
        "type": "string",
        "description": "* `draft` - Borrador\n* `confirmed` - Confirmada\n* `paid` - Pagada"
      },
      "Period": {
        "type": "object",
        "properties": {
          "start_30d": {
            "type": "string",
            "format": "date-time"
          },
          "start_7d": {
            "type": "string",
            "format": "date-time"
          },
          "current_month_start": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "current_month_start",
          "start_30d",
          "start_7d"
        ]
      },
      "PeriodEnum": {
        "enum": [
          "1T",
          "2T",
          "3T",
          "4T",
          "01",
          "02",
          "03",
          "04",
          "05",
          "06",
          "07",
          "08",
          "09",
          "10",
          "11",
          "12"
        ],
        "type": "string",
        "description": "* `1T` - 1T\n* `2T` - 2T\n* `3T` - 3T\n* `4T` - 4T\n* `01` - 01\n* `02` - 02\n* `03` - 03\n* `04` - 04\n* `05` - 05\n* `06` - 06\n* `07` - 07\n* `08` - 08\n* `09` - 09\n* `10` - 10\n* `11` - 11\n* `12` - 12"
      },
      "Pipeline": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 150
          },
          "is_default": {
            "type": "boolean"
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "stage_count": {
            "type": "integer",
            "readOnly": true
          },
          "deal_count": {
            "type": "integer",
            "readOnly": true
          },
          "total_value": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "deal_count",
          "id",
          "name",
          "stage_count",
          "total_value",
          "updated_at"
        ]
      },
      "PipelineRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "is_default": {
            "type": "boolean"
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          }
        },
        "required": [
          "name"
        ]
      },
      "PipelineStage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "pipeline": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 150
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "probability": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Probabilidad de cierre (0-100)"
          },
          "color": {
            "type": "string",
            "maxLength": 7
          },
          "is_won": {
            "type": "boolean"
          },
          "is_lost": {
            "type": "boolean"
          },
          "deal_count": {
            "type": "integer",
            "readOnly": true
          },
          "deal_value": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "readOnly": true
          }
        },
        "required": [
          "deal_count",
          "deal_value",
          "id",
          "name",
          "pipeline"
        ]
      },
      "PipelineStageRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "probability": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Probabilidad de cierre (0-100)"
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          },
          "is_won": {
            "type": "boolean"
          },
          "is_lost": {
            "type": "boolean"
          }
        },
        "required": [
          "name"
        ]
      },
      "PipelineWithStages": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 150
          },
          "is_default": {
            "type": "boolean"
          },
          "order": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "stages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PipelineStage"
            },
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "stages",
          "updated_at"
        ]
      },
      "Plan": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "slug": {
            "type": "string",
            "maxLength": 50,
            "pattern": "^[-a-zA-Z0-9_]+$"
          },
          "description": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "price_monthly": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "description": "Precio mensual regular"
          },
          "price_yearly": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "description": "Precio total anual (se divide por 12 para mostrar equivalente mensual)"
          },
          "monthly_price_promo": {
            "type": "number",
            "format": "double",
            "readOnly": true
          },
          "yearly_price_promo": {
            "type": "number",
            "format": "double",
            "readOnly": true
          },
          "has_promo": {
            "type": "boolean",
            "description": "Aplicar promoción -50% por 3 meses"
          },
          "promo_discount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$",
            "description": "Porcentaje de descuento promocional"
          },
          "promo_duration_months": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Duración promoción en meses"
          },
          "trial_days": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0
          },
          "is_active": {
            "type": "boolean"
          },
          "sort_order": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0
          },
          "features": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanFeature"
            },
            "readOnly": true
          },
          "feature_summary": {
            "type": "object",
            "additionalProperties": {},
            "readOnly": true
          },
          "modules": {
            "type": "array",
            "items": {},
            "readOnly": true
          },
          "available_addons": {
            "type": "array",
            "items": {},
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "available_addons",
          "created_at",
          "feature_summary",
          "features",
          "id",
          "modules",
          "monthly_price_promo",
          "name",
          "slug",
          "updated_at",
          "yearly_price_promo"
        ]
      },
      "PlanFeature": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "plan": {
            "type": "integer"
          },
          "feature": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Feature"
              }
            ],
            "readOnly": true
          },
          "limit_value": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "is_hard_limit": {
            "type": "boolean"
          },
          "overage_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,4})?$",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "feature",
          "id",
          "plan",
          "updated_at"
        ]
      },
      "PlanList": {
        "type": "object",
        "description": "Serializer simplificado para listado de planes",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "slug": {
            "type": "string",
            "maxLength": 50,
            "pattern": "^[-a-zA-Z0-9_]+$"
          },
          "description": {
            "type": "string"
          },
          "price_monthly": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "description": "Precio mensual regular"
          },
          "price_yearly": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "description": "Precio total anual (se divide por 12 para mostrar equivalente mensual)"
          },
          "monthly_price_promo": {
            "type": "number",
            "format": "double",
            "readOnly": true
          },
          "has_promo": {
            "type": "boolean",
            "description": "Aplicar promoción -50% por 3 meses"
          },
          "effective_has_promo": {
            "type": "boolean",
            "readOnly": true
          },
          "promo_discount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$",
            "description": "Porcentaje de descuento promocional"
          },
          "promo_duration_months": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Duración promoción en meses"
          },
          "trial_days": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0
          },
          "effective_trial_days": {
            "type": "integer",
            "readOnly": true
          },
          "feature_summary": {
            "type": "object",
            "additionalProperties": {},
            "readOnly": true
          },
          "modules": {
            "type": "array",
            "items": {},
            "readOnly": true
          },
          "available_addons": {
            "type": "array",
            "items": {},
            "readOnly": true
          }
        },
        "required": [
          "available_addons",
          "effective_has_promo",
          "effective_trial_days",
          "feature_summary",
          "id",
          "modules",
          "monthly_price_promo",
          "name",
          "slug"
        ]
      },
      "Position": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "department": {
            "type": "integer",
            "nullable": true
          },
          "department_name": {
            "type": "string",
            "readOnly": true
          },
          "description": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "department_name",
          "id",
          "title",
          "updated_at"
        ]
      },
      "PositionRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "department": {
            "type": "integer",
            "nullable": true
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "title"
        ]
      },
      "Practitioner": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "user": {
            "type": "integer",
            "nullable": true
          },
          "first_name": {
            "type": "string",
            "maxLength": 150
          },
          "last_name": {
            "type": "string",
            "maxLength": 150
          },
          "full_name": {
            "type": "string",
            "readOnly": true
          },
          "license_number": {
            "type": "string",
            "description": "Número de colegiado",
            "maxLength": 50
          },
          "specialty": {
            "type": "integer",
            "nullable": true
          },
          "specialty_name": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "professional_title": {
            "type": "string",
            "maxLength": 200
          },
          "phone": {
            "type": "string",
            "maxLength": 50
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "is_active": {
            "type": "boolean"
          },
          "user_email": {
            "type": "string",
            "format": "email",
            "readOnly": true,
            "default": ""
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "first_name",
          "full_name",
          "id",
          "last_name",
          "specialty_name",
          "updated_at",
          "user_email"
        ]
      },
      "PractitionerRequest": {
        "type": "object",
        "properties": {
          "user": {
            "type": "integer",
            "nullable": true
          },
          "first_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "last_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "license_number": {
            "type": "string",
            "description": "Número de colegiado",
            "maxLength": 50
          },
          "specialty": {
            "type": "integer",
            "nullable": true
          },
          "professional_title": {
            "type": "string",
            "maxLength": 200
          },
          "phone": {
            "type": "string",
            "maxLength": 50
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "first_name",
          "last_name"
        ]
      },
      "PriorityEnum": {
        "enum": [
          "low",
          "medium",
          "high",
          "urgent"
        ],
        "type": "string",
        "description": "* `low` - Baja\n* `medium` - Media\n* `high` - Alta\n* `urgent` - Urgente"
      },
      "ProcessInvoiceRequest": {
        "type": "object",
        "description": "Serializer para procesar una factura con VeriFactu.",
        "properties": {
          "invoice_id": {
            "type": "integer"
          },
          "force_reprocess": {
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "invoice_id"
        ]
      },
      "Product": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "code": {
            "type": "string",
            "maxLength": 48
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "description": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/ProductTypeEnum"
          },
          "unit": {
            "type": "integer",
            "nullable": true
          },
          "unit_display": {
            "type": "string",
            "readOnly": true
          },
          "barcode": {
            "type": "string",
            "maxLength": 64
          },
          "sale_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "sale_price_includes_tax": {
            "type": "boolean",
            "description": "El precio de venta es el PVP con impuestos incluidos (venta a particulares). La base se obtiene del PVP; úsalo en documentos con «precios con IVA incluido» para que el total cuadre al céntimo."
          },
          "sale_price_without_tax": {
            "type": "string",
            "readOnly": true,
            "description": "Precio de venta sin impuestos (base). Si sale_price_includes_tax, se obtiene del PVP con los impuestos del producto."
          },
          "sale_price_with_tax": {
            "type": "string",
            "readOnly": true,
            "description": "Precio de venta con impuestos incluidos (PVP). Si sale_price_includes_tax, es el propio sale_price."
          },
          "purchase_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "tax_template": {
            "type": "integer",
            "nullable": true
          },
          "tax_template_display": {
            "type": "string",
            "readOnly": true
          },
          "spanish_taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "discount_allowed": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          },
          "inventory_tracking": {
            "type": "boolean"
          },
          "stock_quantity": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "reorder_point": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "sale_price_with_tax",
          "sale_price_without_tax",
          "tax_template_display",
          "unit_display",
          "updated_at"
        ]
      },
      "ProductRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "maxLength": 48
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/ProductTypeEnum"
          },
          "unit": {
            "type": "integer",
            "nullable": true
          },
          "barcode": {
            "type": "string",
            "maxLength": 64
          },
          "sale_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "sale_price_includes_tax": {
            "type": "boolean",
            "description": "El precio de venta es el PVP con impuestos incluidos (venta a particulares). La base se obtiene del PVP; úsalo en documentos con «precios con IVA incluido» para que el total cuadre al céntimo."
          },
          "purchase_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "tax_template": {
            "type": "integer",
            "nullable": true
          },
          "spanish_taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "discount_allowed": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          },
          "inventory_tracking": {
            "type": "boolean"
          },
          "stock_quantity": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "reorder_point": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          }
        },
        "required": [
          "name"
        ]
      },
      "ProductTypeEnum": {
        "enum": [
          "goods",
          "service"
        ],
        "type": "string",
        "description": "* `goods` - Bien\n* `service` - Servicio"
      },
      "ProfitTrendItem": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "profit": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          }
        },
        "required": [
          "date",
          "profit"
        ]
      },
      "Proforma": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ProformaStatusEnum"
              }
            ],
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "tax_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "withholding_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "surcharge_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "sequence_number": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "number": {
            "type": "string",
            "readOnly": true,
            "nullable": true
          },
          "metadata": {},
          "pdf_url": {
            "type": "string",
            "format": "uri",
            "readOnly": true,
            "description": "URL del PDF definitivo (solo facturas emitidas)"
          },
          "draft_pdf_url": {
            "type": "string",
            "format": "uri",
            "readOnly": true,
            "description": "URL del PDF borrador (con marca de agua)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "balance",
          "created_at",
          "customer",
          "draft_pdf_url",
          "id",
          "issue_date",
          "number",
          "pdf_url",
          "sequence_number",
          "status",
          "subtotal",
          "surcharge_total",
          "tax_total",
          "total",
          "updated_at",
          "withholding_total"
        ]
      },
      "ProformaRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLineRequest"
            },
            "writeOnly": true
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "customer"
        ]
      },
      "ProformaStatusEnum": {
        "enum": [
          "draft",
          "sent",
          "invoiced",
          "cancelled"
        ],
        "type": "string",
        "description": "* `draft` - Borrador\n* `sent` - Enviado\n* `invoiced` - Facturada\n* `cancelled` - Anulada"
      },
      "Property": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Identificador (se genera si falta)."
          },
          "rol": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RolEnum"
              }
            ],
            "description": "`arrendatario`: modelo 180 y marca de arrendamiento del 347. `arrendador`: registro de inmueble del 347.\n\n* `arrendatario` - La empresa es arrendataria (paga el alquiler)\n* `arrendador` - La empresa es arrendadora (cobra el alquiler)"
          },
          "nif_contraparte": {
            "type": "string",
            "description": "NIF del arrendador (rol arrendatario) o del arrendatario (rol arrendador).",
            "maxLength": 20
          },
          "nombre_contraparte": {
            "type": "string",
            "maxLength": 40
          },
          "referencia_catastral": {
            "type": "string",
            "description": "Referencia catastral (20 caracteres). Vacía si el inmueble no tiene.",
            "maxLength": 25
          },
          "ubicacion": {
            "allOf": [
              {
                "$ref": "#/components/schemas/UbicacionEnum"
              }
            ],
            "default": "espana"
          },
          "local_negocio": {
            "type": "boolean",
            "default": true,
            "description": "Local de negocio (marca del 347)."
          },
          "tipo_via": {
            "type": "string",
            "description": "Código INE: CL, AV…",
            "maxLength": 5
          },
          "nombre_via": {
            "type": "string",
            "maxLength": 50
          },
          "tipo_numeracion": {
            "type": "string",
            "description": "NUM, KM, S/N",
            "maxLength": 3
          },
          "numero_casa": {
            "type": "string",
            "maxLength": 5
          },
          "calificador_numero": {
            "type": "string",
            "maxLength": 3
          },
          "bloque": {
            "type": "string",
            "maxLength": 3
          },
          "portal": {
            "type": "string",
            "maxLength": 3
          },
          "escalera": {
            "type": "string",
            "maxLength": 3
          },
          "planta": {
            "type": "string",
            "maxLength": 3
          },
          "puerta": {
            "type": "string",
            "maxLength": 3
          },
          "complemento": {
            "type": "string",
            "maxLength": 40
          },
          "localidad": {
            "type": "string",
            "maxLength": 30
          },
          "municipio": {
            "type": "string",
            "maxLength": 30
          },
          "codigo_municipio": {
            "type": "string",
            "description": "Código INE del municipio (5 dígitos).",
            "maxLength": 5
          },
          "provincia": {
            "type": "string",
            "description": "Código (2 dígitos) o nombre de la provincia.",
            "maxLength": 30
          },
          "codigo_postal": {
            "type": "string",
            "maxLength": 5
          }
        },
        "required": [
          "nif_contraparte",
          "rol"
        ]
      },
      "PropertyRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Identificador (se genera si falta)."
          },
          "rol": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RolEnum"
              }
            ],
            "description": "`arrendatario`: modelo 180 y marca de arrendamiento del 347. `arrendador`: registro de inmueble del 347.\n\n* `arrendatario` - La empresa es arrendataria (paga el alquiler)\n* `arrendador` - La empresa es arrendadora (cobra el alquiler)"
          },
          "nif_contraparte": {
            "type": "string",
            "minLength": 1,
            "description": "NIF del arrendador (rol arrendatario) o del arrendatario (rol arrendador).",
            "maxLength": 20
          },
          "nombre_contraparte": {
            "type": "string",
            "maxLength": 40
          },
          "referencia_catastral": {
            "type": "string",
            "description": "Referencia catastral (20 caracteres). Vacía si el inmueble no tiene.",
            "maxLength": 25
          },
          "ubicacion": {
            "allOf": [
              {
                "$ref": "#/components/schemas/UbicacionEnum"
              }
            ],
            "default": "espana"
          },
          "local_negocio": {
            "type": "boolean",
            "default": true,
            "description": "Local de negocio (marca del 347)."
          },
          "tipo_via": {
            "type": "string",
            "description": "Código INE: CL, AV…",
            "maxLength": 5
          },
          "nombre_via": {
            "type": "string",
            "maxLength": 50
          },
          "tipo_numeracion": {
            "type": "string",
            "description": "NUM, KM, S/N",
            "maxLength": 3
          },
          "numero_casa": {
            "type": "string",
            "maxLength": 5
          },
          "calificador_numero": {
            "type": "string",
            "maxLength": 3
          },
          "bloque": {
            "type": "string",
            "maxLength": 3
          },
          "portal": {
            "type": "string",
            "maxLength": 3
          },
          "escalera": {
            "type": "string",
            "maxLength": 3
          },
          "planta": {
            "type": "string",
            "maxLength": 3
          },
          "puerta": {
            "type": "string",
            "maxLength": 3
          },
          "complemento": {
            "type": "string",
            "maxLength": 40
          },
          "localidad": {
            "type": "string",
            "maxLength": 30
          },
          "municipio": {
            "type": "string",
            "maxLength": 30
          },
          "codigo_municipio": {
            "type": "string",
            "description": "Código INE del municipio (5 dígitos).",
            "maxLength": 5
          },
          "provincia": {
            "type": "string",
            "description": "Código (2 dígitos) o nombre de la provincia.",
            "maxLength": 30
          },
          "codigo_postal": {
            "type": "string",
            "maxLength": 5
          }
        },
        "required": [
          "nif_contraparte",
          "rol"
        ]
      },
      "PurchaseDocumentLine": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "product": {
            "type": "integer",
            "nullable": true
          },
          "description": {
            "type": "string",
            "maxLength": 300
          },
          "quantity": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "unit_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,6})?$"
          },
          "discount_percent": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "tax_template": {
            "type": "integer",
            "nullable": true
          },
          "withholding_template": {
            "type": "integer",
            "nullable": true
          },
          "surcharge_template": {
            "type": "integer",
            "nullable": true
          },
          "line_subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "line_tax": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "line_withholding": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "line_surcharge": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "line_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "description",
          "id",
          "line_subtotal",
          "line_surcharge",
          "line_tax",
          "line_total",
          "line_withholding",
          "updated_at"
        ]
      },
      "PurchaseDocumentLineRequest": {
        "type": "object",
        "properties": {
          "product": {
            "type": "integer",
            "nullable": true
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "quantity": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "unit_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,6})?$"
          },
          "discount_percent": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "tax_template": {
            "type": "integer",
            "nullable": true
          },
          "withholding_template": {
            "type": "integer",
            "nullable": true
          },
          "surcharge_template": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "description"
        ]
      },
      "PurchaseOrder": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "supplier": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/PurchaseOrderStatusEnum"
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "vendor_reference": {
            "type": "string",
            "description": "Número/factura del proveedor",
            "maxLength": 100
          },
          "subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "tax_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "withholding_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "surcharge_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "sequence_number": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "number": {
            "type": "string",
            "readOnly": true,
            "nullable": true
          },
          "metadata": {},
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "balance",
          "created_at",
          "id",
          "number",
          "sequence_number",
          "subtotal",
          "supplier",
          "surcharge_total",
          "tax_total",
          "total",
          "updated_at",
          "withholding_total"
        ]
      },
      "PurchaseOrderRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "supplier": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/PurchaseOrderStatusEnum"
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "vendor_reference": {
            "type": "string",
            "description": "Número/factura del proveedor",
            "maxLength": 100
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseDocumentLineRequest"
            },
            "writeOnly": true
          }
        },
        "required": [
          "lines",
          "supplier"
        ]
      },
      "PurchaseOrderStatusEnum": {
        "enum": [
          "draft",
          "sent",
          "received",
          "cancelled"
        ],
        "type": "string",
        "description": "* `draft` - Borrador\n* `sent` - Enviado\n* `received` - Recibido\n* `cancelled` - Anulado"
      },
      "Quote": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuoteStatusEnum"
              }
            ],
            "readOnly": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "tax_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "withholding_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "surcharge_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "sequence_number": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "number": {
            "type": "string",
            "readOnly": true,
            "nullable": true
          },
          "metadata": {},
          "pdf_url": {
            "type": "string",
            "format": "uri",
            "readOnly": true,
            "description": "URL del PDF definitivo (solo facturas emitidas)"
          },
          "draft_pdf_url": {
            "type": "string",
            "format": "uri",
            "readOnly": true,
            "description": "URL del PDF borrador (con marca de agua)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "balance",
          "created_at",
          "customer",
          "draft_pdf_url",
          "id",
          "issue_date",
          "number",
          "pdf_url",
          "sequence_number",
          "status",
          "subtotal",
          "surcharge_total",
          "tax_total",
          "total",
          "updated_at",
          "withholding_total"
        ]
      },
      "QuoteRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "income_category": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta contable asociada (PGC PYMES)"
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLineRequest"
            },
            "writeOnly": true
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "customer"
        ]
      },
      "QuoteStatusEnum": {
        "enum": [
          "draft",
          "sent",
          "accepted",
          "rejected",
          "expired"
        ],
        "type": "string",
        "description": "* `draft` - Borrador\n* `sent` - Enviado\n* `accepted` - Aceptado\n* `rejected` - Rechazado\n* `expired` - Expirado"
      },
      "RecentActivity": {
        "type": "object",
        "properties": {
          "invoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecentInvoice"
            }
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecentPayment"
            }
          },
          "expenses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecentExpense"
            }
          },
          "customers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecentCustomer"
            }
          }
        },
        "required": [
          "customers",
          "expenses",
          "invoices",
          "payments"
        ]
      },
      "RecentCustomer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "created_at",
          "email",
          "id",
          "name",
          "type"
        ]
      },
      "RecentExpense": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "description": {
            "type": "string"
          },
          "supplier_name": {
            "type": "string"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "expense_date": {
            "type": "string",
            "format": "date"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "amount",
          "created_at",
          "description",
          "expense_date",
          "id",
          "supplier_name",
          "type"
        ]
      },
      "RecentInvoice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "number": {
            "type": "string"
          },
          "customer_name": {
            "type": "string"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "status": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "amount",
          "created_at",
          "customer_name",
          "id",
          "number",
          "status",
          "type"
        ]
      },
      "RecentPayment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "invoice_number": {
            "type": "string"
          },
          "customer_name": {
            "type": "string"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "payment_date": {
            "type": "string",
            "format": "date"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "amount",
          "created_at",
          "customer_name",
          "id",
          "invoice_number",
          "payment_date",
          "type"
        ]
      },
      "ReconciliationRule": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "is_active": {
            "type": "boolean"
          },
          "priority": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Menor = se evalúa antes."
          },
          "concept_contains": {
            "description": "Textos (basta con uno) que debe contener el concepto."
          },
          "counterparty_contains": {
            "type": "string",
            "maxLength": 200
          },
          "amount_min": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe absoluto mínimo."
          },
          "amount_max": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "direction": {
            "$ref": "#/components/schemas/ReconciliationRuleDirectionEnum"
          },
          "action": {
            "$ref": "#/components/schemas/ReconciliationRuleActionEnum"
          },
          "supplier": {
            "type": "integer",
            "nullable": true
          },
          "supplier_name": {
            "type": "string",
            "readOnly": true
          },
          "expense_category": {
            "type": "integer",
            "nullable": true
          },
          "document_type": {
            "type": "string",
            "description": "Tipo de documento del gasto creado (por defecto comisión bancaria).",
            "maxLength": 20
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true
          },
          "accounting_account_code": {
            "type": "string",
            "readOnly": true
          },
          "target_bank_account": {
            "type": "integer",
            "nullable": true
          },
          "target_bank_account_name": {
            "type": "string",
            "readOnly": true
          },
          "description": {
            "type": "string",
            "maxLength": 200
          },
          "auto_apply": {
            "type": "boolean",
            "description": "Aplicar sin confirmación al importar."
          },
          "times_applied": {
            "type": "integer",
            "readOnly": true
          },
          "learned_from": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "accounting_account_code",
          "created_at",
          "id",
          "learned_from",
          "name",
          "supplier_name",
          "target_bank_account_name",
          "times_applied",
          "updated_at"
        ]
      },
      "ReconciliationRuleActionEnum": {
        "enum": [
          "expense",
          "transfer",
          "book",
          "ignore"
        ],
        "type": "string",
        "description": "* `expense` - Registrar gasto (comisión, cuota…)\n* `transfer` - Traspaso a otra cuenta\n* `book` - Contabilizar a una cuenta\n* `ignore` - Ignorar"
      },
      "ReconciliationRuleDirectionEnum": {
        "enum": [
          "in",
          "out",
          "any"
        ],
        "type": "string",
        "description": "* `in` - Cobros\n* `out` - Pagos\n* `any` - Ambos"
      },
      "ReconciliationRuleRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "is_active": {
            "type": "boolean"
          },
          "priority": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Menor = se evalúa antes."
          },
          "concept_contains": {
            "description": "Textos (basta con uno) que debe contener el concepto."
          },
          "counterparty_contains": {
            "type": "string",
            "maxLength": 200
          },
          "amount_min": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe absoluto mínimo."
          },
          "amount_max": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "nullable": true
          },
          "direction": {
            "$ref": "#/components/schemas/ReconciliationRuleDirectionEnum"
          },
          "action": {
            "$ref": "#/components/schemas/ReconciliationRuleActionEnum"
          },
          "supplier": {
            "type": "integer",
            "nullable": true
          },
          "expense_category": {
            "type": "integer",
            "nullable": true
          },
          "document_type": {
            "type": "string",
            "minLength": 1,
            "description": "Tipo de documento del gasto creado (por defecto comisión bancaria).",
            "maxLength": 20
          },
          "accounting_account": {
            "type": "integer",
            "nullable": true
          },
          "target_bank_account": {
            "type": "integer",
            "nullable": true
          },
          "description": {
            "type": "string",
            "maxLength": 200
          },
          "auto_apply": {
            "type": "boolean",
            "description": "Aplicar sin confirmación al importar."
          }
        },
        "required": [
          "name"
        ]
      },
      "RecoverRequest": {
        "type": "object",
        "properties": {
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "Reenviar las entregas fallidas creadas desde esta fecha (ISO 8601)."
          },
          "until": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "since"
        ]
      },
      "RecoverResult": {
        "type": "object",
        "properties": {
          "recovered": {
            "type": "integer",
            "description": "Entregas puestas de nuevo en cola."
          }
        },
        "required": [
          "recovered"
        ]
      },
      "Rectification": {
        "type": "object",
        "properties": {
          "nif_operador": {
            "type": "string",
            "description": "NIF-IVA con el código de país.",
            "maxLength": 17
          },
          "nombre": {
            "type": "string",
            "maxLength": 40
          },
          "clave": {
            "$ref": "#/components/schemas/RectificationClaveEnum"
          },
          "ejercicio": {
            "type": "integer",
            "maximum": 2100,
            "minimum": 2000
          },
          "periodo": {
            "type": "string",
            "description": "01-12, 1T-4T o 0A.",
            "pattern": "^(0[1-9]|1[0-2]|[1-4]T|0A)$"
          },
          "base_rectificada": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,11}(?:\\.\\d{0,2})?$"
          },
          "base_anterior": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,11}(?:\\.\\d{0,2})?$"
          }
        },
        "required": [
          "base_anterior",
          "base_rectificada",
          "clave",
          "ejercicio",
          "nif_operador",
          "nombre",
          "periodo"
        ]
      },
      "RectificationClaveEnum": {
        "enum": [
          "E",
          "M",
          "H",
          "A",
          "T",
          "S",
          "I",
          "R",
          "D",
          "C"
        ],
        "type": "string",
        "description": "* `E` - E\n* `M` - M\n* `H` - H\n* `A` - A\n* `T` - T\n* `S` - S\n* `I` - I\n* `R` - R\n* `D` - D\n* `C` - C"
      },
      "RectificationCodeEnum": {
        "enum": [
          "R1",
          "R2",
          "R3",
          "R4"
        ],
        "type": "string",
        "description": "* `R1` - R1 — Error fundado en derecho y art. 80 Uno, Dos y Seis LIVA\n* `R2` - R2 — Art. 80.Tres LIVA (concurso)\n* `R3` - R3 — Art. 80.Cuatro LIVA (incobrables)\n* `R4` - R4 — Resto de causas"
      },
      "RectificationRequest": {
        "type": "object",
        "properties": {
          "nif_operador": {
            "type": "string",
            "minLength": 1,
            "description": "NIF-IVA con el código de país.",
            "maxLength": 17
          },
          "nombre": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          },
          "clave": {
            "$ref": "#/components/schemas/RectificationClaveEnum"
          },
          "ejercicio": {
            "type": "integer",
            "maximum": 2100,
            "minimum": 2000
          },
          "periodo": {
            "type": "string",
            "minLength": 1,
            "description": "01-12, 1T-4T o 0A.",
            "pattern": "^(0[1-9]|1[0-2]|[1-4]T|0A)$"
          },
          "base_rectificada": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,11}(?:\\.\\d{0,2})?$"
          },
          "base_anterior": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,11}(?:\\.\\d{0,2})?$"
          }
        },
        "required": [
          "base_anterior",
          "base_rectificada",
          "clave",
          "ejercicio",
          "nif_operador",
          "nombre",
          "periodo"
        ]
      },
      "RectifyingInvoiceCreated": {
        "type": "object",
        "properties": {
          "rectifying_invoice_id": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "detail",
          "rectifying_invoice_id"
        ]
      },
      "RectifyingInvoiceRequestRequest": {
        "type": "object",
        "properties": {
          "series": {
            "type": "integer",
            "description": "Serie de rectificativas."
          },
          "issue_date": {
            "type": "string",
            "format": "date"
          },
          "due_date": {
            "type": "string",
            "format": "date"
          },
          "payment_terms": {
            "type": "integer"
          }
        }
      },
      "RecurringInvoice": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "series": {
            "type": "integer"
          },
          "interval": {
            "$ref": "#/components/schemas/IntervalEnum"
          },
          "every": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 1
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "timezone": {
            "type": "string",
            "maxLength": 50
          },
          "is_active": {
            "type": "boolean"
          },
          "last_run_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "next_run_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "auto_send_pdf": {
            "type": "boolean"
          },
          "auto_charge": {
            "type": "boolean"
          },
          "metadata": {},
          "estimated_total": {
            "type": "string",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "customer",
          "estimated_total",
          "id",
          "last_run_at",
          "next_run_at",
          "series",
          "start_date",
          "updated_at"
        ]
      },
      "RecurringInvoiceRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "customer": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "series": {
            "type": "integer"
          },
          "interval": {
            "$ref": "#/components/schemas/IntervalEnum"
          },
          "every": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 1
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "is_active": {
            "type": "boolean"
          },
          "auto_send_pdf": {
            "type": "boolean"
          },
          "auto_charge": {
            "type": "boolean"
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecurringLineRequest"
            },
            "writeOnly": true
          }
        },
        "required": [
          "customer",
          "series",
          "start_date"
        ]
      },
      "RecurringLine": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "product": {
            "type": "integer",
            "nullable": true
          },
          "description": {
            "type": "string",
            "maxLength": 300
          },
          "quantity": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "unit_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,6})?$"
          },
          "discount_percent": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "spanish_taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "tax_template": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "withholding_template": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "surcharge_template": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "line_subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "line_tax": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "line_withholding": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "line_surcharge": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "line_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "description",
          "id",
          "line_subtotal",
          "line_surcharge",
          "line_tax",
          "line_total",
          "line_withholding",
          "surcharge_template",
          "tax_template",
          "updated_at",
          "withholding_template"
        ]
      },
      "RecurringLineRequest": {
        "type": "object",
        "properties": {
          "product": {
            "type": "integer",
            "nullable": true
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "quantity": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "unit_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,6})?$"
          },
          "discount_percent": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "spanish_taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        },
        "required": [
          "description"
        ]
      },
      "RecurringState": {
        "type": "object",
        "properties": {
          "is_active": {
            "type": "boolean"
          },
          "next_run_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "is_active"
        ]
      },
      "RecurringStats": {
        "type": "object",
        "properties": {
          "active_count": {
            "type": "integer"
          },
          "monthly_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          }
        },
        "required": [
          "active_count",
          "monthly_value"
        ]
      },
      "RegimeEnum": {
        "enum": [
          "general",
          "redeme",
          "recargo_equivalencia"
        ],
        "type": "string",
        "description": "* `general` - General\n* `redeme` - REDEME\n* `recargo_equivalencia` - Recargo de equivalencia"
      },
      "RegistroAltaApiRequest": {
        "type": "object",
        "description": "Serializer compatible con la API original para registro de alta.\nDEPRECATED: Usar RegistroAltaSerializer que incluye desglose completo.",
        "properties": {
          "id_emisor_factura": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "num_serie_factura": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "fecha_expedicion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10
          },
          "tipo_factura": {
            "$ref": "#/components/schemas/TipoFacturaEnum"
          },
          "fecha_operacion": {
            "type": "string",
            "maxLength": 10
          },
          "descripcion_operacion": {
            "type": "string",
            "maxLength": 500
          },
          "cuota_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "importe_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "auto_enviar": {
            "type": "boolean",
            "default": true
          }
        },
        "required": [
          "fecha_expedicion",
          "id_emisor_factura",
          "num_serie_factura",
          "tipo_factura"
        ]
      },
      "RegistroFactura": {
        "type": "object",
        "description": "Serializer para registros de facturas VeriFactu.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "organization": {
            "type": "integer",
            "readOnly": true
          },
          "organization_name": {
            "type": "string",
            "readOnly": true
          },
          "tipo_registro": {
            "$ref": "#/components/schemas/TipoRegistroEnum"
          },
          "tipo_registro_display": {
            "type": "string",
            "readOnly": true
          },
          "num_serie_factura": {
            "type": "string",
            "maxLength": 120
          },
          "id_emisor_factura": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]{1,20}$",
            "maxLength": 20
          },
          "fecha_expedicion": {
            "type": "string",
            "maxLength": 10
          },
          "importe_total": {
            "type": "string",
            "nullable": true,
            "maxLength": 30
          },
          "cuota_total": {
            "type": "string",
            "nullable": true,
            "maxLength": 30
          },
          "estado_envio": {
            "$ref": "#/components/schemas/EstadoEnvioEnum"
          },
          "estado_envio_display": {
            "type": "string",
            "readOnly": true
          },
          "huella": {
            "type": "string",
            "readOnly": true,
            "nullable": true
          },
          "xml_path": {
            "type": "string",
            "readOnly": true,
            "nullable": true
          },
          "qr_path": {
            "type": "string",
            "readOnly": true,
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "estado_envio_display",
          "fecha_expedicion",
          "huella",
          "id",
          "id_emisor_factura",
          "num_serie_factura",
          "organization",
          "organization_name",
          "qr_path",
          "tipo_registro",
          "tipo_registro_display",
          "updated_at",
          "xml_path"
        ]
      },
      "RematchRequestRequest": {
        "type": "object",
        "description": "``POST /treasury/transactions/rematch/``: recalcula las sugerencias de los pendientes.",
        "properties": {
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Opcional: sólo los movimientos pendientes de esta cuenta bancaria."
          }
        }
      },
      "RematchResult": {
        "type": "object",
        "properties": {
          "pending": {
            "type": "integer",
            "description": "Movimientos pendientes cuyas sugerencias se han recalculado."
          },
          "with_suggestions": {
            "type": "integer",
            "description": "Pendientes que quedan con alguna sugerencia."
          },
          "without_suggestions": {
            "type": "integer",
            "description": "Pendientes que quedan sin sugerencias."
          },
          "resolved": {
            "type": "integer",
            "description": "Siempre 0: este endpoint no aplica ninguna sugerencia."
          },
          "bank_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta a la que se limitó (null = todas)."
          }
        },
        "required": [
          "bank_account",
          "pending",
          "resolved",
          "with_suggestions",
          "without_suggestions"
        ]
      },
      "Renta": {
        "type": "object",
        "properties": {
          "fecha": {
            "type": "string",
            "format": "date",
            "description": "Fecha de devengo (exigibilidad) de la renta."
          },
          "nif": {
            "type": "string",
            "maxLength": 20
          },
          "nombre": {
            "type": "string",
            "maxLength": 40
          },
          "codigo_postal": {
            "type": "string",
            "maxLength": 5
          },
          "clave": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RentaClaveEnum"
              }
            ],
            "default": "A"
          },
          "naturaleza": {
            "type": "string",
            "description": "Naturaleza del 193 (A: 02 dividendos; B/D: 03 préstamos no bancarios…). Por defecto la habitual.",
            "maxLength": 2
          },
          "base": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "porcentaje": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$",
            "default": "19.00"
          },
          "retencion": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "especie": {
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "base",
          "fecha",
          "nif",
          "nombre",
          "retencion"
        ]
      },
      "RentaClaveEnum": {
        "enum": [
          "A",
          "B",
          "C",
          "D"
        ],
        "type": "string",
        "description": "* `A` - Dividendos y participaciones en beneficios\n* `B` - Intereses y rentas por cesión de capitales\n* `C` - Otros rendimientos del capital mobiliario\n* `D` - Cesión de capitales a entidades vinculadas"
      },
      "RentaRequest": {
        "type": "object",
        "properties": {
          "fecha": {
            "type": "string",
            "format": "date",
            "description": "Fecha de devengo (exigibilidad) de la renta."
          },
          "nif": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "nombre": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          },
          "codigo_postal": {
            "type": "string",
            "maxLength": 5
          },
          "clave": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RentaClaveEnum"
              }
            ],
            "default": "A"
          },
          "naturaleza": {
            "type": "string",
            "description": "Naturaleza del 193 (A: 02 dividendos; B/D: 03 préstamos no bancarios…). Por defecto la habitual.",
            "maxLength": 2
          },
          "base": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "porcentaje": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$",
            "default": "19.00"
          },
          "retencion": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "especie": {
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "base",
          "fecha",
          "nif",
          "nombre",
          "retencion"
        ]
      },
      "ResetPolicyEnum": {
        "enum": [
          "never",
          "yearly",
          "monthly"
        ],
        "type": "string",
        "description": "* `never` - Nunca\n* `yearly` - Anual\n* `monthly` - Mensual"
      },
      "ResultAllocationRequest": {
        "type": "object",
        "properties": {
          "account": {
            "type": "integer",
            "nullable": true
          },
          "account_code": {
            "type": "string",
            "description": "Código de la cuenta (112, 113, 118, 120, 121, 129, 550).",
            "maxLength": 12
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          }
        },
        "required": [
          "amount"
        ]
      },
      "ResyncModelEnum": {
        "enum": [
          "invoice",
          "creditnote",
          "expense",
          "payment",
          "expensepayment",
          "payrollrecord"
        ],
        "type": "string",
        "description": "* `invoice` - invoice\n* `creditnote` - creditnote\n* `expense` - expense\n* `payment` - payment\n* `expensepayment` - expensepayment\n* `payrollrecord` - payrollrecord"
      },
      "ResyncRequest": {
        "type": "object",
        "properties": {
          "model": {
            "$ref": "#/components/schemas/ResyncModelEnum"
          },
          "id": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "model"
        ]
      },
      "RevenueStats": {
        "type": "object",
        "properties": {
          "total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "current_month": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "last_month": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "last_30_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "last_7_days": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "period_value": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "growth_rate": {
            "type": "number",
            "format": "double"
          },
          "outstanding": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          }
        },
        "required": [
          "current_month",
          "growth_rate",
          "last_30_days",
          "last_7_days",
          "last_month",
          "outstanding",
          "period_value",
          "total"
        ]
      },
      "RevenueTrendItem": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "revenue": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "count": {
            "type": "integer"
          }
        },
        "required": [
          "count",
          "date",
          "revenue"
        ]
      },
      "ReverseEntryRequest": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "description": {
            "type": "string",
            "maxLength": 300
          }
        }
      },
      "RevolutAccount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "revolut_id": {
            "type": "string",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "readOnly": true
          },
          "currency": {
            "type": "string",
            "readOnly": true
          },
          "balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,14}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "nullable": true
          },
          "balance_updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "state": {
            "type": "string",
            "readOnly": true,
            "description": "active | inactive"
          },
          "is_public": {
            "type": "boolean",
            "readOnly": true,
            "description": "Con datos bancarios visibles para terceros."
          },
          "iban": {
            "type": "string",
            "readOnly": true
          },
          "bic": {
            "type": "string",
            "readOnly": true
          },
          "is_enabled": {
            "type": "boolean",
            "readOnly": true,
            "description": "Importar los movimientos de esta cuenta."
          },
          "bank_account": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "bank_account_name": {
            "type": "string",
            "readOnly": true
          },
          "balance_check": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RevolutBalanceCheck"
              }
            ],
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "balance",
          "balance_check",
          "balance_updated_at",
          "bank_account",
          "bank_account_name",
          "bic",
          "created_at",
          "currency",
          "iban",
          "id",
          "is_enabled",
          "is_public",
          "name",
          "revolut_id",
          "state",
          "updated_at"
        ]
      },
      "RevolutAlert": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ]
      },
      "RevolutAuthorizeUrl": {
        "type": "object",
        "properties": {
          "authorize_url": {
            "type": "string",
            "description": "URL de consentimiento de Revolut Business: ábrela en el navegador."
          },
          "redirect_uri": {
            "type": "string"
          }
        },
        "required": [
          "authorize_url",
          "redirect_uri"
        ]
      },
      "RevolutBalanceCheck": {
        "type": "object",
        "properties": {
          "revolut_balance": {
            "type": "string",
            "nullable": true
          },
          "last_transaction_balance": {
            "type": "string",
            "nullable": true
          },
          "ledger_balance": {
            "type": "string",
            "nullable": true
          },
          "difference_transactions": {
            "type": "string",
            "nullable": true,
            "description": "Revolut − último movimiento importado."
          },
          "difference_ledger": {
            "type": "string",
            "nullable": true,
            "description": "Revolut − contabilidad."
          }
        },
        "required": [
          "difference_ledger",
          "difference_transactions",
          "last_transaction_balance",
          "ledger_balance",
          "revolut_balance"
        ]
      },
      "RevolutCallbackRequestRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "minLength": 1,
            "description": "Parámetro ``code`` recibido en la redirect URI.",
            "maxLength": 2000
          }
        },
        "required": [
          "code"
        ]
      },
      "RevolutConnection": {
        "type": "object",
        "description": "Estado de la conexión. ``auth_mode`` = ``api_key`` (recomendado) u ``oauth`` (método antiguo\ncon certificado: ``certificate_pem`` es el certificado público que hay que subir a Revolut\nBusiness → APIs → Business API junto con ``redirect_uri``).",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "environment": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RevolutEnvironmentEnum"
              }
            ],
            "readOnly": true
          },
          "auth_mode": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AuthModeEnum"
              }
            ],
            "readOnly": true,
            "description": "Método de autenticación: API key (recomendado) u OAuth con certificado (obsoleto en Revolut).\n\n* `api_key` - API key\n* `oauth` - Certificado y OAuth (método antiguo)"
          },
          "configured": {
            "type": "boolean",
            "readOnly": true,
            "description": "Están las credenciales del método elegido: la API key (y su clave de firma si la exige) o el client_id y la clave privada."
          },
          "has_api_key": {
            "type": "boolean",
            "readOnly": true
          },
          "api_key_last4": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "Últimos 4 caracteres de la API key (null si no hay o si quien consulta no puede gestionar la conexión). La clave completa nunca se devuelve."
          },
          "signing_enabled": {
            "type": "boolean",
            "readOnly": true,
            "description": "La API key exige firmar cada petición (Ed25519)."
          },
          "has_signing_key": {
            "type": "boolean",
            "readOnly": true,
            "description": "Hay clave de firma Ed25519 (generada con connection/signing-key/ o aportada como private.pem)."
          },
          "signing_public_key": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "Clave PÚBLICA de firma en PEM (``-----BEGIN PUBLIC KEY-----``, el mismo formato que ``openssl pkey -pubout``): es la que se sube a Revolut al crear la API key. No es un secreto. null si no hay clave de firma."
          },
          "signing_key_fingerprint": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "Huella de la clave pública: ``SHA256:`` + SHA-256 en hexadecimal de su DER."
          },
          "signing_key_source": {
            "description": "``generated`` (generada en Billora) o ``uploaded`` (aportada por el usuario); null sin clave.",
            "nullable": true,
            "readOnly": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/RevolutSigningKeySourceEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "signing_key_created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "signing_variant": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RevolutSigningVariantEnum"
              }
            ],
            "description": "Variante de la cadena firmada en uso (la detectada al probar la conexión o, si no, la del ajuste del servidor). Sólo para diagnóstico.",
            "readOnly": true
          },
          "permissions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevolutPermission"
            },
            "readOnly": true,
            "description": "Permisos de la API key detectados en la última prueba (connection/test/)."
          },
          "permissions_checked_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "client_id": {
            "type": "string",
            "readOnly": true
          },
          "has_private_key": {
            "type": "boolean",
            "readOnly": true
          },
          "certificate_pem": {
            "type": "string",
            "readOnly": true,
            "description": "Certificado X509 público (se sube a Revolut)."
          },
          "redirect_uri": {
            "type": "string",
            "readOnly": true,
            "description": "Redirect URI que hay que configurar en la aplicación de Revolut."
          },
          "custom_redirect_uri": {
            "type": "string",
            "readOnly": true
          },
          "issuer": {
            "type": "string",
            "readOnly": true,
            "description": "Dominio de la redirect URI (``iss`` del JWT)."
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "readOnly": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RevolutConnectionStatusEnum"
              }
            ],
            "readOnly": true
          },
          "authorized": {
            "type": "boolean",
            "readOnly": true,
            "description": "Billora puede llamar a Revolut: hay API key o el usuario dio su consentimiento (OAuth)."
          },
          "authorized_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true,
            "description": "Fecha estimada en la que el acceso puede caducar (90 días); null = Revolut lo sigue aceptando."
          },
          "days_to_expiry": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "auto_sync": {
            "type": "boolean",
            "readOnly": true,
            "description": "Sincronizar sola (tarea periódica y webhooks)."
          },
          "sync_from": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true,
            "description": "No importar movimientos anteriores a esta fecha."
          },
          "auto_reconcile": {
            "type": "boolean",
            "readOnly": true,
            "description": "Aplicar reglas y casado automático al importar."
          },
          "last_sync_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "last_error": {
            "type": "string",
            "readOnly": true
          },
          "last_error_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "webhook": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RevolutWebhookStatus"
              }
            ],
            "readOnly": true
          },
          "alerts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevolutAlert"
            },
            "readOnly": true
          },
          "accounts_count": {
            "type": "integer",
            "readOnly": true
          },
          "linked_accounts_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "accounts_count",
          "alerts",
          "api_key_last4",
          "auth_mode",
          "authorized",
          "authorized_at",
          "auto_reconcile",
          "auto_sync",
          "certificate_pem",
          "client_id",
          "configured",
          "created_at",
          "custom_redirect_uri",
          "days_to_expiry",
          "environment",
          "expires_at",
          "has_api_key",
          "has_private_key",
          "has_signing_key",
          "id",
          "issuer",
          "last_error",
          "last_error_at",
          "last_sync_at",
          "linked_accounts_count",
          "permissions",
          "permissions_checked_at",
          "redirect_uri",
          "scopes",
          "signing_enabled",
          "signing_key_created_at",
          "signing_key_fingerprint",
          "signing_key_source",
          "signing_public_key",
          "signing_variant",
          "status",
          "sync_from",
          "updated_at",
          "webhook"
        ]
      },
      "RevolutConnectionStatusEnum": {
        "enum": [
          "pending",
          "connected",
          "expired",
          "error"
        ],
        "type": "string",
        "description": "* `pending` - Pendiente de autorizar\n* `connected` - Conectada\n* `expired` - Credenciales rechazadas o caducadas\n* `error` - Error"
      },
      "RevolutConnectionWriteRequest": {
        "type": "object",
        "properties": {
          "environment": {
            "$ref": "#/components/schemas/RevolutEnvironmentEnum"
          },
          "auth_mode": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AuthModeEnum"
              }
            ],
            "description": "Método de autenticación. ``api_key`` (recomendado y por defecto en las conexiones nuevas) u ``oauth`` (certificado + consentimiento: obsoleto en Revolut). Cambiarlo obliga a volver a probar o autorizar la conexión.\n\n* `api_key` - API key\n* `oauth` - Certificado y OAuth (método antiguo)"
          },
          "api_key": {
            "type": "string",
            "writeOnly": true,
            "description": "API key creada en Revolut Business → APIs → API Console. Se guarda cifrada y nunca se devuelve (sólo ``api_key_last4``). Sustituye a la anterior.",
            "maxLength": 2000
          },
          "signing_private_key": {
            "type": "string",
            "writeOnly": true,
            "description": "Clave de firma PROPIA, alternativa a generarla con ``connection/signing-key/``: clave privada Ed25519 (contenido del fichero private.pem que crea el comando de Revolut, PKCS8 sin contraseña). Se guarda cifrada y nunca se devuelve; la respuesta trae su clave pública en ``signing_public_key``. Se puede enviar antes de tener la API key. 400 si es un certificado, la clave pública (public.pem) o una clave RSA.",
            "maxLength": 20000
          },
          "signing_enabled": {
            "type": "boolean",
            "nullable": true,
            "description": "Firmar cada petición (cabeceras ``Revolut-Api-Timestamp`` y ``Revolut-Api-Signature``). Se activa solo cuando hay clave de firma; sólo hace falta enviarlo (``false``) para dejar de firmar con una API key que no lo exige."
          },
          "client_id": {
            "type": "string",
            "description": "Client ID que muestra Revolut tras subir el certificado.",
            "maxLength": 120
          },
          "generate_keys": {
            "type": "boolean",
            "default": false,
            "description": "Generar en Billora el par de claves RSA 2048 y el certificado X509 (la respuesta trae ``certificate_pem`` para pegarlo en Revolut). Sustituye a las claves anteriores."
          },
          "private_key": {
            "type": "string",
            "writeOnly": true,
            "description": "Clave privada RSA propia (PEM sin contraseña), alternativa a generate_keys. Se guarda cifrada y nunca se devuelve.",
            "maxLength": 20000
          },
          "certificate": {
            "type": "string",
            "description": "Certificado X509 (PEM) de esa clave; si se omite se genera uno.",
            "maxLength": 20000
          },
          "redirect_uri": {
            "type": "string",
            "description": "Sólo si la redirect URI configurada en Revolut no es la de Billora (vacío = la de Billora).",
            "maxLength": 500
          },
          "scopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevolutScopeEnum"
            },
            "description": "Permisos a solicitar (por defecto READ y WRITE)."
          },
          "auto_sync": {
            "type": "boolean"
          },
          "auto_reconcile": {
            "type": "boolean"
          },
          "sync_from": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "No importar movimientos anteriores a esta fecha."
          }
        }
      },
      "RevolutCounterparty": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "state": {
            "type": "string",
            "nullable": true
          },
          "profile_type": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "nullable": true
          },
          "accounts": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "accounts",
          "country",
          "created_at",
          "id",
          "name",
          "profile_type",
          "state"
        ]
      },
      "RevolutDisconnectRequestRequest": {
        "type": "object",
        "properties": {
          "delete_keys": {
            "type": "boolean",
            "default": false,
            "description": "Borrar también el client_id, la clave privada y el certificado."
          }
        }
      },
      "RevolutDraftLineInputRequest": {
        "type": "object",
        "properties": {
          "beneficiary_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "iban": {
            "type": "string",
            "minLength": 1,
            "maxLength": 42
          },
          "bic": {
            "type": "string",
            "maxLength": 11
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "default": "EUR",
            "maxLength": 3
          },
          "reference": {
            "type": "string",
            "maxLength": 140
          },
          "individual": {
            "type": "boolean",
            "default": false,
            "description": "El beneficiario es una persona física (no una empresa)."
          }
        },
        "required": [
          "amount",
          "beneficiary_name",
          "iban"
        ]
      },
      "RevolutEnvironmentEnum": {
        "enum": [
          "production",
          "sandbox"
        ],
        "type": "string",
        "description": "* `production` - Producción\n* `sandbox` - Sandbox (pruebas)"
      },
      "RevolutPaymentDraft": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "revolut_id": {
            "type": "string",
            "readOnly": true
          },
          "title": {
            "type": "string",
            "readOnly": true
          },
          "schedule_for": {
            "type": "string",
            "format": "date",
            "readOnly": true,
            "nullable": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RevolutPaymentDraftStatusEnum"
              }
            ],
            "readOnly": true
          },
          "total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "currency": {
            "type": "string",
            "readOnly": true
          },
          "account": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "account_name": {
            "type": "string",
            "readOnly": true
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevolutPaymentDraftLine"
            },
            "readOnly": true
          },
          "next_step": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "created_by": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "account",
          "account_name",
          "created_at",
          "created_by",
          "currency",
          "id",
          "lines",
          "next_step",
          "revolut_id",
          "schedule_for",
          "status",
          "title",
          "total",
          "updated_at"
        ]
      },
      "RevolutPaymentDraftCreateRequest": {
        "type": "object",
        "properties": {
          "expense_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Gastos confirmados con importe pendiente (se paga el pendiente al IBAN del proveedor)."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevolutDraftLineInputRequest"
            },
            "description": "Pagos libres."
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "schedule_for": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de ejecución programada."
          },
          "account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de Revolut de origen (id de accounts/). Opcional si sólo hay una en esa divisa."
          },
          "allow_duplicates": {
            "type": "boolean",
            "default": false,
            "description": "Permitir gastos que ya están en otro borrador pendiente."
          }
        }
      },
      "RevolutPaymentDraftLine": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "expense": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "expense_number": {
            "type": "string",
            "readOnly": true
          },
          "beneficiary_name": {
            "type": "string",
            "readOnly": true
          },
          "iban": {
            "type": "string",
            "readOnly": true
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "currency": {
            "type": "string",
            "readOnly": true
          },
          "reference": {
            "type": "string",
            "readOnly": true
          },
          "counterparty_id": {
            "type": "string",
            "readOnly": true,
            "description": "Id de la contraparte en Revolut."
          },
          "bank_transaction": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "paid": {
            "type": "boolean",
            "readOnly": true
          },
          "paid_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          }
        },
        "required": [
          "amount",
          "bank_transaction",
          "beneficiary_name",
          "counterparty_id",
          "currency",
          "expense",
          "expense_number",
          "iban",
          "id",
          "paid",
          "paid_at",
          "reference"
        ]
      },
      "RevolutPaymentDraftStatusEnum": {
        "enum": [
          "creating",
          "created",
          "completed",
          "partial",
          "deleted"
        ],
        "type": "string",
        "description": "* `creating` - Creándose en Revolut\n* `created` - Creado (pendiente de aprobar en Revolut)\n* `completed` - Pagado y conciliado\n* `partial` - Pagado en parte\n* `deleted` - Eliminado"
      },
      "RevolutPermission": {
        "type": "object",
        "properties": {
          "key": {
            "$ref": "#/components/schemas/KeyEnum"
          },
          "label": {
            "type": "string"
          },
          "required": {
            "type": "boolean",
            "description": "Imprescindible para importar movimientos."
          },
          "ok": {
            "type": "boolean",
            "nullable": true,
            "description": "true = la clave lo permite; false = Revolut lo deniega; null = no se pudo comprobar."
          }
        },
        "required": [
          "key",
          "label",
          "ok",
          "required"
        ]
      },
      "RevolutPermissionProbe": {
        "type": "object",
        "properties": {
          "key": {
            "$ref": "#/components/schemas/KeyEnum"
          },
          "label": {
            "type": "string"
          },
          "required": {
            "type": "boolean",
            "description": "Imprescindible para importar movimientos."
          },
          "ok": {
            "type": "boolean",
            "nullable": true,
            "description": "true = la clave lo permite; false = Revolut lo deniega; null = no se pudo comprobar."
          },
          "status": {
            "type": "integer",
            "nullable": true,
            "description": "Código HTTP que devolvió Revolut."
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "detail",
          "key",
          "label",
          "ok",
          "required",
          "status"
        ]
      },
      "RevolutScopeEnum": {
        "enum": [
          "READ",
          "WRITE",
          "PAY",
          "READ_SENSITIVE_CARD_DATA"
        ],
        "type": "string",
        "description": "* `READ` - READ\n* `WRITE` - WRITE\n* `PAY` - PAY\n* `READ_SENSITIVE_CARD_DATA` - READ_SENSITIVE_CARD_DATA"
      },
      "RevolutSigningAttempt": {
        "type": "object",
        "properties": {
          "variant": {
            "$ref": "#/components/schemas/RevolutSigningVariantEnum"
          },
          "status": {
            "type": "integer",
            "nullable": true,
            "description": "Código HTTP que devolvió Revolut."
          },
          "detail": {
            "type": "string",
            "description": "Mensaje de error literal de Revolut."
          }
        },
        "required": [
          "detail",
          "status",
          "variant"
        ]
      },
      "RevolutSigningKey": {
        "type": "object",
        "properties": {
          "public_key": {
            "type": "string",
            "description": "Clave PÚBLICA en PEM (``-----BEGIN PUBLIC KEY-----``, SubjectPublicKeyInfo), idéntica en formato al public.pem de ``openssl pkey -pubout``: es lo que se sube a Revolut."
          },
          "fingerprint": {
            "type": "string",
            "description": "``SHA256:`` + SHA-256 en hexadecimal del DER de la clave pública."
          },
          "algorithm": {
            "$ref": "#/components/schemas/AlgorithmEnum"
          },
          "source": {
            "$ref": "#/components/schemas/RevolutSigningKeySourceEnum"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "regenerated": {
            "type": "boolean",
            "description": "Sustituye a una clave anterior: hay que volver a subir la pública a Revolut y crear otra API key."
          },
          "has_api_key": {
            "type": "boolean",
            "description": "La conexión ya tiene una API key guardada."
          },
          "message": {
            "type": "string",
            "description": "Qué hacer a continuación (o el aviso de la regeneración)."
          }
        },
        "required": [
          "algorithm",
          "created_at",
          "fingerprint",
          "has_api_key",
          "message",
          "public_key",
          "regenerated",
          "source"
        ]
      },
      "RevolutSigningKeyRequestRequest": {
        "type": "object",
        "properties": {
          "regenerate": {
            "type": "boolean",
            "default": false,
            "description": "Obligatorio (``true``) para sustituir una clave de firma que ya existe: la API key creada en Revolut con la clave pública anterior dejará de funcionar."
          },
          "environment": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RevolutEnvironmentEnum"
              }
            ],
            "description": "Entorno de la conexión si todavía no existe (por defecto, producción).\n\n* `production` - Producción\n* `sandbox` - Sandbox (pruebas)"
          }
        }
      },
      "RevolutSigningKeySourceEnum": {
        "enum": [
          "generated",
          "uploaded"
        ],
        "type": "string"
      },
      "RevolutSigningTest": {
        "type": "object",
        "properties": {
          "tested": {
            "type": "boolean",
            "description": "Revolut rechazó la firma y se probaron las demás variantes."
          },
          "detected": {
            "type": "boolean",
            "description": "Una variante distinta funcionó y se ha guardado en la conexión."
          },
          "variant": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RevolutSigningVariantEnum"
              }
            ],
            "description": "Variante en uso tras la prueba.\n\n* `concat` - concat\n* `concat_url` - concat_url\n* `concat_short_path` - concat_short_path\n* `dotted` - dotted\n* `newline` - newline\n* `concat_seconds` - concat_seconds\n* `dotted_short_path` - dotted_short_path\n* `newline_short_path` - newline_short_path\n* `concat_short_path_seconds` - concat_short_path_seconds\n* `dotted_seconds` - dotted_seconds\n* `newline_seconds` - newline_seconds\n* `dotted_short_path_seconds` - dotted_short_path_seconds"
          },
          "previous_variant": {
            "nullable": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/RevolutSigningVariantEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "attempts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevolutSigningAttempt"
            }
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "attempts",
          "detected",
          "message",
          "previous_variant",
          "tested",
          "variant"
        ]
      },
      "RevolutSigningVariantEnum": {
        "enum": [
          "concat",
          "concat_url",
          "concat_short_path",
          "dotted",
          "newline",
          "concat_seconds",
          "dotted_short_path",
          "newline_short_path",
          "concat_short_path_seconds",
          "dotted_seconds",
          "newline_seconds",
          "dotted_short_path_seconds"
        ],
        "type": "string"
      },
      "RevolutSyncActionEnum": {
        "enum": [
          "created",
          "linked"
        ],
        "type": "string",
        "description": "* `created` - Movimiento creado\n* `linked` - Enlazado con uno ya importado"
      },
      "RevolutSyncLog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "trigger": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RevolutSyncTriggerEnum"
              }
            ],
            "readOnly": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RevolutSyncStatusEnum"
              }
            ],
            "readOnly": true
          },
          "dry_run": {
            "type": "boolean",
            "readOnly": true
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "until": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "finished_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "accounts_synced": {
            "type": "integer",
            "readOnly": true
          },
          "transactions_fetched": {
            "type": "integer",
            "readOnly": true
          },
          "rows_new": {
            "type": "integer",
            "readOnly": true,
            "description": "Movimientos creados."
          },
          "rows_linked": {
            "type": "integer",
            "readOnly": true,
            "description": "Enlazados con uno importado por extracto."
          },
          "rows_duplicate": {
            "type": "integer",
            "readOnly": true,
            "description": "Ya importados (mismo id de Revolut)."
          },
          "rows_skipped": {
            "type": "integer",
            "readOnly": true,
            "description": "Pendientes, rechazados o de cuentas no enlazadas."
          },
          "rows_reverted": {
            "type": "integer",
            "readOnly": true
          },
          "auto_matched": {
            "type": "integer",
            "readOnly": true,
            "description": "Conciliados automáticamente."
          },
          "transfers": {
            "type": "integer",
            "readOnly": true,
            "description": "Traspasos entre cuentas propias."
          },
          "warnings": {
            "readOnly": true
          },
          "error": {
            "type": "string",
            "readOnly": true
          },
          "created_by": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "preview": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevolutSyncPreviewRow"
            },
            "readOnly": true,
            "description": "Sólo en la respuesta de POST sync/: movimientos creados o enlazados (máx. 100)."
          }
        },
        "required": [
          "accounts_synced",
          "auto_matched",
          "created_by",
          "dry_run",
          "error",
          "finished_at",
          "id",
          "preview",
          "rows_duplicate",
          "rows_linked",
          "rows_new",
          "rows_reverted",
          "rows_skipped",
          "since",
          "started_at",
          "status",
          "transactions_fetched",
          "transfers",
          "trigger",
          "until",
          "warnings"
        ]
      },
      "RevolutSyncPreviewRow": {
        "type": "object",
        "properties": {
          "action": {
            "$ref": "#/components/schemas/RevolutSyncActionEnum"
          },
          "external_id": {
            "type": "string"
          },
          "bank_account": {
            "type": "integer"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "amount": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "concept": {
            "type": "string"
          },
          "counterparty_name": {
            "type": "string"
          },
          "transaction": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "action",
          "amount",
          "bank_account",
          "concept",
          "counterparty_name",
          "currency",
          "date",
          "external_id",
          "transaction"
        ]
      },
      "RevolutSyncRequestRequest": {
        "type": "object",
        "properties": {
          "since": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Desde (por defecto, la última sincronización menos 10 días)."
          },
          "until": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Hasta, inclusive (por defecto, ahora)."
          },
          "dry_run": {
            "type": "boolean",
            "default": false,
            "description": "Simular: no guarda nada y devuelve ``preview``."
          }
        }
      },
      "RevolutSyncStatusEnum": {
        "enum": [
          "running",
          "done",
          "partial",
          "error"
        ],
        "type": "string",
        "description": "* `running` - En curso\n* `done` - Completada\n* `partial` - Completada con avisos\n* `error` - Error"
      },
      "RevolutSyncTriggerEnum": {
        "enum": [
          "manual",
          "scheduled",
          "webhook",
          "callback"
        ],
        "type": "string",
        "description": "* `manual` - Manual\n* `scheduled` - Programada\n* `webhook` - Webhook\n* `callback` - Tras autorizar"
      },
      "RevolutTestResult": {
        "type": "object",
        "description": "Con ``auth_mode=oauth`` sólo vienen ``ok``, ``environment``, ``accounts`` y ``currencies``.",
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "La conexión sirve para importar movimientos (con API key: puede leer cuentas y transacciones)."
          },
          "environment": {
            "type": "string"
          },
          "accounts": {
            "type": "integer",
            "description": "Número de cuentas visibles en Revolut."
          },
          "currencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "auth_mode": {
            "$ref": "#/components/schemas/AuthModeEnum"
          },
          "signing_enabled": {
            "type": "boolean"
          },
          "permissions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevolutPermissionProbe"
            },
            "description": "Sólo con API key: cada permiso que usa Billora, probado por separado con una lectura inocua."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "signing": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RevolutSigningTest"
              }
            ],
            "description": "Sólo con firma activada: variante de la cadena firmada en uso y, si Revolut rechazó la firma, el resultado de probar las demás (``attempts``)."
          },
          "error": {
            "type": "string",
            "description": "Sólo cuando ``ok`` es false porque Revolut rechaza la petición con todas las variantes de firma."
          }
        },
        "required": [
          "accounts",
          "currencies",
          "environment",
          "ok"
        ]
      },
      "RevolutWebhookStatus": {
        "type": "object",
        "properties": {
          "registered": {
            "type": "boolean"
          },
          "id": {
            "type": "string",
            "nullable": true
          },
          "url": {
            "type": "string",
            "description": "URL pública que recibe los eventos de Revolut."
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "last_event_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "events",
          "id",
          "last_event_at",
          "registered",
          "url"
        ]
      },
      "RolEnum": {
        "enum": [
          "arrendatario",
          "arrendador"
        ],
        "type": "string",
        "description": "* `arrendatario` - La empresa es arrendataria (paga el alquiler)\n* `arrendador` - La empresa es arrendadora (cobra el alquiler)"
      },
      "RoleEnum": {
        "enum": [
          "claimant",
          "defendant",
          "co_defendant",
          "third_party",
          "witness",
          "expert",
          "other"
        ],
        "type": "string",
        "description": "* `claimant` - Demandante\n* `defendant` - Demandado\n* `co_defendant` - Codemandado\n* `third_party` - Tercero\n* `witness` - Testigo\n* `expert` - Perito\n* `other` - Otro"
      },
      "RotateSecretRequest": {
        "type": "object",
        "properties": {
          "secret": {
            "type": "string",
            "minLength": 1,
            "description": "Opcional: nuevo secreto whsec_ propio. El anterior sigue firmando 24 h."
          }
        }
      },
      "RuleApplyResult": {
        "type": "object",
        "properties": {
          "rule": {
            "type": "integer"
          },
          "applied": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "applied",
          "errors",
          "rule"
        ]
      },
      "ScanJob": {
        "type": "object",
        "description": "Serializer completo para los trabajos de escaneo.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "original_file": {
            "type": "string",
            "format": "uri",
            "description": "Archivo original (imagen o PDF)"
          },
          "processed_file": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "readOnly": true,
            "description": "Archivo PDF procesado"
          },
          "original_filename": {
            "type": "string",
            "maxLength": 255
          },
          "file_size": {
            "type": "integer",
            "readOnly": true,
            "description": "Tamaño en bytes"
          },
          "mime_type": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ScanJobStatusEnum"
              }
            ],
            "readOnly": true
          },
          "processing_started_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "processing_completed_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "error_message": {
            "type": "string",
            "readOnly": true,
            "description": "Mensaje de error si falla"
          },
          "file_url": {
            "type": "string",
            "nullable": true,
            "description": "Obtiene la URL del archivo a mostrar.",
            "readOnly": true
          },
          "display_filename": {
            "type": "string",
            "nullable": true,
            "description": "Obtiene el nombre de archivo para mostrar.",
            "readOnly": true
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ScanResult"
              }
            ],
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "display_filename",
          "error_message",
          "file_size",
          "file_url",
          "id",
          "mime_type",
          "original_file",
          "original_filename",
          "processed_file",
          "processing_completed_at",
          "processing_started_at",
          "result",
          "status",
          "updated_at"
        ]
      },
      "ScanJobCreate": {
        "type": "object",
        "description": "Serializer para crear trabajos de escaneo.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ScanJobStatusEnum"
              }
            ],
            "readOnly": true
          },
          "original_file": {
            "type": "string",
            "format": "uri",
            "description": "Archivo original (imagen o PDF)"
          },
          "original_filename": {
            "type": "string",
            "maxLength": 255
          }
        },
        "required": [
          "id",
          "original_file",
          "original_filename",
          "status"
        ]
      },
      "ScanJobCreateRequest": {
        "type": "object",
        "description": "Serializer para crear trabajos de escaneo.",
        "properties": {
          "original_file": {
            "type": "string",
            "format": "binary",
            "description": "Archivo original (imagen o PDF)"
          },
          "original_filename": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "required": [
          "original_file",
          "original_filename"
        ]
      },
      "ScanJobList": {
        "type": "object",
        "description": "Serializer ligero para el listado de trabajos de escaneo.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "original_filename": {
            "type": "string",
            "maxLength": 255
          },
          "mime_type": {
            "type": "string",
            "maxLength": 100
          },
          "status": {
            "$ref": "#/components/schemas/ScanJobStatusEnum"
          },
          "file_url": {
            "type": "string",
            "nullable": true,
            "description": "Obtiene la URL del archivo a mostrar.",
            "readOnly": true
          },
          "supplier_name": {
            "type": "string",
            "nullable": true,
            "description": "Obtiene el nombre del proveedor del resultado.",
            "readOnly": true
          },
          "invoice_number": {
            "type": "string",
            "nullable": true,
            "description": "Obtiene el número de factura del resultado.",
            "readOnly": true
          },
          "total_amount": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Obtiene el importe total del resultado.",
            "readOnly": true
          },
          "confidence_score": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Obtiene la puntuación de confianza del resultado.",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "confidence_score",
          "file_url",
          "id",
          "invoice_number",
          "mime_type",
          "original_filename",
          "supplier_name",
          "total_amount"
        ]
      },
      "ScanJobRequest": {
        "type": "object",
        "description": "Serializer completo para los trabajos de escaneo.",
        "properties": {
          "original_file": {
            "type": "string",
            "format": "binary",
            "description": "Archivo original (imagen o PDF)"
          },
          "original_filename": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "required": [
          "original_file",
          "original_filename"
        ]
      },
      "ScanJobStatusEnum": {
        "enum": [
          "pending",
          "processing",
          "completed",
          "failed",
          "converted"
        ],
        "type": "string",
        "description": "* `pending` - Pendiente\n* `processing` - Procesando\n* `completed` - Completado\n* `failed` - Error\n* `converted` - Convertido a gasto"
      },
      "ScanResult": {
        "type": "object",
        "description": "Serializer para los resultados de escaneo.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "extracted_data": {
            "description": "Datos extraídos en formato JSON"
          },
          "supplier_vat_id": {
            "type": "string",
            "nullable": true,
            "description": "CIF/NIF del proveedor",
            "maxLength": 20
          },
          "supplier_name": {
            "type": "string",
            "nullable": true,
            "description": "Nombre del proveedor",
            "maxLength": 255
          },
          "identified_supplier": {
            "type": "integer",
            "nullable": true,
            "description": "Proveedor identificado en la base de datos"
          },
          "supplier_display": {
            "type": "string",
            "readOnly": true
          },
          "invoice_number": {
            "type": "string",
            "nullable": true,
            "description": "Número de factura",
            "maxLength": 100
          },
          "invoice_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de la factura"
          },
          "subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe base"
          },
          "tax_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe de impuestos"
          },
          "total_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe total"
          },
          "identified_taxes": {
            "description": "Lista de impuestos identificados con sus porcentajes"
          },
          "spanish_taxes": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "readOnly": true
          },
          "suggested_category": {
            "type": "integer",
            "nullable": true,
            "description": "Categoría sugerida basada en el contenido"
          },
          "category_display": {
            "type": "string",
            "readOnly": true
          },
          "confidence_score": {
            "type": "number",
            "format": "double",
            "description": "Puntuación de confianza (0.0 - 1.0)"
          },
          "extracted_text": {
            "type": "string",
            "description": "Texto completo extraído"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "category_display",
          "created_at",
          "id",
          "spanish_taxes",
          "supplier_display",
          "updated_at"
        ]
      },
      "ScanResultRequest": {
        "type": "object",
        "description": "Serializer para los resultados de escaneo.",
        "properties": {
          "extracted_data": {
            "description": "Datos extraídos en formato JSON"
          },
          "supplier_vat_id": {
            "type": "string",
            "nullable": true,
            "description": "CIF/NIF del proveedor",
            "maxLength": 20
          },
          "supplier_name": {
            "type": "string",
            "nullable": true,
            "description": "Nombre del proveedor",
            "maxLength": 255
          },
          "identified_supplier": {
            "type": "integer",
            "nullable": true,
            "description": "Proveedor identificado en la base de datos"
          },
          "invoice_number": {
            "type": "string",
            "nullable": true,
            "description": "Número de factura",
            "maxLength": 100
          },
          "invoice_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Fecha de la factura"
          },
          "subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe base"
          },
          "tax_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe de impuestos"
          },
          "total_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "Importe total"
          },
          "identified_taxes": {
            "description": "Lista de impuestos identificados con sus porcentajes"
          },
          "suggested_category": {
            "type": "integer",
            "nullable": true,
            "description": "Categoría sugerida basada en el contenido"
          },
          "confidence_score": {
            "type": "number",
            "format": "double",
            "description": "Puntuación de confianza (0.0 - 1.0)"
          },
          "extracted_text": {
            "type": "string",
            "description": "Texto completo extraído"
          }
        }
      },
      "SeriesNumberPreview": {
        "type": "object",
        "properties": {
          "sequence_number": {
            "type": "integer"
          },
          "number": {
            "type": "string"
          },
          "period": {
            "type": "string"
          }
        },
        "required": [
          "number",
          "period",
          "sequence_number"
        ]
      },
      "SeverityEnum": {
        "enum": [
          "mild",
          "moderate",
          "severe"
        ],
        "type": "string",
        "description": "* `mild` - Leve\n* `moderate` - Moderada\n* `severe` - Grave"
      },
      "SignatureDocumentTypeEnum": {
        "enum": [
          "quote",
          "invoice",
          "contract",
          "consent",
          "expediente_doc",
          "clinical_doc",
          "other"
        ],
        "type": "string",
        "description": "* `quote` - Presupuesto\n* `invoice` - Factura\n* `contract` - Contrato\n* `consent` - Consentimiento\n* `expediente_doc` - Documento de expediente\n* `clinical_doc` - Documento clínico\n* `other` - Otro"
      },
      "SignatureEvidence": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "signed_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "signer_ip": {
            "type": "string",
            "readOnly": true,
            "nullable": true
          },
          "signer_browser": {
            "type": "string",
            "readOnly": true
          },
          "signed_pdf_file": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "readOnly": true
          },
          "signed_pdf_hash": {
            "type": "string",
            "readOnly": true
          },
          "certificate_pdf_file": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "readOnly": true
          },
          "geolocation": {
            "readOnly": true
          }
        },
        "required": [
          "certificate_pdf_file",
          "geolocation",
          "id",
          "signed_at",
          "signed_pdf_file",
          "signed_pdf_hash",
          "signer_browser",
          "signer_ip"
        ]
      },
      "SignatureEvidencePublic": {
        "type": "object",
        "description": "Evidencia de firma para la API (sin rutas internas de almacenamiento).",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "request": {
            "type": "integer",
            "readOnly": true
          },
          "signed_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "signer_ip": {
            "type": "string",
            "readOnly": true,
            "nullable": true
          },
          "signer_user_agent": {
            "type": "string",
            "readOnly": true
          },
          "signer_browser": {
            "type": "string",
            "readOnly": true
          },
          "signed_pdf_hash": {
            "type": "string",
            "readOnly": true
          },
          "geolocation": {
            "readOnly": true
          },
          "has_signed_pdf": {
            "type": "boolean",
            "readOnly": true
          },
          "has_certificate": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "required": [
          "geolocation",
          "has_certificate",
          "has_signed_pdf",
          "id",
          "request",
          "signed_at",
          "signed_pdf_hash",
          "signer_browser",
          "signer_ip",
          "signer_user_agent"
        ]
      },
      "SignatureReminderResult": {
        "type": "object",
        "properties": {
          "detail": {
            "type": "string"
          },
          "sent_channels": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "detail",
          "sent_channels"
        ]
      },
      "SignatureRequestCreate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "document_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SignatureDocumentTypeEnum"
              }
            ],
            "default": "other"
          },
          "pdf_file": {
            "type": "string",
            "format": "uri"
          },
          "signer_name": {
            "type": "string",
            "maxLength": 200
          },
          "signer_email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "signer_phone": {
            "type": "string",
            "maxLength": 30
          },
          "delivery_method": {
            "$ref": "#/components/schemas/DeliveryMethodEnum"
          },
          "message": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "case": {
            "type": "integer",
            "nullable": true
          },
          "patient": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "id",
          "pdf_file",
          "signer_name",
          "title"
        ]
      },
      "SignatureRequestCreateRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "document_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SignatureDocumentTypeEnum"
              }
            ],
            "default": "other"
          },
          "pdf_file": {
            "type": "string",
            "format": "binary"
          },
          "signer_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "signer_email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "signer_phone": {
            "type": "string",
            "maxLength": 30
          },
          "delivery_method": {
            "$ref": "#/components/schemas/DeliveryMethodEnum"
          },
          "message": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "case": {
            "type": "integer",
            "nullable": true
          },
          "patient": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "pdf_file",
          "signer_name",
          "title"
        ]
      },
      "SignatureRequestDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "token": {
            "type": "string",
            "format": "uuid",
            "readOnly": true
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "document_type": {
            "$ref": "#/components/schemas/SignatureDocumentTypeEnum"
          },
          "document_type_display": {
            "type": "string",
            "readOnly": true
          },
          "pdf_file": {
            "type": "string",
            "format": "uri"
          },
          "pdf_hash": {
            "type": "string",
            "readOnly": true
          },
          "signer_name": {
            "type": "string",
            "maxLength": 200
          },
          "signer_email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "signer_phone": {
            "type": "string",
            "maxLength": 30
          },
          "delivery_method": {
            "$ref": "#/components/schemas/DeliveryMethodEnum"
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SignatureRequestStatusEnum"
              }
            ],
            "readOnly": true
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "message": {
            "type": "string"
          },
          "decline_reason": {
            "type": "string",
            "readOnly": true
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "sent_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "viewed_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "signed_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "created_by": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "created_by_name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "case": {
            "type": "integer",
            "nullable": true
          },
          "patient": {
            "type": "integer",
            "nullable": true
          },
          "evidence": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SignatureEvidence"
              }
            ],
            "readOnly": true
          },
          "public_url": {
            "type": "string",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "created_by",
          "created_by_name",
          "decline_reason",
          "document_type_display",
          "evidence",
          "id",
          "pdf_file",
          "pdf_hash",
          "public_url",
          "sent_at",
          "signed_at",
          "signer_name",
          "status",
          "status_display",
          "title",
          "token",
          "updated_at",
          "viewed_at"
        ]
      },
      "SignatureRequestDetailRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "document_type": {
            "$ref": "#/components/schemas/SignatureDocumentTypeEnum"
          },
          "pdf_file": {
            "type": "string",
            "format": "binary"
          },
          "signer_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "signer_email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "signer_phone": {
            "type": "string",
            "maxLength": 30
          },
          "delivery_method": {
            "$ref": "#/components/schemas/DeliveryMethodEnum"
          },
          "message": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "case": {
            "type": "integer",
            "nullable": true
          },
          "patient": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "pdf_file",
          "signer_name",
          "title"
        ]
      },
      "SignatureRequestList": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "token": {
            "type": "string",
            "format": "uuid",
            "readOnly": true
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "document_type": {
            "$ref": "#/components/schemas/SignatureDocumentTypeEnum"
          },
          "document_type_display": {
            "type": "string",
            "readOnly": true
          },
          "signer_name": {
            "type": "string",
            "maxLength": 200
          },
          "signer_email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "signer_phone": {
            "type": "string",
            "maxLength": 30
          },
          "delivery_method": {
            "$ref": "#/components/schemas/DeliveryMethodEnum"
          },
          "status": {
            "$ref": "#/components/schemas/SignatureRequestStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "has_evidence": {
            "type": "boolean",
            "readOnly": true
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "sent_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "signed_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "case": {
            "type": "integer",
            "nullable": true
          },
          "patient": {
            "type": "integer",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "document_type_display",
          "has_evidence",
          "id",
          "sent_at",
          "signed_at",
          "signer_name",
          "status_display",
          "title",
          "token",
          "updated_at"
        ]
      },
      "SignatureRequestStatusEnum": {
        "enum": [
          "draft",
          "pending",
          "viewed",
          "signed",
          "declined",
          "expired",
          "cancelled"
        ],
        "type": "string",
        "description": "* `draft` - Borrador\n* `pending` - Pendiente\n* `viewed` - Visto\n* `signed` - Firmado\n* `declined` - Rechazado\n* `expired` - Expirado\n* `cancelled` - Cancelado"
      },
      "SignatureStats": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "draft": {
            "type": "integer"
          },
          "pending": {
            "type": "integer"
          },
          "viewed": {
            "type": "integer"
          },
          "signed": {
            "type": "integer"
          },
          "declined": {
            "type": "integer"
          },
          "expired": {
            "type": "integer"
          },
          "cancelled": {
            "type": "integer"
          }
        },
        "required": [
          "cancelled",
          "declined",
          "draft",
          "expired",
          "pending",
          "signed",
          "total",
          "viewed"
        ]
      },
      "SignedDownloadUrl": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "URL firmada temporal (caduca en minutos)."
          }
        },
        "required": [
          "url"
        ]
      },
      "SistemaInformatico": {
        "type": "object",
        "description": "Serializer para el sistema informático (solo lectura para usuarios no admin).",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "nombre": {
            "type": "string",
            "description": "Nombre del sistema informático",
            "maxLength": 120
          },
          "version": {
            "type": "string",
            "description": "Versión del sistema",
            "maxLength": 40
          },
          "entorno": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EntornoEnum"
              }
            ],
            "description": "Entorno AEAT (TEST/PROD)\n\n* `TEST` - TEST\n* `PROD` - PROD"
          },
          "is_active": {
            "type": "boolean",
            "description": "¿Está activo el sistema VeriFactu?"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "updated_at"
        ]
      },
      "SmsBalance": {
        "type": "object",
        "description": "Saldo de SMS de la organización (respuesta de ``GET /sms/balance/``).",
        "properties": {
          "free_monthly_limit": {
            "type": "integer",
            "description": "SMS gratuitos incluidos cada mes."
          },
          "free_used_this_month": {
            "type": "integer"
          },
          "free_remaining": {
            "type": "integer"
          },
          "paid_credits": {
            "type": "integer",
            "description": "Créditos restantes de bonos pagados."
          },
          "total_available": {
            "type": "integer",
            "description": "SMS que se pueden enviar ahora."
          },
          "total_sent": {
            "type": "integer"
          },
          "sent_this_month": {
            "type": "integer"
          },
          "bundle_price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,2})?$"
          },
          "bundle_quantity": {
            "type": "integer"
          }
        },
        "required": [
          "bundle_price",
          "bundle_quantity",
          "free_monthly_limit",
          "free_remaining",
          "free_used_this_month",
          "paid_credits",
          "sent_this_month",
          "total_available",
          "total_sent"
        ]
      },
      "SmsBundleStatusEnum": {
        "enum": [
          "pending",
          "paid",
          "failed"
        ],
        "type": "string",
        "description": "* `pending` - Pendiente de pago\n* `paid` - Pagado\n* `failed` - Fallido"
      },
      "SmsCreditBundle": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "quantity": {
            "type": "integer",
            "readOnly": true
          },
          "remaining": {
            "type": "integer",
            "readOnly": true
          },
          "price": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "currency": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SmsBundleStatusEnum"
              }
            ],
            "readOnly": true
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "purchased_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "currency",
          "id",
          "price",
          "purchased_at",
          "quantity",
          "remaining",
          "status",
          "status_display"
        ]
      },
      "SmsSendRequest": {
        "type": "object",
        "properties": {
          "to": {
            "type": "string",
            "minLength": 1,
            "description": "Teléfono del destinatario (+34600111222).",
            "maxLength": 30
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "description": "Texto del SMS (máx. 480 caracteres).",
            "maxLength": 480
          }
        },
        "required": [
          "message",
          "to"
        ]
      },
      "SmsSent": {
        "type": "object",
        "description": "SMS enviado + saldo resultante (respuesta de ``POST /sms/send/``).",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "recipient_phone": {
            "type": "string",
            "readOnly": true
          },
          "channel": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ChannelEnum"
              }
            ],
            "readOnly": true
          },
          "channel_display": {
            "type": "string",
            "readOnly": true
          },
          "message_preview": {
            "type": "string",
            "readOnly": true
          },
          "is_free": {
            "type": "boolean",
            "readOnly": true
          },
          "sent_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SmsBalance"
              }
            ],
            "readOnly": true
          }
        },
        "required": [
          "balance",
          "channel",
          "channel_display",
          "id",
          "is_free",
          "message_preview",
          "recipient_phone",
          "sent_at"
        ]
      },
      "SmsUsageLog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "recipient_phone": {
            "type": "string",
            "readOnly": true
          },
          "channel": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ChannelEnum"
              }
            ],
            "readOnly": true
          },
          "channel_display": {
            "type": "string",
            "readOnly": true
          },
          "message_preview": {
            "type": "string",
            "readOnly": true
          },
          "is_free": {
            "type": "boolean",
            "readOnly": true
          },
          "sent_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "channel",
          "channel_display",
          "id",
          "is_free",
          "message_preview",
          "recipient_phone",
          "sent_at"
        ]
      },
      "SourceEnum": {
        "enum": [
          "web",
          "geo",
          "qr",
          "manual"
        ],
        "type": "string",
        "description": "* `web` - Web\n* `geo` - Geolocalización\n* `qr` - Código QR\n* `manual` - Manual"
      },
      "SpanishTaxRate": {
        "type": "object",
        "description": "Serializer para tipos de impuestos.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "description": "Nombre descriptivo del impuesto",
            "maxLength": 100
          },
          "tax_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TaxRateTypeEnum"
              }
            ],
            "description": "Tipo de impuesto\n\n* `IVA` - IVA\n* `IGIC` - IGIC\n* `IPSI` - IPSI\n* `RECARGO` - Recargo de equivalencia\n* `IRPF_PROF` - IRPF - Profesionales\n* `IRPF_ARR` - IRPF - Arrendamientos\n* `RET_ESP` - Retenciones especiales"
          },
          "tax_type_display": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "category": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CategoryEnum"
              }
            ],
            "description": "Categoría del impuesto\n\n* `incremental` - Incremental (se suma al precio)\n* `retencion` - Retención (se descuenta del precio)"
          },
          "category_display": {
            "type": "string",
            "readOnly": true
          },
          "rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$",
            "description": "Porcentaje (ej: 21.00)"
          },
          "effective_rate_display": {
            "type": "string",
            "nullable": true,
            "description": "Tasa efectiva con signo para retenciones.",
            "readOnly": true
          },
          "verifactu_tax_code": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TaxRegimeTypeEnum"
              }
            ],
            "description": "Código impuesto VeriFactu (L1)\n\n* `01` - IVA\n* `02` - IPSI\n* `03` - IGIC\n* `05` - Otros"
          },
          "default_operation_classification": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DefaultOperationClassificationEnum"
              }
            ],
            "description": "Calificación operación por defecto (L9)\n\n* `S1` - Sujeta no exenta (sin ISP)\n* `S2` - Sujeta no exenta (con ISP)\n* `N1` - No sujeta (art.7/14/otros)\n* `N2` - No sujeta (localización)"
          },
          "exemption_type": {
            "nullable": true,
            "description": "Tipo exención si aplica (L10)\n\n* `E1` - Exenta art. 20\n* `E2` - Exenta art. 21\n* `E3` - Exenta art. 22\n* `E4` - Exenta arts. 23 y 24\n* `E5` - Exenta art. 25\n* `E6` - Exenta otros",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExemptionTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "is_active": {
            "type": "boolean"
          },
          "is_exemption": {
            "type": "boolean",
            "description": "¿Es una exención?"
          },
          "scope": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TaxRateScopeEnum"
              }
            ],
            "description": "Dónde se puede usar el tipo: ventas, compras o ambas.\n\n* `both` - Ventas y compras\n* `sales` - Sólo ventas\n* `purchases` - Sólo compras"
          },
          "appears_in_verifactu": {
            "type": "boolean",
            "description": "¿Aparece en VeriFactu? (retenciones no)"
          },
          "verifactu_data": {
            "type": "object",
            "additionalProperties": {},
            "description": "Datos formateados para VeriFactu.",
            "readOnly": true
          }
        },
        "required": [
          "category",
          "category_display",
          "effective_rate_display",
          "id",
          "name",
          "rate",
          "tax_type",
          "tax_type_display",
          "verifactu_data"
        ]
      },
      "SpanishTaxRateRequest": {
        "type": "object",
        "description": "Serializer para tipos de impuestos.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "Nombre descriptivo del impuesto",
            "maxLength": 100
          },
          "tax_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TaxRateTypeEnum"
              }
            ],
            "description": "Tipo de impuesto\n\n* `IVA` - IVA\n* `IGIC` - IGIC\n* `IPSI` - IPSI\n* `RECARGO` - Recargo de equivalencia\n* `IRPF_PROF` - IRPF - Profesionales\n* `IRPF_ARR` - IRPF - Arrendamientos\n* `RET_ESP` - Retenciones especiales"
          },
          "category": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CategoryEnum"
              }
            ],
            "description": "Categoría del impuesto\n\n* `incremental` - Incremental (se suma al precio)\n* `retencion` - Retención (se descuenta del precio)"
          },
          "rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$",
            "description": "Porcentaje (ej: 21.00)"
          },
          "verifactu_tax_code": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TaxRegimeTypeEnum"
              }
            ],
            "description": "Código impuesto VeriFactu (L1)\n\n* `01` - IVA\n* `02` - IPSI\n* `03` - IGIC\n* `05` - Otros"
          },
          "default_operation_classification": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DefaultOperationClassificationEnum"
              }
            ],
            "description": "Calificación operación por defecto (L9)\n\n* `S1` - Sujeta no exenta (sin ISP)\n* `S2` - Sujeta no exenta (con ISP)\n* `N1` - No sujeta (art.7/14/otros)\n* `N2` - No sujeta (localización)"
          },
          "exemption_type": {
            "nullable": true,
            "description": "Tipo exención si aplica (L10)\n\n* `E1` - Exenta art. 20\n* `E2` - Exenta art. 21\n* `E3` - Exenta art. 22\n* `E4` - Exenta arts. 23 y 24\n* `E5` - Exenta art. 25\n* `E6` - Exenta otros",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExemptionTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "is_active": {
            "type": "boolean"
          },
          "is_exemption": {
            "type": "boolean",
            "description": "¿Es una exención?"
          },
          "scope": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TaxRateScopeEnum"
              }
            ],
            "description": "Dónde se puede usar el tipo: ventas, compras o ambas.\n\n* `both` - Ventas y compras\n* `sales` - Sólo ventas\n* `purchases` - Sólo compras"
          },
          "appears_in_verifactu": {
            "type": "boolean",
            "description": "¿Aparece en VeriFactu? (retenciones no)"
          }
        },
        "required": [
          "category",
          "name",
          "rate",
          "tax_type"
        ]
      },
      "SpanishTaxRegime": {
        "type": "object",
        "description": "Serializer para regímenes fiscales españoles.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "code": {
            "type": "string",
            "description": "Código oficial AEAT (L8A/L8B)",
            "maxLength": 2
          },
          "tax_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TaxRegimeTypeEnum"
              }
            ],
            "description": "Tipo de impuesto (L1)\n\n* `01` - IVA\n* `02` - IPSI\n* `03` - IGIC\n* `05` - Otros"
          },
          "tax_type_display": {
            "type": "string",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "description": "Nombre del régimen",
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "description": "Descripción detallada"
          },
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "code",
          "id",
          "name",
          "tax_type",
          "tax_type_display"
        ]
      },
      "SpanishTaxRegimeRequest": {
        "type": "object",
        "description": "Serializer para regímenes fiscales españoles.",
        "properties": {
          "code": {
            "type": "string",
            "minLength": 1,
            "description": "Código oficial AEAT (L8A/L8B)",
            "maxLength": 2
          },
          "tax_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TaxRegimeTypeEnum"
              }
            ],
            "description": "Tipo de impuesto (L1)\n\n* `01` - IVA\n* `02` - IPSI\n* `03` - IGIC\n* `05` - Otros"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "Nombre del régimen",
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "description": "Descripción detallada"
          },
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "code",
          "name",
          "tax_type"
        ]
      },
      "Specialty": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 150
          },
          "code": {
            "type": "string",
            "maxLength": 20
          },
          "description": {
            "type": "string"
          },
          "icon": {
            "type": "string",
            "maxLength": 50
          },
          "color": {
            "type": "string",
            "maxLength": 7
          },
          "custom_fields": {
            "description": "Definición de campos adicionales por especialidad"
          },
          "is_active": {
            "type": "boolean"
          },
          "practitioner_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "practitioner_count",
          "updated_at"
        ]
      },
      "SpecialtyRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "code": {
            "type": "string",
            "maxLength": 20
          },
          "description": {
            "type": "string"
          },
          "icon": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "color": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7
          },
          "custom_fields": {
            "description": "Definición de campos adicionales por especialidad"
          },
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "name"
        ]
      },
      "StatementImportError": {
        "type": "object",
        "description": "400 de ``POST /treasury/imports/`` cuando el fichero no se puede interpretar: el fichero queda\nguardado en una importación con ``status=error`` cuyo id va en ``statement_import``.",
        "properties": {
          "detail": {
            "type": "string",
            "description": "Mensaje legible (en español)."
          },
          "code": {
            "type": "string",
            "description": "Siempre «validation_error»."
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            },
            "description": "Errores por campo ({field, code, message})."
          },
          "statement_import": {
            "type": "integer",
            "nullable": true,
            "description": "Id del BankStatementImport con status=error que conserva el fichero: repite la importación con ``mapping`` (POST /treasury/imports/preview/ para elegir las columnas)."
          },
          "request_id": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "code",
          "detail",
          "errors",
          "statement_import"
        ]
      },
      "StatementImportRequestRequest": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "Extracto: Norma 43 (.q43/.n43/.aeb/.c43/.txt), CSV o XLSX; máximo 10 MB."
          },
          "bank_account": {
            "type": "integer"
          },
          "mapping": {
            "description": "Mapping manual de columnas (ver preview.mapping)."
          }
        },
        "required": [
          "bank_account",
          "file"
        ]
      },
      "StatementPreview": {
        "type": "object",
        "properties": {
          "format": {
            "type": "string"
          },
          "accounts": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Norma 43: cuentas (entidad-oficina-cuenta) que contiene el fichero."
          },
          "bank_preset": {
            "type": "string",
            "nullable": true
          },
          "bank_preset_label": {
            "type": "string",
            "nullable": true
          },
          "sheet": {
            "type": "string",
            "nullable": true
          },
          "mapping": {
            "type": "object",
            "additionalProperties": {}
          },
          "confidence": {
            "type": "string",
            "description": "high | medium | low"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sample_rows": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          },
          "rows_total": {
            "type": "integer"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "opening_balance": {
            "type": "string",
            "nullable": true
          },
          "closing_balance": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "bank_preset",
          "columns",
          "confidence",
          "format",
          "issues",
          "mapping",
          "rows_total",
          "sample_rows"
        ]
      },
      "StatementPreviewRequestRequest": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "Extracto: Norma 43 (.q43/.n43/.aeb/.c43/.txt), CSV o XLSX; máximo 10 MB."
          },
          "bank_account": {
            "type": "integer",
            "nullable": true
          },
          "mapping": {
            "description": "Mapping manual de columnas (ver preview.mapping)."
          }
        },
        "required": [
          "file"
        ]
      },
      "StatusDistribution": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          }
        },
        "required": [
          "amount",
          "count",
          "status"
        ]
      },
      "StatusResult": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          }
        },
        "required": [
          "status"
        ]
      },
      "SuggestedReasonEnum": {
        "enum": [
          "exact",
          "prefix",
          "name",
          "vat_id",
          "bank_account",
          "new_account",
          "regularize"
        ],
        "type": "string",
        "description": "* `exact` - exact\n* `prefix` - prefix\n* `name` - name\n* `vat_id` - vat_id\n* `bank_account` - bank_account\n* `new_account` - new_account\n* `regularize` - regularize"
      },
      "SuggestionResult": {
        "type": "object",
        "properties": {
          "transaction": {
            "type": "integer"
          },
          "result": {
            "type": "string",
            "description": "applied | would_apply | skipped | error"
          },
          "detail": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "suggestion": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          }
        },
        "required": [
          "detail",
          "result",
          "transaction"
        ]
      },
      "Supplier": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "legal_name": {
            "type": "string",
            "maxLength": 200
          },
          "trade_name": {
            "type": "string",
            "maxLength": 200
          },
          "vat_id": {
            "type": "string",
            "maxLength": 20
          },
          "vat_id_type": {
            "description": "Tipo de documento de identificación fiscal (L7 AEAT). Vacío = NIF/CIF español.\n\n* `` - NIF/CIF español\n* `02` - NIF-IVA intracomunitario\n* `03` - Pasaporte\n* `04` - Documento oficial de identificación\n* `05` - Certificado de residencia\n* `06` - Otro documento probatorio\n* `07` - No censado",
            "oneOf": [
              {
                "$ref": "#/components/schemas/VatIdTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "website": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 200
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "party_type": {
            "$ref": "#/components/schemas/PartyTypeEnum"
          },
          "billing_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Address"
              }
            ],
            "nullable": true
          },
          "shipping_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Address"
              }
            ],
            "nullable": true
          },
          "fiscal_country": {
            "type": "string",
            "maxLength": 2
          },
          "fiscal_province": {
            "type": "string",
            "maxLength": 100
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "default_payment_method": {
            "$ref": "#/components/schemas/VendorPaymentMethodEnum"
          },
          "iban": {
            "type": "string",
            "maxLength": 34
          },
          "mandate_reference": {
            "type": "string",
            "maxLength": 64
          },
          "sepa_mandate_signed_at": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "language": {
            "type": "string",
            "maxLength": 10
          },
          "notes": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {},
            "description": "Serializar tags para lectura (GET requests)",
            "readOnly": true
          },
          "previous_names": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            },
            "readOnly": true,
            "description": "Histórico de razones sociales del mismo NIF: [{legal_name, trade_name, until}]. Se rellena solo al cambiar legal_name (y al fusionar duplicados)."
          },
          "warnings": {
            "type": "array",
            "items": {},
            "readOnly": true,
            "description": "Avisos de la ficha ({code, message}): country_mismatch si el país de la dirección de facturación no coincide con el país fiscal."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "is_public_entity": {
            "type": "boolean",
            "description": "Indica si es una administración pública u organismo oficial."
          },
          "office_code": {
            "type": "string",
            "description": "Identificador de la unidad administrativa (delegación, secretaría, subdelegación, etc.) para distinguir entidades con el mismo CIF.",
            "maxLength": 150
          },
          "dir3_unit": {
            "type": "string"
          },
          "dir3_organ": {
            "type": "string"
          },
          "dir3_office": {
            "type": "string"
          }
        },
        "required": [
          "created_at",
          "id",
          "legal_name",
          "previous_names",
          "tags",
          "updated_at",
          "warnings"
        ]
      },
      "SupplierExpectedFrequencyEnum": {
        "enum": [
          "monthly",
          "quarterly",
          "yearly"
        ],
        "type": "string",
        "description": "* `monthly` - Mensual\n* `quarterly` - Trimestral\n* `yearly` - Anual"
      },
      "SupplierExpenseDefaults": {
        "type": "object",
        "description": "Valores por defecto de los gastos de un proveedor (cuenta, categoría, tipo de\ndocumento y de operación) y avisos de proveedor recurrente.",
        "properties": {
          "supplier": {
            "type": "integer",
            "readOnly": true
          },
          "supplier_display": {
            "type": "string",
            "readOnly": true
          },
          "default_accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de gasto (6xx) por defecto de las facturas de este proveedor."
          },
          "default_category": {
            "type": "integer",
            "nullable": true,
            "description": "Categoría de gasto por defecto."
          },
          "default_document_type": {
            "nullable": true,
            "description": "Tipo de documento por defecto (factura, recibo de seguro, comisión bancaria…).\n\n* `invoice` - Factura recibida\n* `simplified_invoice` - Factura simplificada / ticket\n* `receipt` - Recibo o justificante (sin factura)\n* `settlement` - Liquidación (kilometraje, dietas, hoja de gastos)\n* `insurance_receipt` - Recibo de seguro\n* `bank_fee` - Comisión bancaria o de pasarela de pago\n* `tax_or_fee` - Tributo o tasa\n* `penalty` - Sanción o recargo (gasto excepcional)\n* `financial_interest` - Intereses de demora o financieros\n* `pass_through` - Suplido (pagado por cuenta del cliente)\n* `supplier_credit_note` - Abono / rectificativa de proveedor\n* `other` - Otro documento (no factura)",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExpenseDocumentTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "default_operation_type": {
            "nullable": true,
            "description": "Tipo de operación a efectos de IVA por defecto; vacío = se deduce del país fiscal (ES → interior, UE → intracomunitaria, resto → servicios ISP).\n\n* `domestic` - Operación interior\n* `intra_eu` - Adquisición intracomunitaria de bienes o servicios (UE)\n* `foreign_services` - Servicios de empresario no establecido en la UE (ISP)\n* `domestic_reverse_charge` - Inversión del sujeto pasivo interior (art. 84.Uno.2º)\n* `import` - Importación (DUA)\n* `not_subject` - No sujeta a IVA\n* `non_deductible` - IVA soportado no deducible",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExpenseOperationTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "expected_frequency": {
            "nullable": true,
            "description": "Frecuencia con la que factura este proveedor (para avisar de facturas que faltan).\n\n* `monthly` - Mensual\n* `quarterly` - Trimestral\n* `yearly` - Anual",
            "oneOf": [
              {
                "$ref": "#/components/schemas/SupplierExpectedFrequencyEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "recurring_alerts": {
            "type": "boolean",
            "description": "Avisar de los meses sin factura y de los saltos de numeración de este proveedor."
          }
        },
        "required": [
          "supplier",
          "supplier_display"
        ]
      },
      "SupplierExpenseDefaultsRequest": {
        "type": "object",
        "description": "Valores por defecto de los gastos de un proveedor (cuenta, categoría, tipo de\ndocumento y de operación) y avisos de proveedor recurrente.",
        "properties": {
          "default_accounting_account": {
            "type": "integer",
            "nullable": true,
            "description": "Cuenta de gasto (6xx) por defecto de las facturas de este proveedor."
          },
          "default_category": {
            "type": "integer",
            "nullable": true,
            "description": "Categoría de gasto por defecto."
          },
          "default_document_type": {
            "nullable": true,
            "description": "Tipo de documento por defecto (factura, recibo de seguro, comisión bancaria…).\n\n* `invoice` - Factura recibida\n* `simplified_invoice` - Factura simplificada / ticket\n* `receipt` - Recibo o justificante (sin factura)\n* `settlement` - Liquidación (kilometraje, dietas, hoja de gastos)\n* `insurance_receipt` - Recibo de seguro\n* `bank_fee` - Comisión bancaria o de pasarela de pago\n* `tax_or_fee` - Tributo o tasa\n* `penalty` - Sanción o recargo (gasto excepcional)\n* `financial_interest` - Intereses de demora o financieros\n* `pass_through` - Suplido (pagado por cuenta del cliente)\n* `supplier_credit_note` - Abono / rectificativa de proveedor\n* `other` - Otro documento (no factura)",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExpenseDocumentTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "default_operation_type": {
            "nullable": true,
            "description": "Tipo de operación a efectos de IVA por defecto; vacío = se deduce del país fiscal (ES → interior, UE → intracomunitaria, resto → servicios ISP).\n\n* `domestic` - Operación interior\n* `intra_eu` - Adquisición intracomunitaria de bienes o servicios (UE)\n* `foreign_services` - Servicios de empresario no establecido en la UE (ISP)\n* `domestic_reverse_charge` - Inversión del sujeto pasivo interior (art. 84.Uno.2º)\n* `import` - Importación (DUA)\n* `not_subject` - No sujeta a IVA\n* `non_deductible` - IVA soportado no deducible",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExpenseOperationTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "expected_frequency": {
            "nullable": true,
            "description": "Frecuencia con la que factura este proveedor (para avisar de facturas que faltan).\n\n* `monthly` - Mensual\n* `quarterly` - Trimestral\n* `yearly` - Anual",
            "oneOf": [
              {
                "$ref": "#/components/schemas/SupplierExpectedFrequencyEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          },
          "recurring_alerts": {
            "type": "boolean",
            "description": "Avisar de los meses sin factura y de los saltos de numeración de este proveedor."
          }
        }
      },
      "SupplierRequest": {
        "type": "object",
        "properties": {
          "legal_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "trade_name": {
            "type": "string",
            "maxLength": 200
          },
          "vat_id": {
            "type": "string",
            "maxLength": 20
          },
          "vat_id_type": {
            "description": "Tipo de documento de identificación fiscal (L7 AEAT). Vacío = NIF/CIF español.\n\n* `` - NIF/CIF español\n* `02` - NIF-IVA intracomunitario\n* `03` - Pasaporte\n* `04` - Documento oficial de identificación\n* `05` - Certificado de residencia\n* `06` - Otro documento probatorio\n* `07` - No censado",
            "oneOf": [
              {
                "$ref": "#/components/schemas/VatIdTypeEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "email": {
            "oneOf": [
              {
                "type": "string",
                "format": "email",
                "maxLength": 254
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "phone": {
            "type": "string",
            "maxLength": 30
          },
          "website": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 200
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "party_type": {
            "$ref": "#/components/schemas/PartyTypeEnum"
          },
          "billing_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AddressRequest"
              }
            ],
            "nullable": true
          },
          "shipping_address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AddressRequest"
              }
            ],
            "nullable": true
          },
          "fiscal_country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "fiscal_province": {
            "type": "string",
            "maxLength": 100
          },
          "payment_terms": {
            "type": "integer",
            "nullable": true
          },
          "default_payment_method": {
            "$ref": "#/components/schemas/VendorPaymentMethodEnum"
          },
          "iban": {
            "type": "string",
            "maxLength": 34
          },
          "mandate_reference": {
            "type": "string",
            "maxLength": 64
          },
          "sepa_mandate_signed_at": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "language": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10
          },
          "notes": {
            "type": "string"
          },
          "is_public_entity": {
            "type": "boolean",
            "description": "Indica si es una administración pública u organismo oficial."
          },
          "office_code": {
            "type": "string",
            "description": "Identificador de la unidad administrativa (delegación, secretaría, subdelegación, etc.) para distinguir entidades con el mismo CIF.",
            "maxLength": 150
          },
          "dir3_unit": {
            "type": "string"
          },
          "dir3_organ": {
            "type": "string"
          },
          "dir3_office": {
            "type": "string"
          }
        },
        "required": [
          "legal_name"
        ]
      },
      "SupplierStats": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "new_period": {
            "type": "integer"
          }
        },
        "required": [
          "new_period",
          "total"
        ]
      },
      "SupplyTypeEnum": {
        "enum": [
          "services",
          "goods"
        ],
        "type": "string",
        "description": "* `services` - Servicios\n* `goods` - Bienes"
      },
      "SyncStatusEnum": {
        "enum": [
          "not_synced",
          "pending",
          "synced",
          "error",
          "cloud_deleted"
        ],
        "type": "string",
        "description": "* `not_synced` - No sincronizado\n* `pending` - Pendiente\n* `synced` - Sincronizado\n* `error` - Error\n* `cloud_deleted` - Eliminado en la nube"
      },
      "Tag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 50
          },
          "slug": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^[-a-zA-Z0-9_]+$"
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "TagRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "slug": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^[-a-zA-Z0-9_]+$"
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          }
        },
        "required": [
          "name"
        ]
      },
      "TaxCalculationRequest": {
        "type": "object",
        "description": "Serializer para cálculos de impuestos.",
        "properties": {
          "tax_rate_id": {
            "type": "integer"
          },
          "base_amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "regime_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "operation_classification": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          }
        },
        "required": [
          "base_amount",
          "tax_rate_id"
        ]
      },
      "TaxConfigSetupResult": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "config": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "config",
          "message"
        ]
      },
      "TaxModelEnum": {
        "enum": [
          "303",
          "111",
          "115",
          "123",
          "130",
          "131",
          "202",
          "200",
          "100"
        ],
        "type": "string",
        "description": "* `303` - Modelo 303\n* `111` - Modelo 111\n* `115` - Modelo 115\n* `123` - Modelo 123\n* `130` - Modelo 130\n* `131` - Modelo 131\n* `202` - Modelo 202\n* `200` - Modelo 200\n* `100` - Modelo 100"
      },
      "TaxModelExportError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Datos que faltan para generar el fichero."
          }
        },
        "required": [
          "detail",
          "error",
          "missing"
        ]
      },
      "TaxModelOverridesRequestRequest": {
        "type": "object",
        "properties": {
          "overrides": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            },
            "description": "`[{casilla_code, value, note}]`: casillas editables del modelo."
          }
        },
        "required": [
          "overrides"
        ]
      },
      "TaxPaymentModelEnum": {
        "enum": [
          "303",
          "111",
          "115",
          "123",
          "130",
          "131",
          "202",
          "200",
          "100"
        ],
        "type": "string",
        "description": "* `303` - 303\n* `111` - 111\n* `115` - 115\n* `123` - 123\n* `130` - 130\n* `131` - 131\n* `202` - 202\n* `200` - 200\n* `100` - 100"
      },
      "TaxPaymentRequest": {
        "type": "object",
        "properties": {
          "model": {
            "$ref": "#/components/schemas/TaxPaymentModelEnum"
          },
          "period": {
            "type": "string",
            "minLength": 1,
            "description": "Periodo del modelo (p. ej. 2026-1T o 2026).",
            "maxLength": 10
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "description": "Positivo = pago a la AEAT; negativo = devolución recibida."
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "bank_account": {
            "type": "integer",
            "nullable": true
          },
          "reference": {
            "type": "string",
            "default": "",
            "maxLength": 100
          }
        },
        "required": [
          "amount",
          "date",
          "model",
          "period"
        ]
      },
      "TaxPaymentRequestRequest": {
        "type": "object",
        "properties": {
          "model": {
            "$ref": "#/components/schemas/TaxModelEnum"
          },
          "period": {
            "type": "string",
            "minLength": 1,
            "description": "YYYY-1T…4T (trimestral), YYYY-MM (mensual) o YYYY (anual).",
            "maxLength": 10,
            "pattern": "^\\d{4}(-([1-4]T|0[1-9]|1[0-2]))?$"
          }
        },
        "required": [
          "model",
          "period"
        ]
      },
      "TaxRateScopeEnum": {
        "enum": [
          "both",
          "sales",
          "purchases"
        ],
        "type": "string",
        "description": "* `both` - Ventas y compras\n* `sales` - Sólo ventas\n* `purchases` - Sólo compras"
      },
      "TaxRateTypeEnum": {
        "enum": [
          "IVA",
          "IGIC",
          "IPSI",
          "RECARGO",
          "IRPF_PROF",
          "IRPF_ARR",
          "RET_ESP"
        ],
        "type": "string",
        "description": "* `IVA` - IVA\n* `IGIC` - IGIC\n* `IPSI` - IPSI\n* `RECARGO` - Recargo de equivalencia\n* `IRPF_PROF` - IRPF - Profesionales\n* `IRPF_ARR` - IRPF - Arrendamientos\n* `RET_ESP` - Retenciones especiales"
      },
      "TaxRegimeTypeEnum": {
        "enum": [
          "01",
          "02",
          "03",
          "05"
        ],
        "type": "string",
        "description": "* `01` - IVA\n* `02` - IPSI\n* `03` - IGIC\n* `05` - Otros"
      },
      "TaxSettings": {
        "type": "object",
        "properties": {
          "withholding_criterion": {
            "$ref": "#/components/schemas/WithholdingCriterionSettings"
          },
          "can_edit": {
            "type": "boolean",
            "description": "El usuario puede cambiar los ajustes (propietario o administrador)."
          }
        },
        "required": [
          "can_edit",
          "withholding_criterion"
        ]
      },
      "TaxTemplate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,3})?$",
            "description": "Porcentaje, p.ej. 21.000"
          },
          "kind": {
            "$ref": "#/components/schemas/TaxTemplateKindEnum"
          },
          "scope": {
            "$ref": "#/components/schemas/TaxTemplateScopeEnum"
          },
          "country": {
            "type": "string",
            "maxLength": 2
          },
          "is_compound": {
            "type": "boolean"
          },
          "components": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "rate",
          "updated_at"
        ]
      },
      "TaxTemplateKindEnum": {
        "enum": [
          "VAT",
          "WITHHOLDING",
          "SURCHARGE"
        ],
        "type": "string",
        "description": "* `VAT` - IVA\n* `WITHHOLDING` - Retención/IRPF\n* `SURCHARGE` - Recargo equivalencia"
      },
      "TaxTemplateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,3})?$",
            "description": "Porcentaje, p.ej. 21.000"
          },
          "kind": {
            "$ref": "#/components/schemas/TaxTemplateKindEnum"
          },
          "scope": {
            "$ref": "#/components/schemas/TaxTemplateScopeEnum"
          },
          "country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "is_compound": {
            "type": "boolean"
          },
          "components": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          "active": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "rate"
        ]
      },
      "TaxTemplateScopeEnum": {
        "enum": [
          "sales",
          "purchases",
          "both"
        ],
        "type": "string",
        "description": "* `sales` - Ventas\n* `purchases` - Compras\n* `both` - Ambos"
      },
      "TemplateTypeEnum": {
        "enum": [
          "modern",
          "classic",
          "minimal",
          "professional",
          "elegant",
          "bold",
          "stripe",
          "compact",
          "corporate",
          "executive",
          "legal",
          "nordic",
          "atelier",
          "monochrome",
          "ledger",
          "geometric",
          "sidebar",
          "letterhead",
          "banner",
          "editorial",
          "startup",
          "clinic",
          "industrial",
          "luxe",
          "eco",
          "consulting",
          "creative"
        ],
        "type": "string",
        "description": "* `modern` - Moderna\n* `classic` - Clásica\n* `minimal` - Minimalista\n* `professional` - Profesional\n* `elegant` - Elegante\n* `bold` - Audaz\n* `stripe` - Tech\n* `compact` - Compacta\n* `corporate` - Corporativa\n* `executive` - Ejecutiva\n* `legal` - Despacho\n* `nordic` - Nórdica\n* `atelier` - Atelier\n* `monochrome` - Monocromo\n* `ledger` - Libro mayor\n* `geometric` - Geométrica\n* `sidebar` - Lateral\n* `letterhead` - Membrete\n* `banner` - Banda\n* `editorial` - Editorial\n* `startup` - Startup\n* `clinic` - Clínica\n* `industrial` - Industrial\n* `luxe` - Luxe\n* `eco` - Natural\n* `consulting` - Consultoría\n* `creative` - Agencia"
      },
      "TestResult": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "status_code": {
            "type": "integer",
            "nullable": true
          },
          "duration_ms": {
            "type": "integer"
          },
          "error": {
            "type": "string"
          },
          "response_body": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "delivery_id": {
            "type": "integer"
          },
          "attempt": {
            "$ref": "#/components/schemas/WebhookAttempt"
          }
        },
        "required": [
          "attempt",
          "delivery_id",
          "duration_ms",
          "error",
          "event_id",
          "response_body",
          "status_code",
          "success"
        ]
      },
      "TimeEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "employee": {
            "type": "integer"
          },
          "employee_name": {
            "type": "string",
            "readOnly": true
          },
          "clock_in": {
            "type": "string",
            "format": "date-time"
          },
          "clock_out": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "source": {
            "$ref": "#/components/schemas/SourceEnum"
          },
          "source_display": {
            "type": "string",
            "readOnly": true
          },
          "entry_type": {
            "$ref": "#/components/schemas/EntryTypeEnum"
          },
          "entry_type_display": {
            "type": "string",
            "readOnly": true
          },
          "latitude": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,6})?$",
            "nullable": true
          },
          "longitude": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,6})?$",
            "nullable": true
          },
          "ip_address": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "duration_hours": {
            "type": "number",
            "format": "double",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "clock_in",
          "created_at",
          "duration_hours",
          "employee",
          "employee_name",
          "entry_type_display",
          "id",
          "source_display",
          "updated_at"
        ]
      },
      "TimeEntryRequest": {
        "type": "object",
        "properties": {
          "employee": {
            "type": "integer"
          },
          "clock_in": {
            "type": "string",
            "format": "date-time"
          },
          "clock_out": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "source": {
            "$ref": "#/components/schemas/SourceEnum"
          },
          "entry_type": {
            "$ref": "#/components/schemas/EntryTypeEnum"
          },
          "latitude": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,6})?$",
            "nullable": true
          },
          "longitude": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,6})?$",
            "nullable": true
          },
          "ip_address": {
            "type": "string",
            "nullable": true,
            "minLength": 1
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "clock_in",
          "employee"
        ]
      },
      "TimeTrackingQR": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "code": {
            "type": "string",
            "format": "uuid",
            "readOnly": true
          },
          "work_center": {
            "type": "integer",
            "nullable": true
          },
          "work_center_name": {
            "type": "string",
            "readOnly": true
          },
          "label": {
            "type": "string",
            "maxLength": 100
          },
          "is_active": {
            "type": "boolean"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "auto_renew": {
            "type": "boolean"
          },
          "auto_renew_hours": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648
          },
          "is_expired": {
            "type": "boolean",
            "readOnly": true
          },
          "is_valid": {
            "type": "boolean",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "code",
          "created_at",
          "id",
          "is_expired",
          "is_valid",
          "updated_at",
          "work_center_name"
        ]
      },
      "TimeTrackingQRRequest": {
        "type": "object",
        "properties": {
          "work_center": {
            "type": "integer",
            "nullable": true
          },
          "label": {
            "type": "string",
            "maxLength": 100
          },
          "is_active": {
            "type": "boolean"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "auto_renew": {
            "type": "boolean"
          },
          "auto_renew_hours": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": -2147483648
          }
        }
      },
      "TipoDeclaracionEnum": {
        "enum": [
          "I",
          "U",
          "G",
          "N",
          "B"
        ],
        "type": "string",
        "description": "* `I` - Ingreso\n* `U` - Domiciliación\n* `G` - Ingreso en CCT\n* `N` - Negativa\n* `B` - A deducir (130)"
      },
      "TipoFacturaEnum": {
        "enum": [
          "F1",
          "F2"
        ],
        "type": "string",
        "description": "* `F1` - Factura\n* `F2` - Rectificativa"
      },
      "TipoPresentacionEnum": {
        "enum": [
          "complementaria",
          "sustitutiva",
          "rectificativa"
        ],
        "type": "string",
        "description": "* `` - Normal\n* `complementaria` - Complementaria\n* `sustitutiva` - Sustitutiva\n* `rectificativa` - Rectificativa (303)"
      },
      "TipoRegistroEnum": {
        "enum": [
          "ALTA",
          "ANULACION"
        ],
        "type": "string",
        "description": "* `ALTA` - ALTA\n* `ANULACION` - ANULACION"
      },
      "TopCustomer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "revenue": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
          },
          "invoice_count": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "invoice_count",
          "name",
          "revenue"
        ]
      },
      "TrackingMethodEnum": {
        "enum": [
          "web",
          "geo",
          "qr"
        ],
        "type": "string",
        "description": "* `web` - Solo web\n* `geo` - Web + Geolocalización\n* `qr` - Web + Geolocalización + QR"
      },
      "TramoIncnEnum": {
        "enum": [
          "0",
          "1",
          "2",
          "3"
        ],
        "type": "string",
        "description": "* `0` - No consta / < 10 M€\n* `1` - ≥ 10 M€ y < 20 M€\n* `2` - ≥ 20 M€ y < 60 M€\n* `3` - ≥ 60 M€"
      },
      "TransferRequestRequest": {
        "type": "object",
        "properties": {
          "target_bank_account": {
            "type": "integer"
          },
          "mirror_transaction": {
            "type": "integer",
            "nullable": true,
            "description": "Movimiento espejo en la cuenta de destino."
          },
          "remember": {
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "target_bank_account"
        ]
      },
      "TreasurySettings": {
        "type": "object",
        "properties": {
          "auto_match_threshold": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Puntuación mínima (0-100) para casar automáticamente."
          },
          "date_window_days": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Días tras la fecha de la factura/gasto en los que se buscan candidatos."
          },
          "amount_tolerance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,2})?$"
          },
          "existing_payment_days_before": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Días anteriores a la fecha del banco en los que se buscan cobros/pagos ya registrados a mano (sin cuenta bancaria) para conciliarlos en lugar de duplicarlos."
          },
          "existing_payment_days_after": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "description": "Días posteriores a la fecha del banco en los que se buscan cobros/pagos ya registrados (p. ej. pagos cargados en bloque semanas después). Los que distan más de 10 días puntúan menos y no se casan solos salvo que el concepto cite el número."
          },
          "learn_rules": {
            "type": "boolean",
            "description": "Guardar pistas al resolver movimientos a mano."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "updated_at"
        ]
      },
      "Treatment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "title": {
            "type": "string",
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "treatment_type": {
            "$ref": "#/components/schemas/TreatmentTypeEnum"
          },
          "treatment_type_display": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "$ref": "#/components/schemas/TreatmentStatusEnum"
          },
          "status_display": {
            "type": "string",
            "readOnly": true
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "status_display",
          "title",
          "treatment_type_display",
          "updated_at"
        ]
      },
      "TreatmentRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "description": {
            "type": "string"
          },
          "treatment_type": {
            "$ref": "#/components/schemas/TreatmentTypeEnum"
          },
          "status": {
            "$ref": "#/components/schemas/TreatmentStatusEnum"
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "title"
        ]
      },
      "TreatmentStatusEnum": {
        "enum": [
          "active",
          "completed",
          "discontinued"
        ],
        "type": "string",
        "description": "* `active` - Activo\n* `completed` - Completado\n* `discontinued` - Suspendido"
      },
      "TreatmentTypeEnum": {
        "enum": [
          "medication",
          "therapy",
          "lifestyle",
          "referral",
          "other"
        ],
        "type": "string",
        "description": "* `medication` - Medicación\n* `therapy` - Terapia\n* `lifestyle` - Estilo de vida\n* `referral` - Derivación\n* `other` - Otro"
      },
      "TriggerEnum": {
        "enum": [
          "automatic",
          "manual",
          "test"
        ],
        "type": "string",
        "description": "* `automatic` - Automático\n* `manual` - Reenvío manual\n* `test` - Prueba"
      },
      "UbicacionEnum": {
        "enum": [
          "espana",
          "pais_vasco",
          "navarra",
          "extranjero"
        ],
        "type": "string",
        "description": "* `espana` - Territorio común\n* `pais_vasco` - País Vasco\n* `navarra` - Navarra\n* `extranjero` - Extranjero"
      },
      "Unit": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "code": {
            "type": "string",
            "pattern": "^[\\w\\-\\.\\%]+$",
            "maxLength": 10
          },
          "name": {
            "type": "string",
            "maxLength": 50
          },
          "active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "code",
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "UnitRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "minLength": 1,
            "pattern": "^[\\w\\-\\.\\%]+$",
            "maxLength": 10
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "active": {
            "type": "boolean"
          }
        },
        "required": [
          "code",
          "name"
        ]
      },
      "UnpostedDocument": {
        "type": "object",
        "properties": {
          "entry_id": {
            "type": "integer",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "description": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "source_type": {
            "type": "string"
          },
          "source_id": {
            "type": "integer",
            "nullable": true
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "date",
          "description",
          "entry_id",
          "kind",
          "reason",
          "source_id",
          "source_type"
        ]
      },
      "UploadedFileCheck": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "model": {
            "type": "string",
            "nullable": true
          },
          "year": {
            "type": "integer",
            "nullable": true
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "layout": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          }
        },
        "required": [
          "errors",
          "layout",
          "model",
          "valid",
          "year"
        ]
      },
      "UploadedFileCheckRequestRequest": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "Fichero de presentación de la AEAT (303, 111, 115, 123, 130, 202, 390, 180, 190, 193, 347 o 349)."
          },
          "model": {
            "type": "string",
            "description": "Modelo (si no se deduce del fichero)."
          }
        },
        "required": [
          "file"
        ]
      },
      "UsageRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "feature": {
            "type": "integer"
          },
          "feature_key": {
            "type": "string",
            "readOnly": true
          },
          "feature_name": {
            "type": "string",
            "readOnly": true
          },
          "period": {
            "type": "string",
            "maxLength": 7
          },
          "used": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "feature",
          "feature_key",
          "feature_name",
          "id",
          "period",
          "updated_at"
        ]
      },
      "UsageSummary": {
        "type": "object",
        "properties": {
          "period": {
            "type": "string"
          },
          "summary": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "period",
          "summary"
        ]
      },
      "VatIdTypeEnum": {
        "enum": [
          "02",
          "03",
          "04",
          "05",
          "06",
          "07"
        ],
        "type": "string",
        "description": "* `` - NIF/CIF español\n* `02` - NIF-IVA intracomunitario\n* `03` - Pasaporte\n* `04` - Documento oficial de identificación\n* `05` - Certificado de residencia\n* `06` - Otro documento probatorio\n* `07` - No censado"
      },
      "VatSettlement": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "model": {
            "type": "string",
            "readOnly": true
          },
          "period_key": {
            "type": "string",
            "readOnly": true,
            "description": "Periodo del modelo, p. ej. 2026-1T."
          },
          "year": {
            "type": "integer",
            "readOnly": true
          },
          "period": {
            "type": "string",
            "readOnly": true,
            "description": "1T-4T (trimestral) o 01-12 (mensual, REDEME)."
          },
          "entry": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "entry_number": {
            "type": "integer",
            "nullable": true,
            "readOnly": true
          },
          "entry_status": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "result": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Casilla 71 (positivo: a ingresar; negativo: a compensar/devolver)."
          },
          "boxes": {
            "readOnly": true,
            "description": "Casillas del 303 usadas al contabilizar."
          },
          "ledger_difference": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true,
            "description": "Diferencia entre el resultado del 303 y los saldos 472/477 del periodo (ajuste 634/639)."
          },
          "created_by": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "boxes",
          "created_at",
          "created_by",
          "entry",
          "entry_number",
          "entry_status",
          "id",
          "ledger_difference",
          "model",
          "period",
          "period_key",
          "result",
          "year"
        ]
      },
      "VatSettlementCreateRequest": {
        "type": "object",
        "properties": {
          "year": {
            "type": "integer",
            "maximum": 2100,
            "minimum": 2000
          },
          "period": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PeriodEnum"
              }
            ],
            "description": "1T-4T (trimestral) o 01-12 (mensual, REDEME / grandes empresas).\n\n* `1T` - 1T\n* `2T` - 2T\n* `3T` - 3T\n* `4T` - 4T\n* `01` - 01\n* `02` - 02\n* `03` - 03\n* `04` - 04\n* `05` - 05\n* `06` - 06\n* `07` - 07\n* `08` - 08\n* `09` - 09\n* `10` - 10\n* `11` - 11\n* `12` - 12"
          },
          "force": {
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "period",
          "year"
        ]
      },
      "VendorBill": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "supplier": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/VendorBillStatusEnum"
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "vendor_reference": {
            "type": "string",
            "description": "Número/factura del proveedor",
            "maxLength": 100
          },
          "subtotal": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "tax_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "withholding_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "surcharge_total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "total": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "balance": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$",
            "readOnly": true
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "sequence_number": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "number": {
            "type": "string",
            "readOnly": true,
            "nullable": true
          },
          "metadata": {},
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "balance",
          "created_at",
          "id",
          "number",
          "sequence_number",
          "subtotal",
          "supplier",
          "surcharge_total",
          "tax_total",
          "total",
          "updated_at",
          "withholding_total"
        ]
      },
      "VendorBillApproveRequestRequest": {
        "type": "object",
        "properties": {
          "issue_date": {
            "type": "string",
            "format": "date",
            "description": "Fecha de emisión (por defecto, la de la factura)."
          }
        }
      },
      "VendorBillApproved": {
        "type": "object",
        "properties": {
          "number": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "number",
          "status"
        ]
      },
      "VendorBillCreatedFromOrder": {
        "type": "object",
        "properties": {
          "vendor_bill_id": {
            "type": "integer"
          }
        },
        "required": [
          "vendor_bill_id"
        ]
      },
      "VendorBillRequest": {
        "type": "object",
        "description": "Normaliza ``\"\"`` → ``None`` en los campos de fecha/fecha-hora anulables.\n\nEl frontend envía la cadena vacía cuando el usuario borra una fecha (p. ej.\nel vencimiento de una factura); DRF rechaza ``\"\"`` en ``DateField`` con\n\"Date has wrong format\" aunque el modelo admita NULL. Con este mixin la\ncadena vacía equivale a ``null`` para esos campos, sin tocar el resto.",
        "properties": {
          "supplier": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "exchange_rate": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,6}(?:\\.\\d{0,6})?$"
          },
          "issue_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/VendorBillStatusEnum"
          },
          "notes": {
            "type": "string"
          },
          "terms": {
            "type": "string"
          },
          "vendor_reference": {
            "type": "string",
            "description": "Número/factura del proveedor",
            "maxLength": 100
          },
          "series": {
            "type": "integer",
            "nullable": true
          },
          "metadata": {},
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseDocumentLineRequest"
            },
            "writeOnly": true
          }
        },
        "required": [
          "lines",
          "supplier"
        ]
      },
      "VendorBillStatusEnum": {
        "enum": [
          "draft",
          "approved",
          "paid",
          "partially_paid",
          "overdue",
          "cancelled"
        ],
        "type": "string",
        "description": "* `draft` - Borrador\n* `approved` - Aprobada\n* `paid` - Pagada\n* `partially_paid` - Parcialmente pagada\n* `overdue` - Vencida\n* `cancelled` - Anulada"
      },
      "VendorPayment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "bill": {
            "type": "integer"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "currency": {
            "type": "string",
            "maxLength": 3
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "method": {
            "$ref": "#/components/schemas/VendorPaymentMethodEnum"
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "notes": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "amount",
          "bill",
          "created_at",
          "id",
          "updated_at"
        ]
      },
      "VendorPaymentMethodEnum": {
        "enum": [
          "transfer",
          "cash",
          "card",
          "direct_debit"
        ],
        "type": "string",
        "description": "* `transfer` - Transferencia\n* `cash` - Efectivo\n* `card` - Tarjeta\n* `direct_debit` - Domiciliación (SEPA)"
      },
      "VendorPaymentRequest": {
        "type": "object",
        "properties": {
          "bill": {
            "type": "integer"
          },
          "amount": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,12}(?:\\.\\d{0,2})?$"
          },
          "currency": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "method": {
            "$ref": "#/components/schemas/VendorPaymentMethodEnum"
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "amount",
          "bill"
        ]
      },
      "VeriFactuHealth": {
        "type": "object",
        "description": "Serializer para el estado de salud del sistema VeriFactu.",
        "properties": {
          "sistema_activo": {
            "type": "boolean"
          },
          "entorno": {
            "type": "string"
          },
          "configuracion_completa": {
            "type": "boolean"
          },
          "certificados_validos": {
            "type": "boolean"
          },
          "ultima_actividad": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "certificados_validos",
          "configuracion_completa",
          "entorno",
          "sistema_activo",
          "ultima_actividad"
        ]
      },
      "VeriFactuRetryResult": {
        "type": "object",
        "properties": {
          "detail": {
            "type": "string"
          },
          "estado_envio": {
            "type": "string"
          },
          "registro_id": {
            "type": "integer"
          },
          "method": {
            "type": "string",
            "description": "`subsanacion` o `alta`."
          }
        },
        "required": [
          "detail",
          "estado_envio",
          "method",
          "registro_id"
        ]
      },
      "VeriFactuStats": {
        "type": "object",
        "description": "Serializer para estadísticas VeriFactu de una organización.",
        "properties": {
          "total_facturas_procesadas": {
            "type": "integer"
          },
          "total_facturas_enviadas": {
            "type": "integer"
          },
          "facturas_pendientes": {
            "type": "integer"
          },
          "facturas_error": {
            "type": "integer"
          },
          "ultimo_procesamiento": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "configuracion": {
            "$ref": "#/components/schemas/OrganizacionConfig"
          }
        },
        "required": [
          "configuracion",
          "facturas_error",
          "facturas_pendientes",
          "total_facturas_enviadas",
          "total_facturas_procesadas",
          "ultimo_procesamiento"
        ]
      },
      "VerifactuModeEnum": {
        "enum": [
          "VERI",
          "NO_VERI"
        ],
        "description": "* `VERI` - VeriFactu Activado\n* `NO_VERI` - VeriFactu Desactivado\n* `None` - No definido"
      },
      "VitalSigns": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "patient": {
            "type": "integer"
          },
          "episode": {
            "type": "integer",
            "nullable": true
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "practitioner_name": {
            "type": "string",
            "readOnly": true,
            "default": ""
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          },
          "systolic_bp": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "mmHg"
          },
          "diastolic_bp": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "mmHg"
          },
          "heart_rate": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "bpm"
          },
          "temperature": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,1})?$",
            "nullable": true,
            "description": "°C"
          },
          "respiratory_rate": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "rpm"
          },
          "weight": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "kg"
          },
          "height": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$",
            "nullable": true,
            "description": "cm"
          },
          "bmi": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "readOnly": true
          },
          "oxygen_saturation": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "%"
          },
          "blood_glucose": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "mg/dL"
          },
          "notes": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "bmi",
          "created_at",
          "id",
          "patient",
          "practitioner_name",
          "updated_at"
        ]
      },
      "VitalSignsRequest": {
        "type": "object",
        "properties": {
          "patient": {
            "type": "integer"
          },
          "episode": {
            "type": "integer",
            "nullable": true
          },
          "practitioner": {
            "type": "integer",
            "nullable": true
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          },
          "systolic_bp": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "mmHg"
          },
          "diastolic_bp": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "mmHg"
          },
          "heart_rate": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "bpm"
          },
          "temperature": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,1})?$",
            "nullable": true,
            "description": "°C"
          },
          "respiratory_rate": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "rpm"
          },
          "weight": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,2})?$",
            "nullable": true,
            "description": "kg"
          },
          "height": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,4}(?:\\.\\d{0,1})?$",
            "nullable": true,
            "description": "cm"
          },
          "oxygen_saturation": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "%"
          },
          "blood_glucose": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "nullable": true,
            "description": "mg/dL"
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "patient"
        ]
      },
      "WebhookAttempt": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "attempted_at": {
            "type": "string",
            "format": "date-time"
          },
          "trigger": {
            "$ref": "#/components/schemas/TriggerEnum"
          },
          "url": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 2048
              },
              {
                "type": "string",
                "maxLength": 0
              }
            ]
          },
          "status_code": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "nullable": true
          },
          "duration_ms": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0
          },
          "succeeded": {
            "type": "boolean",
            "readOnly": true
          },
          "response_body": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "request_headers": {}
        },
        "required": [
          "id",
          "succeeded"
        ]
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "event": {
            "type": "string"
          },
          "event_type": {
            "type": "string",
            "readOnly": true
          },
          "endpoint": {
            "type": "integer"
          },
          "endpoint_url": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "$ref": "#/components/schemas/WebhookDeliveryStatusEnum"
          },
          "attempt_count": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "last_status_code": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "nullable": true
          },
          "last_error": {
            "type": "string"
          },
          "last_attempt_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "delivered_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "endpoint",
          "endpoint_url",
          "event",
          "event_type",
          "id",
          "updated_at"
        ]
      },
      "WebhookDeliveryDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "event": {
            "type": "string"
          },
          "event_type": {
            "type": "string",
            "readOnly": true
          },
          "endpoint": {
            "type": "integer"
          },
          "endpoint_url": {
            "type": "string",
            "readOnly": true
          },
          "status": {
            "$ref": "#/components/schemas/WebhookDeliveryStatusEnum"
          },
          "attempt_count": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "last_status_code": {
            "type": "integer",
            "maximum": 32767,
            "minimum": 0,
            "nullable": true
          },
          "last_error": {
            "type": "string"
          },
          "last_attempt_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "delivered_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "payload": {
            "type": "object",
            "additionalProperties": {},
            "readOnly": true
          },
          "attempts": {
            "type": "array",
            "items": {},
            "readOnly": true
          }
        },
        "required": [
          "attempts",
          "created_at",
          "endpoint",
          "endpoint_url",
          "event",
          "event_type",
          "id",
          "payload",
          "updated_at"
        ]
      },
      "WebhookDeliveryStatusEnum": {
        "enum": [
          "pending",
          "retrying",
          "succeeded",
          "failed",
          "cancelled"
        ],
        "type": "string",
        "description": "* `pending` - Pendiente\n* `retrying` - Reintentando\n* `succeeded` - Entregado\n* `failed` - Fallido\n* `cancelled` - Cancelado"
      },
      "WebhookEndpoint": {
        "type": "object",
        "description": "Endpoint SIN el secreto (el secreto sólo sale al crear, al rotar y en ``/secret/``).",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "url": {
            "type": "string",
            "description": "URL https pública que recibirá los eventos (POST).",
            "maxLength": 2048
          },
          "description": {
            "type": "string",
            "maxLength": 255
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Tipos de evento suscritos (ver /webhooks/event-types/) o [\"*\"] para todos."
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "disabled_reason": {
            "readOnly": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/DisabledReasonEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "disabled_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "failure_since": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "last_success_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "last_failure_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "api_version": {
            "type": "string",
            "readOnly": true
          },
          "metadata": {},
          "secret_format": {
            "type": "string",
            "readOnly": true,
            "description": "«whsec» (generado por Billora) o «legacy» (secreto antiguo, se usa como bytes UTF-8)."
          },
          "previous_secret_expires_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "description": "Tras rotar, hasta cuándo se sigue firmando también con el secreto anterior."
          },
          "created_by": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "integer"
              },
              "email": {
                "type": "string"
              }
            },
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "api_version",
          "created_at",
          "created_by",
          "disabled_at",
          "disabled_reason",
          "events",
          "failure_since",
          "id",
          "last_failure_at",
          "last_success_at",
          "previous_secret_expires_at",
          "secret_format",
          "updated_at",
          "url"
        ]
      },
      "WebhookEndpointCreateRequest": {
        "type": "object",
        "description": "Endpoint SIN el secreto (el secreto sólo sale al crear, al rotar y en ``/secret/``).",
        "properties": {
          "url": {
            "type": "string",
            "minLength": 1,
            "description": "URL https pública que recibirá los eventos (POST).",
            "maxLength": 2048
          },
          "description": {
            "type": "string",
            "maxLength": 255
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "description": "Tipos de evento suscritos (ver /webhooks/event-types/) o [\"*\"] para todos."
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "metadata": {},
          "secret": {
            "type": "string",
            "writeOnly": true,
            "minLength": 1,
            "description": "Opcional: secreto propio con formato whsec_<base64 de 24 a 64 bytes>. Si no se indica, Billora genera uno."
          }
        },
        "required": [
          "events",
          "url"
        ]
      },
      "WebhookEndpointRequest": {
        "type": "object",
        "description": "Endpoint SIN el secreto (el secreto sólo sale al crear, al rotar y en ``/secret/``).",
        "properties": {
          "url": {
            "type": "string",
            "minLength": 1,
            "description": "URL https pública que recibirá los eventos (POST).",
            "maxLength": 2048
          },
          "description": {
            "type": "string",
            "maxLength": 255
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "description": "Tipos de evento suscritos (ver /webhooks/event-types/) o [\"*\"] para todos."
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "metadata": {}
        },
        "required": [
          "events",
          "url"
        ]
      },
      "WebhookEndpointWithSecret": {
        "type": "object",
        "description": "Respuesta de creación: incluye ``secret`` (única vez que se devuelve sin pedirlo).",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "url": {
            "type": "string",
            "description": "URL https pública que recibirá los eventos (POST).",
            "maxLength": 2048
          },
          "description": {
            "type": "string",
            "maxLength": 255
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Tipos de evento suscritos (ver /webhooks/event-types/) o [\"*\"] para todos."
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "disabled_reason": {
            "readOnly": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/DisabledReasonEnum"
              },
              {
                "$ref": "#/components/schemas/BlankEnum"
              }
            ]
          },
          "disabled_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "failure_since": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "last_success_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "last_failure_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          },
          "api_version": {
            "type": "string",
            "readOnly": true
          },
          "metadata": {},
          "secret_format": {
            "type": "string",
            "readOnly": true,
            "description": "«whsec» (generado por Billora) o «legacy» (secreto antiguo, se usa como bytes UTF-8)."
          },
          "previous_secret_expires_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "description": "Tras rotar, hasta cuándo se sigue firmando también con el secreto anterior."
          },
          "created_by": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "integer"
              },
              "email": {
                "type": "string"
              }
            },
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "secret": {
            "type": "string",
            "readOnly": true
          }
        },
        "required": [
          "api_version",
          "created_at",
          "created_by",
          "disabled_at",
          "disabled_reason",
          "events",
          "failure_since",
          "id",
          "last_failure_at",
          "last_success_at",
          "previous_secret_expires_at",
          "secret",
          "secret_format",
          "updated_at",
          "url"
        ]
      },
      "WebhookEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "readOnly": true
          },
          "type": {
            "type": "string",
            "maxLength": 64
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "api_version": {
            "type": "string",
            "maxLength": 16
          },
          "object_type": {
            "type": "string",
            "maxLength": 48
          },
          "object_id": {
            "type": "string",
            "maxLength": 64
          }
        },
        "required": [
          "id",
          "type"
        ]
      },
      "WebhookEventDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "readOnly": true
          },
          "type": {
            "type": "string",
            "maxLength": 64
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "api_version": {
            "type": "string",
            "maxLength": 16
          },
          "object_type": {
            "type": "string",
            "maxLength": 48
          },
          "object_id": {
            "type": "string",
            "maxLength": 64
          },
          "payload": {
            "type": "object",
            "additionalProperties": {},
            "readOnly": true,
            "description": "Sobre exacto que se envía (id, type, created_at, data…)."
          }
        },
        "required": [
          "id",
          "payload",
          "type"
        ]
      },
      "WebhookEventType": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "group": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "description": "Recurso que viaja en data.object."
          },
          "explicit_subscription": {
            "type": "boolean",
            "description": "Datos de salud: el comodín * no lo incluye; hay que suscribirse expresamente."
          }
        },
        "required": [
          "description",
          "explicit_subscription",
          "group",
          "object",
          "type"
        ]
      },
      "WebhookEventTypeList": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer"
          },
          "next": {
            "type": "string",
            "nullable": true
          },
          "previous": {
            "type": "string",
            "nullable": true
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            }
          }
        },
        "required": [
          "count",
          "next",
          "previous",
          "results"
        ]
      },
      "WebhookSecret": {
        "type": "object",
        "properties": {
          "secret": {
            "type": "string",
            "readOnly": true,
            "description": "Secreto de firma actual (whsec_…)."
          },
          "previous_secret_expires_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true
          }
        },
        "required": [
          "previous_secret_expires_at",
          "secret"
        ]
      },
      "WithholdingCriterionEnum": {
        "enum": [
          "pago",
          "devengo"
        ],
        "type": "string",
        "description": "* `pago` - Pago (art. 78 RIRPF)\n* `devengo` - Devengo (fecha de factura / nómina)"
      },
      "WithholdingCriterionPatchRequest": {
        "type": "object",
        "properties": {
          "default": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WithholdingCriterionEnum"
              }
            ],
            "description": "Nuevo criterio por defecto.\n\n* `pago` - Pago (art. 78 RIRPF)\n* `devengo` - Devengo (fecha de factura / nómina)"
          },
          "by_year": {
            "type": "object",
            "additionalProperties": {
              "enum": [
                "pago",
                "devengo",
                null
              ],
              "type": "string",
              "description": "* `pago` - Pago (art. 78 RIRPF)\n* `devengo` - Devengo (fecha de factura / nómina)",
              "nullable": true
            },
            "description": "Criterio por ejercicio; sólo cambia los ejercicios indicados. `null` quita el criterio propio del ejercicio (vuelve al de por defecto). Ej.: `{\"2026\": \"devengo\", \"2025\": null}`."
          },
          "year": {
            "type": "integer",
            "maximum": 2100,
            "minimum": 2000,
            "description": "Atajo para un solo ejercicio, junto con `criterion`."
          },
          "criterion": {
            "nullable": true,
            "description": "Criterio del ejercicio `year` (`null` = el de por defecto).\n\n* `pago` - Pago (art. 78 RIRPF)\n* `devengo` - Devengo (fecha de factura / nómina)",
            "oneOf": [
              {
                "$ref": "#/components/schemas/WithholdingCriterionEnum"
              },
              {
                "$ref": "#/components/schemas/NullEnum"
              }
            ]
          }
        }
      },
      "WithholdingCriterionSettings": {
        "type": "object",
        "description": "Criterio de imputación temporal de las retenciones (modelos 111/190 y 115/180).",
        "properties": {
          "default": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WithholdingCriterionEnum"
              }
            ],
            "description": "Criterio de los ejercicios sin criterio propio: `pago` (la retención se declara al pagar la factura; art. 78 RIRPF) o `devengo` (por la fecha de la factura / el periodo de la nómina).\n\n* `pago` - Pago (art. 78 RIRPF)\n* `devengo` - Devengo (fecha de factura / nómina)"
          },
          "by_year": {
            "type": "object",
            "additionalProperties": {
              "enum": [
                "pago",
                "devengo"
              ],
              "type": "string",
              "description": "* `pago` - Pago (art. 78 RIRPF)\n* `devengo` - Devengo (fecha de factura / nómina)"
            },
            "description": "Criterio propio de cada ejercicio: `{\"2026\": \"devengo\"}`."
          },
          "year": {
            "type": "integer",
            "description": "Ejercicio consultado (`?year=`; por defecto, el actual)."
          },
          "effective": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WithholdingCriterionEnum"
              }
            ],
            "description": "Criterio que aplican los modelos del ejercicio `year`.\n\n* `pago` - Pago (art. 78 RIRPF)\n* `devengo` - Devengo (fecha de factura / nómina)"
          },
          "previous_year_effective": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WithholdingCriterionEnum"
              }
            ],
            "description": "Criterio del ejercicio anterior a `year`.\n\n* `pago` - Pago (art. 78 RIRPF)\n* `devengo` - Devengo (fecha de factura / nómina)"
          },
          "changed_from_previous_year": {
            "type": "boolean",
            "description": "El ejercicio `year` usa un criterio distinto del anterior."
          },
          "transition_note": {
            "type": "string",
            "nullable": true,
            "description": "Explicación de cómo se tratan las facturas y nóminas que cruzan de ejercicio cuando cambia el criterio (null si no cambia)."
          }
        },
        "required": [
          "by_year",
          "changed_from_previous_year",
          "default",
          "effective",
          "previous_year_effective",
          "transition_note",
          "year"
        ]
      },
      "WithholdingKeyEnum": {
        "enum": [
          "F01",
          "F02",
          "F03",
          "F04",
          "F05",
          "F06",
          "G01",
          "G02",
          "G03",
          "G04",
          "G05",
          "G06",
          "G07",
          "G08",
          "H01",
          "H02",
          "H03",
          "H04",
          "J",
          "K01",
          "K02",
          "K03"
        ],
        "type": "string",
        "description": "* `` - Automática\n* `F01` - F.01 — Premios literarios, artísticos o científicos (trabajo)\n* `F02` - F.02 — Cursos, conferencias, coloquios y similares (trabajo)\n* `F03` - F.03 — Elaboración de obras literarias, artísticas o científicas, tipo general\n* `F04` - F.04 — Elaboración de obras literarias, artísticas o científicas, tipo reducido\n* `F05` - F.05 — Propiedad intelectual (trabajo), tipo general\n* `F06` - F.06 — Propiedad intelectual (trabajo), tipo reducido\n* `G01` - G.01 — Actividades profesionales, tipo general\n* `G02` - G.02 — Recaudadores municipales, mediadores de seguros y delegados comerciales\n* `G03` - G.03 — Actividades profesionales, tipo reducido de inicio de actividad (7 %)\n* `G04` - G.04 — Actividades profesionales, tipo del art. 95.1.d) RIRPF\n* `G05` - G.05 — Propiedad intelectual (actividad), tipo general\n* `G06` - G.06 — Propiedad intelectual (actividad), tipo reducido\n* `G07` - G.07 — Anticipos a cuenta de derechos de autor\n* `G08` - G.08 — Cesión del derecho de imagen (actividad profesional)\n* `H01` - H.01 — Actividades agrícolas, ganaderas o forestales (tipo general)\n* `H02` - H.02 — Engorde de porcino y avicultura\n* `H03` - H.03 — Actividades forestales\n* `H04` - H.04 — Actividades en estimación objetiva (art. 95.6.2.º RIRPF)\n* `J` - J — Imputación de rentas por cesión de derechos de imagen (art. 92.8 LIRPF)\n* `K01` - K.01 — Premios de juegos sin fines publicitarios\n* `K02` - K.02 — Ganancias por aprovechamientos forestales de vecinos en montes públicos\n* `K03` - K.03 — Premios de concursos con fines publicitarios"
      },
      "WorkCenter": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "address": {
            "type": "string",
            "maxLength": 300
          },
          "city": {
            "type": "string",
            "maxLength": 100
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "postal_code": {
            "type": "string",
            "maxLength": 10
          },
          "country": {
            "type": "string",
            "maxLength": 2
          },
          "latitude": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,6})?$",
            "nullable": true
          },
          "longitude": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,6})?$",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "id",
          "name",
          "updated_at"
        ]
      },
      "WorkCenterRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "address": {
            "type": "string",
            "maxLength": 300
          },
          "city": {
            "type": "string",
            "maxLength": 100
          },
          "province": {
            "type": "string",
            "maxLength": 100
          },
          "postal_code": {
            "type": "string",
            "maxLength": 10
          },
          "country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2
          },
          "latitude": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,6})?$",
            "nullable": true
          },
          "longitude": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,6})?$",
            "nullable": true
          }
        },
        "required": [
          "name"
        ]
      },
      "WorkSchedule": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 150
          },
          "description": {
            "type": "string"
          },
          "is_default": {
            "type": "boolean"
          },
          "weekly_hours": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "days": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkScheduleDay"
            },
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_at",
          "days",
          "id",
          "name",
          "updated_at"
        ]
      },
      "WorkScheduleDay": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "day_of_week": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DayOfWeekEnum"
              }
            ],
            "minimum": -2147483648,
            "maximum": 2147483647
          },
          "day_of_week_display": {
            "type": "string",
            "readOnly": true
          },
          "start_time": {
            "type": "string",
            "format": "time"
          },
          "end_time": {
            "type": "string",
            "format": "time"
          },
          "break_start": {
            "type": "string",
            "format": "time",
            "nullable": true
          },
          "break_end": {
            "type": "string",
            "format": "time",
            "nullable": true
          }
        },
        "required": [
          "day_of_week",
          "day_of_week_display",
          "end_time",
          "id",
          "start_time"
        ]
      },
      "WorkScheduleDayRequest": {
        "type": "object",
        "properties": {
          "day_of_week": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DayOfWeekEnum"
              }
            ],
            "minimum": -2147483648,
            "maximum": 2147483647
          },
          "start_time": {
            "type": "string",
            "format": "time"
          },
          "end_time": {
            "type": "string",
            "format": "time"
          },
          "break_start": {
            "type": "string",
            "format": "time",
            "nullable": true
          },
          "break_end": {
            "type": "string",
            "format": "time",
            "nullable": true
          }
        },
        "required": [
          "day_of_week",
          "end_time",
          "start_time"
        ]
      },
      "WorkScheduleWrite": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 150
          },
          "description": {
            "type": "string"
          },
          "is_default": {
            "type": "boolean"
          },
          "weekly_hours": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "days": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkScheduleDay"
            }
          }
        },
        "required": [
          "days",
          "id",
          "name"
        ]
      },
      "WorkScheduleWriteRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "description": {
            "type": "string"
          },
          "is_default": {
            "type": "boolean"
          },
          "weekly_hours": {
            "type": "string",
            "format": "decimal",
            "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
          },
          "days": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkScheduleDayRequest"
            }
          }
        },
        "required": [
          "days",
          "name"
        ]
      },
      "Error": {
        "type": "object",
        "description": "Formato de error de la API. En los 400 de validación se conservan además las claves por campo (p. ej. `\"lines\": {\"0\": {\"quantity\": [\"…\"]}}`).",
        "required": [
          "detail",
          "code"
        ],
        "properties": {
          "detail": {
            "type": "string",
            "description": "Mensaje legible (en español)."
          },
          "code": {
            "type": "string",
            "description": "Código estable del error.",
            "example": "validation_error"
          },
          "errors": {
            "type": "array",
            "description": "Errores por campo (validación).",
            "items": {
              "type": "object",
              "required": [
                "field",
                "code",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string",
                  "example": "lines.0.quantity"
                },
                "code": {
                  "type": "string",
                  "example": "invalid"
                },
                "message": {
                  "type": "string",
                  "example": "Se requiere un número válido."
                }
              }
            }
          },
          "request_id": {
            "type": "string",
            "example": "req_01JC3Z8YH8N7Q4W6M2R5T9V0XA"
          },
          "required_scope": {
            "type": "string",
            "description": "Sólo en `insufficient_scope`.",
            "example": "invoices:write"
          },
          "retry_after": {
            "type": "integer",
            "description": "Sólo en `rate_limited` (segundos)."
          },
          "error_id": {
            "type": "string",
            "description": "Sólo en `server_error`: id del evento para soporte."
          }
        },
        "additionalProperties": true
      }
    },
    "securitySchemes": {
      "bearerApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key blr_…",
        "description": "`Authorization: Bearer blr_…` (recomendado). También `Authorization: ApiKey blr_…`."
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "`X-Api-Key: blr_…`."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Clave única (1–255 caracteres ASCII imprimibles) para reintentar sin duplicar. Se guarda 24 h por organización; la misma clave con otra petición → 422 `idempotency_key_reused`; en curso → 409 `idempotency_key_in_use`.",
        "schema": {
          "type": "string",
          "maxLength": 255
        }
      },
      "XRequestId": {
        "name": "X-Request-Id",
        "in": "header",
        "required": false,
        "description": "Identificador de la petición (≤128 caracteres `[A-Za-z0-9._-]`). Si no se envía se genera uno (`req_…`) y se devuelve en la respuesta.",
        "schema": {
          "type": "string",
          "maxLength": 128
        }
      }
    },
    "headers": {
      "X-Request-Id": {
        "description": "Identificador de la petición (inclúyelo al contactar con soporte).",
        "schema": {
          "type": "string"
        }
      },
      "X-RateLimit-Limit": {
        "description": "Peticiones permitidas en la ventana actual.",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Remaining": {
        "description": "Peticiones restantes en la ventana actual.",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Reset": {
        "description": "Momento (epoch, segundos) en que se libera la ventana.",
        "schema": {
          "type": "integer"
        }
      },
      "Retry-After": {
        "description": "Segundos que hay que esperar antes de reintentar.",
        "schema": {
          "type": "integer"
        }
      },
      "Idempotent-Replayed": {
        "description": "`true` si la respuesta es la reproducción de una petición anterior con la misma `Idempotency-Key`.",
        "schema": {
          "type": "string",
          "enum": [
            "true"
          ]
        }
      }
    },
    "responses": {
      "ValidationError": {
        "description": "Datos no válidos.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "detail": "Datos no válidos.",
              "code": "validation_error",
              "request_id": "req_01JC3Z8YH8N7Q4W6M2R5T9V0XA"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "API key ausente, inválida, revocada o caducada.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "detail": "API key ausente, inválida, revocada o caducada.",
              "code": "authentication_failed",
              "request_id": "req_01JC3Z8YH8N7Q4W6M2R5T9V0XA"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Sin permiso: scope insuficiente (`insufficient_scope`), endpoint no disponible con API key (`api_key_not_allowed`), plan sin acceso (`plan_no_api_access`, `module_not_available`) o creador de la clave sin permisos (`api_key_creator_inactive`).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "detail": "Sin permiso: scope insuficiente (`insufficient_scope`), endpoint no disponible con API key (`api_key_not_allowed`), plan sin acceso (`plan_no_api_access`, `module_not_available`) o creador de la clave sin permisos (`api_key_creator_inactive`).",
              "code": "insufficient_scope",
              "request_id": "req_01JC3Z8YH8N7Q4W6M2R5T9V0XA"
            }
          }
        }
      },
      "NotFound": {
        "description": "No encontrado.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "detail": "No encontrado.",
              "code": "not_found",
              "request_id": "req_01JC3Z8YH8N7Q4W6M2R5T9V0XA"
            }
          }
        }
      },
      "Conflict": {
        "description": "Conflicto con el estado del recurso o `Idempotency-Key` en curso.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "detail": "Conflicto con el estado del recurso o `Idempotency-Key` en curso.",
              "code": "idempotency_key_in_use",
              "request_id": "req_01JC3Z8YH8N7Q4W6M2R5T9V0XA"
            }
          }
        }
      },
      "IdempotencyKeyReused": {
        "description": "`Idempotency-Key` reutilizada con otra petición.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "detail": "`Idempotency-Key` reutilizada con otra petición.",
              "code": "idempotency_key_reused",
              "request_id": "req_01JC3Z8YH8N7Q4W6M2R5T9V0XA"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Límite de peticiones superado.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/X-RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "detail": "Límite de peticiones superado.",
              "code": "rate_limited",
              "request_id": "req_01JC3Z8YH8N7Q4W6M2R5T9V0XA"
            }
          }
        }
      },
      "ServerError": {
        "description": "Error interno (incluye `error_id`).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "detail": "Error interno (incluye `error_id`).",
              "code": "server_error",
              "request_id": "req_01JC3Z8YH8N7Q4W6M2R5T9V0XA"
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.billora.app",
      "description": "Producción"
    }
  ],
  "externalDocs": {
    "description": "Documentación para desarrolladores",
    "url": "https://billora.app/es/desarrolladores"
  },
  "security": [
    {
      "bearerApiKey": []
    },
    {
      "apiKeyHeader": []
    }
  ],
  "tags": [
    {
      "name": "Facturas",
      "description": "Facturas emitidas: borradores, emisión (numeración y registro VeriFactu), PDF, Facturae, anulación, rectificativas, envío por email y enlaces de pago."
    },
    {
      "name": "Presupuestos",
      "description": "Presupuestos (ofertas) y su conversión en proforma o factura."
    },
    {
      "name": "Proformas",
      "description": "Facturas proforma y su conversión en factura."
    },
    {
      "name": "Notas de crédito",
      "description": "Notas de crédito (abonos)."
    },
    {
      "name": "Facturas externas",
      "description": "Facturas de ingreso que no expide Billora (autofacturación o emitidas por un tercero): no se renumeran ni se envían a VeriFactu."
    },
    {
      "name": "Facturas recurrentes",
      "description": "Plantillas que generan facturas periódicamente."
    },
    {
      "name": "Cobros",
      "description": "Cobros registrados contra facturas emitidas."
    },
    {
      "name": "Métodos de cobro",
      "description": "Métodos de cobro de facturas (transferencia, tarjeta, Bizum…)."
    },
    {
      "name": "Categorías de ingreso",
      "description": "Categorías para clasificar los ingresos."
    },
    {
      "name": "Clientes",
      "description": "Clientes (personas físicas o jurídicas)."
    },
    {
      "name": "Proveedores",
      "description": "Proveedores."
    },
    {
      "name": "Personas de contacto",
      "description": "Personas de contacto de clientes y proveedores (filtra con ?customer= o ?supplier=)."
    },
    {
      "name": "Direcciones",
      "description": "Direcciones postales."
    },
    {
      "name": "Etiquetas",
      "description": "Etiquetas de contactos."
    },
    {
      "name": "Condiciones de pago",
      "description": "Condiciones de pago (días de vencimiento)."
    },
    {
      "name": "Productos",
      "description": "Catálogo de productos y servicios."
    },
    {
      "name": "Unidades",
      "description": "Unidades de medida."
    },
    {
      "name": "Impuestos",
      "description": "Tipos impositivos españoles (IVA, IGIC, IPSI, IRPF, recargo de equivalencia), regímenes, plantillas de impuestos y configuración fiscal. Los `id` de los tipos son los que se envían en `spanish_taxes` de las líneas."
    },
    {
      "name": "Series",
      "description": "Series de numeración de documentos."
    },
    {
      "name": "Gastos",
      "description": "Gastos (facturas recibidas, facturas simplificadas y otros justificantes) con desglose de IVA, retenciones, otros tributos, periodo de deducción, divisa y adjunto."
    },
    {
      "name": "Categorías de gasto",
      "description": "Categorías de gasto."
    },
    {
      "name": "Pagos de gastos",
      "description": "Pagos de gastos."
    },
    {
      "name": "Métodos de pago de gastos",
      "description": "Métodos de pago de gastos."
    },
    {
      "name": "Escaneo de documentos",
      "description": "Escaneo (OCR) de facturas y tickets para convertirlos en gastos."
    },
    {
      "name": "Descargas masivas",
      "description": "Descarga masiva de PDFs de documentos en un ZIP (asíncrona)."
    },
    {
      "name": "Webhooks",
      "description": "Endpoints de webhooks salientes, eventos y entregas (Standard Webhooks)."
    },
    {
      "name": "Expedientes",
      "description": "Expedientes (casos), partes, actuaciones, carpetas, archivos y documentos vinculados."
    },
    {
      "name": "CRM",
      "description": "Embudos, leads, oportunidades, actividades y notas."
    },
    {
      "name": "Agenda",
      "description": "Tipos de evento, reservas y disponibilidad."
    },
    {
      "name": "Contabilidad",
      "description": "Plan de cuentas, ejercicios, asientos (alta, confirmación y cierre), configuración e informes contables."
    },
    {
      "name": "Tesorería",
      "description": "Cuentas bancarias, importación de extractos (Norma 43, CSV, XLSX), movimientos bancarios con sugerencias de conciliación, acciones de conciliación (cobros, pagos, traspasos, impuestos, nóminas, comisiones), reglas, resumen banco ↔ contabilidad y ajustes. Integración con Revolut Business (``/treasury/revolut/``): conexión, cuentas, sincronización automática de movimientos, webhooks y borradores de pago."
    },
    {
      "name": "Informes",
      "description": "Libros registro de IVA, informes fiscales y modelos tributarios (303, 130, 111, 347…)."
    },
    {
      "name": "Cuadro de mando",
      "description": "Indicadores, gráficos y actividad reciente del cuadro de mando de facturación."
    },
    {
      "name": "Pedidos de compra",
      "description": "Pedidos de compra a proveedores y su conversión en factura de proveedor."
    },
    {
      "name": "Facturas de proveedor",
      "description": "Facturas de proveedor (cuentas a pagar): aprobación, anulación, PDF y envío por email."
    },
    {
      "name": "Pagos a proveedores",
      "description": "Pagos de facturas de proveedor (actualizan el saldo y el estado de la factura)."
    },
    {
      "name": "Organización",
      "description": "Perfil y datos fiscales de la organización (NIF, dirección fiscal, IBAN, régimen, logo…)."
    },
    {
      "name": "Diseños de factura",
      "description": "Diseños de los PDF de factura (colores, cabecera, pie y logo) y diseño activo."
    },
    {
      "name": "Plantillas de email",
      "description": "Plantillas de los emails que envía Billora (facturas, presupuestos, recordatorios…)."
    },
    {
      "name": "Plantillas de documentos",
      "description": "Plantillas Word (.docx) con marcadores de expedientes, clínica y consentimientos, y generación de documentos (PDF o DOCX) a partir de ellas."
    },
    {
      "name": "RRHH",
      "description": "Empleados, estructura (departamentos, puestos, centros), contratos, horarios, ausencias y saldos, festivos, fichajes, códigos QR, nóminas, documentos y registro horario (RD 8/2019)."
    },
    {
      "name": "Clínica",
      "description": "Pacientes e historia clínica (alergias, antecedentes, constantes, episodios, diagnósticos CIE-11, tratamientos), consentimientos, carpetas y archivos. **Datos de salud** (categoría especial del RGPD): requieren `clinica:read`/`clinica:write` y cada acceso con API key queda en la auditoría."
    },
    {
      "name": "Firma digital",
      "description": "Solicitudes de firma electrónica: envío por email/SMS, recordatorios, cancelación, evidencia y descarga del PDF firmado y del certificado."
    },
    {
      "name": "Importaciones",
      "description": "Importación masiva desde Excel (.xlsx): plantillas, validación, procesamiento y resultado por fila."
    },
    {
      "name": "VeriFactu",
      "description": "Registros VeriFactu de las facturas, su estado de envío a la AEAT, reintentos y configuración."
    },
    {
      "name": "Auditoría",
      "description": "Registro de auditoría de la organización (altas, cambios, borrados y accesos a datos clínicos)."
    },
    {
      "name": "SMS",
      "description": "Envío de SMS (consume saldo), saldo disponible, bonos comprados e historial."
    },
    {
      "name": "Cuenta",
      "description": "Organización, plan, uso y límites, módulos activos, miembros y estado de las integraciones."
    }
  ]
}