---
title: "Get an assistant document's download link"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.nicer.travel/llms.txt
> Use this file to discover all available pages before exploring further.

# Get an assistant document's download link

Path: Nicer API › Assistant

`POST /agent/documents/download`

URL: `https://api.nicer.travel/agent/documents/download`

Returns a download link, valid for five minutes, for a document the caller made with the assistant (`POST /agent/documents`), by its key. Any signed-in person may call it, for their own documents only. Errors: 403 ERROR_UNAUTHORIZED for a key of another person's document.

## Authentication

- `bearerAuth`, http bearer, header `Authorization`, format `JWT`

## Request body

_Required._

- `key` (`agent.documents.download.key`; string, required)
  - maxLength: `512` · minLength: `1` · pattern: `^agentAttachment\/[^/]+\/[^/]+\/[^/]+$`

## Example request

```json
{
  "key": "string"
}
```

## Code samples

### JavaScript SDK

```javascript
import { createClient } from "@nicertravel/sdk";

const nicer = createClient({
  baseUrl: "https://api.nicer.travel",
  token: process.env.NICER_TOKEN,
});

await nicer.agent.documents.download({
  "key": "string"
});
```

### Nicer CLI

```bash
nicer agent documents download --input - <<'JSON'
{
  "key": "string"
}
JSON
```

### cURL

```bash
curl --request POST \
  --url https://api.nicer.travel/agent/documents/download \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "key": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/agent/documents/download';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({key: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.nicer.travel/agent/documents/download"

payload = { "key": "string" }
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "url": "string"
}
```

- `url` (`agent.documents.download.response.200.url`; string, required) — The presigned link: anyone holding it can download the file until it expires, so open it right away and never store it.

### 400

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`agent.documents.download.response.400.errorCode`; string, required)
- `errorMessage` (`agent.documents.download.response.400.errorMessage`; string, required)

### 401

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`agent.documents.download.response.401.errorCode`; string, required)
- `errorMessage` (`agent.documents.download.response.401.errorMessage`; string, required)

### 403

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`agent.documents.download.response.403.errorCode`; string, required)
- `errorMessage` (`agent.documents.download.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/Assistant/agent.documents.download/index.md
