Create a journey

This guide covers how to create a journey using the Aara API. We’ll start with a basic example using curl, followed by JavaScript examples using the native fetch API. The only required parameter to create a journey is cityName . All the rest is optional.

Curl example

curl -X POST "https://api.aara.app/v1/journeys" \
-H "AARA_API_KEY: YOUR_API_KEY" \
-H "UNIQUE_USER_ID: UNIQUE_USER_ID" \
-H "Content-Type: application/json" \
-d '{
  "cityName": "Paris"
}'

JavaScript example (minimal Parameters)

const createJourney = async () => {
  const response = await fetch("https://api.aara.app/v1/journeys", {
    method: "POST",
    headers: {
      AARA_API_KEY: "YOUR_API_KEY",
      UNIQUE_USER_ID: "UNIQUE_USER_ID",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      cityName: "Paris",
    }),
  });

  const data = await response.json();
  console.log(data);
};

createJourney();

Instructions:

  • Replace YOUR_API_KEY and UNIQUE_USER_ID with your actual credentials.
  • This script sends a POST request with the cityName set to "Paris".

JavaScript example (All Parameters)

const createJourney = async () => {
  const response = await fetch("https://api.aara.app/v1/journeys", {
    method: "POST",
    headers: {
      AARA_API_KEY: "YOUR_API_KEY",
      UNIQUE_USER_ID: "UNIQUE_USER_ID",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      cityName: "Paris",
      categoryNames: ["Food", "Drinks"],
      from: 8,
      to: 23,
      price: [0, 1, 2, 3],
      lat: 48.856614,
      lng: 2.3522219,
      radius: 2,
    }),
  });

  const data = await response.json();
  console.log(data);
};

createJourney();

Instructions:

  • Replace YOUR_API_KEY and UNIQUE_USER_ID with your actual credentials.
  • This script sends a POST request with the cityName set to "Paris".

Create Journey parameters

When creating a journey, you can customise it by providing several optional parameters along with the required cityName. Below is a table detailing each parameter:

Parameter NameData TypeUsagePossible Values
cityNamestringRequired. The name of the city where the journey is being created.Any valid city name as a string (e.g., "Paris", "London").
categoryNamesarray of stringsOptional. Specifies the categories of spots to include in the journey.An array of strings. Example: ["Food", "Drinks"]. Categories should correspond to available spot types.
fromnumberOptional. Specifies the starting hour for the journey.A number representing the hour in 24-hour format. Example: 8 (for 8:00 AM).
tonumberOptional. Specifies the ending hour for the journey.A number representing the hour in 24-hour format. Example: 23 (for 11:00 PM).
pricearray of numbersOptional. Specifies the price range for spots to include in the journey.An array of numbers. Example: [0, 1, 2, 3]. Typically represents pricing tiers, where 0 is cheap and 3 is high-end.
latnumberOptional. The latitude of the location to center the journey around.A number representing latitude in decimal degrees. Example: 48.856614 (for Paris).
lngnumberOptional. The longitude of the location to center the journey around.A number representing longitude in decimal degrees. Example: 2.3522219 (for Paris).
radiusnumberOptional. The radius in kilometers around the specified location to search for spots.A number representing the radius. Example: 2 (for 2 kilometers).