---
title: "Claim a booking-site referral"
---

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

# Claim a booking-site referral

Path: Nicer API › identity

`POST /identity/referral/claim`

URL: `https://api.nicer.travel/identity/referral/claim`

Links the signed-in traveler to the referring advisor of a booking site when the traveler has no deliberate advisor yet; a traveler who already has one is never moved. result says what happened, and companyChanged that the session must be refreshed before the next call. Any signed-in person, for themself.

## Authentication

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

## Request body

_Required._

- `host` (`identity.referral.claim.host`; string, required)
  - maxLength: `253` · minLength: `1`
- `ref` (`identity.referral.claim.ref`; string, optional)
  - maxLength: `64`

## Example request

```json
{
  "host": "string",
  "ref": "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.identity.referral.claim({
  "host": "string"
});
```

### Nicer CLI

```bash
nicer identity referral claim --input - <<'JSON'
{
  "host": "string"
}
JSON
```

### cURL

```bash
curl --request POST \
  --url https://api.nicer.travel/identity/referral/claim \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "host": "string",
  "ref": "string"
}
'
```

### TypeScript

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

payload = {
    "host": "string",
    "ref": "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
{
  "companyChanged": true,
  "ownerSiteUrl": "string",
  "result": "ATTACHED"
}
```

- `companyChanged` (`identity.referral.claim.response.200.companyChanged`; boolean, required)
- `result` (`identity.referral.claim.response.200.result`; string, required)
  - one of `"ATTACHED"`, `"UNCHANGED"`, `"IGNORED_OWNED"`, `"IGNORED_FOREIGN"`, `"IGNORED_INVALID"`
- `ownerSiteUrl` (`identity.referral.claim.response.200.ownerSiteUrl`; string, optional)

### 400

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

#### Example

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

- `errorCode` (`identity.referral.claim.response.400.errorCode`; string, required)
- `errorMessage` (`identity.referral.claim.response.400.errorMessage`; string, required)

### 401

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

#### Example

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

- `errorCode` (`identity.referral.claim.response.401.errorCode`; string, required)
- `errorMessage` (`identity.referral.claim.response.401.errorMessage`; string, required)

### 403

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

#### Example

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

- `errorCode` (`identity.referral.claim.response.403.errorCode`; string, required)
- `errorMessage` (`identity.referral.claim.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/identity/identity.referral.claim/index.md
