Ir al contenido

Create or update a contact

POST
/v2/clients/{client_id}/contacts
curl --request POST \
--url https://api-agent.manoflow.com/v2/clients/4e2a8c3d-1b9f-4e6a-8c7d-9f0a1b2c3d4e/contacts \
--header 'Content-Type: application/json' \
--header 'x-kyto-key: <x-kyto-key>' \
--data '{ "user_id": "10000000042", "platform": "whatsapp", "language": "es", "lead_stage": "Lead Nuevo", "lead_stage_order": 1, "reachout_step": 0, "last_reachout_at": "2026-09-30T14:00:00.000Z", "attributes": { "orders_count": 2 } }'

Upsert by user_id: 201 created, 200 updated or unchanged, with result (created, updated, unchanged) in the answer. A field that is absent, null or an empty text keeps the stored value; clearing a field is not offered. name, first_name, whatsapp_name, phone and email only fill what is still empty (conversations own them); attributes merge per key. user_id and platform are required: the contact is found under any stored form of the id (10000000042 finds +10000000042, so a resend never makes a twin) and the answer’s user_id is the stored id. Unknown top-level fields are 422: extras go inside attributes, and an attributes key named like a field of the contact is reserved_name. The read-only fields of the answer (id, conversation_count, last_conversation_summary, created_at, updated_at) may be sent back and are ignored. Send lead_stage and lead_stage_order together. Every _at field is a JSON string YYYY-MM-DDTHH:MM:SS[.fraction](Z|+HH:MM): capital T, seconds, and Z or an offset. A time without an offset (timestamp_without_offset), an epoch number or string, a space instead of T, no seconds, a lowercase t or z, a date only, T24:00:00, a leap second or an impossible offset (invalid_timestamp) is 422: no time zone is ever guessed. Instants come back as UTC with milliseconds, YYYY-MM-DDTHH:MM:SS.sssZ.

client_id
required
string

The client the key belongs to (any other client is 403)

Example

4e2a8c3d-1b9f-4e6a-8c7d-9f0a1b2c3d4e

The contact. user_id and platform are required.

Media typeapplication/json
ContactIn

A contact, created or updated by user_id. A field that is absent or null keeps the stored value. name, first_name, whatsapp_name, phone and email only fill what is still empty (conversations own them). The read-only fields of the answer may be sent back and are ignored, so a contact that was searched can be written back.

object
user_id
required
User Id

The contact’s id on its channel: a phone with or without +, a WhatsApp reference (CO.123...) or an Instagram id. Found under any stored form. Required.

string
platform
required
Platform

The channel: a lowercase token (whatsapp, instagram, telegram, web…). It decides whether a bare number is a phone: only whatsapp (or a phone sent beside it) makes it one. Required.

string
name
Name
Any of:
string
first_name
First Name
Any of:
string
whatsapp_name
Whatsapp Name
Any of:
string
phone
Phone
Any of:
string
email
Email
Any of:
string
language
Language
Any of:
string
lead_score
Lead Score
Any of:
integer
lead_stage
Lead Stage

The funnel stage’s name; send lead_stage_order with it.

Any of:
string
lead_stage_order
Lead Stage Order
Any of:
integer
reachout_step
Reachout Step
Any of:
integer
last_reachout_at
Last Reachout At
Any of:
string format: date-time
last_conversation_at
Last Conversation At
Any of:
string format: date-time
attributes
Attributes

Extras that are not fields of this resource, any JSON. Merged per key; a null value keeps the stored one. A key named like a field is reserved_name.

Any of:
object
key
additional properties
any
id
Id
conversation_count
Conversation Count
last_conversation_summary
Last Conversation Summary
created_at
Created At
updated_at
Updated At

Example

{
"user_id": "10000000042",
"platform": "whatsapp",
"language": "es",
"lead_stage": "Lead Nuevo",
"lead_stage_order": 1,
"reachout_step": 0,
"last_reachout_at": "2026-09-30T14:00:00.000Z",
"attributes": {
"orders_count": 2
}
}

Updated or unchanged

Media typeapplication/json

Example

{
"id": "0c6f7a52-3d64-4b58-a1cd-5f0d1e2b9a10",
"user_id": "+10000000042",
"name": "Cliente Prueba",
"first_name": "Cliente",
"whatsapp_name": null,
"phone": "+10000000042",
"email": null,
"language": "es",
"lead_score": 10,
"lead_stage": "Lead Nuevo",
"lead_stage_order": 1,
"reachout_step": 1,
"last_reachout_at": null,
"last_conversation_at": "2026-09-01T10:00:00.000Z",
"last_conversation_summary": "Pregunta por apartamentos de 2 habitaciones.",
"conversation_count": 3,
"attributes": {
"orders_count": 2
},
"created_at": "2026-08-20T15:00:00.000Z",
"updated_at": "2026-09-01T10:05:00.000Z",
"result": "updated"
}
X-Request-Id
string

The request’s id: the one sent, or a generated one. On every log line of the request; quote it when reporting a problem.

Created

Media typeapplication/json

Example

{
"id": "0c6f7a52-3d64-4b58-a1cd-5f0d1e2b9a10",
"user_id": "+10000000042",
"name": "Cliente Prueba",
"first_name": "Cliente",
"whatsapp_name": null,
"phone": "+10000000042",
"email": null,
"language": "es",
"lead_score": 10,
"lead_stage": "Lead Nuevo",
"lead_stage_order": 1,
"reachout_step": 1,
"last_reachout_at": null,
"last_conversation_at": "2026-09-01T10:00:00.000Z",
"last_conversation_summary": "Pregunta por apartamentos de 2 habitaciones.",
"conversation_count": 3,
"attributes": {
"orders_count": 2
},
"created_at": "2026-08-20T15:00:00.000Z",
"updated_at": "2026-09-01T10:05:00.000Z",
"result": "created"
}
X-Request-Id
string

The request’s id: the one sent, or a generated one. On every log line of the request; quote it when reporting a problem.

The body is not valid JSON, or not a JSON object

Media typeapplication/problem+json

Example

{
"type": "https://api-agent.manoflow.com/problems/invalid-json",
"title": "The body is not valid JSON",
"status": 400,
"code": "invalid_json",
"request_id": "01J9ZK8Q4T7X2M5N6P3R1S0V9W"
}
X-Request-Id
string

The request’s id: the one sent, or a generated one. On every log line of the request; quote it when reporting a problem.

Missing, malformed, unknown or revoked key (one answer for all)

Media typeapplication/problem+json

Example

{
"type": "https://api-agent.manoflow.com/problems/unauthorized",
"title": "Missing, malformed, unknown or revoked key",
"status": 401,
"code": "unauthorized",
"request_id": "01J9ZK8Q4T7X2M5N6P3R1S0V9W"
}
X-Request-Id
string

The request’s id: the one sent, or a generated one. On every log line of the request; quote it when reporting a problem.

The key belongs to another client, or the client does not exist

Media typeapplication/problem+json

Example

{
"type": "https://api-agent.manoflow.com/problems/forbidden",
"title": "The key does not belong to this client",
"status": 403,
"code": "forbidden",
"request_id": "01J9ZK8Q4T7X2M5N6P3R1S0V9W"
}
X-Request-Id
string

The request’s id: the one sent, or a generated one. On every log line of the request; quote it when reporting a problem.

The body is over 1 MiB

Media typeapplication/problem+json

Example

{
"type": "https://api-agent.manoflow.com/problems/payload-too-large",
"title": "The body is too large",
"status": 413,
"code": "payload_too_large",
"detail": "The limit is 1 MiB.",
"request_id": "01J9ZK8Q4T7X2M5N6P3R1S0V9W"
}
X-Request-Id
string

The request’s id: the one sent, or a generated one. On every log line of the request; quote it when reporting a problem.

A write needs Content-Type: application/json

Media typeapplication/problem+json

Example

{
"type": "https://api-agent.manoflow.com/problems/unsupported-media-type",
"title": "Content-Type must be application/json",
"status": 415,
"code": "unsupported_media_type",
"request_id": "01J9ZK8Q4T7X2M5N6P3R1S0V9W"
}
X-Request-Id
string

The request’s id: the one sent, or a generated one. On every log line of the request; quote it when reporting a problem.

Well-formed JSON that cannot be stored: a wrong type, an unknown field, a time without an offset, a missing key. errors lists every invalid field with its JSON pointer and a stable code; nothing was stored

Media typeapplication/problem+json

Example

{
"type": "https://api-agent.manoflow.com/problems/validation-failed",
"title": "The request has invalid fields",
"status": 422,
"code": "validation_failed",
"detail": "2 fields are invalid",
"request_id": "01J9ZK8Q4T7X2M5N6P3R1S0V9W",
"errors": [
{
"pointer": "/last_reachout_at",
"code": "timestamp_without_offset",
"message": "must be ISO-8601 with Z or an offset"
},
{
"pointer": "/phone_number",
"code": "unknown_field",
"message": "is not a field of this resource (extras go inside attributes)"
}
]
}
X-Request-Id
string

The request’s id: the one sent, or a generated one. On every log line of the request; quote it when reporting a problem.

The key made too many requests this minute (only when a limit is set); wait the Retry-After seconds

Media typeapplication/problem+json

Example

{
"type": "https://api-agent.manoflow.com/problems/rate-limited",
"title": "Too many requests",
"status": 429,
"code": "rate_limited",
"request_id": "01J9ZK8Q4T7X2M5N6P3R1S0V9W"
}
X-Request-Id
string

The request’s id: the one sent, or a generated one. On every log line of the request; quote it when reporting a problem.

Unexpected error: quote the request_id

Media typeapplication/problem+json

Example

{
"type": "https://api-agent.manoflow.com/problems/internal-error",
"title": "Internal error",
"status": 500,
"code": "internal_error",
"request_id": "01J9ZK8Q4T7X2M5N6P3R1S0V9W"
}
X-Request-Id
string

The request’s id: the one sent, or a generated one. On every log line of the request; quote it when reporting a problem.