Documentation

DepartCart API Reference

Overview

DepartCart provides secure, white-label ancillary services for airlines and travel partners. Partners authenticate with an API key and secret to obtain a short-lived bearer token, then call the API with the raw booking details (PNR and passenger last name).

Building deeplinks? The recommended way is to encode the deeplink id yourself with your brand key, with no API call per link. See the Partner Self-Encoding Guide. The deeplink endpoints below remain available as an alternative and return interchangeable links.

Table of Contents

  1. Authentication & Bearer Tokens
  2. Generate Seatmap Deeplink
  3. Generate All Deeplinks
  4. Seatmap Display
  5. GTM Integration
  6. Webhook Notifications
  7. Error Handling
  8. Implementation Guide

Authentication & Bearer Tokens

All API calls are authenticated with a short-lived bearer token. You exchange your brand's API key and secret (issued during onboarding) for a token, then send it in the Authorization header on every request.

Note: Your API key and secret are provided during onboarding and differ from the examples shown here. The deeplink endpoints encrypt server-side and need no key on your side. Partners who self-encode (recommended) are also issued a brand encoding password and salt; those are separate from the API key and secret and are never sent to these endpoints.

Step 1. Request a bearer token

Endpoint: POST /generate-bearer-token

Request Body:

{
  "api_key": "YOUR_API_KEY",
  "api_secret": "YOUR_API_SECRET",
  "duration_hours": 24
}

duration_hours is optional and defaults to 24.

Response:

{
  "success": true,
  "bearer_token": "your_brand:1718790000:1718876400:Ab12Cd...:9f8e7d...",
  "token_type": "Bearer",
  "expires_in": 86400,
  "expires_at": 1718876400,
  "brand": "your_brand"
}

Step 2. Authenticate requests

Send the token in the Authorization header:

Authorization: Bearer your_brand:1718790000:1718876400:Ab12Cd...:9f8e7d...

Tokens expire after duration_hours; a 401 response indicates an invalid or expired token. Cache and reuse a token until it is close to expiry rather than requesting a new one on every call.


Create an encrypted seatmap URL for a booking. Send the raw pnr and last_name; DepartCart encrypts them server-side and returns the deeplink. The brand is taken from your bearer token.

Endpoint: POST /api/generate-encrypted-seatmap-url

Headers:

Authorization: Bearer <token>
Content-Type: application/json

Request Body:

Field Type Required Description
pnr string Yes Booking reference / PNR (e.g. ABC123).
last_name string Yes Passenger last name (e.g. SMITH).
source string No Integration source identifier (e.g. api, app). Defaults to cart.
{
  "pnr": "ABC123",
  "last_name": "SMITH",
  "source": "api"
}

Response:

{
  "success": true,
  "encrypted_id": "Z0FBQUFBQm9VQTE2...",
  "seatmap_url": "/seatmap?id=Z0FBQUFBQm9VQTE2...&source=api",
  "source": "api"
}

seatmap_url is a path on the DepartCart domain. Prepend https://departcart.com to build the full customer-facing deeplink:

https://departcart.com/seatmap?id=Z0FBQUFBQm9VQTE2...&source=api

Example Usage:

import requests

BASE_URL = "https://departcart.com"

# 1) Exchange API credentials for a bearer token
auth = requests.post(f"{BASE_URL}/generate-bearer-token", json={
    "api_key": "YOUR_API_KEY",
    "api_secret": "YOUR_API_SECRET",
}).json()
token = auth["bearer_token"]

# 2) Generate the seatmap deeplink for a booking
resp = requests.post(
    f"{BASE_URL}/api/generate-encrypted-seatmap-url",
    headers={"Authorization": f"Bearer {token}"},
    json={"pnr": "ABC123", "last_name": "SMITH", "source": "api"},
).json()

seatmap_deeplink = f"{BASE_URL}{resp['seatmap_url']}"
print(seatmap_deeplink)
const BASE_URL = 'https://departcart.com';

// 1) Exchange API credentials for a bearer token
const auth = await fetch(`${BASE_URL}/generate-bearer-token`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        api_key: 'YOUR_API_KEY',
        api_secret: 'YOUR_API_SECRET',
    }),
}).then(r => r.json());

// 2) Generate the seatmap deeplink for a booking
const result = await fetch(`${BASE_URL}/api/generate-encrypted-seatmap-url`, {
    method: 'POST',
    headers: {
        'Authorization': `Bearer ${auth.bearer_token}`,
        'Content-Type': 'application/json',
    },
    body: JSON.stringify({ pnr: 'ABC123', last_name: 'SMITH', source: 'api' }),
}).then(r => r.json());

const seatmapDeeplink = `${BASE_URL}${result.seatmap_url}`;
console.log(seatmapDeeplink);
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Http.Json;

const string baseUrl = "https://departcart.com";
var client = new HttpClient();

// 1) Exchange API credentials for a bearer token
var authResp = await client.PostAsJsonAsync($"{baseUrl}/generate-bearer-token", new
{
    api_key = "YOUR_API_KEY",
    api_secret = "YOUR_API_SECRET",
});
var auth = await authResp.Content.ReadFromJsonAsync<Dictionary<string, object>>();
string token = auth["bearer_token"].ToString();

// 2) Generate the seatmap deeplink for a booking
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var resp = await client.PostAsJsonAsync($"{baseUrl}/api/generate-encrypted-seatmap-url", new
{
    pnr = "ABC123",
    last_name = "SMITH",
    source = "api",
});
var result = await resp.Content.ReadFromJsonAsync<Dictionary<string, object>>();
string seatmapDeeplink = $"{baseUrl}{result["seatmap_url"]}";
require 'net/http'
require 'uri'
require 'json'

BASE_URL = 'https://departcart.com'

def post_json(path, body, token = nil)
  uri = URI("#{BASE_URL}#{path}")
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true
  req = Net::HTTP::Post.new(uri)
  req['Content-Type'] = 'application/json'
  req['Authorization'] = "Bearer #{token}" if token
  req.body = body.to_json
  JSON.parse(http.request(req).body)
end

# 1) Exchange API credentials for a bearer token
auth = post_json('/generate-bearer-token', {
  api_key: 'YOUR_API_KEY',
  api_secret: 'YOUR_API_SECRET'
})

# 2) Generate the seatmap deeplink for a booking
result = post_json('/api/generate-encrypted-seatmap-url',
  { pnr: 'ABC123', last_name: 'SMITH', source: 'api' },
  auth['bearer_token'])

seatmap_deeplink = "#{BASE_URL}#{result['seatmap_url']}"
puts seatmap_deeplink

Generate the seatmap, cart, and checkout deeplinks for a booking in a single call. As with the seatmap endpoint, encryption is performed server-side and the brand is taken from your bearer token. The difference is that this endpoint returns all three deeplinks as absolute URLs.

Endpoint: POST /generate-encrypted-url

Headers:

Authorization: Bearer <token>
Content-Type: application/json

Request Body:

Field Type Required Description
pnr string Yes Booking reference / PNR.
last_name string Yes Any passenger's last name from the booking.
source string No Integration source identifier. Defaults to cart.
{
  "pnr": "ABC123",
  "last_name": "SMITH",
  "source": "cart"
}

Response:

{
  "success": true,
  "encrypted_id": "Z0FBQUFBQm9VQTE2...",
  "seatmap_url": "https://departcart.com/seatmap?id=Z0FBQUFBQm9VQTE2...&source=cart",
  "cart_url": "https://departcart.com/cart?id=Z0FBQUFBQm9VQTE2...",
  "checkout_url": "https://departcart.com/checkout?id=Z0FBQUFBQm9VQTE2...",
  "source": "cart"
}

Use seatmap_url to drop the customer directly into seat selection, cart_url for the full ancillary cart, or checkout_url to jump straight to payment. These are absolute URLs and can be used as-is.


Seatmap Display

Endpoint: GET /seatmap

Parameters:

  • id (string): Encrypted passenger data ID
  • source (string, optional): Integration source identifier (api, gtm, cart, etc.)

Example:

https://departcart.com/seatmap?id=Z0FBQUFBQm9VQTE2...&source=api

GTM Integration

Lightweight Integration

For a quick, low-maintenance integration, use Google Tag Manager to inject seat selection panels into your confirmation or account pages.

GTM Code Template:

<script>
(function() {
    // Ultra-minimal GTM injectable - just loads the script, no logic
    var script = document.createElement('script');
    script.src = 'https://departcart.com/static/loaders-dist/seat_selection_loader.js';
    script.setAttribute('data-gtm-source', 'true');
    document.head.appendChild(script);
})();
</script>

Benefits:

  • Minimal development: Just add GTM code
  • Auto-detection: Finds PNR/passenger data from page
  • Modal interface: No page navigation required
  • Responsive design: Works on all devices

Setup Steps:

  1. Add the GTM code above to your tag manager
  2. Configure trigger for confirmation/account pages
  3. Ensure your pages have identifiable booking elements
  4. Test with sample bookings

For detailed GTM integration instructions, see: GTM Integration Guide


Webhook Notifications

After a customer pays for extras on a website booking and every item has been confirmed with the airline, DepartCart sends a signed transaction.processed JSON POST to the endpoint you gave us at onboarding.

The full specification, including every field, the HMAC-SHA256 signature scheme and verification code in Python, Node.js and C#, is in the Partner Webhook Guide.


Error Handling

HTTP Status Codes

  • 200 - Success
  • 400 - Bad Request (invalid parameters)
  • 401 - Unauthorized (invalid or missing credentials)
  • 403 - Forbidden (insufficient permissions)
  • 404 - Not Found (resource doesn't exist)
  • 422 - Unprocessable Entity (validation errors)
  • 500 - Internal Server Error

Error Response Format

{
    "success": false,
    "error": {
        "code": "INVALID_PNR",
        "message": "The provided PNR could not be found or is invalid",
        "details": {
            "pnr": "ABC123",
            "brand": "your_brand_name"
        }
    }
}

Common Error Codes

  • INVALID_PNR - PNR not found or invalid format
  • ENCRYPTION_ERROR - Failed to decrypt passenger data
  • BRAND_NOT_CONFIGURED - Brand not set up for ancillary services
  • PAYMENT_FAILED - Payment processing error
  • GDS_ERROR - Unable to communicate with airline reservation system

Implementation Guide

πŸš€ Quick Start Checklist

Complete these steps to get your DepartCart integration up and running quickly.


πŸ“‹ Phase 1: Onboarding Requirements

Essential setup items needed before development begins

  • [ ] 🎨 Provide branding assets (logos, color palette)
  • [ ] πŸ”— Share GDS credentials (Sabre/Amadeus access)
  • [ ] πŸ’³ Configure payment gateway (Stripe/Adyen)
  • [ ] πŸ” Receive API key, secret, and webhook secrets
  • [ ] 🌐 Set up webhook endpoint

βš™οΈ Phase 2: Integration Options

Choose your preferred integration approach

  • [ ] πŸƒβ€β™‚οΈ GTM Integration (fastest): Add GTM code to confirmation pages
  • [ ] πŸ› οΈ API Integration (custom): Implement bearer-token auth and direct API calls
  • [ ] πŸ”„ Hybrid Approach: GTM for UI, API for custom workflows

πŸ§ͺ Phase 3: Testing

Validate your integration before going live

  • [ ] πŸ”’ Test bearer token retrieval with sample data
  • [ ] πŸ—ΊοΈ Verify seatmap loads correctly
  • [ ] πŸ“’ Test webhook notifications
  • [ ] πŸ’° Validate payment processing

🎯 Phase 4: Go Live

Final steps for production deployment

  • [ ] 🏭 Production credentials configured
  • [ ] πŸ“Š Webhook monitoring set up
  • [ ] 🚨 Error handling implemented
  • [ ] πŸ“ž Support contact established

⏱️ Estimated Timeline: 4-8 weeks total

Integration Timeline

Phase Duration Activities
Setup 1-2 weeks Onboarding, credentials, branding
Development 2-4 weeks Implement encryption, integrate APIs
Testing 1-2 weeks End-to-end testing, UAT
Launch 1 week Production deployment, monitoring

For detailed implementation steps, see: Partner Onboarding Guide


Support & Resources

Support Contacts

Testing Tools


This documentation is updated regularly. For the latest version, visit: https://departcart.com/docs/api