---
title: "Save a place"
---

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

# Save a place

Path: Nicer API › favorites

`PUT /favorites`

URL: `https://api.nicer.travel/favorites`

Saves a place for the caller, or refreshes its snapshot when it is already saved — saving twice never creates a second entry.

## Authentication

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

## Request body

_Required._

- `name` (`favorites.update.name`; string, required)
  - maxLength: `300` · minLength: `1`
- `kind` (`favorites.update.kind`; string, required)
  - one of `"HOTEL"`, `"ACTIVITY"`
- `reference` (`favorites.update.reference`; string, required)
  - maxLength: `512` · minLength: `1`
- `activity` (`favorites.update.activity`; any of, optional)
  - any of the following:
    - `FavoriteActivity`
      - `destinationId` (`FavoriteActivity.destinationId`; string, required)
        - maxLength: `32` · minLength: `1`
      - `destinationName` (`FavoriteActivity.destinationName`; any of, required)
        - any of the following: `string`, `null`
      - `durationMinutes` (`FavoriteActivity.durationMinutes`; any of, required)
        - any of the following: `integer`, `null`
      - `reviewCount` (`FavoriteActivity.reviewCount`; any of, required)
        - any of the following: `integer`, `null`
    - `null`
- `city` (`favorites.update.city`; any of, optional)
  - any of the following: `string`, `null`
- `country` (`favorites.update.country`; any of, optional)
  - any of the following: `string`, `null`
- `imageUrl` (`favorites.update.imageUrl`; any of, optional)
  - any of the following: `string`, `null`
- `latitude` (`favorites.update.latitude`; any of, optional)
  - any of the following: `number`, `null`
- `longitude` (`favorites.update.longitude`; any of, optional)
  - any of the following: `number`, `null`
- `rateCodes` (`favorites.update.rateCodes`; any of, optional)
  - any of the following: `array<string>`, `null`
- `starRating` (`favorites.update.starRating`; any of, optional)
  - any of the following: `number`, `null`

## Example request

```json
{
  "activity": {
    "destinationId": "string",
    "destinationName": "string",
    "durationMinutes": 100000,
    "reviewCount": 9007199254740991
  },
  "city": "string",
  "country": "string",
  "imageUrl": "string",
  "latitude": -90,
  "longitude": -180,
  "name": "string",
  "rateCodes": [
    "string"
  ],
  "starRating": 5,
  "kind": "HOTEL",
  "reference": "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.favorites.update({
  "name": "string",
  "kind": "HOTEL",
  "reference": "string"
});
```

### Nicer CLI

```bash
nicer favorites update --input - <<'JSON'
{
  "name": "string",
  "kind": "HOTEL",
  "reference": "string"
}
JSON
```

### cURL

```bash
curl --request PUT \
  --url https://api.nicer.travel/favorites \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "activity": {
    "destinationId": "string",
    "destinationName": "string",
    "durationMinutes": 100000,
    "reviewCount": 9007199254740991
  },
  "city": "string",
  "country": "string",
  "imageUrl": "string",
  "latitude": -90,
  "longitude": -180,
  "name": "string",
  "rateCodes": [
    "string"
  ],
  "starRating": 5,
  "kind": "HOTEL",
  "reference": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/favorites';
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({
    activity: {
      destinationId: 'string',
      destinationName: 'string',
      durationMinutes: 100000,
      reviewCount: 9007199254740991
    },
    city: 'string',
    country: 'string',
    imageUrl: 'string',
    latitude: -90,
    longitude: -180,
    name: 'string',
    rateCodes: ['string'],
    starRating: 5,
    kind: 'HOTEL',
    reference: '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/favorites"

payload = {
    "activity": {
        "destinationId": "string",
        "destinationName": "string",
        "durationMinutes": 100000,
        "reviewCount": 9007199254740991
    },
    "city": "string",
    "country": "string",
    "imageUrl": "string",
    "latitude": -90,
    "longitude": -180,
    "name": "string",
    "rateCodes": ["string"],
    "starRating": 5,
    "kind": "HOTEL",
    "reference": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "activity": {
    "destinationId": "string",
    "destinationName": "string",
    "durationMinutes": 100000,
    "reviewCount": 9007199254740991
  },
  "city": "string",
  "country": "string",
  "imageUrl": "string",
  "latitude": -90,
  "longitude": -180,
  "name": "string",
  "rateCodes": [
    "string"
  ],
  "starRating": 5,
  "createdAt": "string",
  "updatedAt": "string",
  "favoriteId": "string",
  "kind": "HOTEL",
  "reference": "string",
  "type": "Favorite",
  "userId": "string"
}
```

- `name` (`favorites.update.response.200.name`; string, required)
  - maxLength: `300` · minLength: `1`
- `createdAt` (`favorites.update.response.200.createdAt`; string, required)
- `updatedAt` (`favorites.update.response.200.updatedAt`; string, required)
- `favoriteId` (`favorites.update.response.200.favoriteId`; string, required)
- `kind` (`favorites.update.response.200.kind`; string, required)
  - one of `"HOTEL"`, `"ACTIVITY"`
- `reference` (`favorites.update.response.200.reference`; string, required)
  - maxLength: `512` · minLength: `1`
- `type` (`favorites.update.response.200.type`; string, required)
- `userId` (`favorites.update.response.200.userId`; string, required)
- `activity` (`favorites.update.response.200.activity`; any of, optional)
  - any of the following:
    - `FavoriteActivity`
      - `destinationId` (`FavoriteActivity.destinationId`; string, required)
        - maxLength: `32` · minLength: `1`
      - `destinationName` (`FavoriteActivity.destinationName`; any of, required)
        - any of the following: `string`, `null`
      - `durationMinutes` (`FavoriteActivity.durationMinutes`; any of, required)
        - any of the following: `integer`, `null`
      - `reviewCount` (`FavoriteActivity.reviewCount`; any of, required)
        - any of the following: `integer`, `null`
    - `null`
- `city` (`favorites.update.response.200.city`; any of, optional)
  - any of the following: `string`, `null`
- `country` (`favorites.update.response.200.country`; any of, optional)
  - any of the following: `string`, `null`
- `imageUrl` (`favorites.update.response.200.imageUrl`; any of, optional)
  - any of the following: `string`, `null`
- `latitude` (`favorites.update.response.200.latitude`; any of, optional)
  - any of the following: `number`, `null`
- `longitude` (`favorites.update.response.200.longitude`; any of, optional)
  - any of the following: `number`, `null`
- `rateCodes` (`favorites.update.response.200.rateCodes`; any of, optional)
  - any of the following: `array<string>`, `null`
- `starRating` (`favorites.update.response.200.starRating`; any of, optional)
  - any of the following: `number`, `null`

### 400

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

#### Example

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

- `errorCode` (`favorites.update.response.400.errorCode`; string, required)
- `errorMessage` (`favorites.update.response.400.errorMessage`; string, required)

### 401

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

#### Example

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

- `errorCode` (`favorites.update.response.401.errorCode`; string, required)
- `errorMessage` (`favorites.update.response.401.errorMessage`; string, required)

### 403

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

#### Example

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

- `errorCode` (`favorites.update.response.403.errorCode`; string, required)
- `errorMessage` (`favorites.update.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/favorites/favorites.update/index.md
