- Developers
- Getting started: from zero to the first booking
Getting started: from zero to the first booking
This page provides a step-by-step checklist for developers integrating with Ferry from initial setup to issuing the first ferry ticket. Following these steps sequentially ensures smooth integration and prevents service disruption.
10-step integration roadmap
Section titled “10-step integration roadmap”The diagram below illustrates the 10-step journey from preparation to your first ticket:
flowchart TB subgraph prep["Preparation Phase"] s1["1. Identify organization in hierarchy"] s2["2. Receive API key from admin"] s3["3. Store key securely and set header"] s4["4. Select environment and get base URL"] end subgraph query["Data Retrieval Phase"] s5["5. Test voyage search call"] s6["6. Fetch seat layout and availability"] s7["7. Verify pricing and vouchers"] end subgraph trans["Transaction Phase"] s8["8. Ensure sufficient agency balance"] s9["9. Create reservation booking"] s10["10. Confirm ticket issuance and track status"] end s1 --> s2 --> s3 --> s4 --> s5 --> s6 --> s7 --> s8 --> s9 --> s10Step-by-step guide
Section titled “Step-by-step guide”Step 1 — Identify your organization’s position in the agency hierarchy
Section titled “Step 1 — Identify your organization’s position in the agency hierarchy”What to do: Contact your Ferry representative to verify your agency organization details in the system. Clearly identify your direct parent organization to understand pricing policies, markup tiers, and bank account details for balance top-ups.
Done when: You know your organization ID, your direct parent organization, and the net pricing terms applicable to your agency.
Step 2 — Obtain an API key from your agency administrator
Section titled “Step 2 — Obtain an API key from your agency administrator”What to do: Partners cannot create keys via API. An agency user with the admin role must sign in to the web Dashboard, navigate to Settings > API Keys, generate a new key, and securely transfer it to the technical team. For detailed instructions, see API Key Management on Dashboard.
Done when: You possess the complete API key string. This key is displayed only once upon creation and cannot be retrieved later.
Keys are issued only to organizations with an active partnership contract. Keys do not expire automatically unless you set an expiration date; they can be paused (and re-enabled) or revoked (soft-revoked permanently while preserving audit history). When rotating keys, use Rotate with grace (1h/24h/7d) so both the old and new keys stay active during cutover.
Step 3 — Store the key securely and configure authentication headers
Section titled “Step 3 — Store the key securely and configure authentication headers”What to do: Store the API key in a secure server-side secrets store or environment variable. Configure your HTTP client to attach the Authorization: Bearer <API_KEY> header to every outbound call to Ferry.
Done when: Your backend service reads the key from environment variables. The key string must never be committed to source code repositories or exposed in client-facing applications.
Ferry reads the key only through Authorization; X-API-Key has no effect. Keep the key out of logs and variables embedded into client builds.
If your backend is written in TypeScript or JavaScript, the official SDK already handles the header, pagination, and retries for read calls; for manual work without code there is the ferry CLI.
Step 4 — Choose your environment and confirm the base URL
Section titled “Step 4 — Choose your environment and confirm the base URL”What to do: Point your integration test configuration to the UAT environment (https://api.ferryvn.net, or the official base URL confirmed in writing by Ferry). On UAT, Ferry isolates all real ferry operators via OPERATOR_ADAPTER_ALLOWLIST=uatexpress and enables the simulated operator UAT Express (operator_code: uatexpress) across three test route pairs (UAT Rạch Giá ⇄ UAT Phú Quốc, UAT Hà Tiên ⇄ UAT Phú Quốc, UAT Trần Đề ⇄ UAT Côn Đảo).
Done when: You hold the confirmed UAT base URL alongside a UAT API key and know the UAT ... pier pairs operated by uatexpress.
Real operators may still appear in UAT search results (copied from production), but booking or issuing tickets on real operators is rejected on UAT. Always pick uatexpress voyages on UAT to run end-to-end booking, ticket PDF issuance, and cancellation at zero real cost; see Environments.
Step 5 — Make a test voyage search call
Section titled “Step 5 — Make a test voyage search call”What to do: Send a GET request to the Voyages group searching for ferry sailings by departure terminal, arrival terminal, and departure date (on UAT, look up piers prefixed with UAT, such as UAT Rạch Giá to UAT Phú Quốc).
Done when: You receive an HTTP 200 response with a list of voyages. If you receive an HTTP 401, verify the Authorization header name and the Bearer prefix.
HTTP 200 with an empty list can hide a system failure; it does not prove there are no voyages. Try a pier pair and date known to have data before concluding. Sorting by fields other than _id falls back to descending _id; see General conventions.
Step 6 — Fetch seat layouts and seat availability
Section titled “Step 6 — Fetch seat layouts and seat availability”What to do: Using the voyage ID obtained in the previous step, call the Boat Layout group to retrieve cabin seating charts and the Voyage Counts group to check remaining seat counts per cabin class.
Done when: You have detailed information about valid vacant seat codes ready to submit in an order.
Availability changes continuously. Query Ferry again immediately before creating the booking; do not rely on a long-cached layout or derive remaining capacity yourself.
Step 7 — Verify pricing and discounts
Section titled “Step 7 — Verify pricing and discounts”What to do: Call the Ticket Price Additions group to review applicable surcharges or markup rules, and the Vouchers group to validate discount codes (if applicable).
Done when: You know both the retail price charged to end customers and the agency NET amount payable to your direct parent organization.
Step 8 — Ensure sufficient agency deposit balance
Section titled “Step 8 — Ensure sufficient agency deposit balance”What to do: Inspect your current balance and credit line via the Organizations, Transactions, or Debt Ledgers groups. On UAT, your test account uses simulated balance/credit at zero real cost; on Production, transfer funds following your parent organization’s payment instructions so your available balance meets or exceeds the total NET value of the upcoming order.
Done when: Your agency’s available balance (plus credit limit) is sufficient to cover the order cost. Balance deduction occurs automatically upon ticket confirmation.
Step 9 — Create a reservation booking
Section titled “Step 9 — Create a reservation booking”What to do: Call the Bookings group with voyage details, selected seat positions, and complete passenger identity details to create a tentative booking.
Done when: You have saved the booking ID, Requested status (2), Unpaid payment status (1), and payment_expired_at. Seats are marked within Ferry only, not reserved on the operator system.
Step 10 — Confirm ticket issuance and track status
Section titled “Step 10 — Confirm ticket issuance and track status”What to do: Call POST /bookings/confirmToIssue/{id}, then poll GET /bookings/{id} to confirm the outcome. Webhooks are signals only: they carry HMAC signatures, a 2-second timeout per attempt, and up to 3 retries (30 seconds, 5 minutes, 30 minutes), so they can arrive duplicated or late; do not replace polling with webhook delivery.
Done when: The booking reaches Issued status (10); then download the electronic tickets for the customer.
On UAT with uatexpress, boarding pass PDFs are issued immediately without contacting any live carrier. On Production with certain live operators, confirmation can take 5–8 minutes: a timeout does not prove failure, and a paid booking may automatically reach status 10 after several minutes through background reconciliation. Do not rush to cancel or create a replacement; consult Bookings and Rate limits before retrying.
10-step summary table
Section titled “10-step summary table”| Step | Location | Relevant API group | Done when |
|---|---|---|---|
| 1 | Ferry liaison | None (offline) | Parent organization and pricing tier confirmed |
| 2 | Agency Dashboard | None (offline) | Valid API key received |
| 3 | Your server | None (offline) | Key stored in secret store with Bearer header set |
| 4 | Environment config | None (offline) | UAT base URL configured and uatexpress routes selected |
| 5 | Your server | Voyages | Voyage list received (HTTP 200) |
| 6 | Your server | Boat Layout, Voyage Counts | Seat layout and valid vacant seats retrieved |
| 7 | Your server | Ticket Price Additions, Vouchers | Retail and wholesale pricing determined |
| 8 | Dashboard / Bank transfer | Organizations, Transactions, Debt Ledgers | Available balance sufficient for order value |
| 9 | Your server | Bookings | Booking created with seat hold timestamp |
| 10 | Your server | Bookings | Booking reaches status 10 and e-tickets received |
Common misconceptions
Section titled “Common misconceptions”| Misconception | Reality | Correct practice |
|---|---|---|
| Attempting to book or issue real operators on UAT | UAT isolates real operators (OPERATOR_ADAPTER_ALLOWLIST=uatexpress) and enables only uatexpress | Always select UAT ... routes operated by uatexpress when testing on UAT |
| Automatically retrying timed-out booking calls | Booking creation lacks automated deduplication | Check recent bookings before deciding to retry |
| Expecting balance deduction upon booking creation | Balance is only deducted upon ticket confirmation | Ensure balance is sufficient before triggering confirmation |
| Confusing retail prices with agency settlement prices | Different amounts depending on markup configurations | Always verify pricing via calculation APIs before checkout |
Where to look in Scalar
Section titled “Where to look in Scalar”The API groups required for these 10 steps are mapped on the Scalar UI — Ferry VN API:
| Workflow step | Scalar group |
|---|---|
| Step 5: Voyage search | Voyages |
| Step 6: Seat layout and counts | Boat Layout, Voyage Counts |
| Step 7: Price additions and vouchers | Ticket Price Additions, Vouchers |
| Step 8: Balances and debt ledgers | Organizations, Transactions, Debt Ledgers |
| Steps 9 and 10: Booking and ticketing | Bookings, Orders |
Read next
Section titled “Read next”| Guide | Recommended next reading |
|---|---|
| Environments | Learn about the uatexpress sandbox on UAT and the 12 Production operators |
| Authentication with an API key | Key format, scopes, lifecycle, and safe rotation procedures |
| Voyage and seat lookup | Detailed guide on schedule search, seat layouts, and voyage disruptions |
| Bookings: the life cycle of one booking | In-depth order handling workflow from creation to completion |