Get up and running with the Requirements API in minutes.
In this quickstart, you'll learn how to make a simple API call to the /v3/trips
endpoint and display travel requirements in a basic HTML page. We'll show you how to:
Before you start, you'll need:
Let's start with a simple trip from the United States to the United Kingdom. Here's the basic request structure:
Never expose your API key in client-side code. In production, make API calls from your backend server and use environment variables to store your API key securely.
The API returns a structured response with travel requirements organized into information groups. The exact structure depends on your API key and the specific trip details. Here's what a complete response structure looks like:
The API response structure can vary depending on your API key type and the
specific trip. Some responses may include detailed informationGroups
with
requirements, while others might return a simpler structure with just the trip
details. The HTML example below handles both cases gracefully.
Now let's create a simple HTML page that displays the travel requirements. This example shows the basic structure for parsing and displaying the API response:
Key concepts:
?.
) to safely access nested propertiesinformationGroups
to display different requirement categoriesincluded
array using the requirement IDHere's what the rendered result looks like:
The API response contains several key sections:
headline
: A human-readable summary of the trip requirementstraveller
: Information about the traveler's passport and vaccination statustravelNodes
: Details about the trip itineraryTravel requirements are organized into categories:
Each requirement has an enforcement level:
MANDATORY
: Required for travelNOT_REQUIRED
: Not neededMAY_BE_REQUIRED
: Depends on specific circumstances