Skip to main content

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.

A company is the top-level tenant in MultiSas. Every piece of data — clients, orders, products, employees, invoices — is scoped to a company document and isolated from all other tenants. Before any module can be used, a company must be registered in the system, a subscription plan must be assigned, and at least one user account must be activated. This page walks through each step of that setup process.

Company Fields

Stored in the company collection. The following fields define a company’s identity, access level, and billing configuration:
FieldTypeNotes
name_companyStringThe business’s registered name
name_founderStringName of the person who founded or owns the business
nit_companyStringTax identification number (NIT/RUT)
type_companyStringBusiness type — determines which modules and counters are provisioned (see below)
role_userString (enum)Defaults to "Sin rol". Must be set to "Admin" or "Super Admin" before the account can operate
available_plansString (enum)Subscription plan: "Plan Basico", "Plan Profesional", "Plan Premium", "Plan Personalizado", or "Sin Plan"
type_available_plansString (enum)Billing frequency: "Mensual", "Anual", "Permanente", or "Vacio"
months_quantityNumberNumber of months purchased (used to compute expired_available_plans)
day_available_plansStringDate and time the current plan was activated
expired_available_plansStringCalculated expiration date of the current plan
active_accountArrayActivation history objects: { name: String, value: String }
countersMap<String, Number>Auto-incremented bill numbering counters, one per document type. Keys depend on type_company
active_account states:
NameValueMeaning
"Pendiente""1"Payment submitted, awaiting confirmation
"Activo""2"Payment confirmed, account is live
"Inactivo""3"Plan expired or payment lapsed

Company Type Configuration

The type_company field controls which functional modules are enabled and which bill counters are initialised when the company is first registered. This mapping is defined in src/core/middleware/lib/companyConfig.js.
Setting the wrong type_company at registration time means the company will have the wrong set of counters and modules. Choose carefully — changing it later requires manual counter migration.

farmacia — Pharmacy

{
  "modules": ["inventario", "compras", "ventas", "lotes", "clientes", "proveedores"],
  "counters": {
    "bill_counter_pharmacy": 0,
    "bill_counter_sale_pharmacy": 0,
    "bill_counter_batch": 0
  }
}

restaurante — Restaurant

{
  "modules": ["mesas", "pedidos", "cocina"],
  "counters": {
    "bill_counter_pedido_restaurante": 0
  }
}

comercial — Commercial / Retail

{
  "modules": ["ventas", "compras", "inventario"],
  "counters": {
    "bill_counter": 0,
    "bill_counter_credit": 0,
    "bill_counter_debit": 0
  }
}

produccion — Production

{
  "modules": ["produccion", "inventario", "materia_prima"],
  "counters": {
    "bill_counter_production": 0
  }
}
Sublimation businesses (sublimacion) are not listed in companyConfig.js because their counters (bill_counter, bill_counter_production, bill_counter_credit, bill_counter_debit) are provisioned separately through the sublimation registration flow. All four type_company values above map directly to the keys in companyConfig.

Registration & Activation Flow

1

Register the Company (Super Admin)

A Super Admin calls the company registration endpoint with the business details:
POST /api/user/register-company
Content-Type: application/json

{
  "name_company": "Impresos Express",
  "name_founder": "Ana Gómez",
  "nit_company": "900123456-1",
  "type_company": "farmacia",
  "password": "securepassword"
}
The system creates the company document with role_user: "Sin rol" and available_plans: "Sin Plan".
2

Assign a Subscription Plan (Super Admin)

The Super Admin assigns a plan and billing period to activate the account:
PUT /api/user/update-company/:company_id
Content-Type: application/json

{
  "available_plans": "Plan Basico",
  "type_available_plans": "Mensual",
  "months_quantity": 1,
  "expired_available_plans": "2025-08-01"
}
This also updates active_account to { name: "Activo", value: "2" }.
3

Company Admin Logs In

The company admin authenticates to receive a JWT token, which must be included in all subsequent requests as a Bearer token:
POST /api/user/login-company
Content-Type: application/json

{
  "nit_company": "900123456-1",
  "password": "securepassword"
}
4

Create Sub-Users

The company admin creates operator or sales accounts within their tenant:
POST /api/user/create-user-company-by-admin/:company_id
Content-Type: application/json

{
  "name_user_company": "Carlos Ruiz",
  "role_user": "Vendedor",
  "password": "userpassword"
}
5

Activate Sub-User Accounts

Each new sub-user starts as inactive. The admin activates them:
PUT /api/user/active-account-user-by-company/:user_company_id
Once activated, sub-users can log in and access the modules permitted by their role_user.

Available Plans Summary

PlanKey Features
Plan BasicoElectronic invoicing, client/product/supplier management, basic document storage, 1 user, 1 company
Plan ProfesionalEverything in Basico + credit/debit notes, basic inventory, sales reports, multi-user, read API
Plan PremiumEverything in Profesional + advanced inventory, accounts receivable, multi-company, full API, custom PDF templates, advanced roles
Plan PersonalizadoCustom feature set agreed with the client
Credit notes and debit notes require at minimum Plan Basico. Advanced inventory and multi-company features require Plan Premium. The TokenValidationPlan middleware enforces these requirements at the API level.

Build docs developers (and LLMs) love