{
  "openapi": "3.1.0",
  "info": {
    "title": "Despacho · API REST y autenticación",
    "version": "2026-10-26",
    "description": "Referencia del contrato inspeccionado para expedientes, caja y bancos, agenda, ventas y servicios, compras, horas, contratos y documentos, además del OAuth utilizado por MCP. Las rutas REST de negocio aceptan un token de API personal y exigen los permisos del usuario. Un token OAuth con scope MCP solo puede acceder a /api/mcp/rpc. El portal mantiene desactivadas las solicitudes reales. Los objetos de negocio pueden incluir propiedades dependientes de la cuenta y las asociaciones solicitadas. En operaciones de guardado complejas se muestran los campos principales; las reglas de negocio pueden exigir más datos. Todos los ejemplos son sintéticos."
  },
  "servers": [
    {
      "url": "https://{cuenta}.despacho.pe",
      "description": "Sustituya cuenta por el subdominio de su organización",
      "variables": {
        "cuenta": {
          "default": "su-cuenta"
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Descubrimiento OAuth",
      "description": "Metadatos de autorización publicados por cada cuenta."
    },
    {
      "name": "OAuth para MCP",
      "description": "Registro y ciclo de tokens para clientes MCP. El consentimiento se presenta en la aplicación web de la cuenta."
    },
    {
      "name": "Expedientes",
      "description": "Listado, detalle y operaciones principales de expedientes."
    },
    {
      "name": "Caja y bancos",
      "description": "Consulta de pagos y sesiones de caja."
    },
    {
      "name": "Agenda",
      "description": "Eventos y tareas."
    },
    {
      "name": "Ventas",
      "description": "Cotizaciones, comprobantes, documentos por cobrar y catálogo de servicios."
    },
    {
      "name": "Compras",
      "description": "Facturas de gastos, proveedores, letras y documentos por pagar."
    },
    {
      "name": "Horas",
      "description": "Entradas de tiempo y gastos."
    },
    {
      "name": "Contratos",
      "description": "Contratos y solicitudes."
    },
    {
      "name": "Documentos",
      "description": "Documentos y plantillas."
    }
  ],
  "paths": {
    "/.well-known/oauth-authorization-server": {
      "get": {
        "tags": [
          "Descubrimiento OAuth"
        ],
        "operationId": "obtenerServidorAutorizacion",
        "summary": "Consultar el servidor de autorización",
        "description": "Devuelve las rutas OAuth y las capacidades que anuncia la cuenta. La URL de autorización es una vista web para el consentimiento del usuario, no una operación de esta referencia.",
        "responses": {
          "200": {
            "description": "Metadatos OAuth",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MetadatosAutorizacion"
                },
                "example": {
                  "issuer": "https://su-cuenta.despacho.pe",
                  "authorization_endpoint": "https://su-cuenta.despacho.pe/oauth/authorize",
                  "token_endpoint": "https://su-cuenta.despacho.pe/api/oauth/token",
                  "registration_endpoint": "https://su-cuenta.despacho.pe/api/oauth/register",
                  "revocation_endpoint": "https://su-cuenta.despacho.pe/api/oauth/revoke",
                  "scopes_supported": [
                    "mcp:read",
                    "mcp:write"
                  ],
                  "response_types_supported": [
                    "code"
                  ],
                  "grant_types_supported": [
                    "authorization_code",
                    "refresh_token"
                  ],
                  "token_endpoint_auth_methods_supported": [
                    "none"
                  ],
                  "code_challenge_methods_supported": [
                    "S256"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "tags": [
          "Descubrimiento OAuth"
        ],
        "operationId": "obtenerRecursoProtegido",
        "summary": "Consultar el recurso MCP protegido",
        "responses": {
          "200": {
            "description": "Metadatos del recurso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MetadatosRecurso"
                },
                "example": {
                  "resource": "https://su-cuenta.despacho.pe/api/mcp/rpc",
                  "authorization_servers": [
                    "https://su-cuenta.despacho.pe"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/oauth/register": {
      "post": {
        "tags": [
          "OAuth para MCP"
        ],
        "operationId": "registrarClienteOAuth",
        "summary": "Registrar un cliente OAuth",
        "description": "Registro dinámico de un cliente público. El nombre es obligatorio y se acorta a 255 caracteres. Se admiten hasta cinco URI de retorno, de hasta 500 bytes cada una. Deben ser HTTPS, salvo localhost y 127.0.0.1. El cliente conserva el client_id para intercambios posteriores. Cuota adicional: cinco registros por IP y hora.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegistroCliente"
              },
              "example": {
                "client_name": "Integración de ejemplo",
                "redirect_uris": [
                  "https://cliente.example.com/oauth/callback"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Cliente registrado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClienteRegistrado"
                },
                "example": {
                  "client_id": "ID_GENERADO_POR_EL_SERVIDOR",
                  "client_name": "Integración de ejemplo",
                  "redirect_uris": [
                    "https://cliente.example.com/oauth/callback"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorOAuth"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/oauth/token": {
      "post": {
        "tags": [
          "OAuth para MCP"
        ],
        "operationId": "obtenerTokenOAuth",
        "summary": "Canjear o renovar un token",
        "description": "Admite authorization_code con PKCE S256 y refresh_token. resource, si se envía, debe identificar exactamente el MCP de esta cuenta. El refresh token rota al renovarse. El código de autorización es de un solo uso y caduca a los 120 segundos.",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/CanjeCodigo"
                  },
                  {
                    "$ref": "#/components/schemas/RenovacionToken"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Par de tokens; los valores del ejemplo son ficticios",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RespuestaToken"
                },
                "example": {
                  "access_token": "TOKEN_DE_EJEMPLO_NO_VALIDO",
                  "token_type": "Bearer",
                  "expires_in": 3600,
                  "refresh_token": "REFRESH_DE_EJEMPLO_NO_VALIDO",
                  "scope": "mcp:read"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorOAuth"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/oauth/revoke": {
      "post": {
        "tags": [
          "OAuth para MCP"
        ],
        "operationId": "revocarTokenOAuth",
        "summary": "Revocar un token",
        "description": "Acepta un token de acceso o renovación. Devuelve un objeto vacío tanto si existía como si no.",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "description": "Token que se desea revocar"
                  }
                },
                "required": [
                  "token"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta vacía",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "maxProperties": 0
                },
                "example": {}
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/expediente/listar": {
      "post": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "listarExpedientes",
        "summary": "Listar expedientes",
        "description": "Exige permiso expedientes.expediente. Los filtros extra_* permiten filtrar por los campos extra configurados en la cuenta. Los elementos y asociaciones dependen de los permisos y de los filtros.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 500,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "codigo": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "anio": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_cliente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_materia": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_estado": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_estados": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_usuario_responsable": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_inicio": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "archivado": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "sin_movimiento": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_etiquetas": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "ordenar": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "inclusiones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_expediente": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador del expediente."
                                  },
                                  "codigo": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Código del expediente."
                                  },
                                  "dias_ultimo_movimiento": {
                                    "type": "integer"
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 500
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/expediente/get/{id_expediente}": {
      "post": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "obtenerExpediente",
        "summary": "Obtener expediente",
        "description": "Exige permiso expedientes.expediente. Devuelve el detalle y añade cargos y abonos. Con la asociación usuarios_activos agrega esa lista; con usuarios_internos, los usuarios internos del expediente (id_usuario, nombre, id_empleado).",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_expediente",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "asociaciones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Asociaciones solicitadas; las autorizadas dependen de la implementación."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_expediente": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "cargos": {
                              "type": "array",
                              "items": {}
                            },
                            "abonos": {
                              "type": "array",
                              "items": {}
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/expediente/guardar": {
      "post": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "guardarExpediente",
        "summary": "Crear o editar expediente",
        "description": "Exige permiso nuevo o editar de expedientes.expediente según id_expediente. Se aceptan más campos y asociaciones; las reglas y los campos extra dependen del tipo de expediente.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Si se envía, se edita; si se omite, se crea."
                  },
                  "id_tipo_proceso": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "En alta, por defecto 100 cuando está vacío."
                  },
                  "id_materia": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Materia principal."
                  },
                  "id_cliente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Cliente asociado."
                  },
                  "codigo": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Código del expediente."
                  },
                  "sumilla": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Sumilla."
                  },
                  "id_etiquetas": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Arreglo o texto JSON de identificadores de etiquetas."
                  },
                  "usuarios_internos": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Arreglo o texto JSON de id_usuario. Reemplaza la lista: al editar envía la lista completa (obtenla con la asociación usuarios_internos de expediente/get); si se omite, solo queda el responsable."
                  },
                  "partes_procesales": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Arreglo o texto JSON de partes procesales."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_expediente": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador asignado o editado."
                            },
                            "codigo": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Código resultante."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/expediente/getDetalleEconomico/{id_expediente}": {
      "post": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "obtenerDetalleEconomicoExpediente",
        "summary": "Consultar detalle económico del expediente",
        "description": "Exige expedientes.expediente y comprueba acceso al expediente. Devuelve hasta 200 detalles.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_expediente",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "array",
                          "maxItems": 200,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id_detalle_economico": {
                                "type": [
                                  "integer",
                                  "string",
                                  "null"
                                ],
                                "description": "Identificador del detalle."
                              },
                              "id_expediente": {
                                "type": [
                                  "integer",
                                  "string",
                                  "null"
                                ],
                                "description": "Expediente asociado."
                              },
                              "id_concepto_economico": {
                                "type": [
                                  "integer",
                                  "string",
                                  "null"
                                ],
                                "description": "Concepto económico."
                              },
                              "fecha": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Fecha del detalle."
                              },
                              "monto": {
                                "type": [
                                  "number",
                                  "string",
                                  "null"
                                ],
                                "description": "Importe."
                              }
                            },
                            "additionalProperties": true
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/expediente/agregarExpedienteRelacionado/{id_expediente}/{id_expediente_relacionado}": {
      "post": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "agregarExpedienteRelacionado",
        "summary": "Relacionar expedientes",
        "description": "Exige expedientes.expediente/editar y acceso a ambos expedientes. Devuelve el expediente de origen previo a la relación.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_expediente",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "id_expediente_relacionado",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "expediente": {
                              "type": "object",
                              "properties": {},
                              "additionalProperties": true
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/expediente/vincularPrincipal/{id_expediente}/{id_expediente_principal}": {
      "post": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "vincularExpedientePrincipal",
        "summary": "Vincular expediente principal",
        "description": "Exige expedientes.expediente/editar y acceso a ambos expedientes. El destino debe ser un expediente principal; devuelve el expediente de origen previo al cambio.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_expediente",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "id_expediente_principal",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "expediente": {
                              "type": "object",
                              "properties": {},
                              "additionalProperties": true
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/expediente/desvincularPrincipal/{id_expediente}": {
      "put": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "desvincularExpedientePrincipal",
        "summary": "Desvincular expediente principal",
        "description": "Exige expedientes.expediente/editar y acceso al expediente. Devuelve el expediente previo al cambio.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_expediente",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "expediente": {
                              "type": "object",
                              "properties": {},
                              "additionalProperties": true
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/plazo/listar": {
      "post": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "listarPlazos",
        "summary": "Listar plazos",
        "description": "Exige expedientes.plazo/listar. estado admite vigente, vencido y atendido. La asociación totales agrega conteos por estado.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "descripcion": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_vence_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_vence_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "mis_casos": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "asociaciones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "dias_faltan": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Días hasta el vencimiento, con signo."
                                  },
                                  "porcentaje_avance": {
                                    "type": [
                                      "number",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Avance calculado."
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/plazo/get/{id_plazo}": {
      "post": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "obtenerPlazo",
        "summary": "Obtener plazo",
        "description": "Exige expedientes.plazo y acceso al expediente vinculado.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_plazo",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "asociaciones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Asociaciones opcionales."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_plazo": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador del plazo."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/plazo/guardar": {
      "post": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "guardarPlazo",
        "summary": "Crear o editar plazo",
        "description": "En HTTP exige el modelo completo de plazo. Comprueba expedientes.plazo/nuevo o editar y el acceso al expediente de origen y destino.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "plazo": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id_plazo": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Vacío para crear; valor existente para editar."
                          },
                          "id_expediente": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Expediente al que pertenece."
                          },
                          "descripcion": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Descripción."
                          },
                          "fecha_inicio": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Inicio del plazo."
                          },
                          "tipo_plazo": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Tipo de plazo."
                          },
                          "plazo": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ],
                            "description": "Duración."
                          },
                          "es_principal": {
                            "type": [
                              "boolean",
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Marca de plazo principal."
                          },
                          "id_plazo_amplia": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Plazo ampliado, si corresponde."
                          },
                          "alarmas": {
                            "type": "array",
                            "items": {}
                          }
                        },
                        "required": [
                          "id_plazo",
                          "id_expediente",
                          "descripcion",
                          "fecha_inicio",
                          "tipo_plazo",
                          "plazo",
                          "es_principal",
                          "id_plazo_amplia",
                          "alarmas"
                        ],
                        "additionalProperties": true
                      },
                      {
                        "type": "string",
                        "contentMediaType": "application/json",
                        "description": "Texto JSON que codifica el mismo objeto."
                      }
                    ]
                  }
                },
                "required": [
                  "plazo"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_plazo": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador resultante."
                            },
                            "es_principal": {
                              "type": [
                                "boolean",
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Marca resultante."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/plazo/registrarAtencion": {
      "post": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "registrarAtencionPlazo",
        "summary": "Registrar atención de plazo",
        "description": "Exige expedientes.plazo/editar y acceso al expediente vinculado. Devuelve el resultado de la operación.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id_plazo": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Plazo a atender."
                  },
                  "fecha_atendido": {
                    "type": "string",
                    "description": "Fecha de atención."
                  }
                },
                "required": [
                  "id_plazo",
                  "fecha_atendido"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/expedienteActoProcesal/listar/{id_expediente}": {
      "post": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "listarActosProcesales",
        "summary": "Listar actuaciones de expediente",
        "description": "Exige expedientes.actoprocesal y acceso al expediente. El listado tiene máximo 50 elementos por página.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_expediente",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "id_tipo_acto": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_persona": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "numero": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "sumilla": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "asociaciones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 50
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/expedienteActoProcesal/get/{id_acto_procesal}": {
      "get": {
        "tags": [
          "Expedientes"
        ],
        "operationId": "obtenerActoProcesal",
        "summary": "Obtener actuación procesal",
        "description": "Exige expedientes.expediente y acceso al expediente vinculado. También acepta POST.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_acto_procesal",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/evento/listar": {
      "post": {
        "tags": [
          "Agenda"
        ],
        "operationId": "listarEventos",
        "summary": "Listar eventos",
        "description": "Exige permiso agenda.evento. Página 1, tamaño 50 por defecto y máximo 200.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_asistente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/evento/misEventos": {
      "post": {
        "tags": [
          "Agenda"
        ],
        "operationId": "listarMisEventos",
        "summary": "Consultar mis eventos",
        "description": "Exige agenda.evento. Si se omiten las fechas, usa el día actual de la zona horaria del usuario. Entrega hasta 100 eventos del usuario ordenados por inicio.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fecha": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Día solicitado."
                  },
                  "fecha_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Inicio del rango."
                  },
                  "fecha_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Fin del rango."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "array",
                          "maxItems": 100,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id_evento": {
                                "type": [
                                  "integer",
                                  "string",
                                  "null"
                                ],
                                "description": "Identificador del evento."
                              },
                              "evento": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Nombre del evento."
                              },
                              "fecha_inicio": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Inicio del evento."
                              },
                              "fecha_finaliza": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Fin del evento."
                              }
                            },
                            "additionalProperties": true
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/evento/guardar": {
      "post": {
        "tags": [
          "Agenda"
        ],
        "operationId": "guardarEvento",
        "summary": "Crear o editar evento",
        "description": "Exige agenda.evento/nuevo o editar y comprueba acceso al expediente relacionado. Si la fecha tiene 16 caracteres, añade segundos :00.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id_evento": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Si se envía, se edita."
                  },
                  "evento": {
                    "type": "string"
                  },
                  "fecha_inicio": {
                    "type": "string",
                    "description": "Fecha y hora de inicio; obligatoria."
                  },
                  "fecha_finaliza": {
                    "type": "string",
                    "description": "Fecha y hora de término; obligatoria."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Expediente relacionado, sujeto a su control de acceso."
                  },
                  "lugar": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Lugar."
                  },
                  "descripcion": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Descripción."
                  },
                  "id_asistentes": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Arreglo o texto JSON de asistentes."
                  },
                  "id_alarmas": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Arreglo o texto JSON de alarmas."
                  }
                },
                "required": [
                  "fecha_inicio",
                  "fecha_finaliza"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_evento": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador resultante."
                            },
                            "evento": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Nombre."
                            },
                            "estado": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Estado resultante."
                            },
                            "aviso_videoconferencia": {
                              "type": [
                                "boolean",
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Aviso resultante."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/evento/editarEstado/{id_evento}/{estado}": {
      "put": {
        "tags": [
          "Agenda"
        ],
        "operationId": "editarEstadoEvento",
        "summary": "Cambiar estado de evento",
        "description": "Exige agenda.evento/editar y acceso al expediente relacionado. Devuelve data=true.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_evento",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "estado",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/evento/editarFecha": {
      "post": {
        "tags": [
          "Agenda"
        ],
        "operationId": "editarFechaEvento",
        "summary": "Cambiar fecha de evento",
        "description": "Exige agenda.evento/editar y acceso al expediente relacionado. Conserva los demás datos y actualiza las fechas recibidas.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id_evento": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Evento a actualizar."
                  },
                  "fecha_inicio": {
                    "type": "string",
                    "description": "Nuevo inicio."
                  },
                  "fecha_finaliza": {
                    "type": "string",
                    "description": "Nuevo fin."
                  }
                },
                "required": [
                  "id_evento"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_evento": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador del evento actualizado."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/tarea/listar": {
      "post": {
        "tags": [
          "Agenda"
        ],
        "operationId": "listarTareas",
        "summary": "Listar tareas",
        "description": "Exige agenda.tarea. Admite filtros de estado y fechas.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_estado": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_limite_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_limite_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_usuario_responsable": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_cliente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "sin_fecha": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "finalizadas": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/tarea/listarMisTareas": {
      "post": {
        "tags": [
          "Agenda"
        ],
        "operationId": "listarMisTareas",
        "summary": "Listar mis tareas",
        "description": "Exige agenda.tarea. El responsable se fija al usuario autenticado; estado o id_estado igual a abierto excluye tareas finalizadas.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "tarea": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_estado": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_limite": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_limite_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_limite_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_finalizacion_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_finalizacion_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_cliente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_creo_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_creo_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_tarea": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador de la tarea."
                                  },
                                  "nombre_estado": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Nombre del estado."
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/tarea/get/{id_tarea}": {
      "get": {
        "tags": [
          "Agenda"
        ],
        "operationId": "obtenerTarea",
        "summary": "Obtener tarea",
        "description": "Exige agenda.tarea y devuelve la tarea con comentarios. También acepta POST.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_tarea",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_tarea": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "comentarios": {
                              "type": "array",
                              "items": {}
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/tarea/guardar": {
      "post": {
        "tags": [
          "Agenda"
        ],
        "operationId": "guardarTarea",
        "summary": "Crear o editar tarea",
        "description": "Exige agenda.tarea/nuevo o editar y controla el acceso al expediente de origen y destino. Devuelve el registro guardado.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id_tarea": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Si se envía, se edita."
                  },
                  "tarea": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Nombre de la tarea."
                  },
                  "descripcion": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Descripción."
                  },
                  "fecha_limite": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Fecha límite cuando control_horas está vacío."
                  },
                  "fecha_inicio": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Inicio cuando control_horas está activo."
                  },
                  "fecha_termino": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Término cuando control_horas está activo."
                  },
                  "control_horas": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Activa el control de horas."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Expediente relacionado."
                  },
                  "id_usuario_responsable": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Responsable."
                  },
                  "usuarios": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Arreglo o texto JSON de usuarios."
                  },
                  "id_alarmas": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Arreglo o texto JSON de alarmas."
                  },
                  "id_etiquetas": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Arreglo o texto JSON de etiquetas."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/tarea/cambiarEstado/{id_tarea}/{id_estado}": {
      "put": {
        "tags": [
          "Agenda"
        ],
        "operationId": "cambiarEstadoPersonalizadoTarea",
        "summary": "Cambiar estado personalizado de tarea",
        "description": "Exige agenda.tarea/editar y acceso al expediente relacionado. Puede avanzar la etapa procesal cuando hay una sola etapa siguiente.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_tarea",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "id_estado",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_tarea": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador de la tarea."
                            },
                            "ids_proximas_etapas": {
                              "type": "array",
                              "items": {
                                "type": [
                                  "integer",
                                  "string"
                                ]
                              }
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/tarea/editarFecha": {
      "post": {
        "tags": [
          "Agenda"
        ],
        "operationId": "editarFechaTarea",
        "summary": "Cambiar fecha de tarea",
        "description": "Exige agenda.tarea/editar y acceso al expediente relacionado. Los campos de fecha actualizados dependen de control_horas.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id_tarea": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Tarea a actualizar."
                  },
                  "fecha_limite": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Nueva fecha límite cuando control_horas está desactivado."
                  },
                  "fecha_inicio": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Nuevo inicio cuando control_horas está activado."
                  },
                  "fecha_termino": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Nuevo término cuando control_horas está activado."
                  }
                },
                "required": [
                  "id_tarea"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_tarea": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador de la tarea actualizada."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/pago/listar": {
      "post": {
        "tags": [
          "Caja y bancos"
        ],
        "operationId": "listarPagos",
        "summary": "Listar pagos",
        "description": "Exige cajabanco.pago. Sin filtros usa la fecha actual en la zona horaria del usuario. Excluye anulados por defecto.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_diario": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_persona": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "tipo_pago": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "incluir_anulados": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "por_conciliar": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/pago/get/{id_pago}": {
      "get": {
        "tags": [
          "Caja y bancos"
        ],
        "operationId": "obtenerPago",
        "summary": "Obtener pago",
        "description": "Exige cajabanco.pago y devuelve el pago con su detalle. También acepta POST.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_pago",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_pago": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "detalle": {
                              "type": "array",
                              "items": {}
                            },
                            "simbolo_moneda": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Símbolo de moneda."
                            },
                            "estado_nombre": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Nombre del estado."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/sesionVenta/listar": {
      "post": {
        "tags": [
          "Caja y bancos"
        ],
        "operationId": "listarSesionesVenta",
        "summary": "Listar sesiones de caja",
        "description": "Exige cajabanco.sesion. Incluye fecha_apertura_local y fecha_cierre_local en cada elemento.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "id_punto_emision": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_usuario": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_apertura": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/sesionVenta/get/{id_sesion}": {
      "post": {
        "tags": [
          "Caja y bancos"
        ],
        "operationId": "obtenerSesionVenta",
        "summary": "Obtener sesión de caja",
        "description": "Exige cajabanco.sesion. Devuelve la sesión y las asociaciones disponibles.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_sesion",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "asociaciones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Asociaciones opcionales."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/sesionVenta/getDetallexDiario/{id_sesion}": {
      "post": {
        "tags": [
          "Caja y bancos"
        ],
        "operationId": "obtenerDetalleSesionPorDiario",
        "summary": "Consultar movimientos de una sesión por diario",
        "description": "Exige cajabanco.sesion. Devuelve un objeto indexado por diario, con movimientos por diario; incluye hasta 1000 pagos y solo sesiones a las que el usuario tiene acceso.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_sesion",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {},
                              "additionalProperties": true
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": true
                              }
                            }
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/cotizacion/listar": {
      "post": {
        "tags": [
          "Ventas"
        ],
        "operationId": "listarCotizaciones",
        "summary": "Listar cotizaciones",
        "description": "Exige ventas.cotizacion. Filtra documentos de tipo cotización.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "fecha_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "numero": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_cliente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_vendedor": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_etiqueta": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/cotizacion/get/{id_documento_venta}": {
      "get": {
        "tags": [
          "Ventas"
        ],
        "operationId": "obtenerCotizacion",
        "summary": "Obtener cotización",
        "description": "Exige ventas.cotizacion. Devuelve cabecera y detalle. También acepta POST.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_documento_venta",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_documento_venta": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "detalle": {
                              "type": "array",
                              "items": {}
                            },
                            "estado_nombre": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Nombre del estado."
                            },
                            "estado_cliente_nombre": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Nombre del estado del cliente."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/cotizacion/getDetalle/{id_documento_venta}": {
      "post": {
        "tags": [
          "Ventas"
        ],
        "operationId": "obtenerDetalleCotizacion",
        "summary": "Consultar líneas de cotización",
        "description": "Exige ventas.cotizacion. Devuelve las líneas de la cotización indicada.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_documento_venta",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_detalle_documento": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador de la línea."
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            {
                              "type": "object",
                              "properties": {},
                              "additionalProperties": true
                            }
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/cotizacion/guardar": {
      "post": {
        "tags": [
          "Ventas"
        ],
        "operationId": "guardarCotizacion",
        "summary": "Crear o editar cotización",
        "description": "Exige ventas.cotizacion/nuevo o editar. venta acepta objeto o texto JSON y detalle debe ser un arreglo no vacío.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "venta": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id_documento_venta": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Si se envía, se edita."
                          },
                          "id_cliente": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Cliente; si está vacío, se usa el predeterminado."
                          },
                          "fecha_documento": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Fecha del documento."
                          },
                          "id_vendedor": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Vendedor."
                          },
                          "detalle": {
                            "type": "array",
                            "minItems": 1,
                            "items": {
                              "type": "object",
                              "properties": {
                                "impuestos": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "id_impuesto": {
                                        "type": [
                                          "integer",
                                          "string",
                                          "null"
                                        ],
                                        "description": "Identificador del impuesto."
                                      }
                                    },
                                    "additionalProperties": true
                                  }
                                }
                              },
                              "additionalProperties": true
                            }
                          }
                        },
                        "required": [
                          "detalle"
                        ],
                        "additionalProperties": true
                      },
                      {
                        "type": "string",
                        "contentMediaType": "application/json",
                        "description": "Texto JSON que codifica el mismo objeto."
                      }
                    ]
                  }
                },
                "required": [
                  "venta"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_documento_venta": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador resultante."
                            },
                            "numero": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Número resultante."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/cotizacion/confirmar/{id_documento_venta}": {
      "post": {
        "tags": [
          "Ventas"
        ],
        "operationId": "confirmarCotizacion",
        "summary": "Confirmar cotización",
        "description": "Exige ventas.cotizacion/nuevo. Devuelve el resultado de la confirmación.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_documento_venta",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_documento_venta": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "numero": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Número resultante."
                            },
                            "id_carpeta": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Carpeta creada, cuando la creación fue posible."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/cotizacion/cerrar": {
      "post": {
        "tags": [
          "Ventas"
        ],
        "operationId": "cerrarFacturacionCotizacion",
        "summary": "Cerrar facturación de cotización",
        "description": "Exige ventas.cotizacion/editar. Requiere motivo de cierre no vacío y devuelve data=true.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id_documento_venta": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Cotización a cerrar."
                  },
                  "motivo_cierre": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "id_documento_venta",
                  "motivo_cierre"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documentoVenta/listar": {
      "post": {
        "tags": [
          "Ventas"
        ],
        "operationId": "listarDocumentosVenta",
        "summary": "Listar comprobantes de venta",
        "description": "Exige ventas.comprobanteventa. Si no se indica tipo, incluye los tipos de comprobante habituales; excluye los documentos de tipo cxc.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "id_tipo_documento": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_cliente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "numero": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "incluir_anulados": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documentoVenta/get/{id_documento_venta}": {
      "get": {
        "tags": [
          "Ventas"
        ],
        "operationId": "obtenerDocumentoVenta",
        "summary": "Obtener comprobante de venta",
        "description": "Exige ventas.comprobanteventa. Devuelve cabecera y detalle. También acepta POST.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_documento_venta",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_documento_venta": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "detalle": {
                              "type": "array",
                              "items": {}
                            },
                            "estado_nombre": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Nombre del estado."
                            },
                            "fe_sunat_estado_nombre": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Nombre del estado de facturación electrónica."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documentoVenta/getDetalle/{id_documento_venta}": {
      "get": {
        "tags": [
          "Ventas"
        ],
        "operationId": "obtenerDetalleDocumentoVenta",
        "summary": "Consultar detalle de comprobante",
        "description": "Exige ventas.comprobanteventa. Devuelve las líneas del documento indicado.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_documento_venta",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_detalle_documento": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador de la línea."
                                  },
                                  "descripcion": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Descripción de la línea."
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            {
                              "type": "object",
                              "properties": {},
                              "additionalProperties": true
                            }
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documentoCobrar/listar": {
      "post": {
        "tags": [
          "Ventas"
        ],
        "operationId": "listarDocumentosCobrar",
        "summary": "Listar documentos por cobrar",
        "description": "Exige clientes.documentocobrar. Devuelve el listado paginado de cuentas por cobrar.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "id_cliente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_vencimiento_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_vencimiento_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "numero": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "pendiente_pago": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/item/listar": {
      "post": {
        "tags": [
          "Ventas"
        ],
        "operationId": "listarServicios",
        "summary": "Listar servicios",
        "description": "Exige ventas.item. Busca por coincidencia parcial en el nombre (item) y en el código interno, ordena por nombre y no incluye el precio: se consulta con item/get.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "item": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "codigo_interno": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_unidad_medida": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "disponible": {
                    "enum": [
                      0,
                      1,
                      "0",
                      "1"
                    ],
                    "description": "Sin enviar, incluye disponibles y no disponibles."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_item": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador del servicio."
                                  },
                                  "item": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Nombre."
                                  },
                                  "codigo_interno": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Código interno."
                                  },
                                  "disponible": {
                                    "enum": [
                                      0,
                                      1,
                                      "0",
                                      "1"
                                    ]
                                  },
                                  "id_unidad_medida": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Unidad de medida."
                                  },
                                  "unidad_medida": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Nombre de la unidad de medida."
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/item/get/{id_item}": {
      "post": {
        "tags": [
          "Ventas"
        ],
        "operationId": "obtenerServicio",
        "summary": "Obtener servicio",
        "description": "Exige ventas.item. Devuelve el servicio con su precio e impuestos; es el objeto de partida para editarlo con item/guardar.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_item",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_item": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "item": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Nombre."
                            },
                            "codigo_interno": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Código interno."
                            },
                            "descripcion_larga": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Descripción larga."
                            },
                            "disponible": {
                              "enum": [
                                0,
                                1,
                                "0",
                                "1"
                              ]
                            },
                            "id_unidad_medida": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Unidad de medida."
                            },
                            "id_moneda_venta": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Moneda de venta."
                            },
                            "precio_venta": {
                              "type": [
                                "number",
                                "string",
                                "null"
                              ],
                              "description": "Precio de venta con impuestos."
                            },
                            "valor_venta": {
                              "type": [
                                "number",
                                "string",
                                "null"
                              ],
                              "description": "Valor de venta sin impuestos."
                            },
                            "afecto_igv": {
                              "enum": [
                                0,
                                1,
                                "0",
                                "1"
                              ]
                            },
                            "id_tipo_afectacion_igv": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Tipo de afectación al IGV."
                            },
                            "impuestos_venta": {
                              "anyOf": [
                                {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "id_impuesto": {
                                        "type": [
                                          "integer",
                                          "string",
                                          "null"
                                        ],
                                        "description": "Impuesto."
                                      }
                                    },
                                    "additionalProperties": true
                                  }
                                },
                                {
                                  "type": "object",
                                  "properties": {},
                                  "additionalProperties": true
                                }
                              ],
                              "description": "Arreglo u objeto indexado de impuestos con id_impuesto."
                            },
                            "impuestos_compra": {
                              "anyOf": [
                                {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "id_impuesto": {
                                        "type": [
                                          "integer",
                                          "string",
                                          "null"
                                        ],
                                        "description": "Impuesto."
                                      }
                                    },
                                    "additionalProperties": true
                                  }
                                },
                                {
                                  "type": "object",
                                  "properties": {},
                                  "additionalProperties": true
                                }
                              ],
                              "description": "Arreglo u objeto indexado de impuestos con id_impuesto."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/item/guardar": {
      "post": {
        "tags": [
          "Ventas"
        ],
        "operationId": "guardarServicio",
        "summary": "Crear o editar servicio",
        "description": "Exige ventas.item/nuevo o editar. item acepta objeto o texto JSON. Al editar se reemplaza el servicio completo: los campos omitidos vuelven a su valor por defecto (precio_venta a 0, codigo_interno vacío), así que envíe el objeto de item/get con los cambios. Si afecto_igv es 1 y no se indica el IGV, se agrega. Registra un servicio por llamada.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "item": {
                    "type": "object",
                    "properties": {
                      "id_item": {
                        "type": [
                          "integer",
                          "string",
                          "null"
                        ],
                        "description": "Si se envía, se edita ese servicio; si no existe, responde error."
                      },
                      "item": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "description": "Nombre del servicio."
                      },
                      "codigo_interno": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 32,
                        "description": "Código interno."
                      },
                      "descripcion_larga": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Descripción larga."
                      },
                      "id_unidad_medida": {
                        "type": [
                          "integer",
                          "string",
                          "null"
                        ],
                        "description": "Unidad de medida existente; la pantalla de servicios usa 2."
                      },
                      "disponible": {
                        "enum": [
                          0,
                          1,
                          "0",
                          "1"
                        ],
                        "description": "Por defecto 1."
                      },
                      "id_moneda_venta": {
                        "type": [
                          "integer",
                          "string",
                          "null"
                        ],
                        "description": "Moneda de venta; vacío usa la moneda de la cuenta."
                      },
                      "precio_venta": {
                        "type": [
                          "number",
                          "string"
                        ],
                        "description": "Precio con impuestos o valor sin impuestos, según la configuración de precios de la cuenta. Por defecto 0."
                      },
                      "afecto_igv": {
                        "enum": [
                          0,
                          1,
                          "0",
                          "1"
                        ],
                        "description": "Por defecto 1."
                      },
                      "id_tipo_afectacion_igv": {
                        "type": [
                          "integer",
                          "string",
                          "null"
                        ],
                        "description": "Vacío usa 10 si afecto_igv es 1 y 30 si es 0."
                      },
                      "impuestos_venta": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id_impuesto": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Impuesto."
                            }
                          },
                          "additionalProperties": true
                        }
                      },
                      "impuestos_compra": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id_impuesto": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Impuesto."
                            }
                          },
                          "additionalProperties": true
                        }
                      }
                    },
                    "required": [
                      "item",
                      "id_unidad_medida"
                    ],
                    "additionalProperties": true
                  }
                },
                "required": [
                  "item"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_item": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador resultante."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documentoProveedorGastos/listar": {
      "post": {
        "tags": [
          "Compras"
        ],
        "operationId": "listarFacturasGastos",
        "summary": "Listar facturas de gastos",
        "description": "Exige compras.documentoproveedorgasto. Sin filtros, usa la fecha actual como intervalo. tipo_compra se fija a gastos. asociaciones=totales agrega totales y moneda_simbolo.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "f": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "por_pagar": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_proveedor": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_guia_ingreso": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "correlativo": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "numero": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_tipo_documento": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "es_anticipo": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "incluir_anulados": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "asociaciones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_documento": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador del documento."
                                  },
                                  "numero": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Número."
                                  },
                                  "estado_nombre": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Nombre del estado."
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documentoProveedorGastos/get/{id_documento}": {
      "post": {
        "tags": [
          "Compras"
        ],
        "operationId": "obtenerFacturaGastos",
        "summary": "Obtener factura de gastos",
        "description": "Exige compras.documentoproveedorgasto. Las asociaciones e inclusiones alteran la representación devuelta.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_documento",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "asociaciones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Asociaciones solicitadas."
                  },
                  "inclusiones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Inclusiones solicitadas."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_documento": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "numero": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Número del documento."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documentoProveedorGastos/getDetalle/{id_documento}": {
      "get": {
        "tags": [
          "Compras"
        ],
        "operationId": "obtenerDetalleFacturaGastos",
        "summary": "Consultar detalle de factura de gastos",
        "description": "Exige compras.documentoproveedorgasto. Devuelve las líneas de detalle.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_documento",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {},
                            "additionalProperties": true
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documentoProveedorGastos/guardar": {
      "post": {
        "tags": [
          "Compras"
        ],
        "operationId": "guardarFacturaGastos",
        "summary": "Crear o editar factura de gastos",
        "description": "Exige compras.documentoproveedorgasto/nuevo o editar según id_documento. documento_proveedor admite objeto o texto JSON; detalle debe ser un arreglo no vacío. Se validan los valores y asociaciones.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documento_proveedor": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id_documento": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Si se envía, edita el documento."
                          },
                          "id_tipo_documento": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Tipo de documento."
                          },
                          "id_proveedor": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Proveedor."
                          },
                          "id_condicion_pago": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Condición de pago."
                          },
                          "tipo_operacion": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Tipo de operación."
                          },
                          "id_clasificacion_compra": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Clasificación de compra."
                          },
                          "es_anticipo": {
                            "type": [
                              "boolean",
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Indica anticipo."
                          },
                          "fecha_documento": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Fecha del documento."
                          },
                          "fecha_contable": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Fecha contable."
                          },
                          "fecha_vencimiento": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Vencimiento."
                          },
                          "numero": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Número del documento."
                          },
                          "id_moneda": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Moneda."
                          },
                          "tipo_cambio": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ],
                            "description": "Tipo de cambio."
                          },
                          "descuento_global": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ],
                            "description": "Descuento global."
                          },
                          "afecto_detraccion": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Marca de detracción."
                          },
                          "detra_tasa": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ],
                            "description": "Tasa de detracción."
                          },
                          "id_tipo_nota_credito": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Tipo de nota de crédito."
                          },
                          "id_tipo_nota_debito": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Tipo de nota de débito."
                          },
                          "detalle": {
                            "type": "array",
                            "minItems": 1,
                            "items": {
                              "type": "object",
                              "properties": {
                                "impuestos": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "id_impuesto": {
                                        "type": [
                                          "integer",
                                          "string",
                                          "null"
                                        ],
                                        "description": "Impuesto aplicado."
                                      }
                                    },
                                    "additionalProperties": true
                                  }
                                }
                              },
                              "additionalProperties": true
                            }
                          },
                          "cargos": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id_impuesto": {
                                  "type": [
                                    "integer",
                                    "string",
                                    "null"
                                  ],
                                  "description": "Cargo aplicado."
                                }
                              },
                              "additionalProperties": true
                            }
                          },
                          "origenes": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {},
                              "additionalProperties": true
                            }
                          }
                        },
                        "required": [
                          "id_tipo_documento",
                          "id_proveedor",
                          "id_condicion_pago",
                          "tipo_operacion",
                          "id_clasificacion_compra",
                          "es_anticipo",
                          "fecha_documento",
                          "fecha_contable",
                          "fecha_vencimiento",
                          "numero",
                          "id_moneda",
                          "tipo_cambio",
                          "descuento_global",
                          "detra_tasa",
                          "detalle"
                        ],
                        "additionalProperties": true
                      },
                      {
                        "type": "string",
                        "contentMediaType": "application/json",
                        "description": "Texto JSON que codifica el mismo objeto."
                      }
                    ]
                  }
                },
                "required": [
                  "documento_proveedor"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_documento": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador guardado."
                            },
                            "numero": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Número guardado."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documentoProveedorGastos/confirmar/{id_documento}": {
      "put": {
        "tags": [
          "Compras"
        ],
        "operationId": "confirmarFacturaGastos",
        "summary": "Confirmar factura de gastos",
        "description": "Exige compras.documentoproveedorgasto/nuevo. Valida el documento y devuelve data=true.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_documento",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/proveedor/buscar": {
      "post": {
        "tags": [
          "Compras"
        ],
        "operationId": "buscarProveedores",
        "summary": "Buscar proveedores activos",
        "description": "Exige compras.proveedor. Devuelve hasta 50 personas activas marcadas como proveedor.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Texto de búsqueda opcional."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": [
                                  "integer",
                                  "string",
                                  "null"
                                ],
                                "description": "Identificador para selección."
                              },
                              "value": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Texto para selección."
                              },
                              "id_persona": {
                                "type": [
                                  "integer",
                                  "string",
                                  "null"
                                ],
                                "description": "Identificador de persona."
                              }
                            },
                            "additionalProperties": true
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/proveedor/get/{id_proveedor}": {
      "get": {
        "tags": [
          "Compras"
        ],
        "operationId": "obtenerProveedor",
        "summary": "Obtener proveedor",
        "description": "Exige compras.proveedor. Devuelve los datos de la persona proveedora.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_proveedor",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_persona": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documentoPagar/listar": {
      "post": {
        "tags": [
          "Compras"
        ],
        "operationId": "listarDocumentosPagar",
        "summary": "Listar documentos por pagar",
        "description": "Exige proveedores.documentopagar. Devuelve cuentas por pagar paginadas.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "id_proveedor": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "numero": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "es_anticipo": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "es_recaudacion": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "pendiente_pago": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_tipo_documento": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "excluir_anulados": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_vencimiento_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_vencimiento_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "ordenar": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_documento_pagar": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador."
                                  },
                                  "numero": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Número."
                                  },
                                  "estado_nombre": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Nombre del estado."
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/letraPagar/listar": {
      "post": {
        "tags": [
          "Compras"
        ],
        "operationId": "listarLetrasPagar",
        "summary": "Listar letras por pagar",
        "description": "Exige compras.letrapagar. q se aplica al número y los resultados incluyen el estado de la cuenta por pagar.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_socio": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "numero": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "numero_unico": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "incluir_anulados": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "ordenar": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_letra": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador."
                                  },
                                  "numero": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Número."
                                  },
                                  "estado_nombre": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Nombre del estado."
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/letraPagar/get/{id_letra}": {
      "post": {
        "tags": [
          "Compras"
        ],
        "operationId": "obtenerLetraPagar",
        "summary": "Obtener letra por pagar",
        "description": "Exige compras.letrapagar. Incluye movimientos de la cuenta por pagar asociada.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_letra",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_letra": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "estado_nombre": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Estado de la letra."
                            },
                            "cxp_estado_nombre": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Estado de la cuenta por pagar."
                            },
                            "moneda_simbolo": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Símbolo de moneda."
                            },
                            "movimientos": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": true
                              }
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/entradaTiempo/listar": {
      "post": {
        "tags": [
          "Horas"
        ],
        "operationId": "listarEntradasTiempo",
        "summary": "Listar horas trabajadas",
        "description": "Exige horas.entradatiempo/listar. Incluye totales del conjunto filtrado.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "id_proyecto": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_cliente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_grupo": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_consulta_legal": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_tipo_actividad": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_usuario": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "descripcion": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "revisado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "facturable": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "liquidado": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "por_facturar": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "ordenar": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_entrada_tiempo": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador."
                                  },
                                  "nombre_estado": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Estado mostrado."
                                  },
                                  "revisado": {
                                    "type": "boolean"
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/entradaTiempo/get/{id_entrada_tiempo}": {
      "get": {
        "tags": [
          "Horas"
        ],
        "operationId": "obtenerEntradaTiempo",
        "summary": "Obtener entrada de tiempo",
        "description": "Exige horas.entradatiempo y valida el acceso al registro.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_entrada_tiempo",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_entrada_tiempo": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "fecha": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Fecha de trabajo."
                            },
                            "descripcion": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Descripción."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/entradaTiempo/guardar": {
      "post": {
        "tags": [
          "Horas"
        ],
        "operationId": "guardarEntradaTiempo",
        "summary": "Crear o editar entrada de tiempo",
        "description": "Exige horas.entradatiempo/nuevo o editar. Valida permiso sobre la entrada y el expediente de destino; ids_otros_usuarios admite arreglo o texto JSON.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id_entrada_tiempo": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_cronometro": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_cliente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_proyecto": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_tarea": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_evento": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_consulta_legal": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_tipo_actividad": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_contacto": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "descripcion": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "fecha": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "hora_inicio": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "duracion": {
                    "type": [
                      "number",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "duracion_facturable": {
                    "type": [
                      "number",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "facturable": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "estado_tiempo": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "ids_otros_usuarios": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Campo opcional."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_entrada_tiempo": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador guardado."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/gastoHoras/listar": {
      "post": {
        "tags": [
          "Horas"
        ],
        "operationId": "listarGastosHoras",
        "summary": "Listar gastos de Horas",
        "description": "Exige horas.gasto/listar. asociaciones=totales agrega totales y moneda_simbolo.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "id_cliente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_responsable": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_proyecto": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_desde": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "por_facturar": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "pendiente_facturacion": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "facturable": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "devolucion": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "ordenar": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "asociaciones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_gasto": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador."
                                  },
                                  "estado_nombre": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Estado mostrado."
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/gastoHoras/get/{id_gasto}": {
      "post": {
        "tags": [
          "Horas"
        ],
        "operationId": "obtenerGastoHoras",
        "summary": "Obtener gasto de Horas",
        "description": "Exige horas.gasto.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_gasto",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "asociaciones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Asociaciones opcionales."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_gasto": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/gastoHoras/guardar": {
      "post": {
        "tags": [
          "Horas"
        ],
        "operationId": "guardarGastoHoras",
        "summary": "Crear o editar gasto de Horas",
        "description": "Exige horas.gasto/nuevo o editar. Adjuntar archivos no forma parte de esta referencia.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id_gasto": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_proyecto": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "fecha": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "fecha_vencimiento": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_motivo_pago": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "descripcion": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "facturable": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_moneda": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "monto": {
                    "type": [
                      "number",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "monto_facturable": {
                    "type": [
                      "number",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_responsable": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_contacto": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_gasto": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador guardado."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/contrato/listar": {
      "post": {
        "tags": [
          "Contratos"
        ],
        "operationId": "listarContratos",
        "summary": "Listar contratos",
        "description": "Exige contratos.contrato/listar. vigentes y vencidos usan la fecha actual como corte.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_tipo_contrato": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "recurso": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_recurso": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_cliente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_persona": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_estado": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "fecha_fin_hasta": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "vigentes": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "vencidos": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "ordenar": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_contrato": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador."
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/contrato/get/{id_contrato}": {
      "post": {
        "tags": [
          "Contratos"
        ],
        "operationId": "obtenerContrato",
        "summary": "Obtener contrato",
        "description": "Exige contratos.contrato. Las asociaciones solicitadas pueden ampliar los datos.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_contrato",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "asociaciones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Asociaciones opcionales."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_contrato": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "contrato": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Nombre del contrato."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/contrato/guardar": {
      "post": {
        "tags": [
          "Contratos"
        ],
        "operationId": "guardarContrato",
        "summary": "Crear o editar contrato",
        "description": "Exige contratos.contrato/nuevo o editar. personas admite arreglo o texto JSON. Se validan los datos y relaciones.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id_contrato": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "contrato": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "objeto": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "observaciones": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "codigo_interno": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "referencia_interna": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_tipo_contrato": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_flujo": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "fecha_inicio": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "fecha_fin": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_usuario_responsable": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_cliente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_cotizacion": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_contacto": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_contrato_origen": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_moneda": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "monto": {
                    "type": [
                      "number",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "porcentaje_honorario_exito": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "plazo": {
                    "type": [
                      "number",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "tipo_plazo": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "recurso": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_recurso": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "prioridad": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "personas": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id_persona": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Parte del contrato."
                            },
                            "id_rol": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Rol."
                            },
                            "firmante": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Marca de firmante."
                            },
                            "observacion": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Observación."
                            }
                          },
                          "additionalProperties": true
                        }
                      },
                      {
                        "type": "string",
                        "contentMediaType": "application/json"
                      }
                    ]
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_contrato": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador guardado."
                            },
                            "contrato": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Nombre guardado."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/solicitudContrato/listar": {
      "post": {
        "tags": [
          "Contratos"
        ],
        "operationId": "listarSolicitudesContrato",
        "summary": "Listar solicitudes de contrato",
        "description": "Exige contratos.solicitud/listar.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_tipo_contrato": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_usuario_creo": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_usuario_responsable": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "ordenar": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_solicitud": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador."
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/solicitudContrato/get/{id_solicitud}": {
      "post": {
        "tags": [
          "Contratos"
        ],
        "operationId": "obtenerSolicitudContrato",
        "summary": "Obtener solicitud de contrato",
        "description": "Exige contratos.solicitud.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_solicitud",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "asociaciones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Asociaciones opcionales."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_solicitud": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "solicitud": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Nombre de la solicitud."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/solicitudContrato/guardar": {
      "post": {
        "tags": [
          "Contratos"
        ],
        "operationId": "guardarSolicitudContrato",
        "summary": "Crear o editar solicitud",
        "description": "Exige contratos.solicitud/nuevo o editar según id_solicitud.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id_solicitud": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "solicitud": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "id_tipo_contrato": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "prioridad": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "descripcion": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  },
                  "detalle": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Campo opcional."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_solicitud": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador guardado."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documento/listar": {
      "post": {
        "tags": [
          "Documentos"
        ],
        "operationId": "listarDocumentos",
        "summary": "Listar documentos",
        "description": "Exige documentos.documento. Si la búsqueda en contenido está habilitada, q también puede buscar en el texto.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "id_expediente": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "recurso": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_recurso": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "estado": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_tipo_documento": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_categoria": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "por_revisar": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "prioridad_revision": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "revisados": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "ordenar": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_documento": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador."
                                  },
                                  "titulo": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Título."
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documento/get/{id_documento}": {
      "post": {
        "tags": [
          "Documentos"
        ],
        "operationId": "obtenerDocumento",
        "summary": "Obtener documento",
        "description": "Exige documentos.documento. Devuelve metadatos y asociaciones solicitadas.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_documento",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "asociaciones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Asociaciones opcionales."
                  },
                  "inclusiones": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Inclusiones opcionales."
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_documento": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "titulo": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Título."
                            },
                            "descripcion": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Descripción."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documento/guardar": {
      "post": {
        "tags": [
          "Documentos"
        ],
        "operationId": "guardarDocumento",
        "summary": "Crear o editar documento",
        "description": "Exige documentos.documento/nuevo o editar. documento admite objeto o texto JSON. Crea o edita la ficha; adjuntar archivos no forma parte de esta referencia.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documento": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id_documento": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Si se envía, edita el documento."
                          },
                          "titulo": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Título."
                          },
                          "descripcion": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Descripción."
                          },
                          "id_expediente": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Expediente asociado."
                          },
                          "recurso": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Tipo de recurso asociado."
                          },
                          "id_recurso": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Recurso asociado."
                          },
                          "privacidad": {
                            "type": "string",
                            "enum": [
                              "publico",
                              "privado"
                            ],
                            "description": "Privacidad del documento."
                          },
                          "accesos": {
                            "type": "array",
                            "description": "Lista completa de accesos compartidos: reemplaza los existentes; [] los quita todos.",
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "entidad": {
                                  "type": "string",
                                  "enum": [
                                    "usuario",
                                    "equipo"
                                  ]
                                },
                                "id_entidad": {
                                  "type": "integer",
                                  "description": "Identificador del usuario o equipo."
                                },
                                "permiso": {
                                  "type": "string",
                                  "enum": [
                                    "leer",
                                    "editar"
                                  ]
                                }
                              },
                              "required": [
                                "entidad",
                                "id_entidad",
                                "permiso"
                              ]
                            }
                          },
                          "id_tipo_documento": {
                            "type": [
                              "integer",
                              "string",
                              "null"
                            ],
                            "description": "Tipo de documento."
                          },
                          "categorias": {
                            "type": "array",
                            "items": {
                              "type": [
                                "integer",
                                "string"
                              ]
                            }
                          }
                        },
                        "required": [
                          "titulo",
                          "descripcion",
                          "id_expediente",
                          "recurso",
                          "id_recurso",
                          "privacidad",
                          "accesos",
                          "id_documento"
                        ],
                        "additionalProperties": true
                      },
                      {
                        "type": "string",
                        "contentMediaType": "application/json",
                        "description": "Texto JSON que codifica el mismo objeto."
                      }
                    ]
                  }
                },
                "required": [
                  "documento"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_documento": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador guardado."
                            },
                            "titulo": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Título guardado."
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documento/getVersiones/{id_documento}": {
      "get": {
        "tags": [
          "Documentos"
        ],
        "operationId": "listarVersionesDocumento",
        "summary": "Listar versiones de documento",
        "description": "Exige documentos.documento y acceso de lectura al documento. Devuelve metadatos de versiones.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_documento",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {},
                            "additionalProperties": true
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documentoPlantilla/listar": {
      "post": {
        "tags": [
          "Documentos"
        ],
        "operationId": "listarPlantillasDocumento",
        "summary": "Listar plantillas de documento",
        "description": "Exige documentos.plantilla/listar. El campo errores llega como arreglo.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pg": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Página solicitada; por defecto 1."
                  },
                  "items_x_pag": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "description": "Tamaño de página; fuera del rango se usa 50."
                  },
                  "q": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "activo": {
                    "type": [
                      "boolean",
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "id_tipo_documento": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  },
                  "ordenar": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Filtro opcional; se aplica cuando no está vacío."
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "pg": 1,
                "items_x_pag": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id_plantilla": {
                                    "type": [
                                      "integer",
                                      "string",
                                      "null"
                                    ],
                                    "description": "Identificador."
                                  },
                                  "plantilla": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Nombre."
                                  },
                                  "errores": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "additionalProperties": true
                              }
                            },
                            "num_items": {
                              "type": "integer"
                            },
                            "pagina": {
                              "type": [
                                "integer",
                                "string"
                              ],
                              "description": "Puede conservar el tipo de pg enviado por el cliente."
                            },
                            "item_desde": {
                              "type": "integer"
                            },
                            "item_hasta": {
                              "type": "integer"
                            },
                            "paginas": {
                              "type": "integer"
                            },
                            "items_x_pag": {
                              "type": "integer",
                              "maximum": 200
                            }
                          },
                          "required": [
                            "items",
                            "num_items",
                            "pagina",
                            "item_desde",
                            "item_hasta",
                            "paginas",
                            "items_x_pag"
                          ],
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                },
                "example": {
                  "error": false,
                  "data": {
                    "items": [],
                    "num_items": 0,
                    "pagina": 1,
                    "item_desde": 0,
                    "item_hasta": 0,
                    "paginas": 0,
                    "items_x_pag": 20
                  },
                  "mensaje": null,
                  "codigo": null,
                  "otros": null
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    },
    "/api/documentoPlantilla/get/{id_plantilla}": {
      "get": {
        "tags": [
          "Documentos"
        ],
        "operationId": "obtenerPlantillaDocumento",
        "summary": "Obtener plantilla de documento",
        "description": "Exige documentos.plantilla/listar.",
        "security": [
          {
            "TokenApiPersonal": []
          }
        ],
        "parameters": [
          {
            "name": "id_plantilla",
            "in": "path",
            "required": true,
            "description": "Identificador del registro en esta cuenta.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Respuesta JSON de la aplicación. Los errores de negocio también pueden llegar con HTTP 200 y error=true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "boolean"
                    },
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id_plantilla": {
                              "type": [
                                "integer",
                                "string",
                                "null"
                              ],
                              "description": "Identificador."
                            },
                            "plantilla": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Nombre."
                            },
                            "errores": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "additionalProperties": true
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mensaje": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "codigo": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "otros": {}
                  },
                  "required": [
                    "error",
                    "data",
                    "mensaje",
                    "codigo",
                    "otros"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/ErrorPermisoRest"
          },
          "429": {
            "$ref": "#/components/responses/LimiteGlobal"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "MetadatosAutorizacion": {
        "type": "object",
        "properties": {
          "issuer": {
            "type": "string",
            "format": "uri"
          },
          "authorization_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "token_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "registration_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "revocation_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "scopes_supported": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "mcp:read",
                "mcp:write"
              ]
            }
          },
          "response_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "grant_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "token_endpoint_auth_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "code_challenge_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "issuer",
          "authorization_endpoint",
          "token_endpoint",
          "registration_endpoint",
          "revocation_endpoint",
          "scopes_supported",
          "response_types_supported",
          "grant_types_supported",
          "token_endpoint_auth_methods_supported",
          "code_challenge_methods_supported"
        ]
      },
      "MetadatosRecurso": {
        "type": "object",
        "properties": {
          "resource": {
            "type": "string",
            "format": "uri"
          },
          "authorization_servers": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          }
        },
        "required": [
          "resource",
          "authorization_servers"
        ]
      },
      "RegistroCliente": {
        "type": "object",
        "properties": {
          "client_name": {
            "type": "string",
            "minLength": 1,
            "description": "Nombre mostrado al usuario durante el consentimiento; se acorta a 255 caracteres"
          },
          "redirect_uris": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "type": "string",
              "format": "uri"
            }
          }
        },
        "required": [
          "client_name",
          "redirect_uris"
        ]
      },
      "ClienteRegistrado": {
        "type": "object",
        "properties": {
          "client_id": {
            "type": "string",
            "readOnly": true
          },
          "client_name": {
            "type": "string",
            "readOnly": true
          },
          "redirect_uris": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "readOnly": true
          }
        },
        "required": [
          "client_id",
          "client_name",
          "redirect_uris"
        ]
      },
      "CanjeCodigo": {
        "type": "object",
        "properties": {
          "grant_type": {
            "type": "string",
            "const": "authorization_code"
          },
          "client_id": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "redirect_uri": {
            "type": "string",
            "format": "uri"
          },
          "code_verifier": {
            "type": "string"
          },
          "resource": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "grant_type",
          "client_id",
          "code",
          "redirect_uri",
          "code_verifier"
        ]
      },
      "RenovacionToken": {
        "type": "object",
        "properties": {
          "grant_type": {
            "type": "string",
            "const": "refresh_token"
          },
          "client_id": {
            "type": "string"
          },
          "refresh_token": {
            "type": "string"
          },
          "resource": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "grant_type",
          "client_id",
          "refresh_token"
        ]
      },
      "RespuestaToken": {
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string",
            "readOnly": true
          },
          "token_type": {
            "type": "string",
            "const": "Bearer",
            "readOnly": true
          },
          "expires_in": {
            "type": "integer",
            "readOnly": true,
            "description": "Segundos hasta el vencimiento; valor configurable"
          },
          "refresh_token": {
            "type": "string",
            "readOnly": true
          },
          "scope": {
            "type": "string",
            "readOnly": true
          }
        },
        "required": [
          "access_token",
          "token_type",
          "expires_in",
          "refresh_token",
          "scope"
        ]
      },
      "ErrorOAuth": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "error_description": {
            "type": "string"
          }
        },
        "required": [
          "error",
          "error_description"
        ]
      },
      "ErrorApi": {
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean"
          },
          "data": {
            "type": "null"
          },
          "mensaje": {
            "type": "string"
          },
          "codigo": {
            "type": "integer"
          },
          "otros": {
            "type": "null"
          }
        },
        "required": [
          "error",
          "data",
          "mensaje",
          "codigo",
          "otros"
        ]
      }
    },
    "responses": {
      "ErrorOAuth": {
        "description": "Error OAuth, sin envoltorio de API",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorOAuth"
            },
            "example": {
              "error": "invalid_grant",
              "error_description": "invalid_grant"
            }
          }
        }
      },
      "LimiteGlobal": {
        "description": "Límite de solicitudes; respuesta con envoltorio general. Retry-After puede acompañar la respuesta.",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorApi"
            },
            "example": {
              "error": true,
              "data": null,
              "mensaje": "Demasiadas solicitudes. Intente en unos segundos.",
              "codigo": 429,
              "otros": null
            }
          }
        }
      },
      "ErrorPermisoRest": {
        "description": "Token ausente, inválido o sin permiso para la operación.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorApi"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "TokenApiPersonal": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Token de API personal de la misma cuenta. Actúa con los permisos del usuario, solo en las operaciones de esta referencia (las demás rutas responden 403), y puede revocarse. Los tokens OAuth con scope mcp:read o mcp:write no autorizan estas rutas."
      }
    }
  }
}
