API Reference / Authentication
POST/auth/register

Register an organization

Create a new organization and its owner account. The account is created pending approval — you can log in once approved.

Purpose

Use this as the first step when a new travel company onboards to the platform. It provisions a tenant (organization) and an owner login. New accounts start in the "pending" state and must be approved by a marketplace admin before they can authenticate and call protected endpoints.

Authentication

This endpoint is public — no authentication required.

Parameters

NameInTypeDescription
email*bodystringOwner login email
password*bodystringMin 8 chars, upper + lower + number
orgName*bodystringOrganization display name
fullName*bodystringOwner full name

Request samples

bash
curl -X POST https://tourapi.nirajp.com.np/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"owner@org.com","password":"Secret123!","orgName":"My Travel Co","fullName":"Jane Doe"}'

Success response

Returns 200 OK with the shape below.

FieldTypeDescription
idnumberUser id of the created owner
emailstringLogin email (echoed back)
organizationIdnumberTenant id created for this org
rolestringAlways "owner" for a new registration
statusstring"pending" until an admin approves the account
json
{
  "success": true,
  "message": "Request successful.",
  "data": {
    "id": 12,
    "email": "owner@org.com",
    "organizationId": 9,
    "role": "owner",
    "status": "pending"
  }
}

Errors

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

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"
  }
}
409The resource already exists (e.g. duplicate email on register).
json
{
  "success": false,
  "message": "Email already registered"
}
500An unexpected error occurred on our side. Retry; if it persists, contact support.
json
{
  "success": false,
  "message": "Internal server error"
}