MultiSas uses JSON Web Tokens (JWT) for authentication. Two separate login flows exist: one for company admins (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/MultiSas/llms.txt
Use this file to discover all available pages before exploring further.
login-company) and one for sub-users such as sellers and consultants (login-user-company). Both flows return a signed JWT that expires after 365 days. On every protected route, include the token in the token-access request header as Bearer <token>. The TokenAny middleware accepts tokens from either identity type, while Token accepts Company tokens only, and TokenAuthorize restricts access further by role.
All endpoints are prefixed with
/api/user. A Super Admin is the platform-level operator who registers and activates company accounts. An Admin is the owner-level user of a specific company.POST /api/user/register-company
Register a new company on the platform. No token is required. On success, the company record is created withactive_account set to Pendiente (pending payment review) and role_user defaulting to Sin rol.
Request
Display name of the company (e.g.
"Estampados del Norte").Full name of the company founder or primary contact.
Tax identification number (NIT/RUT) for the company. Must be unique across all tenants.
Plain-text password for the company admin account. The API bcrypt-hashes this value before storage (salt rounds: 6).
Business category that determines which feature counters are initialised (e.g.
"sublimacion"). When provided, it must match a valid entry in the platform’s companyConfig map; an unrecognised value returns HTTP 400 {"msj": "Tipo de empresa invalida", "status": false}. Omit this field for Super Admin accounts.Human-readable status message:
"Empresa registrada exitosamente".true on success, false on any error.The full persisted company document as returned by MongoDB, including the generated
_id, all submitted fields, and the computed defaults (active_account, available_plans, counters).POST /api/user/login-company
Authenticate as a company admin. On success, a signed JWT is issued and stored on the company record. Use the returnedtoken value in the token-access header for all subsequent requests made by this company admin.
Request
The company’s NIT/RUT identifier, as registered via
register-company.Plain-text password for the company admin account.
"Bienvenido!" on success.true on success.Signed JWT valid for 365 days. Pass this as
Bearer <token> in the token-access header.Snapshot of the authenticated company’s data embedded in the response.
The JWT payload includes
_id, name_company, name_founder, name_sellers, nit_company, role_user, active_account, available_plans, day_available_plans, and expired_available_plans. The Token middleware decodes this payload and looks up the Company record to populate req.user on protected routes.POST /api/user/login-user-company
Authenticate as a sub-user (employee or seller) belonging to a company. The sub-user must have been created by a company Admin viacreate-user-company-by-admin and must have active: true before login is permitted.
Request
The NIT/RUT of the parent company this sub-user belongs to, as stored on the
UserCompany record.Plain-text password set when the sub-user profile was created.
"Iniciando sesion..." on success.true on success.Signed JWT valid for 365 days. Use as
Bearer <token> in token-access.Sub-user profile data.
PUT /api/user/logout-company
Invalidate the current session for a company admin by clearing the storedtoken field on the company document. After logout, any requests using the old token will fail business-logic checks on protected routes.
Auth: TokenAny required — include token-access: Bearer <token> in the request headers.
Request
The NIT/RUT of the company being logged out. Must match the company associated with the bearer token.
"Cerrando sesion..." on success.true on success, false on error.The JWT itself is not blocklisted at the cryptographic level — the
token field on the Company document is set to an empty string "". The token field is cleared in storage; subsequent requests using the old JWT will still pass signature verification.Error Responses
All protected endpoints share a common set of error shapes returned by theToken and TokenAny middleware layers.
| HTTP Status | When | Response Body |
|---|---|---|
401 | No token-access header provided (Token middleware) | {"msj": "Sin autorizacion", "status": false} |
403 | JWT has expired (jwt expired error) | {"msj": "Sesion finalizada", "status": false} |
403 | Other JWT verification failure | {"msj": "<err.message>. Rechazo en la conexion", "status": false} |
404 | Company record not found during token lookup | {"msj": "Usuario no encontrado", "status": false} |