---
title: "Rewrite a description with AI"
---

> 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.

# Rewrite a description with AI

Path: Nicer API › Assistant

`POST /agent/rephrase`

URL: `https://api.nicer.travel/agent/rephrase`

Rewrites the text sent (16,000 characters at most), such as an itinerary segment's description, to read more engaging and professional, with one model call and a fixed instruction, and answers only the rewritten text. Nothing is stored. Any signed-in person may call it.

## Authentication

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

## Request body

_Required._

- `text` (`agent.rephrase.text`; string, required)
  - maxLength: `16000` · minLength: `1`

## Example request

```json
{
  "text": "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.rephrase({
  "text": "string"
});
```

### Nicer CLI

```bash
nicer agent rephrase --input - <<'JSON'
{
  "text": "string"
}
JSON
```

### cURL

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

### TypeScript

```typescript
const url = 'https://api.nicer.travel/agent/rephrase';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({text: '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/rephrase"

payload = { "text": "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
{
  "response": "string"
}
```

- `response` (`agent.rephrase.response.200.response`; string, required) — The rewritten text, and nothing else.

### 400

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

#### Example

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

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

### 401

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

#### Example

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

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

### 403

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

#### Example

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

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


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