npm package: @gojinko/cli
Description: Command-line tool for the Jinko developer platform. Search flights, build trips, and hand users off to a Jinko-hosted checkout page.
Latest version: 1.0.0

# @gojinko/cli

Command-line tool for the Jinko developer platform. Search flights, build trips, and hand users off to a Jinko-hosted checkout page.

## Install

```bash
npm install -g @gojinko/cli
```

## Authentication

```bash
# API key (recommended for agents, CI/CD)
export JINKO_API_KEY=jnk_YOUR_KEY

# OAuth (interactive humans — opens a browser)
jinko auth login
```

Create API keys at https://builders.gojinko.com. OAuth tokens auto-refresh.

### Auth commands

```bash
jinko auth login              # Interactive login
jinko auth login --key jnk_…  # Store an API key
jinko auth status             # Show current method, expiry
jinko auth logout             # Clear stored credentials
```

## Commands

### Discovery (cached)

| Command | Description |
|---|---|
| `find-flight` | Cheapest flights A → B, returns `offer_token` |
| `find-destination` | Discover destinations from an origin |
| `flight-calendar` | Cheapest prices across a date range |

### Live search & trip building

| Command | Description |
|---|---|
| `flight-search` | Live search or price-check an offer, returns `trip_item_token` |
| `trip` | Create/update a trip, add items, set travelers |

### Checkout

| Command | Description |
|---|---|
| `checkout` | Schedule checkout, returns `checkout_url` + items + ancillaries + total |
| `select-ancillaries` | Optional: preselect bags / seats / meals before handoff |
| `trip-status` | Full lifecycle state: cart, quote, fulfillment, bookings |

### Post-booking

| Command | Description |
|---|---|
| `refund check` | Check refund eligibility for a booking |
| `refund commit` | Initiate a refund for a booking |

### Utility

| Command | Description |
|---|---|
| `config set` / `config show` | Manage local config |
| `schema [cmd]` | Show request/response schemas |

## Canonical Flow

```
find-flight → flight-search → trip → checkout → user pays on checkout_url → trip-status
```

Quote is automatic — `checkout` handles it internally. Payment happens on the Jinko web page, not in the CLI.

## Examples

```bash
# Find cheapest flights
jinko find-flight --from PAR --to NYC --date 2026-06-15

# Live price-check an offer
jinko flight-search --offer-token <offer_token>

# Create trip with travelers + contact
jinko trip \
  --trip-item-token <token> \
  --travelers '[{"first_name":"Jane","last_name":"Doe","date_of_birth":"1990-01-15","gender":"FEMALE","passenger_type":"ADULT"}]' \
  --contact '{"email":"jane@example.com","phone":"+33612345678"}'

# Schedule checkout → returns checkout_url
jinko checkout --trip-id <trip_id>

# Optional: add baggage/seats/meals before handoff
jinko select-ancillaries \
  --trip-id <trip_id> \
  --item-id <item_id> \
  --select <offer_id_1>,<offer_id_2> \
  --pax <passenger_ref> \
  --quantity 2

# Poll status until fulfilled
jinko trip-status --trip-id <trip_id>

# Refunds
jinko refund check  --booking-ref <ref> --pnr <pnr>
jinko refund commit --booking-ref <ref> --pnr <pnr> --reason "schedule change"
```

## Output Formats

```bash
jinko find-flight --from PAR --to NYC --date 2026-06-15
jinko find-flight --from PAR --to NYC --date 2026-06-15 --format table
```

## Schema Introspection

```bash
jinko schema                  # List all tools
jinko schema find-flight      # Show a tool's request/response schema
```