API Reference / Integrations
POST/integrations/api-keys

Create a partner API key

Mint a partner API key. The raw key is returned once and must be stored securely — use it as the x-api-key header on /partner/* routes.

🔒 JWT BearerTry in Console →

Purpose

Generate a credential for server-to-server inbound sync (the /partner/* endpoints). The full key is shown ONLY in this response — store it immediately. Afterwards only the keyPrefix is visible. Treat it like a password.

Authentication

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

Parameters

NameInTypeDescription
name*bodystringHuman label for the key
scopesbodystring[]Optional permission scopes

Request samples

bash
curl -X POST https://tourapi.nirajp.com.np/api/v1/integrations/api-keys \
  -H "Content-Type: application/json" \
  -d '{"name":"Server-to-server integration","scopes":["destinations:write"]}'

Success response

Returns 200 OK with the shape below.

FieldTypeDescription
keystringTHE RAW KEY — shown once, store it securely
apiKey.idnumberKey id (use in delete-api-key)
apiKey.namestringLabel you provided
apiKey.keyPrefixstringFirst characters, for identification later
apiKey.activebooleantrue when usable
json
{
  "success": true,
  "message": "Request successful.",
  "data": {
    "key": "tk_live_9a5e8795...",
    "apiKey": {
      "id": 6,
      "name": "Server-to-server integration",
      "keyPrefix": "tk_live_9a5e",
      "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"
}