Authentication & Account – OptoSoft API

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.

JWT bearer auth JSON request & response 85 documented endpoints Reviewed monthly

Authentication & Account

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.

Endpoints

POST /api/Auth/login No token required

Exchanges an OptoSoft username and password for a JWT bearer token. This is the only endpoint you can call without an existing token.

Request body

FieldTypeRequiredDescription
userNamestringRequiredYour OptoSoft login name, as used in the OptoSoft web application.
passwordstringRequiredThe matching password. Sent over HTTPS only.

Example request

curl -X POST https://api.opto-soft.com/api/Auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "userName": "storeadmin",
    "password": "your-password"
  }'

Example response

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "userId": 1042,
  "companyID": 18,
  "branchID": 24
}

The exact response shape is not declared in the OpenAPI specification, which types this response simply as 200 OK. The example above reflects the fields the OptoSoft clients consume. Read the token defensively and ignore any properties you do not recognise.

Errors

StatusCause
400Missing userName or password.
401Credentials rejected, or the account is inactive.
POST /api/Account/get-profile Bearer token

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.

Request body

None. Send an empty POST with the Authorization header.

Example request

curl -X POST https://api.opto-soft.com/api/Account/get-profile \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Length: 0"

Errors

StatusCause
401Token missing, malformed or expired.
GET /api/Account/user-details Bearer token

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.

Query parameters

NameTypeRequiredDescription
date string Optional Business date to resolve the context against. Omit to use today. Send as YYYY-MM-DD.

Example request

curl "https://api.opto-soft.com/api/Account/user-details?date=2026-07-26" \
  -H "Authorization: Bearer YOUR_TOKEN"

Errors

StatusCause
400date is present but not a parseable date.
401Token missing, malformed or expired.

Next steps

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.

Chat with us Call us