Skip to main content
POST
/
api
/
v1
/
clientes
Create or Update Client
curl --request POST \
  --url https://api.example.com/api/v1/clientes \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": 123,
  "dni": "<string>",
  "nombreCompleto": "<string>",
  "correo": "<string>",
  "telefono": "<string>"
}
'
{
  "id": 123,
  "dni": "<string>",
  "nombreCompleto": "<string>",
  "correo": "<string>",
  "telefono": "<string>"
}

Endpoint

POST /api/v1/clientes
Create a new client or update an existing client’s information. If a client with the provided ID exists, their information will be updated.

Request Body

id
number
Client ID (optional - omit for new clients, include for updates)
dni
string
required
National ID number (DNI) - Must be exactly 8 digits
nombreCompleto
string
required
Client’s full name
correo
string
required
Client’s email address - Used for shipment tracking and notifications
telefono
string
required
Client’s phone number - Must be exactly 9 digits

Response

Returns the created or updated client object:
id
number
Unique client identifier (auto-generated for new clients)
dni
string
National ID number
nombreCompleto
string
Client’s full name
correo
string
Client’s email address
telefono
string
Client’s phone number

Example Request - New Client

curl -X POST http://localhost:8080/api/v1/clientes \
  -H "Content-Type: application/json" \
  -d '{
    "dni": "12345678",
    "nombreCompleto": "María García",
    "correo": "[email protected]",
    "telefono": "987654321"
  }'

Example Response

{
  "id": 1,
  "dni": "12345678",
  "nombreCompleto": "María García",
  "correo": "[email protected]",
  "telefono": "987654321"
}

Example Request - Update Existing Client

curl -X POST http://localhost:8080/api/v1/clientes \
  -H "Content-Type: application/json" \
  -d '{
    "id": 1,
    "dni": "12345678",
    "nombreCompleto": "María García López",
    "correo": "[email protected]",
    "telefono": "987654321"
  }'

Validation Rules

  • DNI: Must be exactly 8 numeric characters
  • Telefono: Must be exactly 9 numeric characters
  • Correo: Must be a valid email format
  • NombreCompleto: Cannot be empty

Use Cases

  • Register new clients during shipment creation
  • Update client contact information
  • Import clients from external systems
  • Self-service client registration portals

Build docs developers (and LLMs) love