# Almosafer — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Search and compare flights across multiple airlines with real-time pricing, filtering options, and a fare calendar to find the best deals. Look up airport details and airline information to plan your travel better.

**Category:** Travel | **Website:** [almosafer.com/](https://almosafer.com/) | **Docs:** [parse.bot/marketplace/9dde9fad-572a-4871-ae45-414e04cdbb13/almosafer-com-api](https://parse.bot/marketplace/9dde9fad-572a-4871-ae45-414e04cdbb13/almosafer-com-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-almosafer-com-api-9dde9fad/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_airport_info

Look up airport and airline details by IATA codes. Returns airport names, cities, countries, and airline names for the given codes. Accepts a mix of airport and airline codes in a single request.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `codes` | string | Yes | Comma-separated IATA codes for airports and/or airlines (e.g., 'RUH,JED,SV,F3') |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-almosafer-com-api-9dde9fad/get_airport_info \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"codes":"<string>"}'
```

### get_fares_calendar

Get a fare calendar showing the cheapest one-way prices for each date in a given range for a route. The upstream API supports a maximum 7-day window per request; wider ranges are automatically chunked into multiple requests.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `adults` | integer | No | Number of adult passengers |
| `cabin` | string | No | Cabin class: Economy, Business, First |
| `children` | integer | No | Number of child passengers |
| `currency` | string | No | Price currency code |
| `departure_from` | string | Yes | Start of date range in YYYY-MM-DD format |
| `departure_to` | string | Yes | End of date range in YYYY-MM-DD format |
| `destination` | string | Yes | Destination airport IATA code |
| `infants` | integer | No | Number of infant passengers |
| `origin` | string | Yes | Origin airport IATA code |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-almosafer-com-api-9dde9fad/get_fares_calendar \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"adults":"<integer>","cabin":"<string>","children":"<integer>","currency":"<string>","departure_from":"<string>","departure_to":"<string>","destination":"<string>","infants":"<integer>","origin":"<string>"}'
```

### search_flights

Search for flights between airports with optional filtering by airline, stops, price, and more. Supports one-way and round-trip searches across all cabin classes. Returns flight itineraries sorted by the specified criteria. The upstream search is asynchronous — the scraper polls until all provider results are collected.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `adults` | integer | No | Number of adult passengers |
| `airlines` | string | No | Filter by airline codes, comma-separated (e.g., SV,F3,XY) |
| `cabin` | string | No | Cabin class: Economy, Business, First |
| `children` | integer | No | Number of child passengers (2-11 years) |
| `currency` | string | No | Price currency code (USD, SAR, EUR, etc.) |
| `departure_date` | string | Yes | Departure date in YYYY-MM-DD format |
| `destination` | string | Yes | Destination airport IATA code (e.g., JED, CAI, LHR) |
| `infants` | integer | No | Number of infant passengers (under 2) |
| `max_price` | number | No | Maximum total price filter |
| `max_stops` | integer | No | Maximum number of stops (0 for nonstop) |
| `min_price` | number | No | Minimum total price filter |
| `nonstop_only` | string | No | Set to 'true' to show only nonstop flights |
| `origin` | string | Yes | Origin airport IATA code (e.g., RUH, DXB, JFK) |
| `refundable_only` | string | No | Set to 'true' to show only refundable fares |
| `return_date` | string | No | Return date in YYYY-MM-DD format. Omit for one-way search |
| `sort_by` | string | No | Sort results by: price, duration, stops |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-almosafer-com-api-9dde9fad/search_flights \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"adults":"<integer>","airlines":"<string>","cabin":"<string>","children":"<integer>","currency":"<string>","departure_date":"<string>","destination":"<string>","infants":"<integer>","max_price":"<number>","max_stops":"<integer>","min_price":"<number>","nonstop_only":"<string>","origin":"<string>","refundable_only":"<string>","return_date":"<string>","sort_by":"<string>"}'
```
