CapData Webhooks

CapData can notify your system in real-time about important events, such as the creation of a new reservation, by sending a POST request to a URL you specify. This allows you to react instantly to the extracted data.

1. How to Set Up Your Webhook URL

To receive webhooks, you must configure your "Webhook Endpoint" in the CapData portal:

  1. Log in to your CapData Portal.
  2. Navigate to the Integrations section in the side menu.
  3. Select the General Webhook option.
  4. Enter the URL of your server that will receive the POST requests (e.g., https://myserver.com/receive-capdata-webhook).
  5. Save the changes. From that moment on, CapData will start sending events to that URL.
Note: Your endpoint must be a public URL accessible from the internet. For local testing, you can use tools like ngrok to expose your local server.

2. Webhook Payload Structure

When an event occurs, we will send a POST request to your URL with a JSON body. The payload structure always contains information about the event, the account context, and who originated the action.

Example: new_flight_reservation_from_extension Event

This event is triggered when a new reservation is extracted through the General API (e.g., Chrome extension).

Example JSON Payload
{
    "event_type": "new_flight_reservation_from_extension",
    "reservation_data": [
        {
            "booking_code": "XYZ123",
            "passenger_name": "MARIA LOPEZ",
            "departure_date": "25/12/2025",
            "airline": "Vueling"
            // ... other reservation data
        }
    ],
    "webhook_account_context": {
        "owner_id": 1,
        "owner_name": "Main Owner",
        "owner_email": "owner@email.com",
        "owner_slug": "main-owner"
    },
    "action_originator": {
        "actor_type": "agent",
        "actor_id": 101,
        "actor_name": "Support Agent",
        "actor_username": "support.agent",
        "actor_token_used": "the_agent_token_used",
        "agent_belongs_to_client_id": 15,
        "agent_belongs_to_client_name": "Demo Travel Agency",
        "agent_belongs_to_client_type": "agency"
    }
}

Example: flight_reservation_updated Event

This event is sent when an existing reservation is updated via /api/update_reservation. It includes a updated_at timestamp in ISO 8601 format.

Example JSON Payload – reservation update
{
  "event_type": "flight_reservation_updated",
  "reservation_data": {
    "booking_code": "ABCDEF",
    "passenger_name": "Juan Pérez García",
    "departure_date": "2025-10-15",
    "return_date": "2025-10-22",
    "airline": "Iberia",
    "price": "250.50"
    // ... other fields according to your reservation model
  },
  "updated_at": "2025-05-12T10:15:30Z",
  "webhook_account_context": {
    "owner_id": 1,
    "owner_name": "Main Owner",
    "owner_email": "owner@email.com",
    "owner_slug": "main-owner"
  },
  "action_originator": {
    "actor_type": "owner",
    "actor_id": 1,
    "actor_name": "Main Owner"
    // or "agent"/"agency" if applicable
  }
}

Payload Keys

3. Best Practices and Security

4. Recommended Headers (for your endpoint)

Although CapData sends a Content-Type: application/json, we recommend that your endpoint also:

Important: If you decide to require a token or signature, configure it on your server. CapData will include what you specify in the URL (e.g., ?token=...) or can send signature headers if they are enabled for your account.

5. Idempotency and Retries

Design your handler to be idempotent: