> For the complete documentation index, see [llms.txt](https://docs-agents-api.boolfy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-agents-api.boolfy.com/documents/upload.md).

# Upload

Para subir un documento podemos generar la siguiente solicitud con el archivo `payload.json`:

```
curl "https://agents.boolfy.com/api/documents/upload" \ 
    -H "Authorization: Bearer BOOLFY_BEARER_KEY" \
    -H "Content-Type: application/json" \
    -d @payload.json
```

El archivo `payload.json` debe tener el siguiente formato:

```json
{
    "agent": "Facturas",
    "document": "yJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1...",
    "externalcode": "123456",
    "filename": "0001-00003456.pdf",
    "bag": "{\"user\":\"user@enterprise.com\",\"pass\":\"MD5 password\",...}",
    "cluster":[
        {
        "agent": "Recibo", 
        "document": "yJndgdenen...", 
        "filename":"photo.jpeg"
        }
    ]
}
```

Detallamos en forma completa los campos de la solicitud:

<table><thead><tr><th width="191">Campo</th><th>Descripción</th></tr></thead><tbody><tr><td>Agent</td><td>Especifica el nombre del agente IA que se utilizará para procesar el documento</td></tr><tr><td>Document</td><td>Especifica en Base64 el Stream del documento. Los formatos de archivo aceptados son: PDF, PNG, JPEG y JPG</td></tr><tr><td>ExternalCode</td><td>Opcional. Especifica el identificador del documento en tu plataforma</td></tr><tr><td>Filename</td><td>Opcional. Especifica el nombre del documento. Si no se proporciona, se asume .pdf</td></tr><tr><td>Bag</td><td>Opcional. Permite enviar un JSON especifico para ser utilizado durante el proceso del documento.</td></tr><tr><td>Cluster</td><td>Opcional. Esta opción se debe habilitar desde el Agente principal. Permite adjuntar otros documentos al documento principal. La definición de campos es la misma que la principal.</td></tr></tbody></table>

#### Ejemplo de campo Bag

Detallamos un ejemplo del campo Bag aplicado al envio de los datos extraidos a un tercero:

```json
{
    "user": "user@enterprise.com",
    "pass": "MD5 password",
    "idEmpresa": "Enterprise identifier",
    "endPoint": "End point to call"
}
```

### Respuesta

La respuesta exitosa para la operación de carga de documentos es:

```json
{
    "code": 200,
    "msg": "Document uploaded",
    "response": "{\"Identifier\":\"5a37b2ab-551b-4380-aa88-b808e3352d66\"}"
}
```

La respuesta exitosa cuando se envia con Cluster es:

```json
{
    "code": 200,
    "msg": "Document uploaded",
    "response": "{\"Identifier\":\"5a37b2ab-551b-4380-aa88-b808e3352d66\",
    \"Cluster\":[{\"Identifier\":\"54d542ab-451c-1855-t452-bse4rfse22211\"}]}"
}
```

Detallamos el contenido del campo Response:

<table><thead><tr><th width="194">Campo</th><th>Descripción</th></tr></thead><tbody><tr><td>Identifier</td><td>Especifica el identificador único dentro de Boolfy para el documento</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-agents-api.boolfy.com/documents/upload.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
