{
    "openapi": "3.0.3",
    "info": {
        "title": "Tavros Connect WhatsApp API",
        "version": "1.0.0",
        "description": "Meta WhatsApp Cloud API-compatible API. Bodies, responses and errors follow Meta's Cloud API. Full guide: https://tavrosconnect.com/docs\n\nKeys: tc_live_… sends real messages; tc_test_… is a sandbox (validated, nothing sent, simulated webhook statuses). Rate limit headers: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset; 429 + Retry-After when exceeded.",
        "contact": {
            "name": "Tavros Connect",
            "url": "https://tavrosconnect.com/docs",
            "email": "tavrosconnect@gmail.com"
        }
    },
    "servers": [
        {
            "url": "https://tavrosconnect.com/api/v1"
        },
        {
            "url": "https://tavrosconnect.com/v23.0",
            "description": "Meta-style path (same API)"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "paths": {
        "/{phone_number_id}/messages": {
            "post": {
                "summary": "Send a message or mark one as read",
                "operationId": "sendMessage",
                "tags": [
                    "Messages"
                ],
                "description": "Any Cloud API message type (template, text, image, document, video, audio, sticker, interactive, location, contacts, reaction), or {\"status\":\"read\",\"message_id\":…}. Optional header X-Contact-Name (URL-encoded) names the customer in Chats.",
                "parameters": [
                    {
                        "name": "phone_number_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Your WhatsApp phone number id (Developers page)."
                    },
                    {
                        "name": "X-Contact-Name",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/MessageRequest"
                            },
                            "examples": {
                                "template": {
                                    "value": {
                                        "messaging_product": "whatsapp",
                                        "to": "919876543210",
                                        "type": "template",
                                        "template": {
                                            "name": "payment_receipt_v1",
                                            "language": {
                                                "code": "en"
                                            },
                                            "components": [
                                                {
                                                    "type": "body",
                                                    "parameters": [
                                                        {
                                                            "type": "text",
                                                            "text": "Priya"
                                                        },
                                                        {
                                                            "type": "text",
                                                            "text": "2499"
                                                        }
                                                    ]
                                                }
                                            ]
                                        }
                                    }
                                },
                                "text": {
                                    "value": {
                                        "messaging_product": "whatsapp",
                                        "to": "919876543210",
                                        "type": "text",
                                        "text": {
                                            "body": "Your order is ready"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Accepted by WhatsApp",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MessageResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/{phone_number_id}/media": {
            "post": {
                "summary": "Upload media",
                "operationId": "uploadMedia",
                "tags": [
                    "Media"
                ],
                "parameters": [
                    {
                        "name": "phone_number_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Your WhatsApp phone number id (Developers page)."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "messaging_product",
                                    "file"
                                ],
                                "properties": {
                                    "messaging_product": {
                                        "type": "string",
                                        "enum": [
                                            "whatsapp"
                                        ]
                                    },
                                    "type": {
                                        "type": "string",
                                        "example": "application/pdf"
                                    },
                                    "file": {
                                        "type": "string",
                                        "format": "binary"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Media id",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/{media_id}": {
            "get": {
                "summary": "Media info (url points to /{media_id}/download)",
                "operationId": "getMedia",
                "tags": [
                    "Media"
                ],
                "parameters": [
                    {
                        "name": "media_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Media info",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "url": {
                                            "type": "string"
                                        },
                                        "mime_type": {
                                            "type": "string"
                                        },
                                        "sha256": {
                                            "type": "string"
                                        },
                                        "file_size": {
                                            "type": "integer"
                                        },
                                        "id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/{media_id}/download": {
            "get": {
                "summary": "Download media bytes",
                "operationId": "downloadMedia",
                "tags": [
                    "Media"
                ],
                "parameters": [
                    {
                        "name": "media_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "File",
                        "content": {
                            "application/octet-stream": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/{waba_id}/message_templates": {
            "get": {
                "summary": "List message templates / read their status",
                "operationId": "listTemplates",
                "tags": [
                    "Templates"
                ],
                "description": "Key permission: Read message templates. Use fields=name,language,status,category,rejected_reason to pick fields and ?name=… to find one template (status: APPROVED, PENDING, REJECTED, PAUSED…).",
                "parameters": [
                    {
                        "name": "waba_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "name",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "language",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "fields",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "after",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "before",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Templates",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "additionalProperties": true
                                            }
                                        },
                                        "paging": {
                                            "type": "object",
                                            "additionalProperties": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "summary": "Create a template and submit it to Meta for approval",
                "operationId": "createTemplate",
                "tags": [
                    "Templates"
                ],
                "description": "Key permission: Manage templates. Meta's format. A HEADER with format IMAGE, VIDEO or DOCUMENT takes its sample as example.header_url (a public https link to a JPEG/PNG, MP4 or PDF; Tavros uploads it to Meta for you) or example.header_handle. With a live key this is a real Meta submission (review usually takes minutes; the result arrives as a message_template_status_update webhook). With a test key the request is only validated and a fake id with status PENDING is returned — nothing is sent to Meta or saved.",
                "parameters": [
                    {
                        "name": "waba_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "name",
                                    "language",
                                    "category",
                                    "components"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "lowercase letters, numbers, underscores"
                                    },
                                    "language": {
                                        "type": "string",
                                        "example": "en"
                                    },
                                    "category": {
                                        "type": "string",
                                        "enum": [
                                            "MARKETING",
                                            "UTILITY",
                                            "AUTHENTICATION"
                                        ]
                                    },
                                    "components": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "additionalProperties": true
                                        }
                                    }
                                }
                            },
                            "example": {
                                "name": "order_ready",
                                "language": "en",
                                "category": "UTILITY",
                                "components": [
                                    {
                                        "type": "BODY",
                                        "text": "Hi {{1}}, your order {{2}} is ready for pickup.",
                                        "example": {
                                            "body_text": [
                                                [
                                                    "Rahul",
                                                    "A-1042"
                                                ]
                                            ]
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Submitted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "example": "PENDING"
                                        },
                                        "category": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "delete": {
                "summary": "Delete a template by name",
                "operationId": "deleteTemplate",
                "tags": [
                    "Templates"
                ],
                "description": "Key permission: Manage templates. Deletes every language of the name, or only one language with hsm_id (the template id). Meta does not allow re-using a deleted name for 30 days. Test keys only validate.",
                "parameters": [
                    {
                        "name": "waba_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "name",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "hsm_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Deleted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/{waba_id}/message_template_samples": {
            "post": {
                "summary": "Upload a sample file for an IMAGE / VIDEO / DOCUMENT template header",
                "operationId": "uploadTemplateSample",
                "tags": [
                    "Templates"
                ],
                "description": "Key permission: Manage templates. Returns a handle to pass as example.header_handle when creating the template. JPEG/PNG up to 5 MB, MP4 up to 16 MB or PDF up to 20 MB. Alternatively skip this call and send a public https link as example.header_url on the create call — Tavros uploads it for you.",
                "parameters": [
                    {
                        "name": "waba_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "file"
                                ],
                                "properties": {
                                    "file": {
                                        "type": "string",
                                        "format": "binary"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Handle",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "h": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/{template_id}": {
            "post": {
                "summary": "Edit a template",
                "operationId": "editTemplate",
                "tags": [
                    "Templates"
                ],
                "description": "Key permission: Manage templates. Send components and/or category; Meta reviews the template again (status PENDING until the webhook says otherwise). Meta limits edits (an approved template can be edited about once a day, 10 times a month). Test keys only validate.",
                "parameters": [
                    {
                        "name": "template_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The id returned when the template was created."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "category": {
                                        "type": "string"
                                    },
                                    "components": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "additionalProperties": true
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/contacts": {
            "post": {
                "summary": "Save customer names / tags (Tavros Connect extension)",
                "operationId": "saveContacts",
                "tags": [
                    "Contacts"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "contacts": {
                                        "type": "array",
                                        "maxItems": 1000,
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "phone"
                                            ],
                                            "properties": {
                                                "phone": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "tags": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "Added to the contact; never removed unless replace_tags is true."
                                                },
                                                "attrs": {
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "type": "string"
                                                    },
                                                    "description": "Custom fields (max 20), usable as template variables."
                                                },
                                                "opted_out": {
                                                    "type": "boolean",
                                                    "description": "true marks the customer opted out of campaigns; false never re-subscribes them."
                                                },
                                                "consent": {
                                                    "type": "boolean",
                                                    "description": "false: known contact who has not agreed to WhatsApp messages — kept out of campaigns and drips (names still show in Chats). true: agreed. Omit to leave unchanged."
                                                },
                                                "replace_tags": {
                                                    "type": "boolean",
                                                    "description": "true: tags become exactly the list sent."
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "contacts": [
                                    {
                                        "phone": "919876543210",
                                        "name": "Rahul Patil",
                                        "tags": [
                                            "members"
                                        ],
                                        "attrs": {
                                            "profile_id": "SDG-1042",
                                            "city": "Kolhapur"
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Result per contact",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "test": {
                                            "type": "boolean"
                                        },
                                        "created": {
                                            "type": "integer"
                                        },
                                        "updated": {
                                            "type": "integer"
                                        },
                                        "invalid": {
                                            "type": "integer"
                                        },
                                        "over_limit": {
                                            "type": "integer"
                                        },
                                        "contacts": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "phone": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "enum": [
                                                            "created",
                                                            "updated",
                                                            "invalid",
                                                            "over_limit"
                                                        ]
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/messages/{wamid}": {
            "get": {
                "summary": "Delivery status of one message",
                "operationId": "getMessageStatus",
                "tags": [
                    "Message status"
                ],
                "description": "Key permission: Send messages. Only messages sent with this key. Built from the status events Meta sent us (Meta has no status-read endpoint), with Meta’s own timestamps in UTC. refresh=true only adds a note saying so.",
                "parameters": [
                    {
                        "name": "wamid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "refresh",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Message status",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MessageStatus"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/messages/status:batch": {
            "post": {
                "summary": "Delivery status of up to 100 messages",
                "operationId": "batchMessageStatus",
                "tags": [
                    "Message status"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "wamids"
                                ],
                                "properties": {
                                    "wamids": {
                                        "type": "array",
                                        "minItems": 1,
                                        "maxItems": 100,
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "refresh": {
                                        "type": "boolean"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Found messages and the ids that were not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/MessageStatus"
                                            }
                                        },
                                        "not_found": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/messages": {
            "get": {
                "summary": "List sent messages with their status (cursor-paginated)",
                "operationId": "listMessages",
                "tags": [
                    "Message status"
                ],
                "description": "Messages sent with this key, oldest first (order=desc for newest first). since/until filter on the time we accepted the message.",
                "parameters": [
                    {
                        "name": "since",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "until",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "accepted",
                                "sent",
                                "delivered",
                                "read",
                                "failed"
                            ]
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 100,
                            "maximum": 200
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "order",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "asc",
                                "desc"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/MessageStatus"
                                            }
                                        },
                                        "next_cursor": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "has_more": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/webhooks/replay": {
            "post": {
                "summary": "Re-send stored status events to your webhook",
                "operationId": "replayWebhooks",
                "tags": [
                    "Webhooks"
                ],
                "description": "Send either wamids (up to 500) or since/until (events we received in that window; at most 1000 events per call). One delivery per event, Meta format, signed like live ones; follow them with GET /webhooks/deliveries?replay=true. 5 requests per minute.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "wamids": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "since": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "until": {
                                        "type": "string",
                                        "format": "date-time"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Queued",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "queued": {
                                            "type": "integer"
                                        },
                                        "skipped": {
                                            "type": "integer"
                                        },
                                        "matched": {
                                            "type": "integer"
                                        },
                                        "not_found": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/webhooks/deliveries": {
            "get": {
                "summary": "Webhook attempts we made to you, with your HTTP response codes",
                "operationId": "listWebhookDeliveries",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "since",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "until",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pending",
                                "delivered",
                                "failed"
                            ]
                        }
                    },
                    {
                        "name": "replay",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "wamid",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "include_payload",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "maximum": 100
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page, newest first",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "created_at": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "enum": [
                                                            "pending",
                                                            "delivered",
                                                            "failed"
                                                        ]
                                                    },
                                                    "replay": {
                                                        "type": "boolean"
                                                    },
                                                    "attempts": {
                                                        "type": "integer"
                                                    },
                                                    "last_http_status": {
                                                        "type": "integer",
                                                        "nullable": true
                                                    },
                                                    "last_error": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "delivered_at": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "next_attempt_at": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "events": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "additionalProperties": true
                                                        }
                                                    },
                                                    "attempt_log": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "attempt": {
                                                                    "type": "integer"
                                                                },
                                                                "at": {
                                                                    "type": "string"
                                                                },
                                                                "http_status": {
                                                                    "type": "integer",
                                                                    "nullable": true
                                                                },
                                                                "error": {
                                                                    "type": "string",
                                                                    "nullable": true
                                                                },
                                                                "ms": {
                                                                    "type": "integer"
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "next_cursor": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "has_more": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/test/inbound": {
            "post": {
                "summary": "Test keys only: deliver a fake incoming message to your webhook",
                "operationId": "testInbound",
                "tags": [
                    "Test mode"
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "from": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    },
                                    "text": {
                                        "type": "string"
                                    },
                                    "phone_number_id": {
                                        "type": "string"
                                    }
                                }
                            },
                            "example": {
                                "from": "919876543210",
                                "name": "Rahul",
                                "text": "Hi"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Delivery result",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "delivery_id": {
                                            "type": "integer"
                                        },
                                        "error": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "tc_live_… or tc_test_… key from the Developers page"
            }
        },
        "schemas": {
            "MessageRequest": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                    "to"
                ],
                "properties": {
                    "messaging_product": {
                        "type": "string",
                        "enum": [
                            "whatsapp"
                        ]
                    },
                    "to": {
                        "type": "string",
                        "description": "Country code + number, digits only"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "template",
                            "text",
                            "image",
                            "video",
                            "audio",
                            "document",
                            "sticker",
                            "interactive",
                            "location",
                            "contacts",
                            "reaction"
                        ]
                    },
                    "template": {
                        "type": "object",
                        "additionalProperties": true
                    },
                    "text": {
                        "type": "object",
                        "properties": {
                            "body": {
                                "type": "string"
                            },
                            "preview_url": {
                                "type": "boolean"
                            }
                        }
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "read"
                        ]
                    },
                    "message_id": {
                        "type": "string"
                    }
                }
            },
            "MessageResponse": {
                "type": "object",
                "properties": {
                    "messaging_product": {
                        "type": "string"
                    },
                    "contacts": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "input": {
                                    "type": "string"
                                },
                                "wa_id": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "messages": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "string"
                                },
                                "message_status": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "MessageStatus": {
                "type": "object",
                "properties": {
                    "wamid": {
                        "type": "string"
                    },
                    "phone_number_id": {
                        "type": "string"
                    },
                    "to": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string"
                    },
                    "template": {
                        "type": "string",
                        "nullable": true
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "accepted",
                            "sent",
                            "delivered",
                            "read",
                            "failed"
                        ],
                        "description": "Highest state reached; failed only if the message was never delivered/read."
                    },
                    "timestamps": {
                        "type": "object",
                        "description": "UTC ISO 8601. sent/delivered/read/failed come from Meta’s statuses[].timestamp; accepted_at is when we accepted your API request.",
                        "properties": {
                            "accepted_at": {
                                "type": "string",
                                "nullable": true
                            },
                            "sent_at": {
                                "type": "string",
                                "nullable": true
                            },
                            "delivered_at": {
                                "type": "string",
                                "nullable": true
                            },
                            "read_at": {
                                "type": "string",
                                "nullable": true
                            },
                            "failed_at": {
                                "type": "string",
                                "nullable": true
                            }
                        }
                    },
                    "error": {
                        "type": "object",
                        "nullable": true,
                        "properties": {
                            "code": {
                                "type": "integer"
                            },
                            "title": {
                                "type": "string"
                            },
                            "message": {
                                "type": "string"
                            },
                            "details": {
                                "type": "string"
                            }
                        }
                    },
                    "events": {
                        "type": "array",
                        "description": "Every status Meta sent, ordered by Meta’s timestamp (out-of-order events kept). errors, conversation and pricing are included when Meta sent them.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "status": {
                                    "type": "string"
                                },
                                "timestamp": {
                                    "type": "string",
                                    "nullable": true
                                },
                                "received_at": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "object",
                        "properties": {
                            "message": {
                                "type": "string"
                            },
                            "type": {
                                "type": "string"
                            },
                            "code": {
                                "type": "integer"
                            },
                            "fbtrace_id": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        },
        "responses": {
            "Error": {
                "description": "Error in Meta format (see /docs#errors)",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            }
        }
    }
}