Authentication
Authenticate with JWT tokens, manage sessions, update profiles, and configure SSO.
Authorization: Bearer <token> header.Core Endpoints
Authenticate with email and password to receive a JWT token.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| string | Required | User email address | |
| password | string | Required | User password |
Response
Login successful
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIs...",
"user": {
"id": 1,
"first_name": "...",
"last_name": "...",
"email": "...",
"role": "..."
},
"app_version": "...",
"app_environment": "..."
}Code Examples
curl -X POST "https://crm.revorbit.com/api/auth/login" \
-H "Content-Type: application/json" \
-d '{"email":"...","password":"..."}'const response = await fetch(
"https://crm.revorbit.com/api/auth/login",
{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(
{
"email": "...",
"password": "..."
}
)
}
);
const data = await response.json();Self-service registration for a new organization and admin user.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| organization_name | string | Required | Name for the new organization |
| first_name | string | Required | |
| last_name | string | Required | |
| string | Required | ||
| password | string | Required |
Response
Registration successful
{
"success": true,
"token": "...",
"user": {},
"is_new_org": true
}Code Examples
curl -X POST "https://crm.revorbit.com/api/auth/register" \
-H "Content-Type: application/json" \
-d '{"organization_name":"...","first_name":"...","last_name":"...","email":"...","password":"..."}'const response = await fetch(
"https://crm.revorbit.com/api/auth/register",
{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(
{
"organization_name": "...",
"first_name": "...",
"last_name": "...",
"email": "...",
"password": "..."
}
)
}
);
const data = await response.json();Exchange an expiring JWT token for a new one.
Response
New token issued
{
"success": true,
"token": "...",
"user": {}
}Code Examples
curl -X POST "https://crm.revorbit.com/api/auth/refresh"
const response = await fetch(
"https://crm.revorbit.com/api/auth/refresh",
{
method: "POST",
headers: {
}
}
);
const data = await response.json();Send a password reset email. Returns success regardless of whether the email exists (prevents enumeration).
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| string | Required |
Code Examples
curl -X POST "https://crm.revorbit.com/api/auth/forgot-password" \
-H "Content-Type: application/json" \
-d '{"email":"..."}'const response = await fetch(
"https://crm.revorbit.com/api/auth/forgot-password",
{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(
{
"email": "..."
}
)
}
);
const data = await response.json();Reset password using a token received via email.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| token | string | Required | Password reset token from email |
| password | string | Required | New password |
Code Examples
curl -X POST "https://crm.revorbit.com/api/auth/reset-password" \
-H "Content-Type: application/json" \
-d '{"token":"...","password":"..."}'const response = await fetch(
"https://crm.revorbit.com/api/auth/reset-password",
{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(
{
"token": "...",
"password": "..."
}
)
}
);
const data = await response.json();Retrieve the authenticated user's profile and organization list.
Response
User profile
{
"success": true,
"data": {
"id": 1,
"first_name": "...",
"last_name": "...",
"email": "...",
"role": "...",
"phone": "...",
"timezone": "...",
"title": "...",
"organizations": [
{}
]
}
}Code Examples
curl -X GET "https://crm.revorbit.com/api/auth/me" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
const response = await fetch(
"https://crm.revorbit.com/api/auth/me",
{
method: "GET",
headers: {
"Authorization": "Bearer YOUR_JWT_TOKEN",
}
}
);
const data = await response.json();Change the authenticated user's password.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| current_password | string | Required | |
| new_password | string | Required |
Code Examples
curl -X PUT "https://crm.revorbit.com/api/auth/password" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"current_password":"...","new_password":"..."}'const response = await fetch(
"https://crm.revorbit.com/api/auth/password",
{
method: "PUT",
headers: {
"Authorization": "Bearer YOUR_JWT_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify(
{
"current_password": "...",
"new_password": "..."
}
)
}
);
const data = await response.json();Update the authenticated user's profile fields.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| phone | string | Optional | |
| timezone | string | Optional | |
| title | string | Optional | |
| avatar_type | string | Optional | Values: initials, upload |
| avatar_value | string | Optional |
Code Examples
curl -X PUT "https://crm.revorbit.com/api/auth/profile" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"phone":"...","timezone":"...","title":"...","avatar_type":"initials","avatar_value":"..."}'const response = await fetch(
"https://crm.revorbit.com/api/auth/profile",
{
method: "PUT",
headers: {
"Authorization": "Bearer YOUR_JWT_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify(
{
"phone": "...",
"timezone": "...",
"title": "...",
"avatar_type": "initials",
"avatar_value": "..."
}
)
}
);
const data = await response.json();Upload a custom avatar image (max 2MB).
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| avatar | file | Optional |
Code Examples
curl -X POST "https://crm.revorbit.com/api/auth/avatar" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -F "file=@/path/to/file"
const response = await fetch(
"https://crm.revorbit.com/api/auth/avatar",
{
method: "POST",
headers: {
"Authorization": "Bearer YOUR_JWT_TOKEN",
}
}
);
const data = await response.json();Invalidate the current JWT token.
Code Examples
curl -X POST "https://crm.revorbit.com/api/auth/logout" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
const response = await fetch(
"https://crm.revorbit.com/api/auth/logout",
{
method: "POST",
headers: {
"Authorization": "Bearer YOUR_JWT_TOKEN",
}
}
);
const data = await response.json();Switch to a different organization the user belongs to. Returns a new JWT scoped to the target org.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| organization_id | integer | Required |
Response
Switched to new org
{
"success": true,
"token": "...",
"user": {}
}Code Examples
curl -X POST "https://crm.revorbit.com/api/auth/switch-org" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"organization_id":1}'const response = await fetch(
"https://crm.revorbit.com/api/auth/switch-org",
{
method: "POST",
headers: {
"Authorization": "Bearer YOUR_JWT_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify(
{
"organization_id": 1
}
)
}
);
const data = await response.json();