> 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/docs.facephi-en/rest-api/identity-api/identity-api-reference/security-compliance/document-custody/upload-document.md).

# Upload Document

Service to upload a PDF document using the pre-signed upload URL obtained from the endpoint `/services/custody/upload`.

The upload URL is valid for **5 minutes** from its generation.

{% hint style="info" %}
Use the full upload URL returned by the previous endpoint, not this path directly.
{% endhint %}

### Endpoint

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

### Route parameters

| Parameter     | Type   | Required | Description                         |
| ------------- | ------ | -------- | ----------------------------------- |
| `uploadToken` | string | **Yes**  | Upload Token of the pre-signed URL. |

### Request body

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

#### Parameters

| Parameter | Type   | Required | Description        |
| --------- | ------ | -------- | ------------------ |
| `file`    | binary | **Yes**  | PDF document file. |

### Responses

#### `200` Success

The document was uploaded successfully.

#### `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"
}
```
