Documentation Topics
Account Management API Documentation
Overview
This documentation describes the Account API endpoints for user authentication, registration, and account management.
Authentication
Most endpoints require License Token authentication in Request Header, except for registration and login endpoints.
Authorization: Bearer <your-license-token>
Endpoints
1. User Login
Endpoint: POST /api/account/login
Description: Authenticates a user and returns a License token.if you have a subscription, you can renew your License token by calling this API. Please note that, this API call validates your remaining credits if you are on a API Subscription plan.
Request Body (application/json)
{
"tenantId": "ABC1234567",
"userId": "john.doe",
"password": "yourPassword123"
}
Validation Rules
- User must exist in the system
- User tenant ID to be supplied. You can get the tenant Id from your first Registration Email
- Tenant must have an active subscription. default free account subscription is sufficient
- Subscription must have available credits.
- Password must be correct. if forgotten, use Forgot password Api or Link
Response
200 OK on success with token:
{
"userName": "JohnDoe",
"tenantId": "ABC1234567",
"email": "john@example.com",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Possible error responses:
- 400 Bad Request: Invalid input data
- 401 Unauthorized: Invalid credentials or no active subscription
2. User Registration
Endpoint: POST /api/account/register
Description: Creates a new user account and tenant.
Request Body (application/json)
{
"firstName": "John",
"lastName": "Doe",
"userId": "john.doe",
"email": "john@example.com",
"password": "yourPassword123",
"confirmPassword": "yourPassword123"
}
Validation Rules
- Email must be unique (not already registered)
- Password must meet complexity requirements. one symbol, at least one uppercase,lowercase letters and Numeric
- Password and confirmPassword must match
- All attributes to be provided
What Happens During Registration
- A new tenant account is created and Email conformation will be sending to your inbox
- A free subscription is automatically assigned (30 days trial)
- A new user account is created
- Free credits will be applied (100 credits formonth)
Response
200 OK on success:
{
"message": "Registration successful. Please check your email for confirmation instructions."
}
Possible error responses:
- 400 Bad Request: Invalid input data or email already exists
- 500 Internal Server Error: Registration failed
5. Forgot Password
Endpoint: POST /api/account/forgot-password
Description: Initiates password reset process.
Request Body (application/json)
{
"email": "john@example.com"
}
Response
200 OK on success (even if email doesn't exist, for security). Email with password reset page link will be posted to the given email if it exist.
6. Reset Password
Endpoint: POST /api/account/reset-password
Description: Completes password reset process.
Request Body (application/json)
{
"email": "john@example.com",
"token": "resetTokenFromEmail",
"newPassword": "newPassword123",
"confirmPassword": "newPassword123"
}
Response
200 OK on success:
"Password reset successfully"
Possible error responses:
- 400 Bad Request: Invalid token or password requirements not met
Sample Usage
- Register a new user:
curl -X POST -H "Content-Type: application/json" -d '{ "firstName": "John", "lastName": "Doe", "userId": "john.doe", "email": "john@example.com", "password": "yourPassword123", "confirmPassword": "yourPassword123" }' http://www.pristineinvoice.com/api/account/register
- Login:
curl -X POST -H "Content-Type: application/json" -d '{ "tenantId": "ABC1234567", "userId": "john.doe", "password": "yourPassword123" }' http://www.pristineinvoice.com/api/account/login