> 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/get-custody-urls.md).

# Get Custody URLs

Service to obtain pre-signed URLs for uploading and downloading a document.

The upload URL is valid for **5 minutes**, while the download URL is valid for **5 years**.

### Endpoint

```
GET /services/custody/upload
```

### Headers

| Name          | Type   | Required | Description                   |
| ------------- | ------ | -------- | ----------------------------- |
| **x-api-key** | string | **Yes**  | Access authorization API key. |

### Responses

#### `200` Success

#### Response parameters

| Parameter     | Type   | Description                                                                                                           |
| ------------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| `uploadUrl`   | string | Pre-signed URL to upload the document. Valid for **5 minutes**.                                                       |
| `downloadUrl` | string | Pre-signed URL to download the document. Valid for **5 years**. If lost, it will not be possible to recover the file. |

#### Response example

```json
{
  "uploadUrl": "https://storage.example.com/upload?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "downloadUrl": "https://api.identity-platform.io/custody/download?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
```

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

#### `401` Unauthorized

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

#### `403` Forbidden

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

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