# Searching for service intents

> For the complete documentation index, see [llms.txt](https://developer.fluxir.com/llms.txt).

# Service Intents Search Guide

This document explains how to call:

- `POST /api/app/travel-services/service-intents`

and how to build `ServiceIntentsRequestDto` for each `serviceType`.

---

## Endpoint

```http
POST /api/app/travel-services/service-intents
Content-Type: application/json
```

Authentication is not required by this endpoint.

---

## Request DTO

```json
{
  "serviceType": 0,
  "tripContext": {
	"items": {
	  "system.tripOrigination": "JOR",
	  "system.tripDestination": "USA",
	  "system.tripFrom": "2026-01-10",
	  "system.tripTo": "2026-01-17"
	},
	"travelerContexts": []
  },
  "inputRestrictionMode": "ByPassOnMissing",
  "serviceIntentKeysFilter": [],
  "continuationToken": null
}
```

### `serviceType` values

- `0` = `Visa`
- `1` = `Insurance`
- `2` = `AirportLounge`
- `3` = `FastTrack`
- `4` = `Esim`
- `5` = `FlightItineraryLetter`
- `6` = `HotelItineraryLetter`

> Note: even though `Esim` exists in enum, search is currently not supported in practice (provider returns empty intents).

---

## Core behavior rules in `POST /api/app/travel-services/service-intents`

1. `serviceType` is required when no `serviceIntentKeysFilter` is provided.
2. If `serviceIntentKeysFilter` is provided, key-based resolution is used.
3. `continuationToken` **cannot** be used together with `serviceIntentKeysFilter`.
4. When destination is missing, returned intents may be shuffled; otherwise normal fee ordering applies.

---

## Required `tripContext.items` by `serviceType`

### 1) Visa (`serviceType = 0`)

Required/used keys:

- `system.tripOrigination`
- `system.tripDestination` (can be empty in some flows)
- `system.exemptions` (optional list of exemption IDs)
- `system.tripFrom` / `system.tripTo` (used by downstream disability checks)

About `system.exemptions`:

- It is an array of exemption IDs (numbers).
- It is used only for visa search.
- It can make additional visa intents eligible when the traveler has qualifying documents (for example residence permit / third-country visa conditions configured in Fluxir).
- If omitted or empty, visa results include only normally eligible visas.

### cURL example

```bash
curl -X POST "https://<host>/api/app/travel-services/service-intents" \
  -H "Content-Type: application/json" \
  -d '{
	"serviceType": 0,
	"tripContext": {
	  "items": {
		"system.tripOrigination": "JOR",
		"system.tripDestination": "SAU",
		"system.tripFrom": "2026-02-01",
		"system.tripTo": "2026-02-10",
		"system.exemptions": [101, 205]
	  },
	  "travelerContexts": []
	},
	"inputRestrictionMode": "ByPassOnMissing"
  }'
```

#### How to get exemption IDs (`system.exemptions`)

Use the exemptions API first, then pass selected IDs into `system.exemptions`.

Endpoint:

```http
GET /api/app/visa-type/exemptions?originationCountryCode={ISO3}&destinationCountryCode={ISO3?}
```

cURL (origination + destination):

```bash
curl -G "https://<host>/api/app/visa-type/exemptions" \
  --data-urlencode "originationCountryCode=PSE" \
  --data-urlencode "destinationCountryCode=ALB"
```

cURL (origination only):

```bash
curl -G "https://<host>/api/app/visa-type/exemptions" \
  --data-urlencode "originationCountryCode=PSE"
```

Typical response item:

```json
{
  "id": 101,
  "originationCountryCode": "PSE",
  "documentType": "ResidencePermit",
  "documentCountryCode": "ARE",
  "documentSubtype": null,
  "conditionsText": "Valid UAE residence permit",
  "isActive": true
}
```

### 2) Insurance (`serviceType = 1`)
Provider: `TamkeenInsuranceTravelServiceProvider`

Required/used keys:

- `system.tripOrigination` (must be `PSE` or `JOR` to return intents)
- `system.tripDestination` (optional; affects Plan A/Plan B selection)
- `system.tripFrom`
- `system.tripTo`

### cURL example

```bash
curl -X POST "https://<host>/api/app/travel-services/service-intents" \
  -H "Content-Type: application/json" \
  -d '{
	"serviceType": 1,
	"tripContext": {
	  "items": {
		"system.tripOrigination": "JOR",
		"system.tripDestination": "USA",
		"system.tripFrom": "2026-03-01",
		"system.tripTo": "2026-03-12"
	  },
	  "travelerContexts": []
	},
	"inputRestrictionMode": "FailOnMissing"
  }'
```

### 3) Airport Lounge (`serviceType = 2`)

Required/used keys:

- `city` is required unless `serviceIntentKeysFilter` is provided.

If `city` is missing:
- `ByPassOnMissing` => empty provider result
- `FailOnMissing` => validation error

### cURL example

```bash
curl -X POST "https://<host>/api/app/travel-services/service-intents" \
  -H "Content-Type: application/json" \
  -d '{
	"serviceType": 2,
	"tripContext": {
	  "items": {
		"city": "Dubai"
	  },
	  "travelerContexts": []
	},
	"inputRestrictionMode": "ByPassOnMissing"
  }'
```

### 4) Fast Track (`serviceType = 3`)

Required/used keys:

- `city` is required unless `serviceIntentKeysFilter` is provided.

If `city` is missing:
- `ByPassOnMissing` => empty provider result
- `FailOnMissing` => validation error

### cURL example

```bash
curl -X POST "https://<host>/api/app/travel-services/service-intents" \
  -H "Content-Type: application/json" \
  -d '{
	"serviceType": 3,
	"tripContext": {
	  "items": {
		"city": "Abu Dhabi"
	  },
	  "travelerContexts": []
	},
	"inputRestrictionMode": "ByPassOnMissing"
  }'
```

### 5) eSIM (`serviceType = 4`) — currently not supported for search

Current behavior: returns an empty list.

So `serviceType = Esim` is technically callable but currently returns no searchable intents.

### 6) Flight Itinerary Letter (`serviceType = 5`)

Required keys:

Global context:
- `cityOrigination`
- `cityDestination`
- `tripFrom` / `system.tripFrom`
- `tripTo` / `system.tripTo`

Traveler context (each traveler):
- `traveler.dateOfBirth`
- `traveler.fullName`

### cURL example

```bash
curl -X POST "https://<host>/api/app/travel-services/service-intents" \
  -H "Content-Type: application/json" \
  -d '{
	"serviceType": 5,
	"tripContext": {
	  "items": {
		"cityOrigination": "AMM",
		"cityDestination": "DXB",
		"system.tripFrom": "2026-04-10",
		"system.tripTo": "2026-04-18"
	  },
	  "travelerContexts": [
		{
		  "personId": 1001,
		  "items": {
			"traveler.dateOfBirth": "1990-05-11",
			"traveler.fullName": "John Doe"
		  }
		}
	  ]
	},
	"inputRestrictionMode": "FailOnMissing"
  }'
```

### 7) Hotel Itinerary Letter (`serviceType = 6`)

Required keys:

Global context:
- `cityDestination`
- `tripFrom` / `system.tripFrom`
- `tripTo` / `system.tripTo`

Traveler context (each traveler):
- `traveler.dateOfBirth`
- `traveler.fullName`

### cURL example

```bash
curl -X POST "https://<host>/api/app/travel-services/service-intents" \
  -H "Content-Type: application/json" \
  -d '{
	"serviceType": 6,
	"tripContext": {
	  "items": {
		"cityDestination": "DXB",
		"system.tripFrom": "2026-05-01",
		"system.tripTo": "2026-05-07"
	  },
	  "travelerContexts": [
		{
		  "personId": 1001,
		  "items": {
			"traveler.dateOfBirth": "1990-05-11",
			"traveler.fullName": "John Doe"
		  }
		}
	  ]
	},
	"inputRestrictionMode": "FailOnMissing"
  }'
```

---

## Key-based lookup example (`serviceIntentKeysFilter`)

Use this when you already have intent keys and want exact resolution.

```bash
curl -X POST "https://<host>/api/app/travel-services/service-intents" \
  -H "Content-Type: application/json" \
  -d '{
	"serviceType": 0,
	"tripContext": {
	  "items": {
		"system.tripOrigination": "JOR",
		"system.tripDestination": "SAU"
	  },
	  "travelerContexts": []
	},
	"serviceIntentKeysFilter": [
	  "<existing-service-intent-key>"
	]
  }'
```

Important:
- Do not send `continuationToken` in the same request with `serviceIntentKeysFilter`.
- Each key must belong to the same requested `serviceType`, otherwise validation error is returned.

---

## Continuation token example

```bash
curl -X POST "https://<host>/api/app/travel-services/service-intents" \
  -H "Content-Type: application/json" \
  -d '{
	"serviceType": 5,
	"tripContext": {
	  "items": {
		"cityOrigination": "AMM",
		"cityDestination": "DXB",
		"system.tripFrom": "2026-04-10",
		"system.tripTo": "2026-04-18"
	  },
	  "travelerContexts": [
		{
		  "personId": 1001,
		  "items": {
			"traveler.dateOfBirth": "1990-05-11",
			"traveler.fullName": "John Doe"
		  }
		}
	  ]
	},
	"continuationToken": "11111111-2222-3333-4444-555555555555"
  }'
```

Use the `continuationToken` returned by previous response.