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.

MultiSas includes a basic chart of accounts (plan contable) module. Account plan entries are scoped to a company and provide a structured foundation for recording financial transactions such as purchases, sales, and inventory movements. Each entry maps a standardized account code to an account name and a broad account type.
Both endpoints in this module use the Token middleware exclusively — TokenAny is not accepted. The JWT must be issued to a Company identity (i.e. obtained via POST /api/user/login-company). In addition, the caller’s role must be either Admin or Super Admin; any other role receives a 403 No tienes permisos response.

POST /api/account_plan/:company_id

Creates a new chart-of-accounts entry and appends it to the company’s account_plan_company array. Auth: Token + TokenAuthorize('Admin', 'Super Admin')

Path Parameters

company_id
string
required
MongoDB ObjectId of the company that owns the account plan entry.

Body Parameters

code_plan
string
required
Standardized account code. Must be one of the following enumerated values:
CodeAccount NameClass
1101CajaActivo
1102BancoActivo
1201ClientesActivo
1301InventarioActivo
2101ProveedoresPasivo
2201Cuentas por pagarPasivo
4101VentasIngreso
5101Costo de ventasCosto
account_plan
string
required
Human-readable name for the account. Must be one of the following enumerated values: "Caja", "Banco", "Clientes", "Inventario", "Proveedores", "Cuentas por pagar", "Ventas", "Costo de ventas".
type_account
string
required
Broad classification of the account. Accepted values: "Activo", "Pasivo", "Ingreso", "Costo". Pass an empty string "" to leave unclassified (defaults to "").

Example Request

curl -X POST https://your-domain.com/api/account_plan/64abc1230000000000000001 \
  -H "token-access: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "code_plan": "1101",
    "account_plan": "Caja",
    "type_account": "Activo"
  }'

Response

Returns the newly created account plan document on success.
{
  "msj": "Plan de cuenta creado correctamente",
  "status": true,
  "new_account_plan": {
    "_id": "64def4560000000000000099",
    "company": {
      "_id": "64abc1230000000000000001",
      "name_company": "Acme S.A.S",
      "name_founder": "Juan Pérez",
      "nit_company": "900123456-1"
    },
    "code_plan": "1101",
    "account_plan": "Caja",
    "type_account": "Activo",
    "createdAt": "2024-06-01T10:00:00.000Z",
    "updatedAt": "2024-06-01T10:00:00.000Z",
    "__v": 0
  }
}
msj
string
Human-readable confirmation message: "Plan de cuenta creado correctamente".
status
boolean
true on success.
new_account_plan
object
The persisted account plan document.

GET /api/account_plan/list/:company_id/:pag?/:perpage?

Returns a paginated list of all account plan entries that belong to the specified company, sorted newest-first (_id: -1). Auth: Token + TokenAuthorize('Admin', 'Super Admin')

Path Parameters

company_id
string
required
MongoDB ObjectId of the company whose account plan entries are being listed.
pag
number
Page number to retrieve. Optional — defaults to 1 when omitted. This is a URL segment, not a query string parameter.
perpage
number
Number of records per page. Optional — defaults to 10 when omitted. This is also a URL segment.

Example Request

curl -X GET https://your-domain.com/api/account_plan/list/64abc1230000000000000001/1/20 \
  -H "token-access: Bearer $TOKEN"

Response

{
  "msj": "Cargando plan de cuentas...",
  "status": true,
  "data": [
    {
      "_id": "64def4560000000000000099",
      "company": {
        "_id": "64abc1230000000000000001",
        "name_company": "Acme S.A.S",
        "name_founder": "Juan Pérez",
        "nit_company": "900123456-1"
      },
      "code_plan": "1101",
      "account_plan": "Caja",
      "type_account": "Activo",
      "createdAt": "2024-06-01T10:00:00.000Z",
      "updatedAt": "2024-06-01T10:00:00.000Z"
    }
  ],
  "pagination": {
    "pag": "1",
    "perpage": 20,
    "pags": 1
  }
}
msj
string
Status message: "Cargando plan de cuentas...".
status
boolean
true on success.
data
array
Array of account plan entry objects. Each item has the same shape as the new_account_plan object described in the POST response above.
pagination
object
Pagination metadata returned by the Paginate middleware.

Pagination

Account plan list endpoints use the /:pag?/:perpage? URL-segment pattern rather than query string parameters. Both segments are optional. The Paginate middleware defaults perpage to 10 when the segment is absent.
URL patternEffect
/api/account_plan/list/:company_idPage 1, 10 records per page
/api/account_plan/list/:company_id/2Page 2, 10 records per page
/api/account_plan/list/:company_id/1/20Page 1, 20 records per page
/api/account_plan/list/:company_id/3/10Page 3, 10 records per page
The Paginate middleware computes the skip offset ((pag - 1) * perpage) and injects req.body.skippag and req.body.limit before the controller runs. These values are used directly in the Mongoose .skip() and .limit() calls.

Error Responses

StatusBodyCause
401{"msj": "Sin autorizacion", "status": false}No token provided
403{"msj": "Sesion finalizada", "status": false}Token has expired
403{"msj": "No tienes permisos", "status": false}Caller role is not Admin or Super Admin
403{"msj": "Completea todos los campos", "status": false}One or more required body fields are missing (POST only)
404{"msj": "Empresa no encontrada", "status": false}No company found for the given company_id
500Mongoose/Node error objectUnexpected server error

Build docs developers (and LLMs) love