> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/api-rest/identity-api/identity-api-reference/security-compliance/document-custody/upload-document.md).

# Upload Document

Servicio para cargar un documento PDF utilizando la URL de carga pre-firmada obtenida del endpoint `/services/custody/upload`.

La URL de carga es válida por **5 minutos** desde su generación.

{% hint style="info" %}
Utilizar la URL de carga completa retornada por el endpoint anterior, no esta ruta directamente.
{% endhint %}

### Endpoint

```
PUT /custody/upload/{uploadToken}
```

### Parámetros de ruta

| Parámetro     | Tipo   | Requerido | Descripción                           |
| ------------- | ------ | --------- | ------------------------------------- |
| `uploadToken` | string | **Sí**    | Token de carga de la URL pre-firmada. |

### Cuerpo de la solicitud

**Content-Type:** `multipart/form-data`

#### Parámetros

| Parámetro | Tipo   | Requerido | Descripción               |
| --------- | ------ | --------- | ------------------------- |
| `file`    | binary | **Sí**    | Archivo de documento PDF. |

### Respuestas

#### `200` Éxito

El documento fue cargado exitosamente.

#### `400` Bad Request

```json
{
  "status": 400,
  "title": "Bad Request",
  "detail": "Invalid request.",
  "type": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400",
  "errors": [
    "Invalid file format. Only PDF is supported."
  ]
}
```

#### `401` Unauthorized

```json
{
  "message": "Unauthorized"
}
```

#### `403` Forbidden

```json
{
  "Message": "User is not authorized to access this resource with an explicit deny"
}
```

#### `413` Payload Too Large

```json
{
  "status": 413,
  "title": "Payload Too Large",
  "detail": "File size exceeds limit.",
  "type": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413",
  "errors": []
}
```

#### `502` Bad Gateway

```json
{
  "status": 502,
  "title": "Bad Gateway",
  "detail": "Server got an invalid response.",
  "type": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502"
}
```

#### `504` Gateway Timeout

```json
{
  "message": "Endpoint request timed out"
}
```
