Contactos
POST
Guardar contacto
POST /api/parties/set-party
Descripción
Crea o actualiza un contacto y todos sus sub-recursos en una sola operación atómica.
Detalles
* Permite dar de alta o modificar un contacto junto con sus direcciones, vehículos, datos de repartidor, receptores de factura y proveedores en una única transacción. * Si se envía sin identificador y el teléfono ya pertenece a otro contacto, se reutiliza ese contacto existente para evitar duplicados. * Falla si el teléfono enviado pertenece a un contacto distinto al que se está editando. * El teléfono es obligatorio cuando se incluyen sub-recursos de repartidor o proveedor.
Permisos requeridos
auth-tenant
Request
| Nombre | Tipo | Requerido | Reglas |
|---|---|---|---|
| partyId | int | No |
min_value:1
|
| phone | string | No |
max:30
|
| name | string | No |
max:150
|
| notes | string | No | — |
| creditType | string | No |
enum:none,fixed,unlimited
|
| creditLimitCents | int | No |
min_value:0
|
| addresses | array | No | — |
| addresses[].id | int | No |
min_value:1
|
| addresses[].label | string | No |
max:50
|
| addresses[].addressLine | string | No |
max:300
|
| addresses[].addressDetail | string | No |
max:300
|
| addresses[].addressReference | string | No |
max:300
|
| addresses[].city | string | No |
max:100
|
| addresses[].state | string | No |
max:100
|
| addresses[].countryCode | string | No |
max:2
|
| addresses[].postalCode | string | No |
max:20
|
| addresses[].latitude | string | No |
decimal
|
| addresses[].longitude | string | No |
decimal
|
| addresses[].notes | string | No | — |
| addresses[].isDefault | bool | No | — |
| vehicles | array | No | — |
| vehicles[].id | int | No |
min_value:1
|
| vehicles[].name | string | No |
max:200
|
| vehicles[].vehicleType | string | No |
enum:bike,motorcycle,car
|
| vehicles[].licensePlate | string | No |
max:20
|
| vehicles[].vehicleBrand | string | No |
max:50
|
| vehicles[].vehicleColor | string | No |
max:30
|
| vehicles[].notes | string | No | — |
| couriers | array | No | — |
| couriers[].id | int | No |
min_value:1
|
| couriers[].name | string | No |
max:150
|
| couriers[].platform | string | No |
max:50
|
| invoiceRecipients | array | No | — |
| invoiceRecipients[].id | int | No |
min_value:1
|
| invoiceRecipients[].name | string | No |
max:200
|
| invoiceRecipients[].documentTypeId | int | Sí |
min_value:1
|
| invoiceRecipients[].documentNumber | string | No |
max:50
|
| invoiceRecipients[].organizationTypeId | int | No |
min_value:1
|
| invoiceRecipients[].taxRegimeId | int | No |
min_value:1
|
| invoiceRecipients[].fiscalAddress | string | No |
max:300
|
| invoiceRecipients[].email | string | No |
max:150
|
| invoiceRecipients[].isDefault | bool | No | — |
| suppliers | array | No | — |
| suppliers[].id | int | No |
min_value:1
|
| suppliers[].name | string | No |
max:150
|
| suppliers[].supplierCode | string | No |
max:50
|
| suppliers[].paymentTermsDays | int | No |
min_value:0
|
| suppliers[].contactPersonName | string | No |
max:150
|
| suppliers[].contactPersonPhone | string | No |
max:30
|
| suppliers[].notes | string | No | — |
Ejemplo de request
curl -X POST https://app.restofy.co/api/parties/set-party \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <accessToken>"
Los valores son demo: reemplázalos por datos reales del negocio.
Ejemplo de respuesta
Actualizado: 2026-07-15T13:20:48Z
HTTP 200
Request
{
"name": "Empresa SAS",
"phone": "***",
"invoiceRecipients": [
{
"name": "Empresa SAS",
"documentTypeId": 3,
"documentNumber": "***",
"organizationTypeId": 1,
"taxRegimeId": 1,
"email": "***"
}
]
}
Response
{
"success": true,
"message": "Operación realizada correctamente",
"data": {
"party": {
"id": 3,
"phone": "***",
"name": "Empresa SAS",
"notes": null,
"creditType": "none",
"creditLimitCents": null,
"accountId": null,
"addresses": [],
"vehicles": [],
"couriers": [],
"invoiceRecipients": [
{
"id": 1,
"partyId": 3,
"name": "Empresa SAS",
"documentTypeId": 3,
"documentTypeCode": "nit",
"documentTypeName": "NIT",
"documentNumber": "***",
"organizationTypeId": 1,
"organizationTypeCode": "co.persona.natural",
"organizationTypeName": "Persona Natural",
"taxRegimeId": 1,
"taxRegimeCode": "co.responsable.iva",
"taxRegimeName": "Responsable de IVA",
"fiscalAddress": null,
"email": "***",
"isDefault": 0
}
],
"suppliers": []
}
}
}