# Get the ticket PDF

> Returns the ticket PDF download URL. Poll until ticket_ready is true.

Endpoint: `POST /api/v1/flights/get_ticket`

Source: https://fx-port.com/docs/flights/get-ticket

Returns the download links of the ticket PDF of a booking. The PDF is generated after the booking: call again until `ticket_ready` is `true`.

**Permission:** Read. **Rate group:** default (6,000 requests per minute per key).


> [!NOTE]
> **A simpler way:** [`get_booking`](https://fx-port.com/docs/flights/get-booking.md) returns the same links as `booking.bucket_link` and `booking.bucket_link_no_price`, together with the rest of the booking. Use `get_ticket` when you only need the links and a ready flag.

> [!WARNING]
> **The links are public.** Anybody who has a `download_url` can open the PDF, with no key and no login, and the address of a voucher can be guessed from the PNR and the name. The PDF holds the traveler's name, the itinerary and the fare. Treat the links as sensitive: do not log them, do not put them in e-mails to third parties, and prefer to download the PDF on your server and serve it to your customer yourself. See [Security](https://fx-port.com/docs/security.md#links-to-tickets-vouchers-and-documents-are-not-private).


## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `booking_id` | string | Yes | The PNR, the supplier order id or the FX-Port UUID of the booking. `order_id` and `pnr` are accepted as other names. |

Legacy names: `bookingId` and `orderId`. If `booking_id` is sent together with `order_id` or `pnr` and the values differ, `booking_id` wins and an `ignored_field` warning names the dropped one. A booking of another agency, or of the other environment, is answered `404 booking_not_found`.

## Request example


**Request**

```bash
curl https://api.fx-port.com/api/v1/flights/get_ticket \
  -H "Authorization: Bearer fxp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "booking_id": "Y7PAEU"
}'
```


## Response: not ready

Real response of 2026-11-01, a second after a hold was created:

~~~json
{
  "environment": "sandbox",
  "success": true,
  "requestId": "76be69dc",
  "ticket_ready": false,
  "booking_id": "Y7PAEU",
  "message": "Ticket is not ready yet. Please retry in a moment."
}
~~~

## Response: ready

~~~json
{
  "environment": "sandbox",
  "success": true,
  "requestId": "71fdaeb7",
  "ticket_ready": true,
  "booking_id": "Y7PAEU",
  "download_url": "https://s3.example.com/flight-bookings/Y7PAEU-JAMES-SMITH.pdf",
  "download_url_with_price": "https://s3.example.com/flight-bookings/Y7PAEU-JAMES-SMITH.pdf",
  "download_url_no_price": "https://s3.example.com/flight-bookings/Y7PAEU-JAMES-SMITH-no-price.pdf"
}
~~~

| Field | Meaning |
|---|---|
| `ticket_ready` | `true` when a link exists. **It does not mean that an e-ticket exists** (see below). |
| `booking_id` | **Echoes the value you sent** (the PNR if you sent the PNR, the order id if you sent the order id). It is not normalised. |
| `download_url`, `download_url_with_price` | The same address: the PDF with the fare receipt (twin: `pdf_url`). |
| `download_url_no_price` | A second PDF of the same ticket without prices (twin: `pdf_url_no_price`). Can be `null`. |
| `message` | Only when `ticket_ready` is `false`. |

## What `ticket_ready` means

`ticket_ready` is `true` as soon as the booking has a PDF link, whatever the status of the booking:

- a **held** booking has a **hold voucher**, and the flag can be `true` before the payment;
- a **cancelled** hold keeps its voucher link and stays `true`;
- an instant **ACD booking** can be `true` before the airline has returned an e-ticket number: use [`get_ticket_number`](https://fx-port.com/docs/flights/get-ticket-number.md) to know whether tickets were issued;
- a booking with the status `failed` stays `false` for ever.

## Polling

1. Book, then keep the order id (or the PNR).
2. Wait about 10 seconds and call `get_ticket`.
3. While `ticket_ready` is `false`, call again every 10 seconds, for about two minutes. **Stop then**: a failed booking never gets a PDF. Check the status with `get_booking`.
4. When it is `true`, download the PDF from `download_url`.

## Errors

| Status | Code | When | What to do |
|---|---|---|---|
| `400` | `bad_request` | No `booking_id` (`booking_id is required`). | Send it. |
| `400` | `invalid_booking_id` | `booking_id` is not a valid token. | Send the id as you received it. |
| `400` | `invalid_json`, `invalid_body` | The body is not valid JSON, or not a JSON object. | Send a JSON object. |
| `404` | `booking_not_found` | No such booking in your agency and environment. | Check the id and the key. |

## Related

- [Get a flight booking](https://fx-port.com/docs/flights/get-booking.md) and [Get the ticket number](https://fx-port.com/docs/flights/get-ticket-number.md).
- [Security](https://fx-port.com/docs/security.md): links to tickets, vouchers and documents.
