API Reference / Integrations
POST/integrations/webhooks

Subscribe to webhooks

Register an outbound webhook subscription. We POST signed JSON to your target URL when any of the selected events occur.

🔒 JWT BearerTry in Console →

Purpose

Tell the platform to push real-time event notifications to your server. Subscribe to booking.created / booking.updated / booking.cancelled so your app reacts immediately instead of polling. Each subscription has its own signing secret for HMAC verification.

Authentication

Send your access token as a Bearer header: Authorization: Bearer <token>. Obtain it from Authenticate a user.

Parameters

NameInTypeDescription
targetUrl*bodystringHTTPS URL to receive events
events*bodystring[]booking.created | booking.updated | booking.cancelled
descriptionbodystringOptional label

Request samples

bash
curl -X POST https://tourapi.nirajp.com.np/api/v1/integrations/webhooks \
  -H "Content-Type: application/json" \
  -d '{"targetUrl":"https://your-app.com/webhooks/booking","events":["booking.created","booking.cancelled"],"description":"Production sink"}'

Success response

Returns 200 OK with the shape below.

FieldTypeDescription
idnumberSubscription id (use in delete-webhook)
targetUrlstringConfirmed delivery endpoint
eventsstring[]Events this subscription receives
activebooleantrue once the subscription is live
json
{
  "success": true,
  "message": "Request successful.",
  "data": {
    "id": 3,
    "targetUrl": "https://your-app.com/webhooks/booking",
    "events": [
      "booking.created",
      "booking.cancelled"
    ],
    "active": true
  }
}

Errors

All errors share the envelope { "success": false, "message": "..." }.

401No or invalid authentication token supplied.
json
{
  "success": false,
  "message": "Unauthorized"
}
400A required field is missing or malformed (e.g. invalid email, short password).
json
{
  "success": false,
  "message": "Validation failed",
  "errors": {
    "email": "email must be a valid email"
  }
}
403Authenticated but the account/role lacks permission for this action.
json
{
  "success": false,
  "message": "Forbidden"
}
500An unexpected error occurred on our side. Retry; if it persists, contact support.
json
{
  "success": false,
  "message": "Internal server error"
}