> 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). Agents can also search and read this documentation through its [MCP server](https://docs.facephi.com/~gitbook/mcp).

# Get Custody URLs

Service for obtaining pre-signed URLs to upload and download 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**  | Authorization API key for access. |

### Responses

#### `200` Success

#### Response Parameters

| Parameter     | Type   | Description                                                                                                      |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------------------- |
| `uploadUrl`   | string | Pre-signed URL for uploading the document. Valid for **5 minutes**.                                              |
| `downloadUrl` | string | Pre-signed URL for downloading the document. Valid for **5 years**. If it is lost, the file cannot be recovered. |

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