---
title: "Approve a segment from a shared 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.

# Approve a segment from a shared link

Path: Nicer API › Trip itinerary

`POST /trip-itinerary/{tripItineraryId}/public/approve-segment`

URL: `https://api.nicer.travel/trip-itinerary/{tripItineraryId}/public/approve-segment`

Marks one segment of a shared itinerary as approved by the traveler. Reachable without a token so it works from the traveler's itinerary link, where the itinerary id is the only credential, and rate-limited per IP address.

## Authentication

Requires one of the following:

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

## Path parameters

- `tripItineraryId` (`tripItinerary.public.approveSegment.path.tripItineraryId`; string, required)

## Request body

_Required._

- `segmentId` (`tripItinerary.public.approveSegment.segmentId`; string, required)

## Example request

```json
{
  "segmentId": "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.tripItinerary.public.approveSegment({
  "tripItineraryId": "string",
  "segmentId": "string"
});
```

### Nicer CLI

```bash
nicer trip-itinerary public approve-segment --trip-itinerary-id 'string' --input - <<'JSON'
{
  "segmentId": "string"
}
JSON
```

### cURL

```bash
curl --request POST \
  --url 'https://api.nicer.travel/trip-itinerary/<tripItineraryId>/public/approve-segment' \
  --header 'Content-Type: application/json' \
  --data '
{
  "segmentId": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/trip-itinerary/<tripItineraryId>/public/approve-segment';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({segmentId: '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/trip-itinerary/<tripItineraryId>/public/approve-segment"

payload = { "segmentId": "string" }
headers = {"Content-Type": "application/json"}

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

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "success": true
}
```

- `success` (`tripItinerary.public.approveSegment.response.200.success`; boolean, required)

### 400

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

#### Example

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

- `errorCode` (`tripItinerary.public.approveSegment.response.400.errorCode`; string, required)
- `errorMessage` (`tripItinerary.public.approveSegment.response.400.errorMessage`; string, required)

### 401

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

#### Example

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

- `errorCode` (`tripItinerary.public.approveSegment.response.401.errorCode`; string, required)
- `errorMessage` (`tripItinerary.public.approveSegment.response.401.errorMessage`; string, required)

### 403

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

#### Example

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

- `errorCode` (`tripItinerary.public.approveSegment.response.403.errorCode`; string, required)
- `errorMessage` (`tripItinerary.public.approveSegment.response.403.errorMessage`; string, required)

### 429

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

#### Example

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

- `errorCode` (`tripItinerary.public.approveSegment.response.429.errorCode`; string, required)
- `errorMessage` (`tripItinerary.public.approveSegment.response.429.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/Trip-itinerary/tripItinerary.public.approveSegment/index.md
