Examples
All examples use the test company 4e2a8c3d-1b9f-4e6a-8c7d-9f0a1b2c3d4e and send these headers (GET requests do not need Content-Type):
x-kyto-key: kyto_xxxxxxxx…Content-Type: application/jsonRoutes are written relative to https://api-agent.manoflow.com/v2/clients/{client_id}/. Every field is in the API reference.
Find or create a contact
Section titled “Find or create a contact”When a conversation starts, look up the contact.
POST contacts/search{ "user_id": "10000000042", "platform": "whatsapp" }You can also search by phone: { "phone": "+1 000 000 0042" } (accepts +, spaces, -, (, ) and .).
- If you send both
user_idandphone,user_idwins. - The search finds the contact under any stored form of the number:
10000000042finds+10000000042. - The response is
{ contact, match_count }. Keepcontact.id: the timeline and the contact filters need it. - Only
404withcode: "contact_not_found"means a new contact. Any other error is a failure.
const BASE = 'https://api-agent.manoflow.com/v2/clients/4e2a8c3d-1b9f-4e6a-8c7d-9f0a1b2c3d4e';const headers = { 'x-kyto-key': process.env.MANOFLOW_KEY, 'Content-Type': 'application/json' };
const res = await fetch(`${BASE}/contacts/search`, { method: 'POST', headers, body: JSON.stringify({ user_id: '10000000042', platform: 'whatsapp' }),});const data = await res.json();
let contact = null;if (res.ok) { contact = data.contact; // known contact} else if (res.status === 404 && data.code === 'contact_not_found') { contact = null; // new contact} else { throw new Error(`manoflow ${res.status} ${data.code} ${data.request_id}`); // failure}To create or update the contact:
POST contacts{ "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 }}user_idandplatformare required. Withplatform: "whatsapp", a number without+is stored as a phone (+10000000042). An Instagram id goes withplatform: "instagram"and is stored as is.name,first_name,whatsapp_name,phoneandemailonly fill empty values. To change them, use thecontactobject when you save a conversation.- Send
lead_stageandlead_stage_ordertogether. last_conversation_atonly moves forward: an older value is ignored.
Filter contacts
Section titled “Filter contacts”For example, for a follow-up campaign: contacts with lead_score greater than 2 and reachout_step less than 4.
curl -g "https://api-agent.manoflow.com/v2/clients/4e2a8c3d-1b9f-4e6a-8c7d-9f0a1b2c3d4e/contacts?lead_score[gt]=2&reachout_step[lt]=4&limit=100" \ -H "x-kyto-key: $MANOFLOW_KEY"| Parameter | Rule |
|---|---|
lead_score, reachout_step, conversation_count, lead_stage_order |
field[op]=value with op = gt, gte, lt, lte or eq (no op means eq) |
last_conversation_at, last_reachout_at |
Instant with a zone, or a YYYY-MM-DD day |
lead_stage, language |
Equality only (language=es) |
limit, cursor |
See pagination |
All filters are combined with AND. There are no filters by phone, name or email: use the search for that.
Read a contact’s timeline
Section titled “Read a contact’s timeline”A contact’s conversations, orders and bookings, newest first. Useful as context for an AI agent.
GET contacts/0c6f7a52-3d64-4b58-a1cd-5f0d1e2b9a10/timeline?limit=100{ "contact_id": "0c6f7a52-3d64-4b58-a1cd-5f0d1e2b9a10", "counts": { "conversations": 1, "orders": 1, "bookings": 1 }, "events": [ { "type": "booking", "occurred_at": "2026-09-20T12:00:00.000Z", "booking_id": "bk-0001", "kind": "stay", "status": "confirmed", "check_in_date": "2026-10-10", "nights": 3, "guests": 2 }, { "type": "order", "occurred_at": "2026-09-10T09:30:00.000Z", "order_id": "ord-0001", "status": "confirmed", "payment_status": "paid", "total": 150000, "currency": "COP" }, { "type": "conversation", "occurred_at": "2026-09-01T10:00:00.000Z", "conversation_id": "conv_01_test", "summary": "Asks about apartments.", "qualification": "hot", "message_count": 12 } ]}- Use
contact.idfrom the search, never the phone. limitapplies to each event type, not to the total.- It does not include message text: only the summary and the count.
- No history:
200withevents: [].
Save a conversation
Section titled “Save a conversation”When the conversation ends, save the summary, the qualification and the transcript.
POST conversations{ "conversation_id": "conv_01_test", "platform": "whatsapp", "user_id": "10000000042", "started_at": "2026-09-30T14:00:00.000Z", "summary": "Asks about apartments.", "qualification": "hot", "tags": ["pricing"], "lead_score": 7, "contact": { "name": "Cliente Prueba", "first_name": "Cliente", "phone": "+10000000042" }, "messages": [ { "sender": "user", "content": "Hi", "sent_at": "2026-09-30T14:00:00.000Z" }, { "sender": "bot", "content": "Hi, how can I help?", "sent_at": "2026-09-30T14:00:02.000Z" } ], "attributes": { "country": "CO" }}The first time it answers 201 with "messages": {"received": 2, "inserted": 2} and "result": "created". The same body again answers 200 with inserted: 0 and "result": "unchanged".
conversation_idandplatformare required. Use your bot platform’s conversation id.user_idlinks the conversation to the contact. Withoutuser_idit is saved with no contact (for example, on web chat).contactupdates the contact’s details when it has values: this is where name, phone and email are set. It requiresuser_id.- Messages are only added, never changed or deleted. Resending the full transcript is safe: messages already stored are skipped.
senderisuser,botoragent(a person on your team).started_atis set the first time and does not change.- How the conversation ended goes in
conversation_result, notresult.
Create a stay or an appointment
Section titled “Create a stay or an appointment”POST bookings stores two kinds of booking, chosen by kind.
Stay (kind: "stay"):
{ "booking_id": "bk-0001", "kind": "stay", "user_id": "+10000000042", "platform": "whatsapp", "conversation_id": "conv_01_test", "status": "confirmed", "hotel": "Hostal Prueba", "hotel_country": "CO", "check_in_date": "2026-10-10", "nights": 3, "guests": 2, "total_value": 450000, "currency": "COP", "booked_at": "2026-09-20T12:00:00.000Z", "source_updated_at": "2026-09-21T08:00:00.000Z"}Appointment (kind: "appointment"), for example a visit to a sales room:
{ "booking_id": "ap-0001", "kind": "appointment", "user_id": "+10000000042", "platform": "whatsapp", "conversation_id": "conv_01_test", "meeting_type": "in_person", "project": "Proyecto Prueba", "scheduled_at": "2026-10-03T15:00:00.000Z", "notes": "Visit to the sales room"}| Kind | Own fields |
|---|---|
stay |
hotel, hotel_country, check_in_date, nights, guests, total_value, currency, observation |
appointment |
meeting_type (required: in_person or virtual), project, scheduled_at, notes, meeting_result |
status:pending,confirmed,completed,cancelledorreviewed.- A field of the other kind is
422withfield_not_allowed. check_in_dateis a day (YYYY-MM-DD). An appointment’s time goes inscheduled_at, with a zone.- If you sync from your booking system, send
source_updated_at: an older version answersstaleand overwrites nothing.
To list stays and appointments:
GET bookings?status=confirmed&created_from=2026-09-01&created_to=2026-09-30&limit=50created_from and created_to take a local day (inclusive) or an instant with a zone. contact_id filters by contact. Newest first.
Create an order
Section titled “Create an order”POST orders{ "order_id": "ord-0001", "user_id": "+10000000042", "type": "product", "source": "checkout", "status": "confirmed", "payment_status": "pending", "currency": "COP", "subtotal": 150000, "tax": 0, "total": 150000, "items": [ { "item_id": "sku-1", "name": "Product", "quantity": 1, "unit_price": 150000 } ], "ordered_at": "2026-09-10T09:30:00.000Z", "source_updated_at": "2026-09-12T11:00:00.000Z"}source:checkout,hubspot_syncoragent.status:pending,processing,confirmedorcancelled.payment_status:pendingorpaid.itemsreplaces the stored list. Each item’s price isunit_price.- The total goes in
total; there is noamountfield.
To list a contact’s orders: GET orders?contact_id=0c6f7a52-3d64-4b58-a1cd-5f0d1e2b9a10&limit=10. Without contact_id it lists all your company’s orders.
Create a human-support ticket
Section titled “Create a human-support ticket”When the contact asks to talk to a person:
POST tickets{ "ticket_id": "tk-0001", "conversation_id": "conv_01_test", "user_id": "+10000000042", "platform": "whatsapp", "status": "open", "priority": "medium", "reason": "The contact asks to talk to a person", "entity_type": "hotel", "entity_name": "Hotel Prueba", "updated_by": "bot"}status:open,in_progress,resolvedorclosed.priority:low,medium,highorurgent.entity_type:hotel,store,branch,clinicorother.assigned_toandresolved_byare emails of people on your team in Manoflow.- The response includes
history(status and assignment changes) andtime_to_solve_secondsonce resolved.
Read the knowledge base
Section titled “Read the knowledge base”GET kbReturns, in one call, what the bot can tell a customer: business_info, offerings (products and services), locations, policies and faqs. Only active rows are included. Your team edits it in Manoflow and the change shows on the next read.
truncated: truemeans a list had more than 500 rows.404withcode: "kb_not_available"means your company’s knowledge base is not available through the API. It is a configuration matter, not a sign that the business has no information: contact Manoflow.
Several writes in one call
Section titled “Several writes in one call”POST batch takes up to 500 writes of any resource. Each body is exactly the body of that resource’s POST.
{ "items": [ { "resource": "contacts", "body": { "user_id": "+10000000042", "platform": "whatsapp", "lead_stage": "Lead Nuevo", "lead_stage_order": 1 } }, { "resource": "contacts", "body": { "user_id": "+10000000043", "platform": "whatsapp", "lead_score": "high" } } ]}Response 200:
{ "total": 2, "succeeded": 1, "results": [ { "index": 0, "status": 200, "result": "updated", "id": "0c6f7a52-3d64-4b58-a1cd-5f0d1e2b9a10" }, { "index": 1, "status": 422, "problem": { "status": 422, "code": "validation_failed", "errors": [ { "pointer": "/lead_score", "code": "not_a_number", "message": "must be a number" } ] } } ]}(The real problem also has type, title, detail and request_id.)
resource:contacts,conversations,bookings,ordersortickets.- A
200does not mean everything was saved. Comparesucceededwithtotalor check each item’sstatus. - Each item is saved separately and in order: it is not all or nothing.
- An item’s
pointeris relative to itsbody. - The whole call fails (and nothing is saved) only when the envelope is invalid: empty
items, more than 500 items, an unknown top-level key or invalid JSON. - To retry, resend the items that failed with
5xxor the whole batch (it is safe). Do not resend a422without fixing it.