Skip to content

REST API

Yatra exposes a comprehensive REST API under the yatra/v1 namespace. Every screen in the React admin app talks to this API, and every front-end booking flow does too. You can use the same endpoints from external apps, headless front-ends, or scripts.

text
Base URL:  https://your-site.com/wp-json/yatra/v1/

Authentication

Yatra uses WordPress's standard REST authentication:

  • Cookie + nonce — for logged-in WP users (the admin app uses this).
  • Application Passwords — recommended for server-to-server scripts. Generate per-user under Users → Profile → Application Passwords.
  • Basic Auth over HTTPS — supported by some plugins but not enabled by default in WordPress core.

Most write endpoints require manage_options (admin) or a Yatra-specific capability such as yatra_edit_trips, yatra_manage_settings, manage_yatra. Some read endpoints and the booking session endpoints are public — see the per-endpoint notes.

bash
# List bookings as an admin (Application Password)
curl -u "umesh:xxxx xxxx xxxx xxxx xxxx xxxx" \
     https://example.com/wp-json/yatra/v1/bookings

Permission patterns

PatternUsed by
current_user_can( 'manage_options' )Most admin endpoints (settings, modules, license)
current_user_can( 'manage_yatra' )Module-scoped admin endpoints (Email Automation, etc.)
current_user_can( 'yatra_edit_trips' )Trip CRUD
__return_true / publicBooking session, public consent submission, abandoned-tracking, auth flow

If your custom integration needs a narrower permission, you can register custom capabilities and filter yatra_module_capabilities.

Response shape

Most endpoints return JSON in this canonical shape:

json
{
  "success": true,
  "data":    { /* … */ },
  "meta":    { "page": 1, "per_page": 20, "total": 142 }
}

Errors are WP_Error payloads:

json
{
  "code":    "yatra_validation_error",
  "message": "Trip ID is required.",
  "data":    { "status": 400, "field": "trip_id" }
}

Endpoint surface

The list below groups the routes by area. Each row shows the path (relative to /wp-json/yatra/v1) and a one-line summary. For exact methods and parameters, see each controller class under app/Controllers/ (free) or app/Modules/{Module}/Controllers/ (Pro).

Trips

PathPurpose
/tripsList / create trips
/trips/{id}Read / update / delete a trip
/trips/{id}/duplicateDuplicate a trip
/trips/{id}/permanent-deleteHard-delete a trashed trip
/trips/{id}/revisionsList trip revisions
/trips/{id}/attributesList / set per-trip attributes
/trips/{id}/services(Pro) Additional services attached to a trip
/trips/{id}/availabilityList computed departures (fixed + recurring)
/trips/{id}/downloadsList trip-attached downloads
/trips/searchSearch trips by title / slug
/trips/publicPublic listing endpoint used by [yatra_trip]
/trips/statsTrip-level statistics

Classifications

Same shape for each classification type:

  • /destinations, /destinations/{id}
  • /activities, /activities/{id}
  • /trip-categories, /trip-categories/{id}
  • /difficulty-levels, /difficulty-levels/{id}
  • /traveler-categories, /traveler-categories/{id}

The block-editor pickers also expose lightweight read endpoints under /block-editor/{taxonomy} (permission: edit_posts).

Items, item types, itinerary

PathPurpose
/item-types, /item-types/{id}Itinerary item type CRUD
/items, /items/{id}Itinerary items
/itineraries, /itineraries/{id}Per-trip itinerary records

Availability

PathPurpose
/availability, /availability/{id}Fixed departures CRUD
/recurring-availability, /recurring-availability/{id}Recurring availability rules
/trips/{id}/availabilityComputed merged list

Trip downloads

PathPurpose
/downloads/{id}Get a download record
/downloads/{id}/download-urlGenerate a presigned download URL
/trips/{trip_id}/downloadsAll downloads attached to a trip

Attributes

PathPurpose
/attributes, /attributes/{id}Global attribute CRUD
/trips/{id}/attributesPer-trip values

Booking session and checkout

These power the React booking form. Public for guests, but some operations require a session ID.

PathPurpose
/booking/sessionCreate / read / update / delete a booking session
/booking/trip/{id}Hydrate a booking page for the given trip
/booking/createMaterialize a booking from the session
/booking/summaryServer-side compute of the price summary
/booking/couponsApply / remove a coupon
/payment/{gateway}/completePer-gateway return URL handler
/payment/webhook/{gateway}Per-gateway webhook receiver

Bookings (admin)

PathPurpose
/bookingsList + filter bookings
/bookings/{id}Read / update / delete a booking
/bookings/{id}/travellersList per-traveler details
/bookings/{id}/emailRe-send an email against this booking
/bookings/{id}/voucherPDF voucher
/bookings/{id}/itineraryPDF itinerary
/bookings/{id}/invoicePDF invoice

Payments

PathPurpose
/payments, /payments/{id}Payment-record CRUD
/payment/gatewaysList enabled gateways with their config
/payment/create-intentCreate a payment intent (gateway-specific)
/payment/confirmConfirm a payment intent
/payment/refund/{payment_id}Refund a payment
/payment/remaining/{token}Hydrate a remaining-balance checkout
/payment/invoice/{booking_id}PDF invoice
/payment/voucher/{booking_id}PDF voucher

Customers, reviews, enquiries

PathPurpose
/customers, /customers/{id}Customer CRUD
/reviews, /reviews/{id}Review CRUD
/enquiries, /enquiries/{id}Enquiry CRUD (POST is public for the trip enquiry modal)
/saved-trips(Pro feature) Wishlist / saved trips

Auth (customer-facing)

PathPurpose
/auth/loginCustomer login
/auth/registerCustomer registration
/auth/resend-verificationRe-send the email-verification link

Settings, modules, license

PathPurpose
/settingsRead / write settings (free)
/settings/flush-rewritesFlush WP rewrite rules
/settings/pagesList candidate WP pages for booking / account / TOS
/email-template-previewRender an email template with sample data
/modulesList modules with state
/modules/{slug}Per-module read
/modules/{slug}/toggleToggle on/off
/modules/{slug}/settingsRead / write module settings
/license(Pro) Read / write license info
/license/activate, /deactivate, /check, /save(Pro) License lifecycle

Reports, tools, sample data, cache, migration

PathPurpose
/reportsReporting summary (filters via query)
/tools/export, /tools/importExport / import Yatra data
/tools/logsRead system logs
/tools/jobsManage background jobs
/tools/cron-runTrigger a cron pass manually
/sample-data/import, /sample-data/status, /sample-data/cleanupSeed / clean demo data
/cache/stats, /cache/view, /cache/status, /cache/enable, /cache/disable, /cache/clear-*, /cache/toggle, /cache/warmYatra's cache layer
/migration/status, /migrate, /migrate-all, /progress, /cancel, /clearLegacy → 3.x migration runner
/testHealth check (admin only)
/usage-tracking, /noticesTelemetry (opt-in) and dismissible admin notices

Pro modules (additional routes)

PathPurpose
/dynamic-pricing/rules, /{id}DP rules CRUD
/dynamic-pricing/previewPreview a rule against a trip / date
/dynamic-pricing/statisticsDP stats
/dynamic-pricing/bulk-statusBulk activate / trash / delete
/dynamic-pricing/settingsDP global settings
/email-templates, /email-templates/{id}Per-template CRUD
/email-sequences, /email-sequences/{id}Sequences with steps
/email-logsEmail send log
/consent/forms, /consent/forms/{id}Consent-form CRUD
/consent/form/{token}Public — fetch a form to fill
/consent/submitPublic — submit a signed consent
/google-calendar/connectBegin OAuth
/google-calendar/callbackOAuth callback
/google-calendar/disconnectRevoke connection
/google-calendar/settingsRead / write GCal settings
/google-calendar/sync-allBulk sync existing bookings
/mailchimp/...Mailchimp settings + manual sync
/facebook-pixel/...Pixel + CAPI configuration
/google-analytics/...GA4 + Measurement Protocol configuration
/abandoned-bookings, /abandoned-bookings/{id}Admin browse + delete
/abandoned-bookings/trackPublic tracking endpoint
/abandoned-bookings/recover/{token}Public recovery URL handler
/additional-services, /additional-services/{id}Service CRUD

Pagination, sorting, filtering

Most list endpoints accept the following query parameters:

ParamDefaultDescription
page1Page number
per_page20Page size (max 100)
orderdescasc or desc
orderbyvariesEndpoint-specific sort key
searchFree-text search
statusvariesFilter by status
from, toDate range (ISO 8601)

Total counts are returned in the meta.total body field and as the X-WP-Total / X-WP-TotalPages headers.

Examples

List recent confirmed bookings

bash
curl -u 'admin:APP_PASSWORD' \
     'https://example.com/wp-json/yatra/v1/bookings?status=confirmed&per_page=10&orderby=created_at&order=desc'

Create a trip

bash
curl -X POST -u 'admin:APP_PASSWORD' \
     -H 'Content-Type: application/json' \
     -d '{
       "title": "Annapurna Base Camp Trek",
       "summary": "12-day teahouse trek through the Annapurna Sanctuary.",
       "regular_price": 1450,
       "duration": 12
     }' \
     https://example.com/wp-json/yatra/v1/trips

Toggle the Dynamic Pricing module

bash
curl -X POST -u 'admin:APP_PASSWORD' \
     -H 'Content-Type: application/json' \
     -d '{"enabled": true}' \
     https://example.com/wp-json/yatra/v1/modules/dynamic_pricing/toggle

Submit an enquiry (public)

bash
curl -X POST -H 'Content-Type: application/json' \
     -d '{
       "trip_id":      42,
       "customer_name":"Jane",
       "customer_email":"[email protected]",
       "subject":      "Available in Sep?",
       "message":      "Hi, are there spots Sept 14–25?"
     }' \
     https://example.com/wp-json/yatra/v1/enquiries

Activate a Pro license

bash
curl -X POST -u 'admin:APP_PASSWORD' \
     -H 'Content-Type: application/json' \
     -d '{"license_key":"YOUR-LICENSE-KEY"}' \
     https://example.com/wp-json/yatra/v1/license/activate

Database schema (summary)

Yatra stores data in custom tables (not WP posts/postmeta). The most-referenced ones:

TablePluginDescription
wp_yatra_tripsFreeMain trip records
wp_yatra_trip_metaFreePer-trip key/value meta
wp_yatra_trip_classificationsFreeDestinations, activities, categories, difficulty rows
wp_yatra_trip_classification_pivotFreeTrip ↔ classification join
wp_yatra_trip_attributesFreePer-trip attribute values
wp_yatra_trip_itinerariesFreeItinerary items
wp_yatra_trip_faqsFreePer-trip FAQs
wp_yatra_trip_downloadsFreePer-trip files
wp_yatra_traveler_categoriesFreeAdult/child/etc. with price modifiers
wp_yatra_availabilityFreeFixed departures
wp_yatra_availability_recurring_rulesFreeRecurring availability rules
wp_yatra_bookingsFreeBooking records
wp_yatra_booking_travellersFreePer-booking traveler rows
wp_yatra_paymentsFreePayment records
wp_yatra_customersFreeCustomer records
wp_yatra_enquiriesFreeTrip enquiries
wp_yatra_reviewsFreeTrip reviews
wp_yatra_email_templatesProEditable email templates (Pro Email Automation)
wp_yatra_email_sequencesProSequence definitions
wp_yatra_email_sequence_stepsProSteps within a sequence
wp_yatra_email_queueProScheduled, pending sends
wp_yatra_email_logsProSend-attempt log
wp_yatra_dynamic_pricing_rulesProDP rules
wp_yatra_trip_demand_scoresProRolling demand scores per trip
wp_yatra_pricing_historyProDP price-change history
wp_yatra_additional_servicesProService catalog
wp_yatra_trip_servicesProTrip ↔ service join
wp_yatra_booking_servicesProPer-booking selected services
wp_yatra_consent_formsProConsent form definitions
wp_yatra_consent_requestsProPending requests
wp_yatra_signed_consentsProSigned records
wp_yatra_calendar_eventsProGoogle Calendar event mapping
wp_yatra_abandoned_bookingsProAbandoned-recovery records
wp_yatra_recovery_email_logsProRecovery-email send log
wp_yatra_recovery_statisticsProRecovery success metrics
wp_yatra_scheduled_paymentsProScheduled / installment payments

Versioning and stability

  • The yatra/v1 namespace is stable. Breaking changes will only land in a new namespace (yatra/v2).
  • New endpoints can be added in any minor release.
  • Response field additions are non-breaking; field renames or removals will be deprecated for at least one minor version with a notice in the response.

Building a custom integration

Recommended starting points:

  • List trips for a headless front-endGET /trips/public.
  • Embed a booking widget elsewhere — Yatra's booking React app expects to live on the same site. For cross-site bookings, expose your own thin layer that calls POST /booking/session and POST /booking/create.
  • Sync customers to your CRM — listen on yatra_booking_created server-side, or poll GET /customers?from=...&to=....
  • Build a daily PDF voucher batch — read GET /bookings?status=confirmed&from=tomorrow&to=tomorrow and call /bookings/{id}/voucher for each.

For deeper questions about specific endpoints, the cleanest reference is the controller class — every route is registered with a register_routes() method that documents methods, permission_callback, and args.