Skip to content

API Reference

5 min read

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.

The system provides three interactive documentation portals tailored to distinct integration roles:

Documentation portalTarget audienceUI engineAuthentication characteristics
/docsExternal integrating partners and public catalogue queriesScalar UICombines unauthenticated public routes and API key-protected partner routes
/internal/docsFerry Dashboard and Agency DashboardScalar UIRequires user JWT credentials; partner API keys cannot call these routes
/admin/docsFerry operations and administration teamsSwagger UIRequires 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.

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 Voyages group (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 Additions group (surcharges, partner markup, checking applicable additions), Vouchers (validating and applying voucher codes).
  • Booking and passengers: The Bookings group (create booking, confirm ticket issuance, get booking details), Customers (passenger and buyer information attached to bookings).
  • Orders and e-tickets: The Orders group (details of individual legs within a booking), Bookings (download issued electronic ticket files).
  • Payments and balances: The Transactions group (balance change logs and ledger entries), Debt Ledgers (organization debt tracking), Organizations (credit limits and top-up instructions).
  • Cancellation and refunds: The Cancel Ticket Requests group (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:

  1. 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.
  2. 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 the Authorization header with Bearer <API_KEY>.
  3. Use an external HTTP client: Use external tools such as Postman or your own backend HTTP client with standard Authorization headers to verify server behavior independently.
  4. Report the declaration to Ferry: Notify Ferry technical support to update the security scheme references in the OpenAPI definition.
LimitationBehavior on UIIntegration guidance
Downloading OpenAPI specThe spec download button (JSON/YAML) is disabledContact Ferry if you require raw schema files for SDK generation
Automated client code generationThe code snippet generation feature is disabledConstruct your HTTP client directly against documented field schemas
Session credential persistenceAuth persistence is disabled outside development environmentsYou must re-enter your API key upon every browser reload
MisconceptionRealityConsequence
Authorize returning 401 means the API key is brokenSecurity scheme names are mismatched on BookingsRequesting redundant key re-issuance wastes integration time
If an endpoint is missing from Scalar, Ferry does not have itUntagged routes disappear from documentation UIIncorrect assessment of capabilities; confirm directly with Ferry
If an endpoint is listed on Scalar, my API key can call itThe /docs portal includes routes requiring internal rolesCalls return HTTP 403 due to missing role permissions
The /internal/docs portal is usable by partnersThis portal serves Dashboards and strictly requires user JWTCalling it with an API key always results in unauthorized access
Download OpenAPI specs directly from Scalar for SDK generationThe specification download button is disabled on the UIRequest the schema definition file directly from Ferry
PageRelated topic
Integration surface overviewUnderstand the boundaries between API tiers and capabilities
Authentication with an API keyIssuing, using, and securing your API keys
General conventionsData formats, pagination, filtering, and API calling rules
Voyage search and remaining seatsSequential flow for searching voyages and retrieving seat maps
The booking flowComplete end-to-end booking and confirmation lifecycle