{"openapi":"3.1.0","info":{"title":"Replify WhatsApp API","description":"\nSend and receive WhatsApp messages from your own software.\n\n**Authentication.** Create a key in Replify under *Settings > Developers* and send it on every request:\n`Authorization: Bearer esk_live_...`. Keys are shown once; revoke a leaked key there at any time.\n\n**Errors.** Every error looks like `{\"error\": {\"code\": \"window_closed\", \"message\": \"...\"}}`. Rate limit: 60 requests per minute per key.\n\n**Retries without duplicates.** Send an `Idempotency-Key` header (any unique string up to 200 characters) with `POST /messages`.\nRepeating the request with the same key returns the original result instead of sending a second message.\n\n**Webhooks.** Set your endpoint in *Settings > Developers*. Replify POSTs JSON events (`message.received`, `message.sent`,\n`message.delivered`, `message.read`, `message.failed`) and retries failures for about 7 hours. Verify each request with the\nsigning secret: the `X-Replify-Signature` header is `t=<unix time>,v1=<hex>` where `v1` is the HMAC-SHA256 of `\"<t>.<raw body>\"`\nusing your secret. Reject requests whose `t` is more than 5 minutes old.\n\n**WhatsApp rules.** Free-form text can only be sent within 24 hours of the customer's last message\n(`window_closed` otherwise). To start a conversation, or after 24 hours, send an approved template.\nWhatsApp message charges are billed to your own WhatsApp Business account by Meta.\n","version":"1.0.0"},"servers":[{"url":"/v1"}],"paths":{"/messages":{"post":{"tags":["Messages"],"summary":"Send a message","description":"Send a text or template message. Returns once WhatsApp has accepted it; delivery and read receipts arrive as webhooks\n(or poll `GET /messages/{message_id}`).","operationId":"api_send_message_messages_post","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiSendMessage"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Messages"],"summary":"List recent messages (both directions)","operationId":"api_list_messages_messages_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Return messages older than this message_id","title":"Before"},"description":"Return messages older than this message_id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/messages/{message_id}":{"get":{"tags":["Messages"],"summary":"Get a message and its delivery status","operationId":"api_get_message_messages__message_id__get","parameters":[{"name":"message_id","in":"path","required":true,"schema":{"type":"string","title":"Message Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/templates":{"get":{"tags":["Templates"],"summary":"List your message templates","operationId":"api_list_templates_templates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["Templates"],"summary":"Submit a template for WhatsApp approval","description":"Body: `name`, `category` (UTILITY or MARKETING), `language`, `body` (use {{1}}, {{2}} for variables), `examples` (one per variable), optional `footer`.","operationId":"api_create_template_templates_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/account":{"get":{"tags":["Account"],"summary":"WhatsApp account status","description":"Whether you can send, and why not if you can't (payment method, business verification), plus your daily conversation limit.","operationId":"api_account_account_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/usage":{"get":{"tags":["Account"],"summary":"Messages and API requests this month","operationId":"api_usage_usage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"ApiSendMessage":{"properties":{"to":{"type":"string","title":"To","description":"Recipient phone number with country code","examples":["+923001234567"]},"type":{"type":"string","enum":["text","template"],"title":"Type","description":"'text' (only within 24 hours of the customer's last message) or 'template'"},"text":{"anyOf":[{"type":"string","maxLength":4096},{"type":"null"}],"title":"Text","description":"Message text, required when type is 'text'","examples":["Your order is ready for pickup."]},"template":{"anyOf":[{"$ref":"#/components/schemas/ApiTemplate"},{"type":"null"}],"description":"Required when type is 'template'"}},"type":"object","required":["to","type"],"title":"ApiSendMessage"},"ApiTemplate":{"properties":{"name":{"type":"string","title":"Name","description":"Template name, as listed by GET /templates","examples":["order_update"]},"language":{"type":"string","title":"Language","description":"Template language code","examples":["en_US"]},"params":{"items":{"type":"string"},"type":"array","title":"Params","description":"Values for {{1}}, {{2}} ... in order","examples":[["Sara","#1042"]]}},"type":"object","required":["name","language"],"title":"ApiTemplate"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}