- Developers
- API Reference
API Reference
The official interactive API documentation for Ferry is generated directly from the backend system and continuously updated on the Scalar UI. This page guides you through opening the documentation, navigating business API tags, and testing API calls directly.
Three Ferry API documentation portals
Section titled “Three Ferry API documentation portals”The system provides three interactive documentation portals tailored to distinct integration roles:
| Documentation portal | Target audience | UI engine | Authentication characteristics |
|---|---|---|---|
/docs | External integrating partners and public catalogue queries | Scalar UI | Combines unauthenticated public routes and API key-protected partner routes |
/internal/docs | Ferry Dashboard and Agency Dashboard | Scalar UI | Requires user JWT credentials; partner API keys cannot call these routes |
/admin/docs | Ferry operations and administration teams | Swagger UI | Requires internal administrator credentials |
These portals are served directly on the API server domain for each environment (for example https://api.ferry.vn/docs). When integrating in the UAT testing environment, open the portal on the corresponding UAT hostname; see Environments.
Why the /docs interface combines two tiers
Section titled “Why the /docs interface combines two tiers”The backend documentation generator assigns a single public visibility tag to both public catalog routes (requiring no authentication) and partner business routes (requiring an API key).
Key consequences for partners navigating Scalar:
- No visual separation: The UI does not provide separate lock icons or partitioned sections to distinguish which routes require an API key and which are public. Consult the Integration surface overview to verify the exact boundary.
- Visible on Scalar does not mean callable: Certain routes displayed on
/docs(such as the Zalo ZNS messaging endpoints) consistently return HTTP 403 when called with an API key because the key role lacks permission. - Missing on Scalar does not mean non-existent: Any endpoint that lacks the documentation tag will be omitted from the UI even though the backend server handles it normally.
Navigating API tags on Scalar
Section titled “Navigating API tags on Scalar”Rather than browsing detached endpoints, you should navigate by business domain tags located in the left sidebar of Scalar:
- Voyage lookup and seat availability: The
Voyagesgroup (search voyages by pier pair and date, timetable),Boat Layout(seat map and individual seat statuses),Voyage Counts(available seat counts),Routes(route catalogue),Locations(pier catalogue),Operators(ferry operator directory). - Pricing and promotions: The
Ticket Price Additionsgroup (surcharges, partner markup, checking applicable additions),Vouchers(validating and applying voucher codes). - Booking and passengers: The
Bookingsgroup (create booking, confirm ticket issuance, get booking details),Customers(passenger and buyer information attached to bookings). - Orders and e-tickets: The
Ordersgroup (details of individual legs within a booking),Bookings(download issued electronic ticket files). - Payments and balances: The
Transactionsgroup (balance change logs and ledger entries),Debt Ledgers(organization debt tracking),Organizations(credit limits and top-up instructions). - Cancellation and refunds: The
Cancel Ticket Requestsgroup (creating and tracking ticket cancellation requests).
Handling the Authorize button and testing on Scalar
Section titled “Handling the Authorize button and testing on Scalar”All business endpoints for partners require authentication via an API key passed in the request header:
Authorization: Bearer <API_KEY>Four workaround steps when testing calls on Scalar:
- Test against the Voyages group first: Enter your key into the Authorize modal and call a voyage lookup endpoint. If successful, your API key is entirely valid.
- Manually input headers per endpoint: For sections returning 401 (such as
Bookings), expand the Headers section of that specific endpoint on the Scalar UI and add theAuthorizationheader withBearer <API_KEY>. - Use an external HTTP client: Use external tools such as Postman or your own backend HTTP client with standard
Authorizationheaders to verify server behavior independently. - Report the declaration to Ferry: Notify Ferry technical support to update the security scheme references in the OpenAPI definition.
Limitations of the Scalar UI
Section titled “Limitations of the Scalar UI”| Limitation | Behavior on UI | Integration guidance |
|---|---|---|
| Downloading OpenAPI spec | The spec download button (JSON/YAML) is disabled | Contact Ferry if you require raw schema files for SDK generation |
| Automated client code generation | The code snippet generation feature is disabled | Construct your HTTP client directly against documented field schemas |
| Session credential persistence | Auth persistence is disabled outside development environments | You must re-enter your API key upon every browser reload |
Common misconceptions
Section titled “Common misconceptions”| Misconception | Reality | Consequence |
|---|---|---|
| Authorize returning 401 means the API key is broken | Security scheme names are mismatched on Bookings | Requesting redundant key re-issuance wastes integration time |
| If an endpoint is missing from Scalar, Ferry does not have it | Untagged routes disappear from documentation UI | Incorrect assessment of capabilities; confirm directly with Ferry |
| If an endpoint is listed on Scalar, my API key can call it | The /docs portal includes routes requiring internal roles | Calls return HTTP 403 due to missing role permissions |
The /internal/docs portal is usable by partners | This portal serves Dashboards and strictly requires user JWT | Calling it with an API key always results in unauthorized access |
| Download OpenAPI specs directly from Scalar for SDK generation | The specification download button is disabled on the UI | Request the schema definition file directly from Ferry |
Read next
Section titled “Read next”| Page | Related topic |
|---|---|
| Integration surface overview | Understand the boundaries between API tiers and capabilities |
| Authentication with an API key | Issuing, using, and securing your API keys |
| General conventions | Data formats, pagination, filtering, and API calling rules |
| Voyage search and remaining seats | Sequential flow for searching voyages and retrieving seat maps |
| The booking flow | Complete end-to-end booking and confirmation lifecycle |