Overview
Commands print compact text on stdout, or the response as one line of JSON with --json, and errors on stderr with a fixed exit code.
The exceptions: fortrip guide prints Markdown, fortrip mcp speaks MCP over stdin and stdout, and --help and --version print plain text.
Install
npm install -g fortripOr run any command with npx fortrip. Needs Node.js 22 or newer. Sign in once with fortrip login; you stay signed in until fortrip logout. See Installation.
Commands
| Command | Description |
|---|---|
fortrip hotels search | Search hotels |
fortrip hotels get | Hotel details |
fortrip hotels offers | Live offers |
fortrip hotels book | Create order |
fortrip orders get | Get order |
fortrip orders list | List orders |
fortrip orders cancel | Cancel order |
fortrip orders pay | Pay order |
fortrip login | Sign in |
fortrip logout | Sign out |
fortrip whoami | Show account |
fortrip guide | Agent guide |
fortrip mcp | Local MCP server |
Options of the CLI itself:
| Flag | Description |
|---|---|
-h, --help | Show help for the command or group, or for the CLI when no command is given. |
-v, --version | Print the CLI version. |
--json | Print the answer as its JSON on one line instead of text; an error prints its JSON envelope, on stderr. |
Raw request body
hotels search, hotels offers and hotels book also take --body with a JSON object, or --body @file.json. Flags override its fields. Field names and limits are the same as the MCP tool inputs and the HTTP API bodies.
fortrip hotels search --body '{"destination":{"kind":"place_name","name":"Bangkok","countryCode":"TH"},"filters":{"stars":{"min":5}},"sort":"stars_desc"}'Environment
| Variable | Meaning |
|---|---|
FORTRIP_TOKEN | Use this access token instead of the saved sign-in, e.g. in a remote sandbox or on a CI run. An access token is short-lived, so it suits one sandbox session or one CI run; for longer, sign in. |
FORTRIP_DISPLAY_CURRENCY | Default --display-currency for hotels search and hotels offers. It never changes what is charged. |
FORTRIP_API_URL | The API's base URL (default https://api.fortrip.ai). It must be https, except for localhost, 127.0.0.1 and [::1], which may use plain http. It may end in a path prefix (http://localhost:3000/api/public), which every request path follows; a query or fragment is dropped. |
FORTRIP_MCP_URL | The MCP server fortrip mcp bridges to (default https://mcp.fortrip.ai/), under the same URL rule. Your sign-in is sent to it, so it must be the MCP server of the API you use: on the origin of FORTRIP_API_URL, except that the default API goes with the default MCP server, api.fortrip.ai and mcp.fortrip.ai. When you set FORTRIP_API_URL to a local API, set FORTRIP_MCP_URL too; fortrip mcp exits 2 and says so when you don't. |
Exit codes are listed in Errors & limits.