{"x-mcp-tools":[{"name":"get_workspace","title":"Workspace, plan and usage","description":"The workspace name, plan, limits and how much of them is used this period.","read_only":true,"sends_messages":false},{"name":"list_numbers","title":"List WhatsApp numbers","description":"WhatsApp numbers in the workspace with status (only 'connected' numbers can send), messages sent today and today's cap.","read_only":true,"sends_messages":false},{"name":"search_contacts","title":"Search contacts","description":"Find contacts by phone, @username or name. Pages with cursor.","read_only":true,"sends_messages":false},{"name":"add_contacts","title":"Add or update contacts","description":"Create or update up to 100 contacts (phone with country code or @username, names, custom fields). Each is checked on WhatsApp.","read_only":false,"sends_messages":false},{"name":"list_campaigns","title":"List campaigns","description":"All campaigns with status, step count and results so far.","read_only":true,"sends_messages":false},{"name":"get_campaign","title":"Get a campaign","description":"A campaign's message steps, schedule and settings.","read_only":true,"sends_messages":false},{"name":"create_campaign","title":"Create a campaign","description":"Create a draft campaign with its message steps (first step has no wait_before; each follow-up needs one), schedule and settings. Doesn't send anything until start_campaign.","read_only":false,"sends_messages":false},{"name":"set_campaign_steps","title":"Replace a campaign's steps","description":"Replace the whole message sequence. Only while the campaign is a draft, or paused with no lead past the first message.","read_only":false,"sends_messages":false},{"name":"add_leads_to_campaign","title":"Add leads to a campaign","description":"Add up to 100 leads (existing contact ids and/or new contacts). If the campaign is active, they start receiving messages at the next send window. Reports leads not on WhatsApp and leads missing fields the messages use.","read_only":false,"sends_messages":true},{"name":"start_campaign","title":"Start a campaign","description":"Start or resume sending. This sends real WhatsApp messages to the campaign's leads: confirm with the user first.","read_only":false,"sends_messages":true},{"name":"pause_campaign","title":"Pause a campaign","description":"Stop sending for this campaign until it is started again.","read_only":false,"sends_messages":false},{"name":"get_campaign_stats","title":"Campaign results","description":"Leads by status, messages sent/delivered/read, replies, reply rate and lead statuses.","read_only":true,"sends_messages":false},{"name":"list_conversations","title":"List conversations","description":"Conversations with leads, newest activity first, with the last message and lead status (interested, meeting_booked, ...).","read_only":true,"sends_messages":false},{"name":"get_conversation","title":"Read a conversation","description":"A conversation and its most recent messages, newest first.","read_only":true,"sends_messages":false},{"name":"reply_to_conversation","title":"Reply in a conversation","description":"Send a WhatsApp reply to the lead in this conversation. Sends a real message: confirm the text with the user first.","read_only":false,"sends_messages":true},{"name":"set_lead_status","title":"Set a lead's status","description":"Mark a conversation's lead as interested, not_interested, meeting_booked, out_of_office, wrong_person or none.","read_only":false,"sends_messages":false}],"x-error-codes":[{"status":400,"code":"VALIDATION_ERROR","meaning":"A field is missing or invalid. details.issues lists each problem."},{"status":400,"code":"INVALID_ADDRESS","meaning":"Not a phone number with country code or a WhatsApp username."},{"status":400,"code":"INVALID_CURSOR","meaning":"The cursor is not one this API returned."},{"status":401,"code":"UNAUTHENTICATED","meaning":"No API key or token was sent."},{"status":401,"code":"INVALID_TOKEN","meaning":"The key or token is wrong, revoked or expired."},{"status":402,"code":"PLAN_LIMIT","meaning":"Your plan's limit for this resource is reached. details has the limit and current usage."},{"status":402,"code":"PLAN_INACTIVE","meaning":"The workspace has no active plan, or billing is past due."},{"status":403,"code":"WORKSPACE_SUSPENDED","meaning":"The workspace is suspended."},{"status":404,"code":"NOT_FOUND","meaning":"The resource doesn't exist in this workspace."},{"status":409,"code":"NO_CONNECTED_NUMBERS","meaning":"No WhatsApp number is connected (connect one in the app by scanning a QR code)."},{"status":409,"code":"NO_STEPS","meaning":"The campaign has no message steps yet."},{"status":409,"code":"CAMPAIGN_NOT_EDITABLE","meaning":"Steps can only be replaced while a campaign is a draft, or paused with no leads mid-sequence."},{"status":409,"code":"NUMBER_NOT_CONNECTED","meaning":"The number for this conversation is disconnected."},{"status":409,"code":"DAILY_CAP_REACHED","meaning":"This number has sent its 50 messages for today (UTC). details.resets_at says when it resets."},{"status":409,"code":"IDEMPOTENCY_KEY_REUSED","meaning":"This Idempotency-Key was already used with a different request body."},{"status":409,"code":"REQUEST_IN_PROGRESS","meaning":"A request with this Idempotency-Key is still running."},{"status":422,"code":"CONTACT_NOT_ON_WHATSAPP","meaning":"The phone number or username isn't on WhatsApp."},{"status":429,"code":"RATE_LIMITED","meaning":"Too many requests. Wait for the Retry-After seconds."},{"status":500,"code":"INTERNAL_ERROR","meaning":"Something failed on our side."},{"status":502,"code":"SEND_FAILED","meaning":"WhatsApp didn't accept the message. Try again."}],"x-webhook-events":["message.received","message.sent","message.status_updated","lead.status_changed","number.status_changed"],"x-rate-limit-per-minute":120,"openapi":"3.1.0","info":{"title":"Outreach Camel API","version":"1.0.0","description":"Run WhatsApp outreach from your own systems: contacts, campaigns, leads, replies and webhooks.\n\nAuthenticate with `Authorization: Bearer oc_live_...`. Create keys in the app under Settings, API.\nRate limit: 120 requests per minute per key. Docs: https://outreachcamel.com/docs","contact":{"email":"hello@outreachcamel.com","url":"https://outreachcamel.com/docs"}},"servers":[{"url":"https://api.outreachcamel.com"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Workspace"},{"name":"Numbers"},{"name":"Contacts"},{"name":"Campaigns"},{"name":"Conversations"},{"name":"Webhooks"}],"paths":{"/v1/me":{"get":{"operationId":"getMe","tags":["Workspace"],"summary":"Your workspace, plan, limits and usage","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"workspace":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"plan":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"},"status":{"type":"string","description":"active, past_due, canceled, ..."},"trial_ends_at":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp, UTC"},{"type":"null"}]},"period_ends_at":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp, UTC"},{"type":"null"}]}},"required":["name","status","trial_ends_at","period_ends_at"],"additionalProperties":false},{"type":"null"}]},"limits":{"anyOf":[{"type":"object","properties":{"numbers":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"campaigns":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"new_contacts_this_period":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"messages_this_period":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["numbers","campaigns","new_contacts_this_period","messages_this_period"],"additionalProperties":false},{"type":"null"}]},"usage":{"type":"object","properties":{"numbers":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"campaigns":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"new_contacts_this_period":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"messages_this_period":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["numbers","campaigns","new_contacts_this_period","messages_this_period"],"additionalProperties":false},"credential":{"type":"object","properties":{"type":{"type":"string","enum":["api_key","oauth"]},"name":{"type":"string"}},"required":["type","name"],"additionalProperties":false}},"required":["workspace","plan","limits","usage","credential"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/numbers":{"get":{"operationId":"listNumbers","tags":["Numbers"],"summary":"List WhatsApp numbers","description":"Every number in the workspace with its status, today's sends and today's cap. Numbers are connected in the app by scanning a QR code.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"E.164, e.g. +971501234567. Null until the number is linked."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"WhatsApp profile name"},"status":{"type":"string","description":"connected, qr_pending, disconnected or banned"},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"sent_today":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Outbound messages since 00:00 UTC"},"replies_today":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"daily_cap":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Most messages this number may send today (50, lower while warming up)"},"warmup":{"anyOf":[{"type":"object","properties":{"phase":{"type":"string"},"day":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"daily_limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"}},"required":["phase","day","daily_limit","active"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","phone","name","status","country","sent_today","replies_today","daily_cap","warmup","created_at"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/numbers/{id}":{"get":{"operationId":"getNumber","tags":["Numbers"],"summary":"Get a number","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"E.164, e.g. +971501234567. Null until the number is linked."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"WhatsApp profile name"},"status":{"type":"string","description":"connected, qr_pending, disconnected or banned"},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"sent_today":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Outbound messages since 00:00 UTC"},"replies_today":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"daily_cap":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Most messages this number may send today (50, lower while warming up)"},"warmup":{"anyOf":[{"type":"object","properties":{"phase":{"type":"string"},"day":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"daily_limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"}},"required":["phase","day","daily_limit","active"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","phone","name","status","country","sent_today","replies_today","daily_cap","warmup","created_at"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/contacts":{"get":{"operationId":"listContacts","tags":["Contacts"],"summary":"List or search contacts","parameters":[{"name":"limit","in":"query","required":false,"description":"Items per page, 1 to 100. Default 25.","schema":{"default":25,"description":"Items per page, 1 to 100. Default 25.","type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"next_cursor from the previous page","schema":{"description":"next_cursor from the previous page","type":"string"}},{"name":"search","in":"query","required":false,"description":"Matches phone digits, @username, first or last name","schema":{"description":"Matches phone digits, @username, first or last name","type":"string","maxLength":100}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"address":{"type":"string","description":"What you sent us, normalised: digits for phones, @username for usernames"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"E.164 if this contact is a phone number"},"username":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"@username if this contact is a WhatsApp username"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"custom_fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"on_whatsapp":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Null if it couldn't be checked (no connected number yet)"},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","address","phone","username","first_name","last_name","custom_fields","on_whatsapp","created_at"],"additionalProperties":false}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Pass as ?cursor= to get the next page. Null on the last page."}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createContact","tags":["Contacts"],"summary":"Create or update a contact","description":"Checks the number or username on WhatsApp (when a number is connected). Returns 201 when created, 200 when a contact with this address already existed and was updated.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Any unique string (e.g. a UUID). Retrying with the same key returns the first result instead of doing the work twice. Kept for 24 hours.","schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"phone":{"type":"string","minLength":3,"maxLength":64,"description":"Phone number with country code (+971501234567) or a WhatsApp username (@jane.doe)"},"username_key":{"description":"4-digit username key, if the person set one","type":"string","maxLength":8},"first_name":{"type":"string","maxLength":100},"last_name":{"type":"string","maxLength":100},"custom_fields":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":64},"additionalProperties":{"anyOf":[{"type":"string","maxLength":1000},{"type":"number"},{"type":"boolean"},{"type":"null"}]},"description":"Your own fields, usable in messages as {{field_name}}. Example: {\"company\": \"Acme\"}"}},"required":["phone"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"address":{"type":"string","description":"What you sent us, normalised: digits for phones, @username for usernames"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"E.164 if this contact is a phone number"},"username":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"@username if this contact is a WhatsApp username"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"custom_fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"on_whatsapp":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Null if it couldn't be checked (no connected number yet)"},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","address","phone","username","first_name","last_name","custom_fields","on_whatsapp","created_at"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/contacts/batch":{"post":{"operationId":"createContactsBatch","tags":["Contacts"],"summary":"Create or update up to 100 contacts","description":"Each row is handled on its own; one bad row doesn't stop the others. Check results[].status.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Any unique string (e.g. a UUID). Retrying with the same key returns the first result instead of doing the work twice. Kept for 24 hours.","schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contacts":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","maxLength":64},"username_key":{"description":"4-digit username key, if the person set one","type":"string","maxLength":8},"first_name":{"type":"string","maxLength":100},"last_name":{"type":"string","maxLength":100},"custom_fields":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":64},"additionalProperties":{"anyOf":[{"type":"string","maxLength":1000},{"type":"number"},{"type":"boolean"},{"type":"null"}]},"description":"Your own fields, usable in messages as {{field_name}}. Example: {\"company\": \"Acme\"}"}},"required":["phone"]}}},"required":["contacts"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string","enum":["created","updated","not_on_whatsapp","invalid","plan_limit"]},"contact":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"address":{"type":"string","description":"What you sent us, normalised: digits for phones, @username for usernames"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"E.164 if this contact is a phone number"},"username":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"@username if this contact is a WhatsApp username"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"custom_fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"on_whatsapp":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Null if it couldn't be checked (no connected number yet)"},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","address","phone","username","first_name","last_name","custom_fields","on_whatsapp","created_at"],"additionalProperties":false},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["index","status","contact","error"],"additionalProperties":false}},"summary":{"type":"object","properties":{"created":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"updated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["created","updated","failed"],"additionalProperties":false}},"required":["results","summary"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/contacts/{id}":{"get":{"operationId":"getContact","tags":["Contacts"],"summary":"Get a contact","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"address":{"type":"string","description":"What you sent us, normalised: digits for phones, @username for usernames"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"E.164 if this contact is a phone number"},"username":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"@username if this contact is a WhatsApp username"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"custom_fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"on_whatsapp":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Null if it couldn't be checked (no connected number yet)"},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","address","phone","username","first_name","last_name","custom_fields","on_whatsapp","created_at"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateContact","tags":["Contacts"],"summary":"Update a contact's names or custom fields","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"custom_fields":{"description":"Merged into the existing fields. Set a field to null to remove it.","type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":64},"additionalProperties":{"anyOf":[{"type":"string","maxLength":1000},{"type":"number"},{"type":"boolean"},{"type":"null"}]}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"address":{"type":"string","description":"What you sent us, normalised: digits for phones, @username for usernames"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"E.164 if this contact is a phone number"},"username":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"@username if this contact is a WhatsApp username"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"custom_fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"on_whatsapp":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Null if it couldn't be checked (no connected number yet)"},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","address","phone","username","first_name","last_name","custom_fields","on_whatsapp","created_at"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteContact","tags":["Contacts"],"summary":"Delete a contact","description":"Also removes them from campaigns and deletes their conversations.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deleted":{"type":"boolean","const":true}},"required":["id","deleted"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/campaigns":{"get":{"operationId":"listCampaigns","tags":["Campaigns"],"summary":"List campaigns with their stats","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"status":{"anyOf":[{"type":"string","enum":["draft","active","paused"]},{"type":"string"}]},"schedule":{"anyOf":[{"type":"object","properties":{"timezone":{"type":"string"},"start_time":{"type":"string"},"end_time":{"type":"string"},"days":{"type":"array","items":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"start_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["timezone","start_time","end_time","days","start_date","end_date"],"additionalProperties":false},{"type":"null"}]},"daily_limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stop_on_reply":{"type":"boolean"},"number_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"},"step_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stats":{"type":"object","properties":{"leads":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"delivered":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"replied":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reply_rate":{"type":"number"}},"required":["leads","sent","delivered","replied","reply_rate"],"additionalProperties":false}},"required":["id","name","status","schedule","daily_limit","stop_on_reply","number_ids","created_at","step_count","stats"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createCampaign","tags":["Campaigns"],"summary":"Create a campaign","description":"Creates a draft campaign, optionally with its message steps, schedule and settings in one call. Start it with POST /v1/campaigns/{id}/start.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Any unique string (e.g. a UUID). Retrying with the same key returns the first result instead of doing the work twice. Kept for 24 hours.","schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"steps":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"message":{"type":"string","minLength":1,"maxLength":4096,"description":"Text to send. Personalise with {{first_name}}, {{last_name}} or any custom field, e.g. {{company}}"},"wait_before":{"description":"How long after the previous message to send this one. Required for every step after the first.","anyOf":[{"type":"object","properties":{"value":{"type":"integer","minimum":1,"maximum":365},"unit":{"type":"string","enum":["minutes","hours","days"]}},"required":["value","unit"]},{"type":"null"}]}},"required":["message"]}},"schedule":{"description":"Defaults: UTC, 09:00 to 18:00, Monday to Friday","type":"object","properties":{"timezone":{"type":"string","description":"IANA time zone, e.g. Asia/Dubai"},"start_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Earliest send time, HH:MM in the time zone"},"end_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Latest send time, HH:MM"},"days":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"integer","minimum":0,"maximum":6},"description":"Days to send on: 0 = Sunday ... 6 = Saturday"},"start_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"end_date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]}}},"daily_limit":{"description":"Most messages this campaign sends per day across all numbers. Default 250.","type":"integer","minimum":1,"maximum":10000},"stop_on_reply":{"description":"Stop the sequence for a lead once they reply. Default true.","type":"boolean"},"number_ids":{"description":"Only send from these numbers. Empty or left out = all connected numbers.","maxItems":100,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["name"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"status":{"anyOf":[{"type":"string","enum":["draft","active","paused"]},{"type":"string"}]},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"},"wait_before":{"anyOf":[{"type":"object","properties":{"value":{"type":"integer","minimum":1,"maximum":365},"unit":{"type":"string","enum":["minutes","hours","days"]}},"required":["value","unit"],"additionalProperties":false},{"type":"null"}]},"wait_for_reply":{"type":"boolean","description":"Set for sequences built in the app that wait for a reply before this step"},"variables":{"type":"array","items":{"type":"string"}}},"required":["id","order","message","wait_before","wait_for_reply","variables"],"additionalProperties":false}},"schedule":{"anyOf":[{"type":"object","properties":{"timezone":{"type":"string"},"start_time":{"type":"string"},"end_time":{"type":"string"},"days":{"type":"array","items":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"start_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["timezone","start_time","end_time","days","start_date","end_date"],"additionalProperties":false},{"type":"null"}]},"daily_limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stop_on_reply":{"type":"boolean"},"number_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","name","status","steps","schedule","daily_limit","stop_on_reply","number_ids","created_at"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/campaigns/{id}":{"get":{"operationId":"getCampaign","tags":["Campaigns"],"summary":"Get a campaign with its steps and schedule","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"status":{"anyOf":[{"type":"string","enum":["draft","active","paused"]},{"type":"string"}]},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"},"wait_before":{"anyOf":[{"type":"object","properties":{"value":{"type":"integer","minimum":1,"maximum":365},"unit":{"type":"string","enum":["minutes","hours","days"]}},"required":["value","unit"],"additionalProperties":false},{"type":"null"}]},"wait_for_reply":{"type":"boolean","description":"Set for sequences built in the app that wait for a reply before this step"},"variables":{"type":"array","items":{"type":"string"}}},"required":["id","order","message","wait_before","wait_for_reply","variables"],"additionalProperties":false}},"schedule":{"anyOf":[{"type":"object","properties":{"timezone":{"type":"string"},"start_time":{"type":"string"},"end_time":{"type":"string"},"days":{"type":"array","items":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"start_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["timezone","start_time","end_time","days","start_date","end_date"],"additionalProperties":false},{"type":"null"}]},"daily_limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stop_on_reply":{"type":"boolean"},"number_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","name","status","steps","schedule","daily_limit","stop_on_reply","number_ids","created_at"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateCampaign","tags":["Campaigns"],"summary":"Update a campaign's name, schedule or settings","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"schedule":{"type":"object","properties":{"timezone":{"type":"string","description":"IANA time zone, e.g. Asia/Dubai"},"start_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Earliest send time, HH:MM in the time zone"},"end_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Latest send time, HH:MM"},"days":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"integer","minimum":0,"maximum":6},"description":"Days to send on: 0 = Sunday ... 6 = Saturday"},"start_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"end_date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]}}},"daily_limit":{"description":"Most messages this campaign sends per day across all numbers. Default 250.","type":"integer","minimum":1,"maximum":10000},"stop_on_reply":{"description":"Stop the sequence for a lead once they reply. Default true.","type":"boolean"},"number_ids":{"description":"Only send from these numbers. Empty or left out = all connected numbers.","maxItems":100,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"status":{"anyOf":[{"type":"string","enum":["draft","active","paused"]},{"type":"string"}]},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"},"wait_before":{"anyOf":[{"type":"object","properties":{"value":{"type":"integer","minimum":1,"maximum":365},"unit":{"type":"string","enum":["minutes","hours","days"]}},"required":["value","unit"],"additionalProperties":false},{"type":"null"}]},"wait_for_reply":{"type":"boolean","description":"Set for sequences built in the app that wait for a reply before this step"},"variables":{"type":"array","items":{"type":"string"}}},"required":["id","order","message","wait_before","wait_for_reply","variables"],"additionalProperties":false}},"schedule":{"anyOf":[{"type":"object","properties":{"timezone":{"type":"string"},"start_time":{"type":"string"},"end_time":{"type":"string"},"days":{"type":"array","items":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"start_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["timezone","start_time","end_time","days","start_date","end_date"],"additionalProperties":false},{"type":"null"}]},"daily_limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stop_on_reply":{"type":"boolean"},"number_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","name","status","steps","schedule","daily_limit","stop_on_reply","number_ids","created_at"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteCampaign","tags":["Campaigns"],"summary":"Delete a campaign","description":"Stops all its leads. Conversations and contacts are kept.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deleted":{"type":"boolean","const":true}},"required":["id","deleted"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/campaigns/{id}/steps":{"put":{"operationId":"replaceCampaignSteps","tags":["Campaigns"],"summary":"Replace a campaign's message steps","description":"Allowed while the campaign is a draft or paused, and no lead is past the first message.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"steps":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"message":{"type":"string","minLength":1,"maxLength":4096,"description":"Text to send. Personalise with {{first_name}}, {{last_name}} or any custom field, e.g. {{company}}"},"wait_before":{"description":"How long after the previous message to send this one. Required for every step after the first.","anyOf":[{"type":"object","properties":{"value":{"type":"integer","minimum":1,"maximum":365},"unit":{"type":"string","enum":["minutes","hours","days"]}},"required":["value","unit"]},{"type":"null"}]}},"required":["message"]}}},"required":["steps"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"status":{"anyOf":[{"type":"string","enum":["draft","active","paused"]},{"type":"string"}]},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":"string"},"wait_before":{"anyOf":[{"type":"object","properties":{"value":{"type":"integer","minimum":1,"maximum":365},"unit":{"type":"string","enum":["minutes","hours","days"]}},"required":["value","unit"],"additionalProperties":false},{"type":"null"}]},"wait_for_reply":{"type":"boolean","description":"Set for sequences built in the app that wait for a reply before this step"},"variables":{"type":"array","items":{"type":"string"}}},"required":["id","order","message","wait_before","wait_for_reply","variables"],"additionalProperties":false}},"schedule":{"anyOf":[{"type":"object","properties":{"timezone":{"type":"string"},"start_time":{"type":"string"},"end_time":{"type":"string"},"days":{"type":"array","items":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"start_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["timezone","start_time","end_time","days","start_date","end_date"],"additionalProperties":false},{"type":"null"}]},"daily_limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"stop_on_reply":{"type":"boolean"},"number_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","name","status","steps","schedule","daily_limit","stop_on_reply","number_ids","created_at"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/campaigns/{id}/leads":{"post":{"operationId":"addLeads","tags":["Campaigns"],"summary":"Add leads to a campaign","description":"Adds existing contacts (contact_ids) and/or new ones (contacts) to the campaign, up to 100 per request. Each lead is checked on WhatsApp and assigned to one of your connected numbers. If the campaign is active, the first message goes out at the next send window.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Any unique string (e.g. a UUID). Retrying with the same key returns the first result instead of doing the work twice. Kept for 24 hours.","schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contact_ids":{"description":"Existing contacts to add","maxItems":100,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"contacts":{"description":"New contacts, created and added in one go","maxItems":100,"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":3,"maxLength":64,"description":"Phone number with country code (+971501234567) or a WhatsApp username (@jane.doe)"},"username_key":{"description":"4-digit username key, if the person set one","type":"string","maxLength":8},"first_name":{"type":"string","maxLength":100},"last_name":{"type":"string","maxLength":100},"custom_fields":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":64},"additionalProperties":{"anyOf":[{"type":"string","maxLength":1000},{"type":"number"},{"type":"boolean"},{"type":"null"}]},"description":"Your own fields, usable in messages as {{field_name}}. Example: {\"company\": \"Acme\"}"}},"required":["phone"]}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"enrolled":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"already_enrolled":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"not_on_whatsapp":{"type":"array","items":{"type":"string"},"description":"Addresses skipped because they aren't on WhatsApp"},"own_numbers":{"type":"array","items":{"type":"string"},"description":"Skipped because they are one of your own numbers"},"contact_errors":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"error":{"type":"string"}},"required":["index","error"],"additionalProperties":false},"description":"Inline contacts that couldn't be created"},"missing_variables":{"type":"array","items":{"type":"object","properties":{"contact_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"variables":{"type":"array","items":{"type":"string"}}},"required":["contact_id","variables"],"additionalProperties":false},"description":"Leads missing a field the messages use. Their message would contain the raw {{tag}}; fill the field or remove them."}},"required":["enrolled","already_enrolled","not_on_whatsapp","own_numbers","contact_errors","missing_variables"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listLeads","tags":["Campaigns"],"summary":"List a campaign's leads","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"limit","in":"query","required":false,"description":"Items per page, 1 to 100. Default 25.","schema":{"default":25,"description":"Items per page, 1 to 100. Default 25.","type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"next_cursor from the previous page","schema":{"description":"next_cursor from the previous page","type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","replied","completed","eliminated"]}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"contact_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"contact":{"type":"object","properties":{"address":{"type":"string"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["address","first_name","last_name"],"additionalProperties":false},"number_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","description":"active, replied, completed or eliminated"},"current_step":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"next_send_at":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp, UTC"},{"type":"null"}]},"enrolled_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","contact_id","contact","number_id","status","current_step","next_send_at","enrolled_at"],"additionalProperties":false}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Pass as ?cursor= to get the next page. Null on the last page."}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/campaigns/{id}/start":{"post":{"operationId":"startCampaign","tags":["Campaigns"],"summary":"Start or resume a campaign","description":"Needs at least one message step and one connected number. Sending follows the schedule and the 50 messages a day per number cap.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string"}},"required":["id","status"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/campaigns/{id}/pause":{"post":{"operationId":"pauseCampaign","tags":["Campaigns"],"summary":"Pause a campaign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string"}},"required":["id","status"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/campaigns/{id}/stats":{"get":{"operationId":"getCampaignStats","tags":["Campaigns"],"summary":"Campaign results","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"campaign_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string"},"leads":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"replied":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"completed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"eliminated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["total","active","replied","completed","eliminated"],"additionalProperties":false},"messages":{"type":"object","properties":{"sent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"delivered":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"read":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["sent","delivered","read","failed"],"additionalProperties":false},"replied":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reply_rate":{"type":"number","description":"Replied leads / leads messaged, 0 to 1"},"lead_statuses":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"description":"Conversations by lead status"}},"required":["campaign_id","status","leads","messages","replied","reply_rate","lead_statuses"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/conversations":{"get":{"operationId":"listConversations","tags":["Conversations"],"summary":"List conversations (replies)","description":"Newest activity first. Warmup traffic between your own numbers is left out.","parameters":[{"name":"limit","in":"query","required":false,"description":"Items per page, 1 to 100. Default 25.","schema":{"default":25,"description":"Items per page, 1 to 100. Default 25.","type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"next_cursor from the previous page","schema":{"description":"next_cursor from the previous page","type":"string"}},{"name":"lead_status","in":"query","required":false,"schema":{"type":"string","enum":["interested","not_interested","meeting_booked","out_of_office","wrong_person","none"]}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["open","resolved"]}},{"name":"campaign_id","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"number_id","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"updated_since","in":"query","required":false,"description":"Only conversations with a message after this time","schema":{"description":"Only conversations with a message after this time","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"has_unread","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"number_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"number_phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"address":{"type":"string"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","address","first_name","last_name"],"additionalProperties":false},"status":{"type":"string","description":"open or resolved"},"lead_status":{"anyOf":[{"type":"string","enum":["interested","not_interested","meeting_booked","out_of_office","wrong_person","none"]},{"type":"string"}]},"lead_status_source":{"type":"string","enum":["ai","manual"]},"unread_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last_message_at":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp, UTC"},{"type":"null"}]},"last_message":{"anyOf":[{"type":"object","properties":{"direction":{"type":"string"},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["direction","body","created_at"],"additionalProperties":false},{"type":"null"}]},"campaign":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","number_id","number_phone","contact","status","lead_status","lead_status_source","unread_count","last_message_at","last_message","campaign","created_at"],"additionalProperties":false}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Pass as ?cursor= to get the next page. Null on the last page."}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/conversations/{id}":{"get":{"operationId":"getConversation","tags":["Conversations"],"summary":"Get a conversation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"number_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"number_phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"address":{"type":"string"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","address","first_name","last_name"],"additionalProperties":false},"status":{"type":"string","description":"open or resolved"},"lead_status":{"anyOf":[{"type":"string","enum":["interested","not_interested","meeting_booked","out_of_office","wrong_person","none"]},{"type":"string"}]},"lead_status_source":{"type":"string","enum":["ai","manual"]},"unread_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last_message_at":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp, UTC"},{"type":"null"}]},"last_message":{"anyOf":[{"type":"object","properties":{"direction":{"type":"string"},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["direction","body","created_at"],"additionalProperties":false},{"type":"null"}]},"campaign":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","number_id","number_phone","contact","status","lead_status","lead_status_source","unread_count","last_message_at","last_message","campaign","created_at"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateConversation","tags":["Conversations"],"summary":"Set lead status, or resolve / reopen","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_status":{"type":"string","enum":["interested","not_interested","meeting_booked","out_of_office","wrong_person","none"]},"status":{"type":"string","enum":["open","resolved"]}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"number_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"number_phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"address":{"type":"string"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","address","first_name","last_name"],"additionalProperties":false},"status":{"type":"string","description":"open or resolved"},"lead_status":{"anyOf":[{"type":"string","enum":["interested","not_interested","meeting_booked","out_of_office","wrong_person","none"]},{"type":"string"}]},"lead_status_source":{"type":"string","enum":["ai","manual"]},"unread_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last_message_at":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp, UTC"},{"type":"null"}]},"last_message":{"anyOf":[{"type":"object","properties":{"direction":{"type":"string"},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["direction","body","created_at"],"additionalProperties":false},{"type":"null"}]},"campaign":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","number_id","number_phone","contact","status","lead_status","lead_status_source","unread_count","last_message_at","last_message","campaign","created_at"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/conversations/{id}/messages":{"get":{"operationId":"listMessages","tags":["Conversations"],"summary":"List a conversation's messages","description":"Newest first.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"limit","in":"query","required":false,"description":"Items per page, 1 to 100. Default 25.","schema":{"default":25,"description":"Items per page, 1 to 100. Default 25.","type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"next_cursor from the previous page","schema":{"description":"next_cursor from the previous page","type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"direction":{"anyOf":[{"type":"string","enum":["inbound","outbound"]},{"type":"string"}]},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","description":"For outbound: pending, sent, delivered, read or failed"},"campaign_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"sent_at":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp, UTC"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","direction","body","status","campaign_id","sent_at","created_at"],"additionalProperties":false}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Pass as ?cursor= to get the next page. Null on the last page."}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"sendReply","tags":["Conversations"],"summary":"Reply in a conversation","description":"Sends from the number the conversation is on. Counts toward the plan's messages and the number's 50 a day.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Any unique string (e.g. a UUID). Retrying with the same key returns the first result instead of doing the work twice. Kept for 24 hours.","schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":4096}},"required":["body"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"direction":{"anyOf":[{"type":"string","enum":["inbound","outbound"]},{"type":"string"}]},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","description":"For outbound: pending, sent, delivered, read or failed"},"campaign_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"sent_at":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp, UTC"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","direction","body","status","campaign_id","sent_at","created_at"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks":{"get":{"operationId":"listWebhooks","tags":["Webhooks"],"summary":"List webhook endpoints","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"active":{"type":"boolean"},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"}},"required":["id","url","events","active","created_at"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createWebhook","tags":["Webhooks"],"summary":"Add a webhook endpoint","description":"The response includes the signing secret. It is shown only once.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri","description":"https URL that will receive POSTs"},"events":{"minItems":1,"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.status_updated","lead.status_changed","number.status_changed"]},"description":"Events to send"}},"required":["url","events"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"active":{"type":"boolean"},"created_at":{"type":"string","description":"ISO 8601 timestamp, UTC"},"secret":{"type":"string","description":"Signing secret (whsec_...). Shown only once: store it now."}},"required":["id","url","events","active","created_at","secret"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks/{id}":{"delete":{"operationId":"deleteWebhook","tags":["Webhooks"],"summary":"Delete a webhook endpoint","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deleted":{"type":"boolean","const":true}},"required":["id","deleted"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks/{id}/test":{"post":{"operationId":"testWebhook","tags":["Webhooks"],"summary":"Send a test event","description":"Sends a signed webhook.test event and reports what your endpoint answered.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"delivered":{"type":"boolean"},"status_code":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["delivered","status_code","error"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key (oc_live_...) or OAuth access token (oc_at_...)"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","INVALID_ADDRESS","INVALID_CURSOR","UNAUTHENTICATED","INVALID_TOKEN","PLAN_LIMIT","PLAN_INACTIVE","WORKSPACE_SUSPENDED","NOT_FOUND","NO_CONNECTED_NUMBERS","NO_STEPS","CAMPAIGN_NOT_EDITABLE","NUMBER_NOT_CONNECTED","DAILY_CAP_REACHED","IDEMPOTENCY_KEY_REUSED","REQUEST_IN_PROGRESS","CONTACT_NOT_ON_WHATSAPP","RATE_LIMITED","INTERNAL_ERROR","SEND_FAILED"]},"message":{"type":"string"},"details":{"type":"object","additionalProperties":true}}}}}}}}