API Reference / Integrations
POST
/integrations/webhooksSubscribe 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
| Name | In | Type | Description |
|---|---|---|---|
| targetUrl* | body | string | HTTPS URL to receive events |
| events* | body | string[] | booking.created | booking.updated | booking.cancelled |
| description | body | string | Optional 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.
| Field | Type | Description |
|---|---|---|
| id | number | Subscription id (use in delete-webhook) |
| targetUrl | string | Confirmed delivery endpoint |
| events | string[] | Events this subscription receives |
| active | boolean | true 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"
}