API Reference / Packages
POST
/packagesCreate a package
Publish a new tour package. Requires the package.create permission.
🔒 JWT BearerTry in Console →
Purpose
Add a new tour package to your catalog. After creation the package is immediately listable and bookable. This is the write counterpart to List packages.
Authentication
Send your access token as a Bearer header: Authorization: Bearer <token>. Obtain it from Authenticate a user.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| title* | body | string | Package title |
| destination* | body | string | Destination country/region |
| durationDays* | body | number | Trip length in days |
| price* | body | number | Per-person price |
| currency* | body | string | ISO currency, e.g. USD |
| category | body | string | e.g. trekking, tour, safari |
Request samples
bash
curl -X POST https://tourapi.nirajp.com.np/api/v1/packages \
-H "Content-Type: application/json" \
-d '{"title":"Everest Base Camp Trek","destination":"Nepal","durationDays":12,"price":1240,"currency":"USD","category":"trekking"}'Success response
Returns 200 OK with the shape below.
| Field | Type | Description |
|---|---|---|
| id | number | Newly created package id |
| title | string | Echoed title |
| destination | string | Echoed destination |
| durationDays | number | Trip length |
| price | number | Per-person price |
| currency | string | Currency code |
| category | string | Category |
| status | string | "active" once published |
json
{
"success": true,
"message": "Request successful.",
"data": {
"id": 1,
"title": "Everest Base Camp Trek",
"destination": "Nepal",
"durationDays": 12,
"price": 1240,
"currency": "USD",
"category": "trekking",
"status": "active"
}
}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"
}