{"openapi":"3.1.0","info":{"title":"Chatensy API","version":"1.1.0","description":"Send WhatsApp messages, manage contacts, start journeys and subscribe to events.\n\nAuthenticate with `Authorization: Bearer <key>` (create keys in Integrations → API). Limits: 120 requests per minute per key; every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Errors are JSON `{error, code?, fields?}`."},"servers":[{"url":"https://chatensy.in"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Account"},{"name":"Messages"},{"name":"Contacts"},{"name":"Templates"},{"name":"Journeys"},{"name":"Store events"},{"name":"Webhooks"}],"paths":{"/api/v1/me":{"get":{"operationId":"getMe","tags":["Account"],"summary":"Check your key","description":"Returns the workspace, WhatsApp number and key name. Use it to test a connection.","responses":{"200":{"description":"Who this key belongs to","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/sandbox/inbound":{"post":{"operationId":"sandboxInbound","tags":["Sandbox"],"summary":"Receive a message as a customer (sandbox only)","description":"Acts as a customer writing to your sandbox number, so your webhooks and inbox see a real inbound message. Only works with a key made inside a sandbox workspace (Developers → Sandbox).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["from","text"],"properties":{"from":{"type":"string","example":"+15550100001"},"text":{"type":"string","maxLength":1000,"example":"Where is my order?"},"name":{"type":"string","example":"Asha"}}}}}},"responses":{"201":{"description":"Received","content":{"application/json":{"schema":{"type":"object","properties":{"conversation_id":{"type":"string","nullable":true},"message_id":{"type":"string","nullable":true}}}}}},"403":{"description":"Not a sandbox workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/sandbox/status":{"post":{"operationId":"sandboxStatus","tags":["Sandbox"],"summary":"Change a sent message's status (sandbox only)","description":"Moves a message you sent to delivered, read or failed, as Meta would, so your status webhooks fire. Only works in a sandbox workspace.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["message_id","status"],"properties":{"message_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["delivered","read","failed"]}}}}}},"responses":{"200":{"description":"Done","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"403":{"description":"Not a sandbox workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such sent message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/messages/template":{"post":{"operationId":"sendTemplate","tags":["Messages"],"summary":"Send a template message","description":"Sends an approved template. Starts a conversation even when the 24-hour window is closed. Marketing templates need the contact's opt-in.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["to","template"],"properties":{"to":{"type":"string","description":"Recipient phone, international format","example":"+919876543210"},"template":{"type":"string","description":"Template name","example":"order_update"},"language":{"type":"string","description":"Language code; defaults to the contact's language version when approved","example":"en"},"values":{"type":"array","items":{"type":"string"},"description":"Values for {{1}}, {{2}}…","example":["Aarav","#1042"]},"header_media_url":{"type":"string","format":"uri","description":"Image/video/document URL for media-header templates"}}}}}},"responses":{"201":{"description":"Sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendResult"}}}},"403":{"description":"Not opted in or over the plan quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Template not found or not approved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"No connected WhatsApp number","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"WhatsApp rejected the message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/messages/text":{"post":{"operationId":"sendText","tags":["Messages"],"summary":"Send a text message","description":"Free-form text. Works only inside the 24-hour window after the customer last wrote to you.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["to","text"],"properties":{"to":{"type":"string","example":"+919876543210"},"text":{"type":"string","maxLength":4096,"example":"Your order is out for delivery 🚚"}}}}}},"responses":{"201":{"description":"Sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendResult"}}}},"409":{"description":"Window closed or the contact never messaged you","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"WhatsApp rejected the message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/messages":{"get":{"operationId":"listMessages","tags":["Messages"],"summary":"List recent messages","description":"Newest first. Handy for polling; prefer webhooks for real-time.","parameters":[{"name":"direction","in":"query","schema":{"type":"string","enum":["in","out"]},"description":"in = from customers, out = sent by you"},{"name":"since","in":"query","schema":{"type":"string","format":"date-time"},"description":"Only messages at or after this time"},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Messages","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Message"}}}}}}},"422":{"description":"Bad since value","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/contacts":{"get":{"operationId":"listContacts","tags":["Contacts"],"summary":"List contacts","description":"Newest first.","parameters":[{"name":"tag","in":"query","schema":{"type":"string"},"description":"Only contacts with this tag"},{"name":"since","in":"query","schema":{"type":"string","format":"date-time"},"description":"Only contacts created at or after this time"},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"per_page","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Contacts","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"page":{"type":"integer"},"per_page":{"type":"integer"},"has_more":{"type":"boolean"}}}}}},"422":{"description":"Bad since value","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"upsertContact","tags":["Contacts"],"summary":"Create or update a contact","description":"Matched by phone. Tags are replaced; attributes are merged.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["phone"],"properties":{"phone":{"type":"string","example":"+919876543210"},"name":{"type":"string","example":"Aarav Mehta"},"email":{"type":"string","format":"email"},"city":{"type":"string"},"language":{"type":"string","example":"hi"},"tags":{"type":"array","items":{"type":"string"},"example":["VIP"]},"attributes":{"type":"object","additionalProperties":true,"example":{"last_order":"#1042"}},"opt_in":{"type":"boolean","description":"Marketing consent you collected"},"opt_in_source":{"type":"string","example":"checkout_checkbox"}}}}}},"responses":{"200":{"description":"The contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"422":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/contacts/{phone}":{"get":{"operationId":"getContact","tags":["Contacts"],"summary":"Get a contact","parameters":[{"name":"phone","in":"path","required":true,"description":"Phone number in international format, digits only or with +, e.g. 919876543210","schema":{"type":"string","example":"919876543210"}}],"responses":{"200":{"description":"The contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/contacts/{phone}/tags":{"post":{"operationId":"addTags","tags":["Contacts"],"summary":"Add tags to a contact","description":"Adding a tag can start journeys triggered by \"tag added\".","parameters":[{"name":"phone","in":"path","required":true,"description":"Phone number in international format, digits only or with +, e.g. 919876543210","schema":{"type":"string","example":"919876543210"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["tags"],"properties":{"tags":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":20,"example":["Lead"]}}}}}},"responses":{"200":{"description":"The contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"No tags sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/contacts/{phone}/tags/{tag}":{"delete":{"operationId":"removeTag","tags":["Contacts"],"summary":"Remove a tag from a contact","parameters":[{"name":"phone","in":"path","required":true,"description":"Phone number in international format, digits only or with +, e.g. 919876543210","schema":{"type":"string","example":"919876543210"}},{"name":"tag","in":"path","required":true,"schema":{"type":"string"},"example":"Lead"}],"responses":{"200":{"description":"The contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/templates":{"get":{"operationId":"listTemplates","tags":["Templates"],"summary":"List templates","responses":{"200":{"description":"Templates","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/journeys":{"get":{"operationId":"listJourneys","tags":["Journeys"],"summary":"List journeys","responses":{"200":{"description":"Journeys","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Journey"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/journeys/{id}/enroll":{"post":{"operationId":"enrollInJourney","tags":["Journeys"],"summary":"Add a contact to a journey","description":"Creates the contact if needed. A contact is in each journey once; opted-out contacts are skipped.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["phone"],"properties":{"phone":{"type":"string","example":"+919876543210"},"context":{"type":"object","additionalProperties":true,"description":"Values steps can use, e.g. order_number","example":{"order_number":"#1042"}}}}}}},"responses":{"201":{"description":"Enrolled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Enrollment"}}}},"200":{"description":"Not enrolled (already in it, or opted out)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Enrollment"}}}},"403":{"description":"Journeys need the Growth plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Journey not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Journey is not active","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/events":{"post":{"operationId":"sendStoreEvent","tags":["Store events"],"summary":"Send a store event","description":"Triggers store automations and journeys (cart reminders, order updates, COD confirmation) from any shop platform.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","phone"],"properties":{"event":{"type":"string","enum":["cart.abandoned","order.created","order.paid","order.shipped","order.delivered","order.cancelled"]},"phone":{"type":"string","example":"+919876543210"},"customer_name":{"type":"string","example":"Aarav Mehta"},"order_id":{"type":"string","example":"5551234567"},"order_number":{"type":"string","example":"#1042"},"order_total":{"type":"number","example":1499},"payment_method":{"type":"string","enum":["cod","prepaid"]},"checkout_url":{"type":"string","format":"uri"},"tracking_url":{"type":"string","format":"uri"},"items":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"quantity":{"type":"integer"}}}},"marketing_opt_in":{"type":"boolean"}},"additionalProperties":true}}}},"responses":{"202":{"description":"Accepted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"422":{"description":"Unknown event","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/webhooks":{"get":{"operationId":"listWebhooks","tags":["Webhooks"],"summary":"List webhook subscriptions","responses":{"200":{"description":"Subscriptions","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"createWebhook","tags":["Webhooks"],"summary":"Subscribe to events","description":"We POST `{event, data, created_at}` to your HTTPS URL, signed: `X-Signature` is the hex HMAC-SHA256 of the raw body with the returned secret. Revoking the API key removes subscriptions it made.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url","events"],"properties":{"url":{"type":"string","format":"uri","example":"https://hooks.example.com/whatsapp"},"events":{"type":"array","items":{"$ref":"#/components/schemas/EventName"},"minItems":1,"example":["message.received"]},"source":{"type":"string","enum":["api","zapier","n8n"],"default":"api"}}}}}},"responses":{"201":{"description":"Subscribed (the secret is only returned here)","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Webhook"},{"type":"object","properties":{"secret":{"type":"string","example":"whsec_…"}}}]}}}},"403":{"description":"Webhooks need the Growth plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Bad URL or event","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/webhooks/{id}":{"delete":{"operationId":"deleteWebhook","tags":["Webhooks"],"summary":"Unsubscribe","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/webhooks/events":{"get":{"operationId":"listWebhookEvents","tags":["Webhooks"],"summary":"Event types with sample payloads","responses":{"200":{"description":"Events","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"event":{"$ref":"#/components/schemas/EventName"},"description":{"type":"string"},"sample":{"$ref":"#/components/schemas/WebhookPayload"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}}},"webhooks":{"message.received":{"post":{"summary":"A customer sent a WhatsApp message","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"message.received"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"message.received","data":{"contact_id":"01a17c00-0000-7000-8000-000000000001","phone":"+919876543210","bsuid":null,"name":"Aarav Mehta","type":"text","text":"Is the linen shirt available in XL?","wamid":"wamid.HBgMOTE5ODc2NTQzMjEwFQIAEhgg"},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"message.status":{"post":{"summary":"A message you sent was delivered, read or failed","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"message.status"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"message.status","data":{"wamid":"wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgS","status":"read","error":null},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"contact.opted_in":{"post":{"summary":"A contact opted in to marketing","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"contact.opted_in"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"contact.opted_in","data":{"contact_id":"01a17c00-0000-7000-8000-000000000001","phone":"+919876543210","bsuid":null},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"contact.opted_out":{"post":{"summary":"A contact opted out (e.g. replied STOP)","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"contact.opted_out"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"contact.opted_out","data":{"contact_id":"01a17c00-0000-7000-8000-000000000001","phone":"+919876543210","bsuid":null},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"conversation.assigned":{"post":{"summary":"A conversation was assigned to an agent","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"conversation.assigned"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"conversation.assigned","data":{"conversation_id":"01a17c00-0000-7000-8000-0000000000c1","user_id":"01a17c00-0000-7000-8000-0000000000a1"},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"order.cod_confirmed":{"post":{"summary":"A customer confirmed a cash-on-delivery order","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"order.cod_confirmed"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"order.cod_confirmed","data":{"order_ref":"5551234567","contact_id":"01a17c00-0000-7000-8000-000000000001"},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"order.cod_cancelled":{"post":{"summary":"A customer cancelled a cash-on-delivery order","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"order.cod_cancelled"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"order.cod_cancelled","data":{"order_ref":"5551234567","contact_id":"01a17c00-0000-7000-8000-000000000001"},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"campaign.finished":{"post":{"summary":"A broadcast campaign finished sending","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"campaign.finished"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"campaign.finished","data":{"campaign_id":"01a17c00-0000-7000-8000-0000000000d1","name":"Diwali sale","sent":4820,"delivered":4710,"read":3902,"failed":110},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"conversation.sla_breached":{"post":{"summary":"A conversation missed its first-response target","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"conversation.sla_breached"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"conversation.sla_breached","data":{"conversation_id":"01a17c00-0000-7000-8000-0000000000c1"},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"conversation.rated":{"post":{"summary":"A customer rated a conversation (CSAT)","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"conversation.rated"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"conversation.rated","data":{"conversation_id":"01a17c00-0000-7000-8000-0000000000c1","rating":5},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"message.sent_from_app":{"post":{"summary":"Someone replied from the WhatsApp Business app (Coexistence)","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"message.sent_from_app"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"message.sent_from_app","data":{"contact_id":"01a17c00-0000-7000-8000-000000000001","phone":"+919876543210","type":"text","wamid":"wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgT"},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"order.prepaid":{"post":{"summary":"A COD order was converted to prepaid","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"order.prepaid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"order.prepaid","data":{"order_ref":"5551234567","order_number":"#1042","amount":1499,"contact_id":"01a17c00-0000-7000-8000-000000000001"},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"flow.completed":{"post":{"summary":"A customer submitted a WhatsApp form","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"flow.completed"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"flow.completed","data":{"flow_id":"01a17c00-0000-7000-8000-0000000000f1","flow_name":"Lead form","contact_id":"01a17c00-0000-7000-8000-000000000001","phone":"+919876543210","answers":{"name":"Riya Kapoor","email":"riya@example.com","interest":"Bulk / wholesale"}},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}},"payment.paid":{"post":{"summary":"A customer paid a payment request sent in chat","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"hex HMAC-SHA256 of the raw body"},{"name":"X-Event","in":"header","required":true,"schema":{"type":"string","const":"payment.paid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"},"example":{"event":"payment.paid","data":{"contact_id":"01a17c00-0000-7000-8000-000000000001","phone":"+919876543210","bsuid":null,"payment_id":"01a17c00-0000-7000-8000-0000000000e1","amount":1499,"currency":"INR","provider":"razorpay","reference":"pay_Nx12abc345","description":"Linen shirt, size L"},"created_at":"2026-10-26T10:15:00+00:00"}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Other responses are retried with back-off; 10 failures in a row pause the endpoint."}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key, e.g. tsc_live_…"}},"responses":{"Unauthorized":{"description":"Missing, invalid or revoked key, or a blocked IP address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"Too many requests; retry after the Retry-After header","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string"},"fields":{"type":"object","additionalProperties":{"type":"string"}},"meta_code":{"type":"integer"}}},"Me":{"type":"object","properties":{"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"plan":{"type":"string"},"timezone":{"type":"string"}}},"whatsapp":{"type":["object","null"],"properties":{"phone":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"quality":{"type":["string","null"]}}},"api_key":{"type":"object","properties":{"name":{"type":"string"},"prefix":{"type":"string"}}}}},"SendResult":{"type":"object","properties":{"message_id":{"type":"string"},"wamid":{"type":["string","null"]},"status":{"type":"string","enum":["sent","failed"]},"error_code":{"type":["integer","null"]}}},"Contact":{"type":"object","properties":{"id":{"type":"string"},"phone":{"type":"string","example":"+919876543210"},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"city":{"type":["string","null"]},"language":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"attributes":{"type":"object","additionalProperties":true},"opt_in_status":{"type":["string","null"],"enum":["opted_in","opted_out","unknown",null]},"window_open":{"type":"boolean","description":"Inside the 24-hour customer service window"},"created_at":{"type":"string"}}},"Message":{"type":"object","properties":{"id":{"type":"string"},"contact_id":{"type":"string"},"phone":{"type":["string","null"]},"name":{"type":["string","null"]},"direction":{"type":"string","enum":["in","out"]},"type":{"type":"string"},"text":{"type":"string"},"status":{"type":"string"},"wamid":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"}}},"Template":{"type":"object","properties":{"name":{"type":"string"},"language":{"type":"string"},"category":{"type":"string","enum":["marketing","utility","authentication"]},"status":{"type":"string"},"variables":{"type":"integer"},"body":{"type":"string"}}},"Journey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"trigger":{"type":"string"},"steps":{"type":"integer"},"enrolled":{"type":"integer"}}},"Enrollment":{"type":"object","properties":{"enrolled":{"type":"boolean"},"reason":{"type":["string","null"],"enum":["already_enrolled","opted_out",null]},"contact":{"$ref":"#/components/schemas/Contact"}}},"EventName":{"type":"string","enum":["message.received","message.status","contact.opted_in","contact.opted_out","conversation.assigned","order.cod_confirmed","order.cod_cancelled","campaign.finished","conversation.sla_breached","conversation.rated","message.sent_from_app","order.prepaid","flow.completed","payment.paid"]},"Webhook":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"$ref":"#/components/schemas/EventName"}},"status":{"type":"string","enum":["active","paused"]},"source":{"type":"string"},"created_at":{"type":"string","format":"date-time"}}},"WebhookPayload":{"type":"object","required":["event","data","created_at"],"properties":{"event":{"$ref":"#/components/schemas/EventName"},"data":{"type":"object","additionalProperties":true},"created_at":{"type":"string","format":"date-time"}}}}}}