NAV
http

Introduction

Welcome to the Magpie API, which provides programmatic access to the Magpie platform.

For our OCTO API Documentation, please visit this page.

Authentication

Provide X-Api-Key header:

GET /api HTTP/1.1
Host: magpie.travel
Accept: application/json
X-Api-Key: your_api_key_here

or api_key query parameter:

GET /api?api_key=your_api_key_here HTTP/1.1
Host: magpie.travel
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json

{ "documentation": "https://docs.magpie.travel" }

Magpie API requires the X-Api-Key header containing your API key to be included for all requests:

X-Api-Key: <Your API Key>

Alternatively, the API key can be provided via the api_key query parameter:

https://magpie.travel/api?api_key=<Your API Key>

If an API key was not given, is unknown, is not active, or belongs to a deleted account, a 401 Unauthorized response status is returned. Every product endpoint below is scoped to the account that owns the API key.

You can find the API key for your Magpie account here.

Products

The Product resource consists of the following fields:

Attribute Type Description
id string The unique identifier of the product
version_id string The unique identifier of this version of the product
name string The name of the product
internal_id string The user-defined internal ID of the product
account object Contains ID and name of the company account that owns the product
start_date date The date when the product starts operating (optional)
end_date date The date when the product stops operating (optional)
summary string Short summary of the product
description string Main description of the product
long_description string Longer description of the product (if necessary)
highlights[] array Key selling features of the product
included[] array Features included in the product
excluded[] array Features NOT incuded in the product
additional_info string Any additional information for the product
health_items[] array List of Covid measures taken by Operator
health_info string Additional Covid information
before_arrival string Important information people need to know before arrival
before_booking string Important information people need to know before booking
booking_cutoff string Cut-off period where bookings are no longer allowed quantity unit and type
validity string Period of time the product is valid for. quantity unit and type
cancellation_policy string Cancellation type for bookings
cancellation_period string Cancellation period quantity and unit
cancellation_info string Additional cancellation information
voucher_info string Information to display on customer voucher
terms_and_conditions string Product terms & conditions
location string Location of the product
starts_notes string Information about starting location
starts_type string Starting point and pick-up
addresses[] array Various addresses
addresses[].type string Possible values are: Starts, Ends, or Redemption
addresses[].latitude decimal Latitude
addresses[].longitude decimal Longitude
addresses[].address1 string Street address 1
addresses[].address2 string Street address 2
addresses[].city string City or Town
addresses[].state string State, Province or Region
addresses[].country string Country code
addresses[].postal_code string Postcode or zipcode
addresses[].directions string Directions to this address
addresses[].notes string Additional notes
duration_type string Type of Duration of the product. Fixed or Flexible
duration_from decimal Value of Fixed Duration or Value of Flexible Duration'From'
duration_unit string Unit of Duration. Days, Hours, or Minutes
duration_to decimal Value of Flexible 'To' Duration
category string The product category
currency string Currency used for the product
language string Language used to describe this product
timezone string Time zone in which the product is operated
redemption_type string Tickets help at office, or Voucher scanned / collected
freesell string Freesell or On-Request
commentaries array Commentary options for the guest
commentaries.format string Commentary Type: Audio, Guide or Written
commentaries.language string Commentary language
guide_type string Tour Guide, Host, Greeter, Instructor or Driver
trip_difficulty string Easy, Moderate or Challenging
emerg_phone_prefix string Emergency Phone Number - prefix
emerg_phone_number string Emergency Phone Number for guests
accessibility string Choose accessibility options
multi-day boolean Multi-day product (includes at least 1 overnight)
accommodation_inc boolean Is accommidation included in the price
private boolean Product is private to only those in a single booking
confirmation_req boolean Customer is required to confirm before travel
max_pax integer Maximum guests per booking
min_pax integer Minimum guests per booking
max_group_size integer Maximum group size on the product
age_restriction_type string Age restrictions for guests
age_restriction_value integer Age in years
height_restriction_type string Height restrictions: Minimum or Maximum
height_restriction_value integer Height restriction value
height_restriction_unit string Height Unit: cm or inches
weight_restriction_type string Weight restrictions: Minimum or Maximum
weight_restriction_value integer Weight restriction value
weight_restriction_unit string Weight Unit: Kg or Lbs
dress_code string Dress code requirements for guests
license_required string Licenses or certifications required by guests
health_restrictions string Health restrictions for guests
other_requirements string Other guest requirements
items_required string Items gursts are required to bring
required_info string Custom information required at the time of booking
food_included string Food included in the product
drinks_included string Drink(s) included in the product
image_url array List of image url
image_ttd_url array List of image TTD url
retail_rates_adult decimal Retail rate of adult
retail_rates_youth decimal Retail rate of youth
retail_rates_child decimal Retail rate of child
retail_rates_infant decimal Retail rate of infant
retail_rates_senior decimal Retail rate of senior
retail_rates_adult_ttd decimal Retail rate of adult TTD
retail_rates_youth_ttd decimal Retail rate of youth TTD
retail_rates_child_ttd decimal Retail rate of child TTD
retail_rates_infant_ttd decimal Retail rate of infant TTD
retail_rates_senior_ttd decimal Retail rate of senior TTD
option_name_ttd string Option name of TTD
option_description_ttd string Option description of TTD

Get All Products

GET /api/products HTTP/1.1
Host: magpie.travel
Accept: application/json
X-Api-Key: your_api_key_here
HTTP/1.1 200 OK
Content-Type: application/json

{
  "categories": [ ... ]
    "Air, Balloon & Helicopter Tours",
    "Attractions / Museums",
    ...
  ],
  "locations": [
    "1206 Front St, Sacramento, CA",
    "13755 Fiji Way, Marina del Rey, CA 90292",
    "207 Queens Quay W, Toronto, ON M5J 1A7, Canada",
    ...
  ],
  "limit_value": 100,
  "total_pages": 10,
  "current_page": 1,
  "next_page": 2,
  "prev_page": null,
  "products": [
    {
      "id": "3bba0442-7f76-4af2-8f90-a962a36833e8",
      "name": "Activity Private Xmas Markets & Alsace Villages",
      "internal_id": "55MJ4Q",
      "account": { "ID": "ABC123", "name": "Ophorus Tours in France" },
      "system_providers": [],
      "location": "Strasbourg",
      "category": "Tours & Sightseeing",
      "duration": "7 hours",
      "currency": "EUR",
      "language": "en",
      "timezone": "Europe/Paris",
      "highlights": [
        "Visit the famous markets of Colmar, knowledgeably guided by one of our local team.",
        "Visit Christmas markets in local villages along the Alsace Wine Route. ",
        ...
      ],
      "summary": "<div>Let us guide you through the most beautiful Alsatian villages and discover the wonders on Christmas markets in Alsace. Your suited private driver will drive you the whole day to places you want to explore. The tour is 100% tailor made and you can either visit the villages or experience a wine tasting in a typical winery.</div>",
      "description": "",
      "commentaries": [ "English: Guide", "French: Guide" ],
      "included": [
        "Visit Christmas markets in Colmar.",
        "English-speaking private driver & guide.",
        ...
      ],
      "excluded": [
        "Personal insurance and expenses.",
        "Meals & drinks.",
        ...
      ],
      "before_booking": [
        "Tour requires minimum 2 passengers (adults) to operate.",
        "Tour is operated in English, other languages on request.",
        ...
      ],
      "before_arrival": [
        "Tour involves some walking, comfortable walking shoes are recommended.",
        "Notify tour operator your Strasbourg hotel information as soon as receive confirmation. "
        ...
      ],
      "additional_info": "<div>Christmas market tour for 2 guests or a total of 8 guests, same party, in the private minivan. <br>Tour runs from 9:30am to 4:30pm, every day.<br>November 30th through December 23rd, 2019</div>",
      "restrictions": [ "Dresscode: Wear Warm Layered Clothing And Good Walking Shoes.", ... ],
      "start_date": null,
      "end_date": null,
      "booking_cutoff": [ 7, "days" ],
      "booking_min_pax": 2,
      "booking_max_pax": 8,
      "valid_for": "7 hours Only on date on reservation",
      "opening_hours": { "Sunday": "Closed", "Monday": "Open", "Tuesday": "Open", ... },
      "availability_notes": [ ],
      "addresses": [{ "location_type": "Starts", "directions": null, "notes": "Pick-up from your centrally located Strasbourg hotel.", "coordinates": "", "full_street_address": "Strasbourg, Alsace, FR" }],
      "cancellation_policy": "custom",
      "cancellation_cutoff": "7 days",
      "cancellation_notes": "Operator strictly adheres to its cancellation policy and will make no exceptions to the policy. If Guest chooses to cancel his or her reservation, ...",
      "terms_and_conditions": "Protection of personal data\r\n\r\nNCDK – OPHORUS attaches great importance to respecting the right to privacy. The policy on the protection of individuals ...",
      "voucher_info": "Notify tour operator your Strasbourg hotel information as soon as receive confirmation. ",
      "faqs": [],
      "confirmation_necessary": false,
      "redemption_type": "voucher | Evoucher"
      "covid_info": "Strict safety measures are taken"
    },
    ...
  ]
}

The /api/products endpoint returns a paginated list of the active, non-deleted products owned by the account of your API key. This listing has no product quality threshold. The following query parameters are accepted:

Parameter Default Description
page 1 The page to fetch.
limit 100 How many products should be retrieved per page.
location none The location to retrieve products for (matched to a city name; an unrecognised location returns 500 with {"error":"invalid location"}).
category none Only return products in this category (exact match).
internal_id none Only return the product(s) with this user-defined internal ID. An unknown ID returns an empty list.
account_id none Additional filter on the owning account ID. Results are always limited to your own account, so any other value returns an empty list.

A page or limit that is missing, not a number, or less than 1 falls back to its default.

The HTTP response will also include:

HTTP Request

GET https://magpie.travel/api/products
GET https://magpie.travel/api/products?page=2
GET https://magpie.travel/api/products?limit=50
GET https://magpie.travel/api/products?location=San%20Francisco
GET https://magpie.travel/api/products?account=Ophorus

Update Bulk Products

PUT /api/products/bulk-update HTTP/1.1
Host: magpie.travel
Accept: application/json
X-Api-Key: your_api_key_here
Content-Type: application/json

{
  "products": [
    {
      "id": "PRODUCT_ID",
      "name": "UPDATED_PRODUCT_NAME",
      ...
    }
  ]
}
HTTP/1.1 200 OK
Content-Type: application/json

{
  "message": "Products updated successfully"
}

The /api/products/bulk-update endpoint updates existing products owned by your account. Send a JSON body with a non-empty products array; every item must contain the id of an existing product of your account. Only the fields you send are changed, and unrecognised fields are ignored. The whole request runs in one transaction: if any item fails, none of the updates are applied.

Status Body Meaning
200 {"message": "Products updated successfully"} All products were updated
401 {"error": ...} Missing, invalid or inactive API key
404 {"error": "Couldn't find Product with 'id'=... "} An item has no id, or the product does not belong to your account
422 {"error": "No products provided"} products is missing or empty
422 {"error": "Validation failed: ..."} An item failed validation (name can't be blank, cancellation_policy must be standard, none or custom, duration_from / duration_to must be greater than 0)
500 {"error": "Failed to update products"} Server error

HTTP Request

PUT https://magpie.travel/api/products/bulk-update

Create Bulk Products

POST /api/products/bulk-create HTTP/1.1
Host: magpie.travel
Accept: application/json
X-Api-Key: your_api_key_here
Content-Type: application/json

{
  "products": [
    {
      "name": "NEW_PRODUCT_NAME",
      ...
    }
  ]
}
HTTP/1.1 201 Created
Content-Type: application/json

[
  {
    "id": "09f33209-ece7-4166-9f5e-29a6a68da2a0",
    "account_id": "21054d26-f328-47ff-b8c2-ed1983437734",
    "code": null,
    "cancellation_notes": "Up to 24 hours before the beginning of the activity: full refund\nLess than 24 hours before the beginning of the activity or no-show: no refund",
    "created_at": "2024-08-30T09:11:03.154Z",
    "updated_at": "2024-08-30T09:11:03.248Z",
    "available_tiers": [
      "adult",
      "child"
    ],
    "tier_conditions": {},
    "weight": 900,
    "active": false,
    "currency": null,
    "freesale": false,
    "external_link": null,
    "category": null,
    "operating_type": "opening_hours",
    "url_path": null,
    "duration_type": "fixed",
    "duration_from": null,
    "duration_to": null,
    "duration_unit": null,
    "instant_confirmation": false,
    "booking_cutoff": null,
    "booking_cutoff_unit": null,
    "cancellation_cutoff": 24,
    "cancellation_cutoff_unit": "hours",
    "tier_ages": {
      "infant": {
        "from": 0,
        "to": 4
      },
      "child": {
        "from": 5,
        "to": 11
      },
      "youth": {
        "from": 12,
        "to": 17
      },
      "adult": {
        "from": 18,
        "to": 64
      },
      "senior": {
        "from": 65,
        "to": 120
      }
    },
    "limited_dates": false,
    "start_date": null,
    "end_date": null,
    "api_available": false,
    "api_mapping": null,
    "location": null,
    "min_pax": null,
    "max_pax": null,
    "has_commentary": false,
    "discarded_at": null,
    "pickup": "none",
    "private": false,
    "cancellation_policy": "standard",
    "internal_id": null,
    "percent_complete": "38.8888888888888889",
    "booking_system_id": null,
    "setup_complete": false,
    "language": "en",
    "multiday": null,
    "accommodation_included": null,
    "valid_type": null,
    "valid_for": null,
    "valid_unit": null,
    "booking_cutoff_type": null,
    "age_restrictions": {},
    "has_height_restrictions": null,
    "height_restrictions": {},
    "weight_restrictions": {},
    "health_restrictions": {},
    "dresscode_restrictions": null,
    "license_or_certification_restrictions": {},
    "additional_requirements": {},
    "item_requirements": {},
    "information_requirements": {},
    "confirmation_necessary": null,
    "redemption_type": null,
    "guide_type": null,
    "accessibility": {},
    "food_included": null,
    "beverages_included": null,
    "emergency_phone_prefix": null,
    "emergency_phone_number": null,
    "surcharges": {},
    "has_longer_description": false,
    "short_code": "HDWPQX",
    "tier_types": {},
    "rails_timezone": null,
    "timezone": null,
    "sellect_all": true,
    "external_code": {},
    "published": 1,
    "locationobj_id": null,
    "name": "test 1",
    "tier_labels": {
      "adult": "",
      "child": "",
      "youth": "",
      "infant": "",
      "senior": "",
      "student": ""
    },
    "summary": null,
    "description": null,
    "included": [],
    "excluded": [],
    "before_arrival": [],
    "before_booking": [],
    "additional_info": null,
    "highlights": [
      "asdasdasdasdas"
    ],
    "short_description": "tes1t",
    "voucher_info": null,
    "terms_and_conditions": null,
    "group_info": null,
    "special_service": null,
    "starts_notes": null,
    "max_group_size": null,
    "trip_difficulty": null,
    "videos": [],
    "contextual_keywords": null,
    "tracking_template": null,
    "custom_parameter": null,
    "health": null,
    "blocked_dates": [],
    "template": false,
    "primary_product_id": null,
    "version_type": "Primary",
    "version_name": "Primary Product",
    "version_description": null,
    "version_date_from": null,
    "version_date_to": null,
    "select_all_resellers_for_version": false,
    "health_items": [],
    "note_job_export_field": null,
    "note_job_copy_field": null,
    "linked_fields": [],
    "sharing_private": false,
    "sharing_directory": true,
    "sharing_api": true,
    "score": null,
    "listings_count": 0,
    "ignore": false,
    "ratings_average": null,
    "ratings_count": null,
    "product_name_ttd": null,
    "inventory_type": false,
    "crawl_info": {},
    "product_quality": 11,
    "ttd_brand": null,
    "partner_booking_url": null,
    "keywords": [],
    "reviews_product_page": false,
    "content_gpt": false,
    "review_widget_code": null,
    "suggestions_gpt": null,
    "conflicts_gpt": null,
    "gpt_status": null,
    "landing_page_url": null,
    "activate": false,
    "place_id_manually": null,
    "google_profile_name_manually": null,
    "option_name_ttd": {},
    "owner_of_poi": false,
    "owner_of_gbp": false,
    "product_system_providers_id": null,
    "connected_review_widget": false,
    "google_backend_connected_review_widget_id": null,
    "gpt_status_reseller": null,
    "collector": null
  }
]

The /api/products/bulk-create endpoint creates new products in your account. It always creates; it never matches existing products by internal_id. Send a JSON body with a non-empty products array. name is required for every item; unrecognised fields are ignored. A successful request returns 201 with an array of the created products.

If any item fails validation, the valid items in the same request are still created. The response is then 422 with the created products and the failed items:

{
  "created_products": [ ... ],
  "errors": [
    { "product": { "name": null, ... }, "errors": ["Name can't be blank"] }
  ]
}
Status Body Meaning
201 array of products All products were created
401 {"error": ...} Missing, invalid or inactive API key
422 {"error": "No products provided"} products is missing or empty
422 {"created_products": [...], "errors": [...]} At least one item failed validation (name can't be blank, cancellation_policy must be standard, none or custom, duration_from / duration_to must be greater than 0)
500 {"error": "Failed to create products"} Server error

HTTP Request

POST https://magpie.travel/api/products/bulk-create

JSON Cache API

The JSON Cache API provides optimized endpoints for retrieving pre-cached account and product information in multiple formats. This API uses intelligent caching to deliver faster responses for frequently accessed data.

Endpoints Overview

Endpoint Method Purpose
/api/content-feed/accounts GET Retrieve cached company data for your account
/api/content-feed/products GET Retrieve cached product data

Both endpoints are scoped to the account that owns your API key. Responses are paginated with page and per_page, and include a paginate object.


Get Accounts Cache

Retrieve cached company data for your account with support for multiple export formats.

HTTP Request

GET /api/content-feed/accounts?format=json&content_type=company_info HTTP/1.1
Host: magpie.travel
Accept: application/json
X-Api-Key: your_api_key_here

URL

GET https://magpie.travel/api/content-feed/accounts

Query Parameters

Parameter Required Default Description
format No json Export format: json, jsonl, jsonld, json-octo, markdown, text
content_type No company_info Content type: company_info or all
page No 1 Page to fetch
per_page No 50 Accounts per page (maximum 100)

An API key is always limited to its own account; the account to return cannot be chosen with a query parameter.

Request Examples

Get company info (JSON format)

GET /api/content-feed/accounts?content_type=company_info HTTP/1.1
Host: magpie.travel
X-Api-Key: your_api_key_here

Get all account data (JSON-LD format)

GET /api/content-feed/accounts?content_type=all&format=jsonld HTTP/1.1
Host: magpie.travel
X-Api-Key: your_api_key_here

Get account data in Markdown format

GET /api/content-feed/accounts?content_type=company_info&format=markdown HTTP/1.1
Host: magpie.travel
X-Api-Key: your_api_key_here

Response Example (JSON format)

HTTP/1.1 200 OK
Content-Type: application/json

{
  "accounts": [
    {
      "id": "YOUR_ACCOUNT_ID",
      "name": "Account Name",
      "telephone": "+33 1 23 45 67 89",
      "website": "https://ophorus.com",
      "description": "Premium tour operator in France",
      "category": "Operator",
      "email": "[email protected]",
      "locale": "en",
      "timeZone": "Europe/Paris",
      "logo": "https://example.com/logo.png",
      "review_rating": "4.8",
      "number_review": 245,
      "bookingSystemsId": ["Ventrata", "Viator"],
      "media": [
        {
          "src": "https://example.com/logo.png",
          "type": "image/png",
          "rel": "LOGO"
        }
      ],
      "locations": [],
      "products": [],
      "faqs": [],
      "reviews": []
    }
  ],
  "count": 1
}

Response Example (Markdown format)

HTTP/1.1 200 OK
Content-Type: application/json

{
  "format": "markdown",
  "content": "# Account: Ophorus Tours in France\n\n## Company Information\n\n- **Website:** https://ophorus.com\n- **Telephone:** +33 1 23 45 67 89\n...",
  "count": 1
}

Response Example (JSON-OCTO format)

HTTP/1.1 200 OK
Content-Type: application/json

{
  "accounts": [
    {
      "id": "YOUR_ACCOUNT_ID",
      "name": "Account Name",
      "description": "Premium tour operator in France",
      "website": "https://ophorus.com",
      "contact": {
        "email": "[email protected]",
        "telephone": "+33 1 23 45 67 89"
      },
      "address": {
        "streetAddress": "123 Main St",
        "addressLocality": "Paris",
        "addressCountry": "FR"
      },
      "products": [...]
    }
  ],
  "count": 1
}

Supported Formats

Format Description Use Case
json Standard JSON format Web APIs, general purpose
jsonl Newline-delimited JSON Streaming, bulk processing
jsonld Schema.org JSON-LD SEO, semantic web
json-octo OCTO Core Specification Tourism industry integration
markdown Human-readable Markdown Documentation, reports
text Plain text format Email, text-based systems

HTTP Status Codes

Code Description
200 Successful request
400 Invalid content_type or format
401 Unauthorized (missing or invalid API key)
404 No accounts found, or page is beyond the last page
500 Server error

Get Products Cache

Retrieve cached product data with support for multiple export formats.

HTTP Request

GET /api/content-feed/products?format=json&product_ids=ID1,ID2 HTTP/1.1
Host: magpie.travel
Accept: application/json
X-Api-Key: your_api_key_here

URL

GET https://magpie.travel/api/content-feed/products

Query Parameters

Parameter Required Default Description
product_ids No - Comma-separated product IDs (e.g., id1,id2,id3). Only products of your account are returned
internal_id No - Your internal ID of a product, used instead of product_ids (ignored if product_ids is given)
version_type No Primary One of Primary, Reseller, Language, Date, Other, XD_reseller_TTD, Reseller_Page, Website. Not applied when product_ids or internal_id is used
version_name No - Only return versions with this name
format No json Export format: json, jsonl, jsonld, markdown, text
html No false true keeps rich-text markup in descriptions and adds fullDescription (json and jsonl only)
page No 1 Page to fetch
per_page No 20 Products per page (maximum 100)

Without product_ids or internal_id, only products with a quality score of 80 or higher are returned. When you request products by product_ids or internal_id, they are returned regardless of quality score.

Request Examples

Get multiple products (JSON format)

GET /api/content-feed/products?product_ids=YOUR_PRODUCT_ID_1,YOUR_PRODUCT_ID_2 HTTP/1.1
Host: magpie.travel
X-Api-Key: your_api_key_here

Get products in Markdown format

GET /api/content-feed/products?format=markdown&product_ids=YOUR_PRODUCT_ID HTTP/1.1
Host: magpie.travel
X-Api-Key: your_api_key_here

Get products in JSONL format for streaming

GET /api/content-feed/products?format=jsonl&product_ids=YOUR_PRODUCT_ID_1,YOUR_PRODUCT_ID_2,YOUR_PRODUCT_ID_3 HTTP/1.1
Host: magpie.travel
X-Api-Key: your_api_key_here

Response Example (JSON format)

HTTP/1.1 200 OK
Content-Type: application/json

{
  "accounts": [
    {
      "products": [
        {
          "id": "YOUR_PRODUCT_ID",
          "title": "Activity Private Xmas Markets & Alsace Villages",
          "shortDescription": "Visit Christmas markets in beautiful Alsatian villages",
          "description": "Let us guide you through the most beautiful Alsatian villages...",
          "category": "Tours & Sightseeing",
          "duration": "7 hours",
          "currency": "EUR",
          "highlights": [
            "Visit the famous markets of Colmar",
            "Visit Christmas markets in local villages",
            "Wine tasting in Alsace"
          ],
          "included": [
            "Visit Christmas markets in Colmar",
            "English-speaking private driver & guide"
          ],
          "excluded": [
            "Personal insurance and expenses",
            "Meals & drinks"
          ],
          "media": [
            {
              "src": "https://example.com/image.jpg",
              "type": "image/jpeg",
              "rel": "GALLERY"
            }
          ]
        }
      ]
    }
  ],
  "count": 1
}

Response Example (JSONL format)

HTTP/1.1 200 OK
Content-Type: application/json

{
  "format": "jsonl",
  "content": "{\"type\":\"product\",\"id\":\"3bba0442-7f76-4af2-8f90-a962a36833e8\",\"name\":\"Activity Private Xmas Markets\",...}\n{\"type\":\"product\",\"id\":\"xyz789\",\"name\":\"Another Tour\",...}",
  "count": 2
}

Supported Formats

Format Description Use Case
json Standard JSON format Web APIs, general purpose
jsonl Newline-delimited JSON Streaming, bulk processing
jsonld Schema.org JSON-LD SEO, semantic web
markdown Human-readable Markdown Documentation, reports
text Plain text format Email, text-based systems

HTTP Status Codes

Code Description
200 Successful request
400 Invalid format or version_type
401 Unauthorized (missing or invalid API key)
404 No products found
500 Server error

Cache Behavior

The JSON Cache API automatically:

Cache Benefits

✅ Fast responses - Pre-computed JSON served from cache
✅ Reduced database load - Intelligent caching minimizes queries
✅ Automatic updates - Cache refreshes when data changes
✅ Multiple formats - Single endpoint supports multiple formats
✅ Industry standards - Complies with Schema.org and OCTO Core


Best Practices

  1. Use cached endpoints for read-heavy operations
  2. Batch requests - Retrieve multiple accounts/products in a single API call
  3. Choose appropriate format - Use JSON for APIs, Markdown for documentation
  4. Handle errors gracefully - Retry 5xx responses (and 429, if returned) with exponential backoff. Never retry 4xx responses: the request itself must change, and a 404 will not resolve on its own
  5. Monitor API usage - Track your API calls to optimize performance

Error Handling

Errors are returned as a JSON body with an error message; the HTTP status code is carried by the response status line.

Invalid Content Type

{
  "error": "Invalid content_type. Supported types: all, company_info"
}

Account/Product Not Found

{
  "error": "No products found"
}

The accounts endpoint returns No accounts found.

Unsupported Format

{
  "error": "Invalid format. Supported formats: json, jsonl, jsonld, json-octo, markdown, text"
}

The products endpoint does not support json-octo: its message lists json, jsonl, jsonld, markdown, text.


API Authentication

All requests to the JSON Cache API require authentication via API key:

X-Api-Key: your_api_key_here

You can find your API key here.

Glossary

Name Description
Reseller You are the reseller, connecting via the API
Operator The operator on Magpie which you are connecting to
Product The attraction, activity or tour
Option A variant of the product, all products must have at least one option
Unit The ticket type, e.g. Adult, Child, Senior etc.
Unit Item A line item per unit within the booking