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.

The Clients resource in the sublimation module lets you register and manage the customers associated with a specific company. Each client record captures identity and contact information and is scoped to a single company_id. All four operations — create, update, list, and delete — are available through these endpoints.
All sublimation client endpoints require two middleware layers: TokenAny validates any active bearer token (company or user-company token), and TokenAuthorize('Admin', 'Super Admin') restricts access to users holding the Admin or Super Admin role. Include the token in every request using the token-access: Bearer $TOKEN header.

POST /api/client/create-client-company/:company_id

Creates a new client record associated with the given company. Path parameters
company_id
string
required
The MongoDB ObjectId of the company under which the client is registered.
Body parameters
document_type_client
string
The type of identification document. Accepted values: CC, NIT, CE, PP. Defaults to an empty string if omitted.
number_document_client
string
The client’s identification document number. Defaults to "Vacio" if omitted.
name_client
string
The client’s full name or business name (razón social). Defaults to "Vacio" if omitted.
email_client
string
The client’s email address. Defaults to "Vacio" if omitted.
phone_client
string
The client’s phone number. Defaults to "Vacio" if omitted.
Responses
msj
string
Human-readable result message. Returns "Nuevo cliente creado exitosamente" on success.
status
boolean
true on success, false on failure.
new_create_client
object
The newly created client document as stored in MongoDB, including the generated _id, all submitted fields, company, and createdAt/updatedAt timestamps.
curl -X POST https://api.example.com/api/client/create-client-company/64a1f2e3b5c8d90012345678 \
  -H "token-access: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "document_type_client": "CC",
    "number_document_client": "1023456789",
    "name_client": "Laura Gómez",
    "email_client": "laura@example.com",
    "phone_client": "3001234567"
  }'
{
  "msj": "Nuevo cliente creado exitosamente",
  "status": true,
  "new_create_client": {
    "_id": "64b2a3c4d6e7f80023456789",
    "company": "64a1f2e3b5c8d90012345678",
    "document_type_client": "CC",
    "number_document_client": "1023456789",
    "name_client": "Laura Gómez",
    "email_client": "laura@example.com",
    "phone_client": "3001234567",
    "createdAt": "2024-07-15T10:23:00.000Z",
    "updatedAt": "2024-07-15T10:23:00.000Z"
  }
}

PUT /api/client/update-client-company/:company_id/:client_id

Updates the fields of an existing client record. Path parameters
company_id
string
required
The MongoDB ObjectId of the company that owns the client.
client_id
string
required
The MongoDB ObjectId of the client to update.
Body parameters
document_type_client
string
Updated document type. Accepted values: CC, NIT, CE, PP.
number_document_client
string
Updated identification document number.
name_client
string
Updated client name or business name.
email_client
string
Updated email address.
phone_client
string
Updated phone number.
Responses
msj
string
Returns "Cliente actualizado correctamente" on success.
status
boolean
true on success, false on failure.
curl -X PUT https://api.example.com/api/client/update-client-company/64a1f2e3b5c8d90012345678/64b2a3c4d6e7f80023456789 \
  -H "token-access: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "document_type_client": "NIT",
    "number_document_client": "900123456-1",
    "name_client": "Gómez Textiles SAS",
    "email_client": "info@gomeztextiles.com",
    "phone_client": "6012345678"
  }'
{
  "msj": "Cliente actualizado correctamente",
  "status": true
}

GET /api/client/list-client-company/:company_id

Returns a paginated list of all clients belonging to a company. Pagination is handled by the Paginate middleware, which reads optional pag and perpage values and injects skippag and limit into req.body. Path parameters
company_id
string
required
The MongoDB ObjectId of the company whose clients are to be listed.
Pagination Append ?pag=1&perpage=10 as query parameters (or omit for defaults) to control the page number and results per page. The response includes a pagination object with the current page, items per page, and total page count. Responses
msj
string
Returns "Cargando clientes" on success.
status
boolean
true on success.
data
array
Array of client documents sorted by _id descending. Each element contains _id, company, document_type_client, number_document_client, name_client, email_client, phone_client, createdAt, and updatedAt.
pagination
object
Pagination metadata.
curl -X GET "https://api.example.com/api/client/list-client-company/64a1f2e3b5c8d90012345678?pag=1&perpage=10" \
  -H "token-access: Bearer $TOKEN"
{
  "msj": "Cargando clientes",
  "status": true,
  "data": [
    {
      "_id": "64b2a3c4d6e7f80023456789",
      "company": "64a1f2e3b5c8d90012345678",
      "document_type_client": "CC",
      "number_document_client": "1023456789",
      "name_client": "Laura Gómez",
      "email_client": "laura@example.com",
      "phone_client": "3001234567",
      "createdAt": "2024-07-15T10:23:00.000Z",
      "updatedAt": "2024-07-15T10:23:00.000Z"
    }
  ],
  "pagination": {
    "pag": "1",
    "perpage": 10,
    "pags": 1
  }
}

DELETE /api/client/delete-client-company/:client_id

Permanently removes a client record. Path parameters
client_id
string
required
The MongoDB ObjectId of the client to delete.
Responses
msj
string
Returns "Cliente eliminado exitosamente" on success.
status
boolean
true on success, false on failure.
curl -X DELETE https://api.example.com/api/client/delete-client-company/64b2a3c4d6e7f80023456789 \
  -H "token-access: Bearer $TOKEN"
{
  "msj": "Cliente eliminado exitosamente",
  "status": true
}

Build docs developers (and LLMs) love