Skip to main content
PUT
/
api
/
clientes
/
:id
Update Client
curl --request PUT \
  --url https://api.example.com/api/clientes/:id \
  --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

Updates information for an existing public client.
No Authentication RequiredThis is currently a public endpoint, though it may be restricted in future versions.

Path Parameters

id
number
required
The unique identifier of the client

Request Body

All fields are optional. Only provided fields will be updated.
nombres
string
First name(s)
apellidos
string
Last name(s)
telefono
string
Phone number
email
string
Email address

Response

message
string
Success message: “Cliente actualizado”
cliente
object
The updated client object

Example Request

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

Example Response

200 OK
{
  "message": "Cliente actualizado",
  "cliente": {
    "id": 42,
    "nombres": "Pedro",
    "apellidos": "Martínez",
    "telefono": "+5559876543",
    "email": "[email protected]",
    "created_at": "2024-03-05T15:30:00.000Z"
  }
}

Error Responses

{
  "message": "Cliente no encontrado"
}
No client exists with the specified ID.
{
  "message": "Error al actualizar cliente"
}
An error occurred while updating the client.

Use Cases

  • Clients updating their own contact information
  • Staff correcting client data errors
  • Updating email or phone numbers
Source: /home/daytona/workspace/source/src/routes/clientes.routes.js:65

Build docs developers (and LLMs) love