Skip to main content
POST
/
api
/
clientes
Create Public Client
curl --request POST \
  --url https://api.example.com/api/clientes \
  --header 'Content-Type: application/json' \
  --data '
{
  "nombres": "<string>",
  "apellidos": "<string>",
  "telefono": "<string>",
  "email": "<string>"
}
'
{
  "message": "<string>",
  "cliente": {
    "id": 123,
    "nombres": "<string>",
    "apellidos": "<string>",
    "telefono": "<string>",
    "email": "<string>",
    "created_at": "<string>"
  }
}

Overview

Creates a new public client in the system. This endpoint is public and doesn’t require authentication.
No Authentication RequiredThis is a public endpoint. Clients are typically created automatically when booking appointments via POST /api/citas, but this endpoint allows manual client creation.

Request Body

nombres
string
required
First name(s) of the client
apellidos
string
Last name(s) of the client (optional)
telefono
string
Phone number (optional)
email
string
Email address (optional)

Response

message
string
Success message: “Cliente creado”
cliente
object
The created client object

Example Request

cURL
curl -X POST http://localhost:3000/api/clientes \
  -H "Content-Type: application/json" \
  -d '{
    "nombres": "Pedro",
    "apellidos": "Martínez",
    "telefono": "+5551234567",
    "email": "[email protected]"
  }'
JavaScript
const response = await fetch('http://localhost:3000/api/clientes', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    nombres: 'Pedro',
    apellidos: 'Martínez',
    telefono: '+5551234567',
    email: '[email protected]'
  })
});
const data = await response.json();

Example Response

201 Created
{
  "message": "Cliente creado",
  "cliente": {
    "id": 42,
    "nombres": "Pedro",
    "apellidos": "Martínez",
    "telefono": "+5551234567",
    "email": "[email protected]",
    "created_at": "2024-03-05T15:30:00.000Z"
  }
}

Error Responses

{
  "message": "Error al crear cliente"
}
Invalid data was provided (e.g., missing required nombres field).

Use Cases

  • Pre-registering clients before appointment booking
  • Importing client data from external systems
  • Manual client record creation by staff
Source: /home/daytona/workspace/source/src/routes/clientes.routes.js:9

Build docs developers (and LLMs) love