Travel Agent Docs

Developer API

Overview of the Travel Agent plugin's REST API for managing packages and bookings.

The Developer API lets you manage travel packages and bookings programmatically. Authenticate using your API key and interact with the following endpoints to create, read, update, and delete data.

Authentication

All API requests require an API key to be included in the request header:

X-API-Key: YOUR_API_KEY_HERE

Ensure that your API key is kept secure and never exposed in client-side code.

Rate Limiting

  • Each API key is limited to 100 requests per minute.
  • If this limit is exceeded, the API will return a 429 Too Many Requests response header.

Endpoints

1. Package Management

Add Package

POST /travel-agent/v1/add-package
Content-Type: application/json

Use this endpoint to add a new travel package to the system.

Request Body (JSON)

{
  "guid": "string",
  "brand_name": "string",
  "external_id": "string",
  "name": "string",
  "destination": "string",
  "web_term_name": "string",
  "item_description": "string",
  "experience": "string",
  "travel_period": "string",
  "image": "string",
  "start_date": "YYYY-MM-DD",
  "end_date": "YYYY-MM-DD",
  "package_stage": 1,
  "waitlist": true,
  "allow_waitlist": false,
  "display_text": "string",
  "page_template_id": 42,
  "item_id": "string"
}

Response (200 OK)

{
  "message": "Package added successfully",
  "package": { /* full package object */ },
  "code": 200
}

Update Package

PUT /travel-agent/v1/update-package
Content-Type: application/json

Use the same request body as Add Package to update an existing package.

Response (200 OK)

{
  "message": "Package updated successfully",
  "package": { /* updated package object */ },
  "code": 200
}

Find Package

GET /travel-agent/v1/find-package/<GUID>

Retrieve a package by its unique GUID.

Response (200 OK)

{ /* package object */ }

Delete Package

DELETE /travel-agent/v1/delete-package/<GUID>

Delete the specified package from the system.

Response (200 OK)

{
  "message": "Package deleted successfully",
  "code": 200
}

2. Post Management

Refresh Post

POST /travel-agent/v1/refresh-post/<GUID>

Compare package data to its associated WordPress post and update the post if necessary.

Response (200 OK)

{
  "message": "Post refreshed successfully",
  "post_id": 123,
  "code": 200
}

Generate Post Using Template

POST /travel-agent/v1/generate-post-using-template/<GUID>

Creates a new post from the package and its assigned template.
Response (200 OK)

{
  "message": "Post generated successfully",
  "post_id": 456,
  "code": 200
}

Generate Post from Package

POST /travel-agent/v1/generate-post-using-package/<GUID>

Generates a blank post populated with package data only.
Response (200 OK)

{
  "message": "Post generated successfully",
  "post_id": 789,
  "code": 200
}

3. Booking Form Management

Reset Booking Form

POST /travel-agent/v1/reset-booking-form/<GUID>

Clears customizations and restores default booking form settings for the package.

Response (200 OK)

{
  "message": "Booking form reset successfully",
  "code": 200
}