Authentication API
Every endpoint except login needs a bearer token. Log in with the email and password of your approved partner account to get a JWT, then send it on each request in the Authorization: Bearer <token> header. Tokens are valid for 7 days. When a request returns 401, log in again to get a fresh token.
Base URL https://api.vismora.com
Log in and get a token
POST
/api/auth/login
No auth
Exchanges your partner email and password for a JWT valid for 7 days. Failed attempts are rate limited per IP address.
Request body
| Field | Type | Description |
|---|---|---|
email
required
|
string (email) | Email address of your partner account. |
password
required
|
string | Account password. |
Response fields
| Field | Type | Description |
|---|---|---|
success
|
boolean | |
token
|
string |
JWT to send as Authorization: Bearer <token>.
|
user
|
object | |
user.id
|
string | Account ID. |
user.firstName
|
string | |
user.lastName
|
string | |
user.email
|
string (email) | |
user.userType
|
string |
One of:
agent individual |
user.companyName
|
string | |
user.walletBalance
|
number | Wallet balance in INR. |
Responses
| Status | Meaning |
|---|---|
| 200 | Logged in. |
| 400 | One or more fields are missing or invalid. |
| 401 | Wrong email or password. |
| 403 | The account exists but can't use the API yet: it is disabled, not approved, not a partner account, or API access hasn't been enabled. The error message says which. |
| 429 | Too many failed login attempts from your IP address. Wait for the number of seconds in the Retry-After header. |
| 500 | Something went wrong on our side. Retry later, and contact support if it continues. |
Request
curl -X POST "https://api.vismora.com/api/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "partner@yourcompany.com",
"password": "your-password"
}'
Response 200
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "665f1c2ab4e9a3d1f0a1b2c3",
"firstName": "Riya",
"lastName": "Shah",
"email": "partner@yourcompany.com",
"userType": "agent",
"companyName": "Skyline Holidays",
"walletBalance": 25000
}
}
Response 400
{
"success": false,
"errors": [
{
"type": "field",
"msg": "Valid email is required",
"path": "email",
"location": "body"
}
]
}
Verify a token
GET
/api/auth/verify
Checks that a token is still valid and returns the account it belongs to, including the current wallet balance.
Response fields
| Field | Type | Description |
|---|---|---|
success
|
boolean | |
user
|
object | |
user.id
|
string | Account ID. |
user.firstName
|
string | |
user.lastName
|
string | |
user.email
|
string (email) | |
user.userType
|
string |
One of:
agent individual |
user.companyName
|
string | |
user.walletBalance
|
number | Wallet balance in INR. |
Responses
| Status | Meaning |
|---|---|
| 200 | Token is valid. |
| 401 | The token is missing, invalid or expired. Log in again. |
| 403 | The account was disabled, unapproved or had API access turned off after the token was issued. |
| 429 | Rate limit reached. Wait for the number of seconds in the Retry-After header, then retry. |
| 500 | Something went wrong on our side. Retry later, and contact support if it continues. |
Request
curl -X GET "https://api.vismora.com/api/auth/verify" \
-H "Authorization: Bearer $VISMORA_TOKEN"
Response 200
{
"success": true,
"user": {
"id": "665f1c2ab4e9a3d1f0a1b2c3",
"firstName": "Riya",
"lastName": "Shah",
"email": "partner@yourcompany.com",
"userType": "agent",
"companyName": "Skyline Holidays",
"walletBalance": 25000
}
}
Response 401
{
"success": false,
"error": "Invalid or expired token. Please login again."
}