# Environments and Postman

> Live and sandbox on one base URL, decided by the API key prefix, and the Postman collections to try every endpoint.

Source: https://fx-port.com/docs/environments

There is **one base URL** for all environments:

~~~
https://api.fx-port.com
~~~

The environment is determined entirely by the **API key prefix** — there are no separate URLs.
Every JSON answer starts with `"environment": "sandbox"` or `"live"` and every response carries the
`X-Environment` header, so your code can assert which environment it is talking to. (An answer to a
request with a missing or unknown key says `live`, because the environment of an unknown key cannot be known.)

| Key prefix | Environment | Behaviour |
|---|---|---|
| `fxp_live_` | **Live** | Real agency data; debits real balance; real bookings |
| `fxp_test_` | **Sandbox** | Isolated test bookings; no real charges; balance endpoints return empty |

## Getting API keys

Create keys in the FX-Port dashboard at [fx-port.com/dashboard/api](https://fx-port.com/dashboard/api).

Both sandbox and live keys can have **Read** or **Read+Write** permissions:

| Permission | Sandbox key use | Live key use |
|---|---|---|
| Read | Search, price, get quotes, retrieve bookings | Same |
| Read+Write | Search + **create test bookings, pay, cancel** | Search + **real bookings, real balance debit** |

## Postman collections

Pre-built collections with every endpoint, auto-wired test scripts (a search saves `search_id` and
`offer_id` for the price and book requests that follow), and randomised Latin passenger names.
Download, import into Postman, set your API key as the `api_key` variable, and every request is
ready to run. **The collections contain no API keys** — add your own. They are generated from the same
description of the API as the [reference](https://fx-port.com/docs/api.md), so they always match it.

Two environment files set `base_url` and `api_key` for you: [FX-Port-Sandbox.postman_environment.json](https://fx-port.com/docs/postman/FX-Port-Sandbox.postman_environment.json)
and [FX-Port-Live.postman_environment.json](https://fx-port.com/docs/postman/FX-Port-Live.postman_environment.json). To import
the whole API at once instead, give Postman (or Insomnia, Bruno, Swagger UI ...) the OpenAPI file:
[`https://fx-port.com/openapi.json`](https://fx-port.com/openapi.json).


- [Flights collection](https://fx-port.com/docs/postman/FX-Port-Flights.postman_collection.json): Search, price, book, hold/pay, cancel, get booking, get ticket, airports.
- [Hotels collection](https://fx-port.com/docs/postman/FX-Port-Hotels.postman_collection.json): Location/name lookup, availability search, rates, pre-book, booking, voucher, and cancellation.
- [eSIMs collection](https://fx-port.com/docs/postman/FX-Port-eSIMs.postman_collection.json): Package catalog, compatible devices, orders, topups, usage, bookings, and installation instructions.
- [Account collection](https://fx-port.com/docs/postman/FX-Port-Account.postman_collection.json): Balances, financial ledger, and booking history.
- [Suppliers collection](https://fx-port.com/docs/postman/FX-Port-Suppliers.postman_collection.json): Discover enabled suppliers and capabilities.


Direct links:

- [FX-Port-Flights.postman_collection.json](https://fx-port.com/docs/postman/FX-Port-Flights.postman_collection.json)
- [FX-Port-Hotels.postman_collection.json](https://fx-port.com/docs/postman/FX-Port-Hotels.postman_collection.json)
- [FX-Port-eSIMs.postman_collection.json](https://fx-port.com/docs/postman/FX-Port-eSIMs.postman_collection.json)
- [FX-Port-Account.postman_collection.json](https://fx-port.com/docs/postman/FX-Port-Account.postman_collection.json)
- [FX-Port-Suppliers.postman_collection.json](https://fx-port.com/docs/postman/FX-Port-Suppliers.postman_collection.json)

Get your API keys at [fx-port.com/dashboard/api](https://fx-port.com/dashboard/api) — sandbox keys
are free.
