Obtain a JWT bearer token with your OptoSoft credentials, then read the signed-in user's profile and daily working context.
3 endpoints in this module. Every request needs a JWT bearer token — see Authentication.
Every OptoSoft API call is authenticated with a JWT bearer token. You obtain one by
posting your OptoSoft credentials to the login endpoint, then send it in the
Authorization header on every subsequent request.
The two account endpoints let you confirm which user, company and branch a token actually resolves to — useful on start-up, and for showing the operator’s name and store in your own interface.
Cache the token, do not re-login per request. Request a token once
when your process starts, reuse it, and only call login again when a request comes
back 401. Repeated logins are the most common
cause of throttling complaints.
Exchanges an OptoSoft username and password for a JWT bearer token. This is the only endpoint you can call without an existing token.
| Field | Type | Required | Description |
|---|---|---|---|
| userName | string | Required | Your OptoSoft login name, as used in the OptoSoft web application. |
| password | string | Required | The matching password. Sent over HTTPS only. |
curl -X POST https://api.opto-soft.com/api/Auth/login \
-H "Content-Type: application/json" \
-d '{
"userName": "storeadmin",
"password": "your-password"
}'
The login response is your session bootstrap. Besides
Token it returns the encrypted
CompanyID, BranchID
and YearId you will need on later calls, plus the
enabled Modules. Capture them here rather than
hard-coding them. Parse defensively and ignore properties you do not recognise.
| Status | Cause |
|---|---|
| 400 | Missing userName or password. |
| 401 | Credentials rejected, or the account is inactive. |
{
"Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVSUQiOiJRMlpRZEciLCJCcmFuY2hJRCI6IlEyWlFkSSIsIkNvbXBhbnlJRCI6IlEyWlFkSCIsInllYXJJRCI6IlEyWlFkSiIsIlVOYW1lIjoiam9obi5kb2UiLCJyb2xlIjoiQWRtaW4iLCJleHAiOjE3Mjk2OTYwMDB9.signature",
"Id": "Q2ZQdGhSZVhBaVlXTnpaWFF3TWk0d01B",
"UserName": "john.doe",
"UserEmail": "john.doe@visionoptics.com",
"UserRole": "Admin",
"YearId": "Q2ZQdGhSZVhBaVlXTnpaWFF4TkM0d01B",
"CompanyID": "Q2ZQdGhSZVhBaVlXTnpaWFF4TWk0d01B",
"CompanyName": "Vision Optics Pvt Ltd",
"CompanyEmail": "info@visionoptics.com",
"BranchID": "Q2ZQdGhSZVhBaVlXTnpaWFF4T0M0d01B",
"BranchName": "Main Branch",
"BranchCity": "Mumbai",
"BranchStateID": "Q2ZQdGhSZVhBaVlXTnpaWFF5TWk0d01B",
"BranchCountryID": "Q2ZQdGhSZVhBaVlXTnpaWFF5T0M0d01B",
"Logo": "https://cdn.example.com/logo/company_logo.png",
"Signature": null,
"DashBoardUserSettings": null,
"MaskCustomerMobileNumber": false,
"Modules": [
{
"ModuleID": 1,
"ModuleName": "Eyewear",
"IsActive": true
},
{
"ModuleID": 2,
"ModuleName": "Contact Lens",
"IsActive": true
},
{
"ModuleID": 3,
"ModuleName": "Accessories",
"IsActive": false
}
]
}
Returns the profile of the user the bearer token belongs to — name, role, and the company and branch the token is scoped to. Takes no request body; the user is resolved entirely from the token.
Call this once after login to discover the companyID
and branchID you must pass to the search and save
endpoints, rather than hard-coding them.
None. Send an empty POST with the Authorization header.
curl -X POST https://api.opto-soft.com/api/Account/get-profile \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Length: 0"
| Status | Cause |
|---|---|
| 401 | Token missing, malformed or expired. |
{
"Message": "Success",
"Profile": {
"Name": "Vision Optics Pvt Ltd",
"Address": "123 MG Road, Fort",
"City": "Mumbai",
"MobileNo": "9876543210",
"Email": "info@visionoptics.com",
"PAN": "ABCDE1234F",
"Website": "www.visionoptics.com",
"State": "Maharashtra",
"Country": "India"
}
}
Returns the signed-in user’s working context for a given business date — typically the active financial year, branch defaults and counters used to initialise a POS session.
| Name | Type | Required | Description |
|---|---|---|---|
| date | string | Optional | Business date to resolve the context against. Omit to use today. Send as YYYY-MM-DD. |
curl "https://api.opto-soft.com/api/Account/user-details?date=2026-07-26" \
-H "Authorization: Bearer YOUR_TOKEN"
| Status | Cause |
|---|---|
| 400 | date is present but not a parseable date. |
| 401 | Token missing, malformed or expired. |
With a token in hand, the usual next step is to look up or create the customer, then attach a prescription and raise an order. See Customers & Prescriptions and Sales Orders, or read the API overview for conventions that apply across every module.
{
"UserID": "Q2ZQdGhSZVhBaVlXTnpaWFF3TWk0d01B",
"UserName": "john.doe",
"UserEmail": "john.doe@visionoptics.com",
"YearID": "5",
"CompanyID": "Q2ZQdGhSZVhBaVlXTnpaWFF4TWk0d01B",
"CompanyName": "Vision Optics Pvt Ltd",
"CompanyEmail": "info@visionoptics.com",
"BranchID": "Q2ZQdGhSZVhBaVlXTnpaWFF4T0M0d01B",
"BranchName": "Main Branch",
"BranchCity": "Mumbai",
"BranchStateID": "Q2ZQdGhSZVhBaVlXTnpaWFF5TWk0d01B",
"BranchCountryID": "Q2ZQdGhSZVhBaVlXTnpaWFF5T0M0d01B",
"BranchLogo": null
}