{
  "openapi": "3.1.0",
  "info": {
    "title": "ConvoBox Business Messaging Developer API",
    "version": "1.0.0",
    "description": "Enterprise WhatsApp Business Messaging API for ConvoBox. Send messages, manage templates, automate chatbots, deploy native WhatsApp Flows, sync CRM contacts, and stream real-time webhooks.",
    "contact": {
      "name": "ConvoBox Developer Platform",
      "url": "https://convobox.in",
      "email": "support@convobox.in"
    }
  },
  "servers": [
    {
      "url": "https://api.convobox.in/api/v1",
      "description": "Production Server"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "cbx_live_...",
        "description": "Use your API Key issued from ConvoBox Dashboard: `Authorization: Bearer cbx_live_...`"
      }
    }
  },
  "paths": {
    "/messages": {
      "post": {
        "summary": "Send Message",
        "description": "Send outbound text, template, media, interactive buttons, or WhatsApp Native Flows.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "to",
                  "type"
                ],
                "properties": {
                  "to": {
                    "type": "string",
                    "example": "919876543210"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "text",
                      "template",
                      "image",
                      "document",
                      "video",
                      "interactive",
                      "flow"
                    ]
                  },
                  "text": {
                    "type": "object",
                    "properties": {
                      "body": {
                        "type": "string"
                      }
                    }
                  },
                  "template": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message accepted and queued for delivery"
          },
          "400": {
            "description": "Validation error"
          },
          "402": {
            "description": "Wallet balance insufficient"
          }
        }
      }
    },
    "/messages/{id}/replies": {
      "get": {
        "summary": "Get Replies to a Sent Message",
        "description": "Returns customer button clicks, text replies, and flow submissions linked to an outbound message ID.",
        "responses": {
          "200": {
            "description": "Array of customer reply objects"
          }
        }
      }
    },
    "/templates": {
      "get": {
        "summary": "List Templates",
        "description": "List all WhatsApp templates for your account.",
        "responses": {
          "200": {
            "description": "Array of template objects"
          }
        }
      },
      "post": {
        "summary": "Create Template",
        "description": "Submit a new template to Meta for review and approval.",
        "responses": {
          "201": {
            "description": "Template created"
          }
        }
      }
    },
    "/flows": {
      "get": {
        "summary": "List WhatsApp Flows"
      },
      "post": {
        "summary": "Create WhatsApp Flow Form"
      }
    },
    "/chatbots": {
      "get": {
        "summary": "List Chatbots"
      },
      "post": {
        "summary": "Create or Update Chatbot Flow"
      }
    },
    "/contacts": {
      "get": {
        "summary": "Search Contacts"
      },
      "post": {
        "summary": "Create or Update Contact"
      }
    },
    "/conversations": {
      "get": {
        "summary": "List Conversations"
      }
    },
    "/settings": {
      "get": {
        "summary": "Get Business & Wallet Settings"
      }
    },
    "/webhooks": {
      "get": {
        "summary": "Get Registered Webhook"
      },
      "put": {
        "summary": "Set Webhook URL"
      }
    }
  }
}