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.

Pharmacy clients are optional customer records that can be linked to a sale. Registering a client allows you to associate purchases with a named individual or business, track their contact details, and apply client-specific logic at checkout. The four endpoints below let you create, update, list, and delete pharmacy clients scoped to a company tenant.
All client endpoints require two authentication middlewares. TokenAny validates the bearer token and attaches the user to the request. TokenAuthorize('Admin', 'Super Admin') restricts access to users whose role is either Admin or Super Admin. Include the token in every request as token-access: Bearer $TOKEN.

Create a Client


POST /api/client-pharmacy/:company_id Registers a new pharmacy client for the specified company. Only name_client is required; all other fields default to placeholder values if omitted.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the owning company.

Body Parameters

name_client
string
required
Full name of the client.
email_client
string
Email address of the client. Defaults to "--------------" if not provided.
phone_client
string
Phone number of the client. Defaults to "--------------" if not provided.
nit_client
string
Tax identification number (NIT) of the client. Defaults to "Sin NIT" if not provided.
type_client
string
Client type. Must be one of: "Individual", "Empresa", "--------------". Defaults to "--------------".
address_client
string
Address of the client. Defaults to "--------------" if not provided.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success, false on failure.
save_client
object
The newly created client document.

Example

curl -X POST https://api.example.com/api/client-pharmacy/64a1f2c3e4b0a1b2c3d4e5f6 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN" \
  -d '{
    "name_client": "Carlos Ramírez",
    "email_client": "carlos@example.com",
    "phone_client": "3009876543",
    "nit_client": "1012345678",
    "type_client": "Individual",
    "address_client": "Carrera 10 # 20-30"
  }'
{
  "msj": "Cliente creado exitosamente",
  "status": true,
  "save_client": {
    "_id": "64i9j0k1l2m3n4o5p6q7r8s9",
    "name_client": "Carlos Ramírez",
    "email_client": "carlos@example.com",
    "phone_client": "3009876543",
    "nit_client": "1012345678",
    "type_client": "Individual",
    "address_client": "Carrera 10 # 20-30",
    "company_id": "64a1f2c3e4b0a1b2c3d4e5f6",
    "createdAt": "2024-01-15T10:00:00.000Z",
    "updatedAt": "2024-01-15T10:00:00.000Z"
  }
}

Update a Client


PUT /api/client-pharmacy/:company_id/updating/:client_id Updates all editable fields of an existing pharmacy client.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the owning company.
client_id
string
required
The MongoDB ObjectId of the client to update.

Body Parameters

name_client
string
required
Updated full name of the client.
email_client
string
Updated email address.
phone_client
string
Updated phone number.
nit_client
string
Updated tax identification number.
type_client
string
Updated client type. Must be one of: "Individual", "Empresa", "--------------".
address_client
string
Updated address.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success.

Example

curl -X PUT https://api.example.com/api/client-pharmacy/64a1f2c3e4b0a1b2c3d4e5f6/updating/64i9j0k1l2m3n4o5p6q7r8s9 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN" \
  -d '{
    "name_client": "Carlos A. Ramírez",
    "email_client": "carlos.a@example.com",
    "phone_client": "3009876543",
    "nit_client": "1012345678",
    "type_client": "Individual",
    "address_client": "Carrera 10 # 20-30, Apto 201"
  }'
{
  "msj": "Cliente actualizado exitosamente",
  "status": true
}

List Clients


GET /api/client-pharmacy/:company_id/:pag?/:perpage? Returns a paginated list of all pharmacy clients belonging to the specified company, sorted by most recently created.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the company whose clients to retrieve.
pag
number
Optional page number.
perpage
number
Optional results per page.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success.
data
array
Array of client documents for the company.
pagination
object
Pagination metadata.

Example

curl -X GET https://api.example.com/api/client-pharmacy/64a1f2c3e4b0a1b2c3d4e5f6/1/10 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN"
{
  "msj": "Cargando clientes",
  "status": true,
  "data": [
    {
      "_id": "64i9j0k1l2m3n4o5p6q7r8s9",
      "name_client": "Carlos Ramírez",
      "email_client": "carlos@example.com",
      "phone_client": "3009876543",
      "nit_client": "1012345678",
      "type_client": "Individual",
      "address_client": "Carrera 10 # 20-30",
      "company_id": "64a1f2c3e4b0a1b2c3d4e5f6",
      "createdAt": "2024-01-15T10:00:00.000Z",
      "updatedAt": "2024-01-15T10:00:00.000Z"
    }
  ],
  "pagination": {
    "pag": "1",
    "perpage": 10,
    "pags": 1
  }
}

Delete a Client


DELETE /api/client-pharmacy/:client_id Permanently removes a pharmacy client record. This action is irreversible.

Path Parameters

client_id
string
required
The MongoDB ObjectId of the client to delete.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success, false if the client was not found.

Example

curl -X DELETE https://api.example.com/api/client-pharmacy/64i9j0k1l2m3n4o5p6q7r8s9 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN"
{
  "msj": "Cliente eliminado exitosamente",
  "status": true
}

Build docs developers (and LLMs) love