Skip to content

Quick start

You need a terminal with curl, or any server that can make HTTPS requests. The examples call tourpingo’s staging API.

The key below is the demo seller’s: it is public, its trips are invented, and every example on this site works with it as written. Use your own site’s key once you have one.

  1. Keep the key in your environment. A website key starts with tp_pk_. It names one seller’s site, so you never send a seller’s id.

    Terminal window
    export TP_KEY=tp_pk_demodemo_demodemodemodemodemodemo
  2. Ask which site the key is for. The answer has the site’s languages and the currencies it sells in.

    Which site the key belongs to
    Terminal window
    curl "https://api.stg.vacationpackagesoman.com/v1/public/storefront" \
    -H "Tp-Publishable-Key: $TP_KEY"
    Answer: 200 OK
    {
    "id": "7f3a1d2e-5b6c-4d8e-9f01-2a3b4c5d6e7f",
    "operator_id": "8a4b2e3f-6c7d-4e9f-a012-3b4c5d6e7f80",
    "kind": "direct",
    "name": "tourpingo demo",
    "default_locale": "en",
    "locales": [
    "en",
    "ar"
    ],
    "display_currency": "USD",
    "currencies": [
    "USD",
    "AED"
    ],
    "display_rounding": "up_to_whole",
    "blog_url": null
    }
  3. List its trips. Each card has the seller’s name, where the trip starts and its from_price: the lowest price per person, as an integer in the currency’s minor units, so 6500 in USD is USD 65.00.

    The seller's trips, two at a time
    Terminal window
    curl "https://api.stg.vacationpackagesoman.com/v1/public/products?limit=2&locale=en" \
    -H "Tp-Publishable-Key: $TP_KEY"
    Answer: 200 OK (shortened)
    {
    "data": [
    {
    "id": "5b1f0c3e-8d2a-4f6b-9c41-2e7a9d0b6f13",
    "slug": "desert-safari-with-bbq-dinner",
    "template": "day_tour",
    "content_locale": "en",
    "title": "Desert safari with BBQ dinner",
    "summary": "Dune driving in a 4WD, a camel ride and dinner at a desert camp outside Dubai.",
    "duration_minutes": 360,
    "duration_days": null,
    "duration_nights": null,
    "sales_paused": false,
    "cover": {
    "url": "https://api.stg.vacationpackagesoman.com/media/dubai-safari.jpg",
    "alt": "4WDs on the dunes outside Dubai"
    },
    "city": {
    "slug": "dubai",
    "name": "Dubai"
    },
    "region": {
    "slug": "dubai-emirate",
    "name": "Dubai"
    },
    "country": {
    "slug": "ae",
    "name": "United Arab Emirates"
    },
    "categories": [
    {
    "slug": "desert-safari",
    "name": "Desert & Safari"
    }
    ],
    "seller": {
    "slug": "demo",
    "name": "tourpingo demo"
    },
    "from_price": {
    "amount": 6500,
    "currency": "USD",
    "group_size": 1
    }
    },
    {
    "id": "6c2a1d4f-9e3b-4a7c-8d52-3f8b0e1c7a24",
    "slug": "abu-dhabi-city-tour-full-day",
    "template": "day_tour",
    "content_locale": "en",
    "title": "Abu Dhabi city tour, full day",
    "summary": "The Sheikh Zayed Grand Mosque, the Corniche and Qasr Al Watan in one day.",
    "duration_minutes": 600,
    "duration_days": null,
    "duration_nights": null,
    "sales_paused": false,
    "cover": {
    "url": "https://api.stg.vacationpackagesoman.com/media/abu-dhabi.jpg",
    "alt": "Sheikh Zayed Grand Mosque, Abu Dhabi"
    },
    "city": {
    "slug": "abu-dhabi",
    "name": "Abu Dhabi"
    },
    "region": {
    "slug": "abu-dhabi-emirate",
    "name": "Abu Dhabi"
    },
    "country": {
    "slug": "ae",
    "name": "United Arab Emirates"
    },
    "categories": [
    {
    "slug": "city-tours",
    "name": "City Tours"
    }
    ],
    "seller": {
    "slug": "demo",
    "name": "tourpingo demo"
    },
    "from_price": null
    }
    ],
    "next_cursor": "WyIyMDI2LTA5LTI0VDExOjIwOjAwLjAwMFoiLCI2YzJhMWQ0Zi05ZTNiLTRhN2MtOGQ1Mi0zZjhiMGUxYzdhMjQiXQ",
    "total": 4
    }
  4. Open one trip with GET /v1/public/products/{product} and its slug, as the trip page guide shows, then price it with a quote.

Every error is a JSON problem with a code. A missing or wrong key is 401 Unauthenticated:

A missing or wrong key
Terminal window
curl "https://api.stg.vacationpackagesoman.com/v1/public/products" \
-H "Tp-Publishable-Key: $TP_KEY"
Answer: 401 Unauthorized
{
"type": "about:blank",
"title": "Unauthorized",
"status": 401,
"code": "Unauthenticated",
"detail": "Send the storefront's publishable key as `Tp-Publishable-Key: tp_pk_…`."
}

The errors guide lists every code.