{
  "openapi": "3.0.3",
  "info": {
    "title": "Flowsensy WhatsApp API",
    "version": "1",
    "description": "Send WhatsApp messages, work the shared inbox and manage contacts. Full guide: https://flowsensy.com/docs/api"
  },
  "servers": [
    {
      "url": "https://app.flowsensy.com/api/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Account"
    },
    {
      "name": "Templates"
    },
    {
      "name": "Messages"
    },
    {
      "name": "Conversations"
    },
    {
      "name": "Calls"
    },
    {
      "name": "Tickets"
    },
    {
      "name": "Subscriptions"
    },
    {
      "name": "WhatsApp Store"
    },
    {
      "name": "Bookings"
    },
    {
      "name": "Help centre"
    },
    {
      "name": "Leads"
    },
    {
      "name": "Forms"
    },
    {
      "name": "Webinars"
    },
    {
      "name": "Contacts"
    },
    {
      "name": "Campaigns"
    },
    {
      "name": "Flows"
    },
    {
      "name": "Links & QR"
    },
    {
      "name": "Instagram"
    },
    {
      "name": "Webhooks"
    }
  ],
  "paths": {
    "/account": {
      "get": {
        "operationId": "getAccount",
        "tags": [
          "Account"
        ],
        "summary": "Your account",
        "description": "Your account, wallet balance and connected WhatsApp numbers. A good first call to check your key works.\n\nUse whatsappAccounts[].id as accountId in other calls if you have more than one WhatsApp account.\n\nMoney is a plain decimal string in rupees (\"1250.000000\"), never formatted.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "3f2e1d0c-…",
                  "name": "Kumar Stores",
                  "wallet": {
                    "balanceInr": "1250.000000",
                    "availableInr": "1248.950000",
                    "currency": "INR"
                  },
                  "whatsappAccounts": [
                    {
                      "id": "6f1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
                      "name": "Kumar Stores",
                      "status": "ACTIVE",
                      "phoneNumbers": [
                        {
                          "id": "…",
                          "phoneNumberId": "1098765432",
                          "displayPhoneNumber": "+91 98222 00000",
                          "verifiedName": "Kumar Stores",
                          "qualityRating": "GREEN",
                          "messagingLimitTier": "TIER_1K"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/apps": {
      "get": {
        "operationId": "listApps",
        "tags": [
          "Account"
        ],
        "summary": "Apps",
        "description": "The apps in your account — WhatsApp, Instagram, Website live chat, Subscriptions, Bookings, WhatsApp Store, Sales CRM, Helpdesk, Forms and the others on the Apps page — and whether each is in your plan and switched on.\n\nstatus is NOT_IN_PLAN, INACTIVE, ACTIVE or CONNECTED (WhatsApp / Instagram with a number or account connected).\n\nCalls for a switched-off app answer 403 APP_INACTIVE, and its webhooks (for example booking.created) stop until it is activated again. Nothing is deleted.\n\nLeads, pipelines, follow-up tasks and quotations belong to **Sales CRM** (sales_crm); tickets and the help centre to **Helpdesk** (helpdesk); forms and responses to **Forms** (forms). Their calls answer FEATURE_NOT_IN_PLAN or APP_INACTIVE while the app is out of the plan or switched off, and their webhooks (lead.*, quote.*, task.due, ticket.*, form.*) stop.\n\nApps are switched on and off on the Apps page in the panel; you get app.activated / app.deactivated webhooks when that happens.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "whatsapp",
                      "name": "WhatsApp API",
                      "included": true,
                      "active": true,
                      "status": "CONNECTED",
                      "info": {
                        "connected": 1
                      }
                    },
                    {
                      "id": "instagram",
                      "name": "Instagram",
                      "included": true,
                      "active": false,
                      "status": "INACTIVE",
                      "info": {
                        "connected": 0
                      }
                    },
                    {
                      "id": "livechat",
                      "name": "Website live chat",
                      "included": true,
                      "active": true,
                      "status": "ACTIVE",
                      "info": {
                        "widgets": 1
                      }
                    },
                    {
                      "id": "subscriptions",
                      "name": "Subscriptions",
                      "included": false,
                      "active": false,
                      "status": "NOT_IN_PLAN",
                      "info": {
                        "active": 0
                      }
                    },
                    {
                      "id": "bookings",
                      "name": "Bookings",
                      "included": true,
                      "active": true,
                      "status": "ACTIVE",
                      "info": {
                        "services": 4,
                        "upcoming": 12
                      }
                    },
                    {
                      "id": "store",
                      "name": "WhatsApp Store",
                      "included": true,
                      "active": true,
                      "status": "ACTIVE",
                      "info": {
                        "stores": 1,
                        "openOrders": 3
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/templates": {
      "get": {
        "operationId": "listTemplates",
        "tags": [
          "Templates"
        ],
        "summary": "List templates",
        "description": "Your message templates with their text, category, approval status and how many variables each needs.\n\nCreate templates in the panel; Meta reviews them. variables.body tells you how many params.body values to send.\n\nCarousel, limited-time offer and map-pin templates say what else they need in variables.cards, variables.offerExpires and variables.location. optOutButton is the position of a \"Stop promotions\" button (a tap opts the contact out of marketing).",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "APPROVED",
                "PENDING",
                "REJECTED",
                "PAUSED",
                "DISABLED"
              ],
              "description": "Only templates with this status."
            },
            "description": "Only templates with this status."
          },
          {
            "name": "accountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Only this WhatsApp account’s templates."
            },
            "description": "Only this WhatsApp account’s templates."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "accountId": "6f1c…",
                      "name": "order_shipped",
                      "language": "en",
                      "category": "UTILITY",
                      "status": "APPROVED",
                      "components": [
                        {
                          "type": "BODY",
                          "text": "Hi {{1}}, your order {{2}} has shipped."
                        }
                      ],
                      "variables": {
                        "header": 0,
                        "body": 2,
                        "buttons": {}
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/templates/sync": {
      "post": {
        "operationId": "syncTemplates",
        "tags": [
          "Templates"
        ],
        "summary": "Sync templates from WhatsApp",
        "description": "Fetches your templates and their latest approval status from WhatsApp now.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "added": 1,
                  "updated": 3,
                  "removed": 0
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "accountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
                  }
                }
              },
              "example": {}
            }
          }
        }
      }
    },
    "/messages/template": {
      "post": {
        "operationId": "sendTemplate",
        "tags": [
          "Messages"
        ],
        "summary": "Send a template",
        "description": "For the first message to a customer, or any time more than 24 hours have passed since they last wrote.\n\nMarketing templates are refused for contacts who opted out (CONTACT_OPTED_OUT).\n\nThe price is held from your wallet now and charged when WhatsApp confirms; failed messages are never charged.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 100
            },
            "description": "Retry safely: the same key and body within 24 hours returns the first answer."
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "0b7d2c1e-5a3f-4c1d-9e2b-7f1a2b3c4d5e",
                  "wamid": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgS",
                  "direction": "outbound",
                  "to": "+919876543210",
                  "type": "template",
                  "template": "order_shipped",
                  "status": "accepted",
                  "category": "utility",
                  "priceInr": "0.115000",
                  "source": "api",
                  "campaignId": null,
                  "createdAt": "2026-10-19T10:15:02.120Z",
                  "sentAt": null,
                  "deliveredAt": null,
                  "readAt": null,
                  "failedAt": null
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "string",
                    "description": "The customer’s number with country code, e.g. +919876543210. Without one it’s treated as Indian."
                  },
                  "accountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
                  },
                  "template": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "description": "The template’s name, exactly as in the panel."
                      },
                      "language": {
                        "type": "string",
                        "description": "e.g. en, hi. Needed only if the name exists in several languages."
                      }
                    },
                    "required": [
                      "name"
                    ]
                  },
                  "params": {
                    "type": "object",
                    "properties": {
                      "body": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Values for {{1}}, {{2}}… in the body, in order."
                      },
                      "header": {
                        "type": "string",
                        "description": "Text for a text header, or an https link for an image, video or document header."
                      },
                      "headerFilename": {
                        "type": "string",
                        "description": "File name the customer sees for a document header."
                      },
                      "buttons": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Variables of link buttons by button position, e.g. {\"0\": \"track/10023\"}."
                      },
                      "code": {
                        "type": "string",
                        "description": "One-time password or offer code for authentication and coupon templates (up to 15 characters)."
                      },
                      "location": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Map-pin header templates (variables.location is true): {\"latitude\": 19.0596, \"longitude\": 72.8295, \"name\": \"Kumar Stores\", \"address\": \"Hill Road, Bandra\"}. Name and address are optional."
                      },
                      "offerExpiresAt": {
                        "type": "string",
                        "description": "Limited-time offers with a countdown (variables.offerExpires is true): when the offer ends, as an ISO time in the future, e.g. 2026-11-20T18:30:00Z."
                      },
                      "cards": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        },
                        "description": "Carousel templates (variables.cards lists each card): one entry per card, in order — {\"header\": \"https://…/photo.jpg\", \"body\": [\"₹899\"], \"buttons\": {\"0\": \"p/123\"}}. header is a public https link to the card’s photo or video."
                      }
                    }
                  }
                },
                "required": [
                  "to"
                ]
              },
              "example": {
                "to": "+919876543210",
                "template": {
                  "name": "order_shipped",
                  "language": "en"
                },
                "params": {
                  "body": [
                    "Asha",
                    "#10023"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/messages/text": {
      "post": {
        "operationId": "sendText",
        "tags": [
          "Messages"
        ],
        "summary": "Reply with text",
        "description": "Free-form text. Allowed only within 24 hours of the customer’s last message (WhatsApp’s rule).\n\nOutside the 24-hour window you get 409 WINDOW_CLOSED: send a template instead.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 100
            },
            "description": "Retry safely: the same key and body within 24 hours returns the first answer."
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "0b7d2c1e-5a3f-4c1d-9e2b-7f1a2b3c4d5e",
                  "wamid": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgS",
                  "direction": "outbound",
                  "to": "+919876543210",
                  "type": "text",
                  "status": "accepted",
                  "category": null,
                  "priceInr": "0.000000",
                  "source": "api",
                  "campaignId": null,
                  "createdAt": "2026-10-19T10:15:02.120Z",
                  "sentAt": null,
                  "deliveredAt": null,
                  "readAt": null,
                  "failedAt": null
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "string",
                    "description": "The customer’s number with country code, e.g. +919876543210. Without one it’s treated as Indian."
                  },
                  "accountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
                  },
                  "text": {
                    "type": "string",
                    "description": "Up to 4096 characters. Emoji and *bold*/_italic_ WhatsApp formatting work."
                  },
                  "replyTo": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The messageId of a customer message (from a webhook) to quote."
                  }
                },
                "required": [
                  "to",
                  "text"
                ]
              },
              "example": {
                "to": "+919876543210",
                "text": "Your order is out for delivery 🚚"
              }
            }
          }
        }
      }
    },
    "/messages/media": {
      "post": {
        "operationId": "sendMedia",
        "tags": [
          "Messages"
        ],
        "summary": "Send a photo, video, voice note or document",
        "description": "Inside the 24-hour window. Give a public https url (we download it) or a fileId from an upload.\n\nPhotos: JPG or PNG · video: MP4 · audio: OGG or MP3 · documents: PDF, Word, Excel, PowerPoint. Up to 16 MB; up to 3 redirects are followed.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 100
            },
            "description": "Retry safely: the same key and body within 24 hours returns the first answer."
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "0b7d2c1e-5a3f-4c1d-9e2b-7f1a2b3c4d5e",
                  "wamid": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgS",
                  "direction": "outbound",
                  "to": "+919876543210",
                  "type": "document",
                  "status": "accepted",
                  "category": null,
                  "priceInr": "0.000000",
                  "source": "api",
                  "campaignId": null,
                  "createdAt": "2026-10-19T10:15:02.120Z",
                  "sentAt": null,
                  "deliveredAt": null,
                  "readAt": null,
                  "failedAt": null
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "string",
                    "description": "The customer’s number with country code, e.g. +919876543210. Without one it’s treated as Indian."
                  },
                  "accountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
                  },
                  "url": {
                    "type": "string",
                    "description": "A public https link to the file. Give this or fileId."
                  },
                  "fileId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "From POST /v1/media. Give this or url."
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "image",
                      "video",
                      "audio",
                      "document"
                    ],
                    "description": "Worked out from the file when left out."
                  },
                  "filename": {
                    "type": "string",
                    "description": "What the customer sees for documents."
                  },
                  "caption": {
                    "type": "string",
                    "description": "Up to 1024 characters (not for audio)."
                  },
                  "voice": {
                    "type": "boolean",
                    "description": "true sends an OGG file as a voice note."
                  },
                  "replyTo": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A customer message to quote."
                  }
                },
                "required": [
                  "to"
                ]
              },
              "example": {
                "to": "+919876543210",
                "url": "https://example.com/invoice-10023.pdf",
                "filename": "Invoice 10023.pdf",
                "caption": "Your invoice"
              }
            }
          }
        }
      }
    },
    "/messages/interactive": {
      "post": {
        "operationId": "sendInteractive",
        "tags": [
          "Messages"
        ],
        "summary": "Send reply buttons, a list menu or a link button",
        "description": "Inside the 24-hour window. Give one of: up to 3 buttons, a list with up to 10 rows in total, or a cta link button.\n\nWhen the customer taps one, message.received arrives with type: \"interactive\" and reply.id set to your id.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 100
            },
            "description": "Retry safely: the same key and body within 24 hours returns the first answer."
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "0b7d2c1e-5a3f-4c1d-9e2b-7f1a2b3c4d5e",
                  "wamid": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgS",
                  "direction": "outbound",
                  "to": "+919876543210",
                  "type": "interactive",
                  "status": "accepted",
                  "category": null,
                  "priceInr": "0.000000",
                  "source": "api",
                  "campaignId": null,
                  "createdAt": "2026-10-19T10:15:02.120Z",
                  "sentAt": null,
                  "deliveredAt": null,
                  "readAt": null,
                  "failedAt": null
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "string",
                    "description": "The customer’s number with country code, e.g. +919876543210. Without one it’s treated as Indian."
                  },
                  "accountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
                  },
                  "body": {
                    "type": "string",
                    "description": "The message text (up to 1024)."
                  },
                  "header": {
                    "type": "string",
                    "description": "Up to 60 characters."
                  },
                  "footer": {
                    "type": "string",
                    "description": "Up to 60 characters."
                  },
                  "buttons": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    },
                    "description": "Up to 3 of { id, title }; titles up to 20 characters. Give this or list."
                  },
                  "list": {
                    "type": "object",
                    "properties": {
                      "button": {
                        "type": "string",
                        "description": "Text of the button that opens the list (up to 20)."
                      },
                      "sections": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        },
                        "description": "{ title?, rows: [{ id, title, description? }] }. Row titles up to 24, descriptions up to 72. Several sections each need a title."
                      }
                    }
                  },
                  "cta": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "description": "Link button: its text (up to 20)."
                      },
                      "url": {
                        "type": "string",
                        "description": "Link button: the https:// address it opens. WhatsApp doesn’t report taps."
                      }
                    }
                  },
                  "headerMedia": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Link button only: { type: \"image\" | \"video\" | \"document\", fileId } from Upload a file, shown above the text (instead of header)."
                  },
                  "replyToId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A customer message to quote."
                  }
                },
                "required": [
                  "to",
                  "body"
                ]
              },
              "example": {
                "to": "+919876543210",
                "header": "Order #10023",
                "body": "When should we deliver?",
                "footer": "Reply anytime",
                "buttons": [
                  {
                    "id": "today",
                    "title": "Today"
                  },
                  {
                    "id": "tomorrow",
                    "title": "Tomorrow"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/media": {
      "post": {
        "operationId": "uploadMedia",
        "tags": [
          "Messages"
        ],
        "summary": "Upload a file",
        "description": "Upload a file once, then send it with POST /v1/messages/media using the fileId.\n\nSend multipart/form-data with the file in a field named file.",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "fileId": "5d4c3b2a-…",
                  "name": "menu.jpg",
                  "contentType": "image/jpeg",
                  "sizeBytes": 182340,
                  "type": "image"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The photo, video, audio or document (up to 16 MB)."
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        }
      }
    },
    "/messages/{id}": {
      "get": {
        "operationId": "getMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Message status",
        "description": "A message and its current status: accepted → sent → delivered → read, or failed with an error.\n\nPrefer the message.status webhook over polling.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The message id you got when sending (or messageId from a webhook)."
            },
            "description": "The message id you got when sending (or messageId from a webhook)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "0b7d2c1e-5a3f-4c1d-9e2b-7f1a2b3c4d5e",
                  "wamid": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgS",
                  "direction": "outbound",
                  "to": "+919876543210",
                  "type": "template",
                  "template": "order_shipped",
                  "status": "read",
                  "category": "utility",
                  "priceInr": "0.115000",
                  "source": "api",
                  "campaignId": null,
                  "createdAt": "2026-10-19T10:15:02.120Z",
                  "sentAt": "2026-10-19T10:15:03.000Z",
                  "deliveredAt": "2026-10-19T10:15:04.000Z",
                  "readAt": "2026-10-19T10:16:40.000Z",
                  "failedAt": null
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/messages/{id}/media": {
      "get": {
        "operationId": "getMessageMedia",
        "tags": [
          "Messages"
        ],
        "summary": "Download a message’s file",
        "description": "The photo, video, voice note or document of a message (the media.url in webhooks).\n\n409 MEDIA_NOT_READY means it’s still being fetched from WhatsApp: retry after a few seconds.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The message id."
            },
            "description": "The message id."
          }
        ],
        "responses": {
          "200": {
            "description": "The file itself, with its Content-Type and a Content-Disposition file name.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/conversations": {
      "get": {
        "operationId": "listConversations",
        "tags": [
          "Conversations"
        ],
        "summary": "List conversations",
        "description": "Chats in your shared inbox, newest first. windowOpen says whether free-form replies are allowed now.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NEW",
                "NEEDS_HUMAN",
                "OPEN",
                "PENDING",
                "RESOLVED",
                "ACTIVE",
                "ALL"
              ],
              "description": "Default ALL. ACTIVE = New, Needs human and Open (the chats that need attention)."
            },
            "description": "Default ALL. ACTIVE = New, Needs human and Open (the chats that need attention)."
          },
          {
            "name": "awaiting",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Only chats whose last message was yours and the customer hasn’t answered yet (last 30 days)."
            },
            "description": "Only chats whose last message was yours and the customer hasn’t answered yet (last 30 days)."
          },
          {
            "name": "assigned",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "unassigned",
                "all"
              ],
              "description": "unassigned for chats nobody has taken."
            },
            "description": "unassigned for chats nobody has taken."
          },
          {
            "name": "assignedTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One team member’s chats (ids from GET /v1/team)."
            },
            "description": "One team member’s chats (ids from GET /v1/team)."
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Search by name, number or Instagram @username."
            },
            "description": "Search by name, number or Instagram @username."
          },
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "WHATSAPP",
                "INSTAGRAM",
                "WEB"
              ],
              "description": "Only one channel. Instagram chats have phone: null and instagram: { id, username }; website and app chats (web) have phone: null and visitorId."
            },
            "description": "Only one channel. Instagram chats have phone: null and instagram: { id, username }; website and app chats (web) have phone: null and visitorId."
          },
          {
            "name": "accountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
            },
            "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–100, default 30."
            },
            "description": "1–100, default 30."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "nextCursor from the previous page."
            },
            "description": "nextCursor from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "9c2e7f10-1b2a-4c3d-8e9f-0a1b2c3d4e5f",
                      "accountId": "6f1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
                      "contactId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                      "phone": "+919876543210",
                      "contactName": "Asha Rao",
                      "tags": [
                        "vip"
                      ],
                      "optedOut": false,
                      "blocked": false,
                      "status": "OPEN",
                      "assignedUserId": null,
                      "assigneeName": null,
                      "unreadCount": 2,
                      "lastMessageAt": "2026-10-19T10:20:09.000Z",
                      "lastMessagePreview": "Is my order shipped?",
                      "lastInboundAt": "2026-10-19T10:20:09.000Z",
                      "windowOpen": true,
                      "windowClosesAt": "2026-10-20T10:20:09.000Z"
                    }
                  ],
                  "nextCursor": "eyJ0IjoiMjAyNi0xMC0xOVQxMDoyMDowOS4wMDBaIn0"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/conversations/{id}": {
      "get": {
        "operationId": "getConversation",
        "tags": [
          "Conversations"
        ],
        "summary": "One conversation",
        "description": "A conversation with its contact.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The conversation id."
            },
            "description": "The conversation id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "9c2e7f10-1b2a-4c3d-8e9f-0a1b2c3d4e5f",
                  "accountId": "6f1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
                  "contactId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                  "phone": "+919876543210",
                  "contactName": "Asha Rao",
                  "tags": [
                    "vip"
                  ],
                  "optedOut": false,
                  "blocked": false,
                  "status": "OPEN",
                  "assignedUserId": null,
                  "assigneeName": null,
                  "unreadCount": 2,
                  "lastMessageAt": "2026-10-19T10:20:09.000Z",
                  "lastMessagePreview": "Is my order shipped?",
                  "lastInboundAt": "2026-10-19T10:20:09.000Z",
                  "windowOpen": true,
                  "windowClosesAt": "2026-10-20T10:20:09.000Z",
                  "contact": {
                    "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "accountId": "6f1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
                    "phone": "+919876543210",
                    "name": "Asha Rao",
                    "email": "asha@example.com",
                    "tags": [
                      "customer",
                      "diwali-2026"
                    ],
                    "attributes": {
                      "city": "Pune",
                      "plan": "gold"
                    },
                    "optedOut": false,
                    "optedOutAt": null,
                    "blocked": false,
                    "blockedAt": null,
                    "blockedOnWhatsapp": false,
                    "source": "API",
                    "lastInboundAt": "2026-10-19T10:20:09.000Z",
                    "createdAt": "2026-10-01T08:00:00.000Z",
                    "updatedAt": "2026-10-19T10:20:09.000Z"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/conversations/{id}/messages": {
      "get": {
        "operationId": "conversationMessages",
        "tags": [
          "Conversations"
        ],
        "summary": "Messages in a conversation",
        "description": "Messages, internal notes and timeline events, newest page first. Each has a plain text where there is one.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The conversation id."
            },
            "description": "The conversation id."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–100, default 50."
            },
            "description": "1–100, default 50."
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "before from the previous answer, for older messages."
            },
            "description": "before from the previous answer, for older messages."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "5a1f…",
                      "direction": "inbound",
                      "type": "text",
                      "text": "Is my order shipped?",
                      "content": {
                        "text": {
                          "body": "Is my order shipped?"
                        }
                      },
                      "status": "received",
                      "author": null,
                      "source": "whatsapp",
                      "createdAt": "2026-10-19T10:20:09.000Z"
                    }
                  ],
                  "before": null
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/conversations/{id}/assign": {
      "post": {
        "operationId": "assignConversation",
        "tags": [
          "Conversations"
        ],
        "summary": "Assign a conversation",
        "description": "Give a chat to a team member by email or id; \"userId\": null unassigns. The person must be able to reply to customers.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The conversation id."
            },
            "description": "The conversation id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "9c2e7f10-1b2a-4c3d-8e9f-0a1b2c3d4e5f",
                  "accountId": "6f1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
                  "contactId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                  "phone": "+919876543210",
                  "contactName": "Asha Rao",
                  "tags": [
                    "vip"
                  ],
                  "optedOut": false,
                  "blocked": false,
                  "status": "OPEN",
                  "assignedUserId": "7e6d…",
                  "assigneeName": "Priya",
                  "unreadCount": 2,
                  "lastMessageAt": "2026-10-19T10:20:09.000Z",
                  "lastMessagePreview": "Is my order shipped?",
                  "lastInboundAt": "2026-10-19T10:20:09.000Z",
                  "windowOpen": true,
                  "windowClosesAt": "2026-10-20T10:20:09.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "The team member’s sign-in email."
                  },
                  "userId": {
                    "type": "string",
                    "format": "uuid",
                    "nullable": true,
                    "description": "Or their id (from GET /v1/team); null unassigns."
                  }
                }
              },
              "example": {
                "email": "priya@shop.in"
              }
            }
          }
        }
      }
    },
    "/conversations/{id}/status": {
      "post": {
        "operationId": "conversationStatus",
        "tags": [
          "Conversations"
        ],
        "summary": "Open, pend or resolve",
        "description": "Change a chat’s status. A customer writing again reopens it by itself.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The conversation id."
            },
            "description": "The conversation id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "9c2e7f10-1b2a-4c3d-8e9f-0a1b2c3d4e5f",
                  "accountId": "6f1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
                  "contactId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                  "phone": "+919876543210",
                  "contactName": "Asha Rao",
                  "tags": [
                    "vip"
                  ],
                  "optedOut": false,
                  "blocked": false,
                  "status": "RESOLVED",
                  "assignedUserId": null,
                  "assigneeName": null,
                  "unreadCount": 2,
                  "lastMessageAt": "2026-10-19T10:20:09.000Z",
                  "lastMessagePreview": "Is my order shipped?",
                  "lastInboundAt": "2026-10-19T10:20:09.000Z",
                  "windowOpen": true,
                  "windowClosesAt": "2026-10-20T10:20:09.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "NEW",
                      "NEEDS_HUMAN",
                      "OPEN",
                      "PENDING",
                      "RESOLVED"
                    ],
                    "description": "The new status. NEW: the customer wrote and nobody has picked it up; NEEDS_HUMAN: an AI assistant or chatbot handed it over; OPEN: a person is working on it; PENDING: waiting; RESOLVED: done."
                  }
                },
                "required": [
                  "status"
                ]
              },
              "example": {
                "status": "RESOLVED"
              }
            }
          }
        }
      }
    },
    "/conversations/{id}/notes": {
      "post": {
        "operationId": "conversationNote",
        "tags": [
          "Conversations"
        ],
        "summary": "Add an internal note",
        "description": "A note your team sees in the chat; the customer never does.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The conversation id."
            },
            "description": "The conversation id."
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "conversationId": "9c2e…",
                  "text": "Lead created in CRM",
                  "createdAt": "2026-10-19T10:22:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Up to 4000 characters."
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "Lead created in CRM"
              }
            }
          }
        }
      }
    },
    "/team": {
      "get": {
        "operationId": "listTeam",
        "tags": [
          "Conversations"
        ],
        "summary": "Team members",
        "description": "People who can reply to customers, with how many open chats each has.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "7e6d…",
                      "name": "Priya",
                      "email": "priya@shop.in",
                      "role": "Agent",
                      "openConversations": 4
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/calls": {
      "get": {
        "operationId": "listCalls",
        "tags": [
          "Calls"
        ],
        "summary": "List calls",
        "description": "Voice calls your team made to website / app visitors, newest first.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "COMPLETED",
                "MISSED",
                "DECLINED",
                "CANCELLED",
                "FAILED",
                "ACTIVE",
                "RINGING"
              ],
              "description": "Only this status."
            },
            "description": "Only this status."
          },
          {
            "name": "conversationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One chat’s calls."
            },
            "description": "One chat’s calls."
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Started at or after this time (ISO 8601)."
            },
            "description": "Started at or after this time (ISO 8601)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–100, default 25."
            },
            "description": "1–100, default 25."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "nextCursor from the previous page."
            },
            "description": "nextCursor from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "callId": "…",
                      "conversationId": "…",
                      "contactId": "…",
                      "visitorId": "…",
                      "externalId": "user_1042",
                      "visitorName": "Asha Rao",
                      "visitorEmail": "asha@example.com",
                      "status": "COMPLETED",
                      "agentUserId": "…",
                      "agentName": "Priya",
                      "recorded": true,
                      "consentAt": "…",
                      "startedAt": "…",
                      "answeredAt": "…",
                      "endedAt": "…",
                      "endedBy": "AGENT",
                      "seconds": 192,
                      "recordingStatus": "READY",
                      "recordingUrl": "/v1/calls/…/recording"
                    }
                  ],
                  "nextCursor": null
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/calls/{id}": {
      "get": {
        "operationId": "getCall",
        "tags": [
          "Calls"
        ],
        "summary": "Get a call",
        "description": "One call: who, when, how long, whether it was recorded (and when the visitor heard the recording notice).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The call id."
            },
            "description": "The call id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "callId": "…",
                  "conversationId": "…",
                  "contactId": "…",
                  "visitorId": "…",
                  "externalId": "user_1042",
                  "visitorName": "Asha Rao",
                  "visitorEmail": "asha@example.com",
                  "status": "COMPLETED",
                  "agentUserId": "…",
                  "agentName": "Priya",
                  "recorded": true,
                  "consentAt": "…",
                  "startedAt": "…",
                  "answeredAt": "…",
                  "endedAt": "…",
                  "endedBy": "AGENT",
                  "seconds": 192,
                  "recordingStatus": "READY",
                  "recordingUrl": "/v1/calls/…/recording"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/calls/{id}/recording": {
      "get": {
        "operationId": "getCallRecording",
        "tags": [
          "Calls"
        ],
        "summary": "Download a call recording",
        "description": "The recording as AAC audio (audio/mp4). Kept for the days set in Live chat → Calls (90 at most), then deleted.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The call id."
            },
            "description": "The call id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {}
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/ai-calls": {
      "get": {
        "operationId": "listAiCalls",
        "tags": [
          "Calls"
        ],
        "summary": "List AI calls",
        "description": "Voice calls visitors made with your AI assistant (“Talk to us”), newest first — with transcript, summary and outcome (COMPLETED = handled by the AI, HANDED_OVER, NO_AGENT, LIMIT, FAILED).",
        "parameters": [
          {
            "name": "conversationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One chat’s AI calls."
            },
            "description": "One chat’s AI calls."
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Started at or after this time (ISO 8601)."
            },
            "description": "Started at or after this time (ISO 8601)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–100, default 25."
            },
            "description": "1–100, default 25."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "nextCursor from the previous page."
            },
            "description": "nextCursor from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "aiCallId": "…",
                      "conversationId": "…",
                      "contactId": "…",
                      "visitorId": "…",
                      "externalId": "user_1042",
                      "visitorName": "Asha Rao",
                      "visitorEmail": "asha@example.com",
                      "provider": "OPENAI",
                      "status": "ENDED",
                      "outcome": "COMPLETED",
                      "origin": "visitor",
                      "agentUserId": null,
                      "agentName": null,
                      "agentNote": null,
                      "fromCallId": null,
                      "handoverReason": null,
                      "handoverCallId": null,
                      "ticketId": null,
                      "leadId": null,
                      "recorded": true,
                      "consentAt": "…",
                      "startedAt": "…",
                      "answeredAt": "…",
                      "endedAt": "…",
                      "seconds": 134,
                      "summary": "• Asked about delivery to Pune\n• Told 3–5 days",
                      "transcript": [
                        {
                          "role": "ai",
                          "text": "Hi! How can I help?",
                          "at": "…"
                        },
                        {
                          "role": "visitor",
                          "text": "Do you deliver to Pune?",
                          "at": "…"
                        }
                      ],
                      "recordingStatus": "READY",
                      "recordingUrl": "/v1/ai-calls/…/recording"
                    }
                  ],
                  "nextCursor": null
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/ai-calls/{id}": {
      "get": {
        "operationId": "getAiCall",
        "tags": [
          "Calls"
        ],
        "summary": "Get an AI call",
        "description": "One call with the AI assistant: transcript, summary, outcome, any ticket / lead it made, and the recording when recorded.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The AI call id."
            },
            "description": "The AI call id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "aiCallId": "…",
                  "conversationId": "…",
                  "contactId": "…",
                  "visitorId": "…",
                  "externalId": "user_1042",
                  "visitorName": "Asha Rao",
                  "visitorEmail": "asha@example.com",
                  "provider": "OPENAI",
                  "status": "ENDED",
                  "outcome": "COMPLETED",
                  "origin": "visitor",
                  "agentUserId": null,
                  "agentName": null,
                  "agentNote": null,
                  "fromCallId": null,
                  "handoverReason": null,
                  "handoverCallId": null,
                  "ticketId": null,
                  "leadId": null,
                  "recorded": true,
                  "consentAt": "…",
                  "startedAt": "…",
                  "answeredAt": "…",
                  "endedAt": "…",
                  "seconds": 134,
                  "summary": "• Asked about delivery to Pune\n• Told 3–5 days",
                  "transcript": [
                    {
                      "role": "ai",
                      "text": "Hi! How can I help?",
                      "at": "…"
                    },
                    {
                      "role": "visitor",
                      "text": "Do you deliver to Pune?",
                      "at": "…"
                    }
                  ],
                  "recordingStatus": "READY",
                  "recordingUrl": "/v1/ai-calls/…/recording"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/ai-calls/{id}/recording": {
      "get": {
        "operationId": "getAiCallRecording",
        "tags": [
          "Calls"
        ],
        "summary": "Download an AI call recording",
        "description": "The recording (caller and AI) as AAC audio (audio/mp4). Kept for the days set in Live chat → Calls (90 at most).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The AI call id."
            },
            "description": "The AI call id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {}
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/store/products": {
      "get": {
        "operationId": "listStoreProducts",
        "tags": [
          "WhatsApp Store"
        ],
        "summary": "List products",
        "description": "Your product catalog (the same one quotations and the WhatsApp catalog use). Prices are in rupees and include GST.\n\nNeeds WhatsApp Store in your plan.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Name or SKU."
            },
            "description": "Name or SKU."
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "store",
                "all"
              ],
              "description": "store (default): products shown in the store; all: the whole catalog."
            },
            "description": "store (default): products shown in the store; all: the whole catalog."
          },
          {
            "name": "categoryId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Filter."
            },
            "description": "Filter."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–100, default 50."
            },
            "description": "1–100, default 50."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Skip this many."
            },
            "description": "Skip this many."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "00000000-0000-4000-8000-000000000031",
                      "name": "Cotton kurta",
                      "slug": "cotton-kurta",
                      "description": "Soft handloom cotton",
                      "sku": "KUR-1",
                      "hsn": "6211",
                      "price": 1049,
                      "comparePrice": 1499,
                      "gstRate": 5,
                      "categoryId": "…",
                      "images": [
                        {
                          "id": "…",
                          "url": "/api/store/images/…"
                        }
                      ],
                      "options": [
                        {
                          "name": "Size",
                          "values": [
                            "M",
                            "L"
                          ]
                        }
                      ],
                      "variants": [
                        {
                          "id": "…",
                          "name": "M",
                          "options": {
                            "Size": "M"
                          },
                          "price": 1049,
                          "comparePrice": null,
                          "sku": "KUR-M",
                          "stock": 6,
                          "active": true,
                          "inStock": true
                        }
                      ],
                      "trackStock": true,
                      "stock": 6,
                      "inStock": true,
                      "inStore": true,
                      "active": true
                    }
                  ],
                  "total": 1
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createStoreProduct",
        "tags": [
          "WhatsApp Store"
        ],
        "summary": "Create a product",
        "description": "Adds a product (with options and variants). Store products count towards your plan’s product limit.",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "00000000-0000-4000-8000-000000000031",
                  "name": "Cotton kurta",
                  "slug": "cotton-kurta",
                  "description": "Soft handloom cotton",
                  "sku": "KUR-1",
                  "hsn": "6211",
                  "price": 1049,
                  "comparePrice": 1499,
                  "gstRate": 5,
                  "categoryId": "…",
                  "images": [
                    {
                      "id": "…",
                      "url": "/api/store/images/…"
                    }
                  ],
                  "options": [
                    {
                      "name": "Size",
                      "values": [
                        "M",
                        "L"
                      ]
                    }
                  ],
                  "variants": [
                    {
                      "id": "…",
                      "name": "M",
                      "options": {
                        "Size": "M"
                      },
                      "price": 1049,
                      "comparePrice": null,
                      "sku": "KUR-M",
                      "stock": 6,
                      "active": true,
                      "inStock": true
                    }
                  ],
                  "trackStock": true,
                  "stock": 6,
                  "inStock": true,
                  "inStore": true,
                  "active": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Product name."
                  },
                  "price": {
                    "type": "string",
                    "description": "Selling price in rupees, including GST."
                  },
                  "comparePrice": {
                    "type": "string",
                    "description": "MRP, shown struck through."
                  },
                  "gstRate": {
                    "type": "integer",
                    "description": "0, 5, 12, 18 or 28."
                  },
                  "description": {
                    "type": "string",
                    "description": "Shown on the product page."
                  },
                  "sku": {
                    "type": "string",
                    "description": "Your code."
                  },
                  "categoryId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A store category."
                  },
                  "options": {
                    "type": "string",
                    "description": "Up to 3, e.g. [{\"name\":\"Size\",\"values\":[\"M\",\"L\"]}]."
                  },
                  "variants": {
                    "type": "string",
                    "description": "One per combination: name, options, price (null = the product price), sku, stock, active. Send id back to keep a variant."
                  },
                  "trackStock": {
                    "type": "boolean",
                    "description": "Orders take stock; cancelled / returned orders put it back."
                  },
                  "stock": {
                    "type": "integer",
                    "description": "Without variants."
                  },
                  "inStore": {
                    "type": "boolean",
                    "description": "Show in the store (default true). Off: a quotation-only product."
                  },
                  "active": {
                    "type": "boolean",
                    "description": "Off hides it everywhere."
                  }
                },
                "required": [
                  "name",
                  "price"
                ]
              },
              "example": {
                "name": "Cotton kurta",
                "price": 1049,
                "comparePrice": 1499,
                "gstRate": 5,
                "options": [
                  {
                    "name": "Size",
                    "values": [
                      "M",
                      "L"
                    ]
                  }
                ],
                "variants": [
                  {
                    "name": "M",
                    "options": {
                      "Size": "M"
                    },
                    "price": null,
                    "stock": 6
                  },
                  {
                    "name": "L",
                    "options": {
                      "Size": "L"
                    },
                    "price": 1099,
                    "stock": 4
                  }
                ],
                "trackStock": true
              }
            }
          }
        }
      }
    },
    "/store/products/{id}": {
      "get": {
        "operationId": "getStoreProduct",
        "tags": [
          "WhatsApp Store"
        ],
        "summary": "Get a product",
        "description": "One product with its variants and stock.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The product id."
            },
            "description": "The product id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "00000000-0000-4000-8000-000000000031",
                  "name": "Cotton kurta",
                  "slug": "cotton-kurta",
                  "description": "Soft handloom cotton",
                  "sku": "KUR-1",
                  "hsn": "6211",
                  "price": 1049,
                  "comparePrice": 1499,
                  "gstRate": 5,
                  "categoryId": "…",
                  "images": [
                    {
                      "id": "…",
                      "url": "/api/store/images/…"
                    }
                  ],
                  "options": [
                    {
                      "name": "Size",
                      "values": [
                        "M",
                        "L"
                      ]
                    }
                  ],
                  "variants": [
                    {
                      "id": "…",
                      "name": "M",
                      "options": {
                        "Size": "M"
                      },
                      "price": 1049,
                      "comparePrice": null,
                      "sku": "KUR-M",
                      "stock": 6,
                      "active": true,
                      "inStock": true
                    }
                  ],
                  "trackStock": true,
                  "stock": 6,
                  "inStock": true,
                  "inStore": true,
                  "active": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateStoreProduct",
        "tags": [
          "WhatsApp Store"
        ],
        "summary": "Update a product",
        "description": "Replaces the product’s details (send every field). Stock and prices go to the WhatsApp catalog within a minute.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The product id."
            },
            "description": "The product id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "00000000-0000-4000-8000-000000000031",
                  "name": "Cotton kurta",
                  "slug": "cotton-kurta",
                  "description": "Soft handloom cotton",
                  "sku": "KUR-1",
                  "hsn": "6211",
                  "price": 1049,
                  "comparePrice": 1499,
                  "gstRate": 5,
                  "categoryId": "…",
                  "images": [
                    {
                      "id": "…",
                      "url": "/api/store/images/…"
                    }
                  ],
                  "options": [
                    {
                      "name": "Size",
                      "values": [
                        "M",
                        "L"
                      ]
                    }
                  ],
                  "variants": [
                    {
                      "id": "…",
                      "name": "M",
                      "options": {
                        "Size": "M"
                      },
                      "price": 1049,
                      "comparePrice": null,
                      "sku": "KUR-M",
                      "stock": 6,
                      "active": true,
                      "inStock": true
                    }
                  ],
                  "trackStock": true,
                  "stock": 6,
                  "inStock": true,
                  "inStore": true,
                  "active": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Product name."
                  },
                  "price": {
                    "type": "string",
                    "description": "Selling price in rupees, including GST."
                  },
                  "comparePrice": {
                    "type": "string",
                    "description": "MRP, shown struck through."
                  },
                  "gstRate": {
                    "type": "integer",
                    "description": "0, 5, 12, 18 or 28."
                  },
                  "description": {
                    "type": "string",
                    "description": "Shown on the product page."
                  },
                  "sku": {
                    "type": "string",
                    "description": "Your code."
                  },
                  "categoryId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A store category."
                  },
                  "options": {
                    "type": "string",
                    "description": "Up to 3, e.g. [{\"name\":\"Size\",\"values\":[\"M\",\"L\"]}]."
                  },
                  "variants": {
                    "type": "string",
                    "description": "One per combination: name, options, price (null = the product price), sku, stock, active. Send id back to keep a variant."
                  },
                  "trackStock": {
                    "type": "boolean",
                    "description": "Orders take stock; cancelled / returned orders put it back."
                  },
                  "stock": {
                    "type": "integer",
                    "description": "Without variants."
                  },
                  "inStore": {
                    "type": "boolean",
                    "description": "Show in the store (default true). Off: a quotation-only product."
                  },
                  "active": {
                    "type": "boolean",
                    "description": "Off hides it everywhere."
                  }
                },
                "required": [
                  "name",
                  "price"
                ]
              },
              "example": {
                "name": "Cotton kurta",
                "price": 999,
                "gstRate": 5,
                "trackStock": true,
                "stock": 20
              }
            }
          }
        }
      }
    },
    "/store/orders": {
      "get": {
        "operationId": "listStoreOrders",
        "tags": [
          "WhatsApp Store"
        ],
        "summary": "List orders",
        "description": "Store orders, newest first. Money is in paise as strings (104900 = ₹1,049).",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "NEW",
                "CONFIRMED",
                "PACKED",
                "SHIPPED",
                "DELIVERED",
                "CANCELLED",
                "RETURNED",
                "ALL"
              ],
              "description": "Filter."
            },
            "description": "Filter."
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Order number, name or phone."
            },
            "description": "Order number, name or phone."
          },
          {
            "name": "contactId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One customer’s orders."
            },
            "description": "One customer’s orders."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–100, default 50."
            },
            "description": "1–100, default 50."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Skip this many."
            },
            "description": "Skip this many."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "00000000-0000-4000-8000-000000000032",
                      "number": "ORD-1042",
                      "storeName": "Kumar Stores",
                      "contactId": "…",
                      "customerName": "Priya Sharma",
                      "customerPhone": "+919811122333",
                      "customerEmail": null,
                      "address": {
                        "line1": "12 MG Road",
                        "city": "Pune",
                        "state": "Maharashtra",
                        "pincode": "411001"
                      },
                      "items": [
                        {
                          "productId": "…",
                          "variantId": "…",
                          "name": "Cotton kurta",
                          "variantName": "M",
                          "qty": 2,
                          "unitPaise": "104900",
                          "gstRate": 5,
                          "lineTotalPaise": "209800"
                        }
                      ],
                      "subtotalPaise": "209800",
                      "discountPaise": "0",
                      "shippingPaise": "0",
                      "codFeePaise": "4900",
                      "taxPaise": "9990",
                      "totalPaise": "214700",
                      "couponCode": null,
                      "paymentMethod": "COD",
                      "paymentStatus": "COD",
                      "status": "NEW",
                      "trackingNumber": null,
                      "trackingUrl": null,
                      "source": "WEBSITE",
                      "invoiceNumber": null,
                      "link": "https://panel.example.com/o/AbC123xyz789",
                      "createdAt": "2026-11-08T05:30:00.000Z"
                    }
                  ],
                  "total": 1
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/store/orders/{id}": {
      "get": {
        "operationId": "getStoreOrder",
        "tags": [
          "WhatsApp Store"
        ],
        "summary": "Get an order",
        "description": "One order with its items, totals, payment, tracking and history.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The order id."
            },
            "description": "The order id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "00000000-0000-4000-8000-000000000032",
                  "number": "ORD-1042",
                  "storeName": "Kumar Stores",
                  "contactId": "…",
                  "customerName": "Priya Sharma",
                  "customerPhone": "+919811122333",
                  "customerEmail": null,
                  "address": {
                    "line1": "12 MG Road",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "pincode": "411001"
                  },
                  "items": [
                    {
                      "productId": "…",
                      "variantId": "…",
                      "name": "Cotton kurta",
                      "variantName": "M",
                      "qty": 2,
                      "unitPaise": "104900",
                      "gstRate": 5,
                      "lineTotalPaise": "209800"
                    }
                  ],
                  "subtotalPaise": "209800",
                  "discountPaise": "0",
                  "shippingPaise": "0",
                  "codFeePaise": "4900",
                  "taxPaise": "9990",
                  "totalPaise": "214700",
                  "couponCode": null,
                  "paymentMethod": "COD",
                  "paymentStatus": "COD",
                  "status": "NEW",
                  "trackingNumber": null,
                  "trackingUrl": null,
                  "source": "WEBSITE",
                  "invoiceNumber": null,
                  "link": "https://panel.example.com/o/AbC123xyz789",
                  "createdAt": "2026-11-08T05:30:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateStoreOrder",
        "tags": [
          "WhatsApp Store"
        ],
        "summary": "Update an order",
        "description": "Move it on (confirmed, packed, shipped…), add the tracking number and link, or mark it paid. The customer gets the WhatsApp update set for that status unless notify is false. Cancelled and returned orders put stock back.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The order id."
            },
            "description": "The order id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "00000000-0000-4000-8000-000000000032",
                  "number": "ORD-1042",
                  "storeName": "Kumar Stores",
                  "contactId": "…",
                  "customerName": "Priya Sharma",
                  "customerPhone": "+919811122333",
                  "customerEmail": null,
                  "address": {
                    "line1": "12 MG Road",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "pincode": "411001"
                  },
                  "items": [
                    {
                      "productId": "…",
                      "variantId": "…",
                      "name": "Cotton kurta",
                      "variantName": "M",
                      "qty": 2,
                      "unitPaise": "104900",
                      "gstRate": 5,
                      "lineTotalPaise": "209800"
                    }
                  ],
                  "subtotalPaise": "209800",
                  "discountPaise": "0",
                  "shippingPaise": "0",
                  "codFeePaise": "4900",
                  "taxPaise": "9990",
                  "totalPaise": "214700",
                  "couponCode": null,
                  "paymentMethod": "COD",
                  "paymentStatus": "COD",
                  "status": "SHIPPED",
                  "trackingNumber": "AWB123456789",
                  "trackingUrl": null,
                  "source": "WEBSITE",
                  "invoiceNumber": null,
                  "link": "https://panel.example.com/o/AbC123xyz789",
                  "createdAt": "2026-11-08T05:30:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "NEW",
                      "CONFIRMED",
                      "PACKED",
                      "SHIPPED",
                      "DELIVERED",
                      "CANCELLED",
                      "RETURNED"
                    ],
                    "description": "New status."
                  },
                  "trackingNumber": {
                    "type": "string",
                    "description": "AWB / consignment number."
                  },
                  "trackingUrl": {
                    "type": "string",
                    "description": "The courier’s tracking page (https)."
                  },
                  "paid": {
                    "type": "boolean",
                    "description": "true marks it paid (a GST invoice is made)."
                  },
                  "notify": {
                    "type": "boolean",
                    "description": "Send the WhatsApp update for the new status. Default: when one is set."
                  },
                  "note": {
                    "type": "string",
                    "description": "Saved in the order history."
                  },
                  "internalNote": {
                    "type": "string",
                    "description": "Only your team sees it."
                  }
                }
              },
              "example": {
                "status": "SHIPPED",
                "trackingNumber": "AWB123456789",
                "trackingUrl": "https://track.example.com/AWB123456789"
              }
            }
          }
        }
      }
    },
    "/bookings/services": {
      "get": {
        "operationId": "listBookingServices",
        "tags": [
          "Bookings"
        ],
        "summary": "List services and staff",
        "description": "Your bookable services (length, price, buffers, seats per slot) and the staff / resources who give them. Prices are in rupees.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "services": [
                    {
                      "id": "…",
                      "name": "Haircut",
                      "durationMin": 30,
                      "price": 500,
                      "advance": null,
                      "bufferBeforeMin": 0,
                      "bufferAfterMin": 15,
                      "capacity": 1,
                      "location": "IN_PERSON",
                      "locationText": "MG Road",
                      "active": true
                    }
                  ],
                  "staff": [
                    {
                      "id": "…",
                      "name": "Anita",
                      "serviceIds": [
                        "…"
                      ],
                      "active": true
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bookings/availability": {
      "get": {
        "operationId": "bookingAvailability",
        "tags": [
          "Bookings"
        ],
        "summary": "Free slots",
        "description": "Free start times on one date, worked out from working hours, days off, the service’s length + buffers and the seats per slot. Times are in your booking time zone.",
        "parameters": [
          {
            "name": "serviceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The service."
            },
            "description": "The service."
          },
          {
            "name": "date",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "YYYY-MM-DD."
            },
            "description": "YYYY-MM-DD."
          },
          {
            "name": "staffId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One staff member (default: anyone)."
            },
            "description": "One staff member (default: anyone)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "timezone": "Asia/Kolkata",
                  "slots": [
                    {
                      "start": "2026-11-20T04:00:00.000Z",
                      "time": "09:30",
                      "staffIds": [
                        "…"
                      ],
                      "seats": 1
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bookings": {
      "get": {
        "operationId": "listBookings",
        "tags": [
          "Bookings"
        ],
        "summary": "List bookings",
        "description": "Appointments, newest first (or by start time with from).",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "PENDING",
                "CONFIRMED",
                "CANCELLED",
                "COMPLETED",
                "NO_SHOW"
              ],
              "description": "Filter (ACTIVE = pending or confirmed)."
            },
            "description": "Filter (ACTIVE = pending or confirmed)."
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Starting at or after (ISO date-time)."
            },
            "description": "Starting at or after (ISO date-time)."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Starting before (ISO date-time)."
            },
            "description": "Starting before (ISO date-time)."
          },
          {
            "name": "staffId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One staff member."
            },
            "description": "One staff member."
          },
          {
            "name": "contactId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One customer."
            },
            "description": "One customer."
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Booking number, name, phone or email."
            },
            "description": "Booking number, name, phone or email."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–100, default 50."
            },
            "description": "1–100, default 50."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Skip this many."
            },
            "description": "Skip this many."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "ref": "B-1001",
                      "status": "CONFIRMED",
                      "service": {
                        "id": "…",
                        "name": "Haircut"
                      },
                      "staff": {
                        "id": "…",
                        "name": "Anita"
                      },
                      "customer": {
                        "name": "Priya Sharma",
                        "phone": "+919811122333",
                        "email": null
                      },
                      "startAt": "2026-11-20T04:00:00.000Z",
                      "endAt": "2026-11-20T04:30:00.000Z",
                      "when": "Fri, 20 Nov at 9:30 am",
                      "paymentStatus": "NONE",
                      "source": "PAGE"
                    }
                  ],
                  "total": 1
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createBooking",
        "tags": [
          "Bookings"
        ],
        "summary": "Book an appointment",
        "description": "Books a slot (double bookings are refused with SLOT_TAKEN, 409). The customer gets the confirmation unless notify is false.",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "ref": "B-1002",
                  "status": "CONFIRMED",
                  "manageUrl": "https://panel.example.com/book/m/AbC123"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "serviceId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The service."
                  },
                  "start": {
                    "type": "string",
                    "description": "Start (ISO date-time), usually one from Free slots."
                  },
                  "name": {
                    "type": "string",
                    "description": "Customer’s name."
                  },
                  "phone": {
                    "type": "string",
                    "description": "WhatsApp number with country code."
                  },
                  "email": {
                    "type": "string",
                    "description": "Email (gets email copies)."
                  },
                  "staffId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A staff member (default: whoever is free)."
                  },
                  "notes": {
                    "type": "string",
                    "description": "Notes."
                  },
                  "anyTime": {
                    "type": "boolean",
                    "description": "Allow times outside working hours (still never a clash)."
                  },
                  "notify": {
                    "type": "boolean",
                    "description": "Send the confirmation. Default true."
                  }
                },
                "required": [
                  "serviceId",
                  "start",
                  "name"
                ]
              },
              "example": {
                "serviceId": "…",
                "start": "2026-11-20T04:00:00.000Z",
                "name": "Priya Sharma",
                "phone": "+919811122333"
              }
            }
          }
        }
      }
    },
    "/bookings/{id}": {
      "get": {
        "operationId": "getBooking",
        "tags": [
          "Bookings"
        ],
        "summary": "Get a booking",
        "description": "One booking by id or number (B-1001), with its history and the customer’s manage link.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Booking id or number."
            },
            "description": "Booking id or number."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "ref": "B-1001",
                  "status": "CONFIRMED",
                  "service": {
                    "id": "…",
                    "name": "Haircut"
                  },
                  "staff": {
                    "id": "…",
                    "name": "Anita"
                  },
                  "startAt": "2026-11-20T04:00:00.000Z",
                  "history": [
                    {
                      "at": "…",
                      "status": "CONFIRMED",
                      "by": null,
                      "note": "Booked (page)"
                    }
                  ],
                  "manageUrl": "https://panel.example.com/book/m/AbC123"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateBooking",
        "tags": [
          "Bookings"
        ],
        "summary": "Update a booking",
        "description": "Reschedule (start, staffId), confirm a pending one, mark attended / no-show, or cancel. The customer is told unless notify is false.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Booking id or number."
            },
            "description": "Booking id or number."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "ref": "B-1001",
                  "status": "CONFIRMED",
                  "startAt": "2026-11-21T05:30:00.000Z",
                  "when": "Sat, 21 Nov at 11:00 am"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "CONFIRMED",
                      "CANCELLED",
                      "COMPLETED",
                      "NO_SHOW"
                    ],
                    "description": "New status."
                  },
                  "start": {
                    "type": "string",
                    "description": "New start (ISO date-time)."
                  },
                  "staffId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Another staff member."
                  },
                  "reason": {
                    "type": "string",
                    "description": "Why (saved in the history)."
                  },
                  "notify": {
                    "type": "boolean",
                    "description": "Tell the customer. Default true."
                  }
                }
              },
              "example": {
                "start": "2026-11-21T05:30:00.000Z"
              }
            }
          }
        }
      }
    },
    "/recurring/plans": {
      "get": {
        "operationId": "listRecurringPlans",
        "tags": [
          "Subscriptions"
        ],
        "summary": "List plans",
        "description": "Your recurring plans (memberships / subscriptions you sell): price per period, GST rate, setup fee, trial and usage allowance.\n\nNeeds Subscriptions in your plan.\n\nMoney is in paise as strings (150000 = ₹1,500).",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "name": "Gym — monthly",
                      "period": "MONTHLY",
                      "periodLabel": "month",
                      "pricePaise": "150000",
                      "gstPercent": "18",
                      "setupFeePaise": "0",
                      "trialDays": 7,
                      "usageLimit": null,
                      "status": "ACTIVE",
                      "activeSubscriptions": 42
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/recurring/subscriptions": {
      "get": {
        "operationId": "listRecurringSubscriptions",
        "tags": [
          "Subscriptions"
        ],
        "summary": "List subscriptions",
        "description": "Your customers’ subscriptions, next renewal first.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "LIVE",
                "TRIAL",
                "ACTIVE",
                "PAST_DUE",
                "PAUSED",
                "CANCELLED",
                "EXPIRED"
              ],
              "description": "LIVE = trial, active, payment due and paused."
            },
            "description": "LIVE = trial, active, payment due and paused."
          },
          {
            "name": "planId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One plan’s subscriptions."
            },
            "description": "One plan’s subscriptions."
          },
          {
            "name": "due",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "week",
                "month"
              ],
              "description": "Renewing within a week or a month."
            },
            "description": "Renewing within a week or a month."
          },
          {
            "name": "requests",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "true: only those with a customer request (pause / cancel / change plan) waiting."
            },
            "description": "true: only those with a customer request (pause / cancel / change plan) waiting."
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Name, phone or S-1001."
            },
            "description": "Name, phone or S-1001."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–100, default 50."
            },
            "description": "1–100, default 50."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Skip this many."
            },
            "description": "Skip this many."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "6c1f…",
                      "ref": "S-1001",
                      "status": "ACTIVE",
                      "contact": {
                        "id": "…",
                        "name": "Asha Rao",
                        "phone": "919876543210"
                      },
                      "plan": {
                        "id": "…",
                        "name": "Gym — monthly",
                        "periodLabel": "month"
                      },
                      "pricePaise": "150000",
                      "renewsAt": "2026-12-07T00:00:00.000Z",
                      "autoRenew": true,
                      "cancelAtPeriodEnd": false,
                      "request": null,
                      "duePaise": "0",
                      "overdue": false
                    }
                  ],
                  "total": 1
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createRecurringSubscription",
        "tags": [
          "Subscriptions"
        ],
        "summary": "Start a subscription",
        "description": "Add a customer to a plan, or on custom terms of their own (no plan). Without a trial, the first invoice is made now (or recorded as paid). Renewal invoices, reminders and pay links follow automatically — nothing is debited.\n\nThe active-subscription limit of your plan applies (LIMIT_REACHED).",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "ref": "S-1001",
                  "status": "ACTIVE",
                  "invoices": [
                    {
                      "id": "…",
                      "number": "INV-0042",
                      "kind": "RENEWAL",
                      "status": "OPEN",
                      "totalPaise": "177000",
                      "taxPaise": "27000",
                      "dueAt": "2026-12-07T00:00:00.000Z",
                      "paidAt": null,
                      "paidVia": null,
                      "link": "https://panel.example.com/i/QTspP_Hdgk…"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "planId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "From GET /v1/recurring/plans. Give this or custom."
                  },
                  "custom": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Custom terms for this customer only, instead of a plan: name, price, period (WEEKLY, MONTHLY, QUARTERLY, YEARLY or DAYS + periodDays), and optional description, gstPercent (0, 5, 12, 18, 28), setupFee, trialDays, usageLimit, usageLabel. The subscription shows plan.custom: true."
                  },
                  "contactId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "An existing contact. Or give phone (found or added on your WhatsApp number)."
                  },
                  "phone": {
                    "type": "string",
                    "description": "The customer’s WhatsApp number, with country code (+919876543210). Numbers without one are read as Indian."
                  },
                  "name": {
                    "type": "string",
                    "description": "Their name (new contacts)."
                  },
                  "email": {
                    "type": "string",
                    "description": "Used when there’s no WhatsApp template for a notice."
                  },
                  "startDate": {
                    "type": "string",
                    "description": "YYYY-MM-DD, default today."
                  },
                  "trialDays": {
                    "type": "integer",
                    "description": "Overrides the plan’s trial (0 = none)."
                  },
                  "price": {
                    "type": "string",
                    "description": "Price for this customer in rupees, e.g. 1299."
                  },
                  "firstPeriodPaid": {
                    "type": "boolean",
                    "description": "Record the first period as already paid. Default false."
                  }
                }
              },
              "example": {
                "planId": "…",
                "phone": "+919876543210",
                "name": "Asha Rao"
              }
            }
          }
        }
      }
    },
    "/recurring/subscriptions/{id}": {
      "get": {
        "operationId": "getRecurringSubscription",
        "tags": [
          "Subscriptions"
        ],
        "summary": "One subscription",
        "description": "A subscription with its plan, customer, current period, usage and invoices (each with the customer’s pay / view link).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The subscription id."
            },
            "description": "The subscription id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "ref": "S-1001",
                  "status": "ACTIVE",
                  "renewsAt": "2026-12-07T00:00:00.000Z",
                  "invoices": [
                    {
                      "id": "…",
                      "number": "INV-0042",
                      "kind": "RENEWAL",
                      "status": "OPEN",
                      "totalPaise": "177000",
                      "taxPaise": "27000",
                      "dueAt": "2026-12-07T00:00:00.000Z",
                      "paidAt": null,
                      "paidVia": null,
                      "link": "https://panel.example.com/i/QTspP_Hdgk…"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/recurring/subscriptions/{id}/pause": {
      "post": {
        "operationId": "pauseRecurringSubscription",
        "tags": [
          "Subscriptions"
        ],
        "summary": "Pause",
        "description": "Pause until a date (or until resumed). When it resumes, the renewal date moves by the days it was paused.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The subscription id."
            },
            "description": "The subscription id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "status": "PAUSED"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "until": {
                    "type": "string",
                    "description": "YYYY-MM-DD; empty = until resumed."
                  },
                  "reason": {
                    "type": "string",
                    "description": "Shown in reports."
                  }
                }
              },
              "example": {
                "until": "2026-12-01",
                "reason": "Travelling"
              }
            }
          }
        }
      }
    },
    "/recurring/subscriptions/{id}/resume": {
      "post": {
        "operationId": "resumeRecurringSubscription",
        "tags": [
          "Subscriptions"
        ],
        "summary": "Resume",
        "description": "Resume a paused subscription.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The subscription id."
            },
            "description": "The subscription id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "status": "ACTIVE"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/recurring/subscriptions/{id}/cancel": {
      "post": {
        "operationId": "cancelRecurringSubscription",
        "tags": [
          "Subscriptions"
        ],
        "summary": "Cancel",
        "description": "PERIOD_END: it runs until the renewal date, then ends. NOW: ends now and open invoices are cancelled.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The subscription id."
            },
            "description": "The subscription id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "status": "ACTIVE",
                  "cancelAtPeriodEnd": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "when": {
                    "type": "string",
                    "enum": [
                      "PERIOD_END",
                      "NOW"
                    ],
                    "description": "When it ends."
                  },
                  "reason": {
                    "type": "string",
                    "description": "Shown in reports."
                  }
                },
                "required": [
                  "when"
                ]
              },
              "example": {
                "when": "PERIOD_END",
                "reason": "Moved city"
              }
            }
          }
        }
      }
    },
    "/recurring/invoices": {
      "get": {
        "operationId": "listRecurringInvoices",
        "tags": [
          "Subscriptions"
        ],
        "summary": "List invoices",
        "description": "Customer invoices (in your name and series), newest first. link is the customer’s page to view, download and pay.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "OVERDUE",
                "PAID"
              ],
              "description": "Filter."
            },
            "description": "Filter."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–200, default 100."
            },
            "description": "1–200, default 100."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "number": "INV-0042",
                      "kind": "RENEWAL",
                      "status": "OPEN",
                      "totalPaise": "177000",
                      "taxPaise": "27000",
                      "dueAt": "2026-12-07T00:00:00.000Z",
                      "paidAt": null,
                      "paidVia": null,
                      "link": "https://panel.example.com/i/QTspP_Hdgk…"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/recurring/invoices/{id}/paid": {
      "post": {
        "operationId": "payRecurringInvoice",
        "tags": [
          "Subscriptions"
        ],
        "summary": "Mark an invoice paid",
        "description": "Record a payment you received outside the pay link (cash, UPI, bank). The period renews and the customer gets the receipt.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The invoice id."
            },
            "description": "The invoice id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "number": "INV-0042",
                  "kind": "RENEWAL",
                  "status": "PAID",
                  "totalPaise": "177000",
                  "taxPaise": "27000",
                  "dueAt": "2026-12-07T00:00:00.000Z",
                  "paidAt": null,
                  "paidVia": "UPI",
                  "link": "https://panel.example.com/i/QTspP_Hdgk…"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "method": {
                    "type": "string",
                    "enum": [
                      "CASH",
                      "UPI",
                      "BANK",
                      "CARD",
                      "OTHER"
                    ],
                    "description": "How they paid."
                  },
                  "reference": {
                    "type": "string",
                    "description": "UTR / receipt number."
                  },
                  "paidOn": {
                    "type": "string",
                    "description": "YYYY-MM-DD, default today."
                  }
                },
                "required": [
                  "method"
                ]
              },
              "example": {
                "method": "UPI",
                "reference": "UTR4211"
              }
            }
          }
        }
      }
    },
    "/tickets": {
      "get": {
        "operationId": "listTickets",
        "tags": [
          "Tickets"
        ],
        "summary": "List tickets",
        "description": "Tickets, most urgent first, then most recently changed. Use updatedSince to sync changes into another system.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "open",
                "waiting",
                "on_hold",
                "solved",
                "closed",
                "overdue",
                "all"
              ],
              "description": "active = open, waiting and on hold. Default all."
            },
            "description": "active = open, waiting and on hold. Default all."
          },
          {
            "name": "priority",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "LOW",
                "NORMAL",
                "HIGH",
                "URGENT"
              ],
              "description": "Only this priority."
            },
            "description": "Only this priority."
          },
          {
            "name": "assignedTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One team member’s tickets (ids from GET /v1/team)."
            },
            "description": "One team member’s tickets (ids from GET /v1/team)."
          },
          {
            "name": "assigned",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "unassigned",
                "all"
              ],
              "description": "unassigned for tickets nobody owns."
            },
            "description": "unassigned for tickets nobody owns."
          },
          {
            "name": "teamId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One team’s tickets (ids from GET /v1/teams)."
            },
            "description": "One team’s tickets (ids from GET /v1/teams)."
          },
          {
            "name": "contactId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One contact’s tickets."
            },
            "description": "One contact’s tickets."
          },
          {
            "name": "updatedSince",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Changed at or after this time (ISO 8601)."
            },
            "description": "Changed at or after this time (ISO 8601)."
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Search the subject, requester or #number."
            },
            "description": "Search the subject, requester or #number."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–100, default 50."
            },
            "description": "1–100, default 50."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Skip this many (for the next page)."
            },
            "description": "Skip this many (for the next page)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "3d9a7c2e-6b1f-4e8d-9a0c-1b2c3d4e5f60",
                      "number": 42,
                      "ref": "#42",
                      "subject": "Order not delivered",
                      "status": "OPEN",
                      "priority": "HIGH",
                      "source": "API",
                      "contactId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                      "conversationId": null,
                      "requester": {
                        "name": "Asha Rao",
                        "email": "asha@example.com",
                        "phone": "919876543210"
                      },
                      "assignedUserId": null,
                      "assigneeName": null,
                      "teamId": null,
                      "teamName": null,
                      "tags": [
                        "delivery"
                      ],
                      "fields": {
                        "order": "10023"
                      },
                      "firstResponseDueAt": "2026-10-19T11:20:00.000Z",
                      "resolveDueAt": "2026-10-20T10:20:00.000Z",
                      "firstRespondedAt": null,
                      "solvedAt": null,
                      "closedAt": null,
                      "overdue": false,
                      "overdueWhat": null,
                      "rating": null,
                      "ratingComment": null,
                      "createdAt": "2026-10-19T10:20:00.000Z",
                      "updatedAt": "2026-10-19T10:20:00.000Z"
                    }
                  ],
                  "total": 1
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createTicket",
        "tags": [
          "Tickets"
        ],
        "summary": "Create a ticket",
        "description": "Open a ticket for a customer. Link it to a contact by id, or let us find them by WhatsApp number or email.\n\nNeeds the Tickets feature in your plan; the monthly ticket limit applies.\n\nSet notify: true to email the customer that their request was received (with their status page link).",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "3d9a7c2e-6b1f-4e8d-9a0c-1b2c3d4e5f60",
                  "number": 42,
                  "ref": "#42",
                  "subject": "Order not delivered",
                  "status": "OPEN",
                  "priority": "HIGH",
                  "source": "API",
                  "contactId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                  "conversationId": null,
                  "requester": {
                    "name": "Asha Rao",
                    "email": "asha@example.com",
                    "phone": "919876543210"
                  },
                  "assignedUserId": null,
                  "assigneeName": null,
                  "teamId": null,
                  "teamName": null,
                  "tags": [
                    "delivery"
                  ],
                  "fields": {
                    "order": "10023"
                  },
                  "firstResponseDueAt": "2026-10-19T11:20:00.000Z",
                  "resolveDueAt": "2026-10-20T10:20:00.000Z",
                  "firstRespondedAt": null,
                  "solvedAt": null,
                  "closedAt": null,
                  "overdue": false,
                  "overdueWhat": null,
                  "rating": null,
                  "ratingComment": null,
                  "createdAt": "2026-10-19T10:20:00.000Z",
                  "updatedAt": "2026-10-19T10:20:00.000Z",
                  "statusPageUrl": "https://app.example.com/t/q7Yb…",
                  "conversation": null,
                  "contact": {
                    "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "name": "Asha Rao",
                    "phone": "919876543210",
                    "email": "asha@example.com",
                    "channel": "WHATSAPP",
                    "tags": []
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subject": {
                    "type": "string",
                    "description": "Short summary, 2–150 characters."
                  },
                  "description": {
                    "type": "string",
                    "description": "What the customer asked (shown to them on the status page)."
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "LOW",
                      "NORMAL",
                      "HIGH",
                      "URGENT"
                    ],
                    "description": "Default NORMAL. Reply and solve targets follow it."
                  },
                  "contact": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "{ \"id\" }, { \"phone\" } or { \"email\" }. Not found by phone or email: the details are kept on the ticket."
                  },
                  "conversationId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Link it to a chat (WhatsApp, Instagram or website)."
                  },
                  "requesterName": {
                    "type": "string",
                    "description": "The customer’s name, if not a contact."
                  },
                  "requesterEmail": {
                    "type": "string",
                    "description": "Where ticket emails go."
                  },
                  "assignedUserId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owner (from GET /v1/team)."
                  },
                  "teamId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Team (from GET /v1/teams)."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Up to 20."
                  },
                  "notify": {
                    "type": "boolean",
                    "description": "Email the customer now. Default false."
                  }
                },
                "required": [
                  "subject"
                ]
              },
              "example": {
                "subject": "Order not delivered",
                "description": "Order 10023 was due yesterday.",
                "priority": "HIGH",
                "contact": {
                  "phone": "+919876543210"
                },
                "tags": [
                  "delivery"
                ]
              }
            }
          }
        }
      }
    },
    "/tickets/{id}": {
      "get": {
        "operationId": "getTicket",
        "tags": [
          "Tickets"
        ],
        "summary": "One ticket",
        "description": "A ticket with its contact, linked chat and the customer’s status page link.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The ticket id."
            },
            "description": "The ticket id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "3d9a7c2e-6b1f-4e8d-9a0c-1b2c3d4e5f60",
                  "number": 42,
                  "ref": "#42",
                  "subject": "Order not delivered",
                  "status": "OPEN",
                  "priority": "HIGH",
                  "source": "API",
                  "contactId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                  "conversationId": null,
                  "requester": {
                    "name": "Asha Rao",
                    "email": "asha@example.com",
                    "phone": "919876543210"
                  },
                  "assignedUserId": null,
                  "assigneeName": null,
                  "teamId": null,
                  "teamName": null,
                  "tags": [
                    "delivery"
                  ],
                  "fields": {
                    "order": "10023"
                  },
                  "firstResponseDueAt": "2026-10-19T11:20:00.000Z",
                  "resolveDueAt": "2026-10-20T10:20:00.000Z",
                  "firstRespondedAt": null,
                  "solvedAt": null,
                  "closedAt": null,
                  "overdue": false,
                  "overdueWhat": null,
                  "rating": null,
                  "ratingComment": null,
                  "createdAt": "2026-10-19T10:20:00.000Z",
                  "updatedAt": "2026-10-19T10:20:00.000Z",
                  "statusPageUrl": "https://app.example.com/t/q7Yb…",
                  "conversation": null,
                  "contact": {
                    "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "name": "Asha Rao",
                    "phone": "919876543210",
                    "email": "asha@example.com",
                    "channel": "WHATSAPP",
                    "tags": []
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateTicket",
        "tags": [
          "Tickets"
        ],
        "summary": "Update a ticket",
        "description": "Change status, priority, owner, team, tags, custom fields or the subject. Send only what changes.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The ticket id."
            },
            "description": "The ticket id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "3d9a7c2e-6b1f-4e8d-9a0c-1b2c3d4e5f60",
                  "number": 42,
                  "ref": "#42",
                  "subject": "Order not delivered",
                  "status": "ON_HOLD",
                  "priority": "URGENT",
                  "source": "API",
                  "contactId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                  "conversationId": null,
                  "requester": {
                    "name": "Asha Rao",
                    "email": "asha@example.com",
                    "phone": "919876543210"
                  },
                  "assignedUserId": null,
                  "assigneeName": null,
                  "teamId": null,
                  "teamName": null,
                  "tags": [
                    "delivery"
                  ],
                  "fields": {
                    "order": "10023"
                  },
                  "firstResponseDueAt": "2026-10-19T11:20:00.000Z",
                  "resolveDueAt": "2026-10-20T10:20:00.000Z",
                  "firstRespondedAt": null,
                  "solvedAt": null,
                  "closedAt": null,
                  "overdue": false,
                  "overdueWhat": null,
                  "rating": null,
                  "ratingComment": null,
                  "createdAt": "2026-10-19T10:20:00.000Z",
                  "updatedAt": "2026-10-19T10:20:00.000Z",
                  "statusPageUrl": "https://app.example.com/t/q7Yb…",
                  "conversation": null,
                  "contact": {
                    "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "name": "Asha Rao",
                    "phone": "919876543210",
                    "email": "asha@example.com",
                    "channel": "WHATSAPP",
                    "tags": []
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "OPEN",
                      "WAITING",
                      "ON_HOLD",
                      "SOLVED",
                      "CLOSED"
                    ],
                    "description": "New status. Solved tickets close by themselves after the days set in Tickets → Settings."
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "LOW",
                      "NORMAL",
                      "HIGH",
                      "URGENT"
                    ],
                    "description": "New priority (targets are recalculated)."
                  },
                  "assignedUserId": {
                    "type": "string",
                    "format": "uuid",
                    "nullable": true,
                    "description": "New owner; null for nobody."
                  },
                  "teamId": {
                    "type": "string",
                    "format": "uuid",
                    "nullable": true,
                    "description": "New team; null for none."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Replaces the tags."
                  },
                  "fields": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Custom fields, { \"name\": \"value\" }; replaces them."
                  },
                  "subject": {
                    "type": "string",
                    "description": "New subject."
                  }
                }
              },
              "example": {
                "status": "ON_HOLD",
                "priority": "URGENT",
                "fields": {
                  "order": "10023"
                }
              }
            }
          }
        }
      }
    },
    "/tickets/{id}/replies": {
      "post": {
        "operationId": "ticketReply",
        "tags": [
          "Tickets"
        ],
        "summary": "Reply to the customer",
        "description": "Emails the customer (and shows on their status page). inChat also sends it in the linked chat.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The ticket id."
            },
            "description": "The ticket id."
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "3d9a7c2e-6b1f-4e8d-9a0c-1b2c3d4e5f60",
                  "number": 42,
                  "ref": "#42",
                  "subject": "Order not delivered",
                  "status": "SOLVED",
                  "priority": "HIGH",
                  "source": "API",
                  "contactId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                  "conversationId": null,
                  "requester": {
                    "name": "Asha Rao",
                    "email": "asha@example.com",
                    "phone": "919876543210"
                  },
                  "assignedUserId": null,
                  "assigneeName": null,
                  "teamId": null,
                  "teamName": null,
                  "tags": [
                    "delivery"
                  ],
                  "fields": {
                    "order": "10023"
                  },
                  "firstResponseDueAt": "2026-10-19T11:20:00.000Z",
                  "resolveDueAt": "2026-10-20T10:20:00.000Z",
                  "firstRespondedAt": null,
                  "solvedAt": null,
                  "closedAt": null,
                  "overdue": false,
                  "overdueWhat": null,
                  "rating": null,
                  "ratingComment": null,
                  "createdAt": "2026-10-19T10:20:00.000Z",
                  "updatedAt": "2026-10-19T10:20:00.000Z",
                  "statusPageUrl": "https://app.example.com/t/q7Yb…",
                  "conversation": null,
                  "contact": {
                    "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "name": "Asha Rao",
                    "phone": "919876543210",
                    "email": "asha@example.com",
                    "channel": "WHATSAPP",
                    "tags": []
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Up to 5000 characters."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "OPEN",
                      "WAITING",
                      "ON_HOLD",
                      "SOLVED",
                      "CLOSED"
                    ],
                    "description": "Status after the reply. Default WAITING (on the customer)."
                  },
                  "inChat": {
                    "type": "boolean",
                    "description": "Also send it in the linked WhatsApp, Instagram or website chat."
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "Your replacement ships today.",
                "status": "SOLVED"
              }
            }
          }
        }
      }
    },
    "/tickets/{id}/notes": {
      "post": {
        "operationId": "ticketNote",
        "tags": [
          "Tickets"
        ],
        "summary": "Add an internal note",
        "description": "Only your team sees it.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The ticket id."
            },
            "description": "The ticket id."
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "3d9a7c2e-6b1f-4e8d-9a0c-1b2c3d4e5f60",
                  "number": 42,
                  "ref": "#42",
                  "subject": "Order not delivered",
                  "status": "OPEN",
                  "priority": "HIGH",
                  "source": "API",
                  "contactId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                  "conversationId": null,
                  "requester": {
                    "name": "Asha Rao",
                    "email": "asha@example.com",
                    "phone": "919876543210"
                  },
                  "assignedUserId": null,
                  "assigneeName": null,
                  "teamId": null,
                  "teamName": null,
                  "tags": [
                    "delivery"
                  ],
                  "fields": {
                    "order": "10023"
                  },
                  "firstResponseDueAt": "2026-10-19T11:20:00.000Z",
                  "resolveDueAt": "2026-10-20T10:20:00.000Z",
                  "firstRespondedAt": null,
                  "solvedAt": null,
                  "closedAt": null,
                  "overdue": false,
                  "overdueWhat": null,
                  "rating": null,
                  "ratingComment": null,
                  "createdAt": "2026-10-19T10:20:00.000Z",
                  "updatedAt": "2026-10-19T10:20:00.000Z",
                  "statusPageUrl": "https://app.example.com/t/q7Yb…",
                  "conversation": null,
                  "contact": {
                    "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "name": "Asha Rao",
                    "phone": "919876543210",
                    "email": "asha@example.com",
                    "channel": "WHATSAPP",
                    "tags": []
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Up to 5000 characters."
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "Courier ref DL-55102"
              }
            }
          }
        }
      }
    },
    "/tickets/{id}/messages": {
      "get": {
        "operationId": "ticketMessages",
        "tags": [
          "Tickets"
        ],
        "summary": "A ticket’s messages",
        "description": "The timeline, oldest first: created, reply (to the customer), customer_reply, note, change and rating.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The ticket id."
            },
            "description": "The ticket id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "1",
                      "kind": "created",
                      "text": "Order 10023 was due yesterday.",
                      "author": null,
                      "data": {
                        "source": "API"
                      },
                      "createdAt": "2026-10-19T10:20:00.000Z"
                    },
                    {
                      "id": "2",
                      "kind": "reply",
                      "text": "Your replacement ships today.",
                      "author": "Priya",
                      "data": {
                        "inChat": false
                      },
                      "createdAt": "2026-10-19T10:40:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/teams": {
      "get": {
        "operationId": "listTeams",
        "tags": [
          "Tickets"
        ],
        "summary": "Teams",
        "description": "Your CRM teams and their members, to route tickets to.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "f6b2…",
                      "name": "Sales",
                      "memberIds": [
                        "7e6d…"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webinars": {
      "get": {
        "operationId": "listWebinars",
        "tags": [
          "Webinars"
        ],
        "summary": "List webinars",
        "description": "Your webinars with their registration page, the open link (joinUrl, join without registering; null when off), next session and counts (Webinars app). durationSeconds is the webinar length after any trim; trim is where it starts and ends inside the video (endSeconds null = the video’s end).",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "00000000-0000-4000-8000-000000000040",
                      "name": "Grow your coaching business",
                      "slug": "grow-your-coaching-business-4f2a1c",
                      "status": "ACTIVE",
                      "registerUrl": "https://acme.example.com/wb/grow-your-coaching-business-4f2a1c",
                      "joinUrl": "https://acme.example.com/wb/grow-your-coaching-business-4f2a1c/join",
                      "registrationPage": true,
                      "videoReady": true,
                      "durationSeconds": 3540,
                      "trim": {
                        "startSeconds": 47,
                        "endSeconds": 3587
                      },
                      "registrations": 128,
                      "attended": 61,
                      "nextSession": "2026-11-20T13:30:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webinars/{id}/sessions": {
      "get": {
        "operationId": "listWebinarSessions",
        "tags": [
          "Webinars"
        ],
        "summary": "List upcoming sessions",
        "description": "The next sessions of a webinar (two weeks ahead), with registrations so far.\n\nJust-in-time webinars list only sessions someone has registered for (a slot becomes a session on its first registration).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The webinar."
            },
            "description": "The webinar."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "00000000-0000-4000-8000-000000000041",
                      "startsAt": "2026-11-20T13:30:00.000Z",
                      "endsAt": "2026-11-20T14:29:00.000Z",
                      "status": "SCHEDULED",
                      "when": "Fri, 20 Nov at 7:00 pm",
                      "live": false,
                      "jit": false,
                      "registered": 34,
                      "joined": 0,
                      "attended": 0,
                      "avgMinutes": 0,
                      "offerShown": 0,
                      "offerClicked": 0,
                      "stayedToOffer": 0,
                      "purchased": 0,
                      "revenue": "0.00"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webinars/{id}/registrants": {
      "get": {
        "operationId": "listWebinarRegistrants",
        "tags": [
          "Webinars"
        ],
        "summary": "List registrants",
        "description": "People registered for a webinar (newest first, up to 200) with attendance, offer clicks, purchases and replay watching.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The webinar."
            },
            "description": "The webinar."
          },
          {
            "name": "sessionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Only one session’s registrants."
            },
            "description": "Only one session’s registrants."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "00000000-0000-4000-8000-000000000042",
                      "sessionId": "00000000-0000-4000-8000-000000000041",
                      "contactId": "00000000-0000-4000-8000-000000000005",
                      "name": "Priya Sharma",
                      "phone": "+919876543210",
                      "email": "priya@example.com",
                      "source": "INSTAGRAM",
                      "utm": {
                        "utm_source": "ig"
                      },
                      "roomUrl": "https://acme.example.com/wbr/AbCdEf1234567890AbCdEf12",
                      "joinedAt": "2026-11-20T13:31:10.000Z",
                      "minutesWatched": 52,
                      "furthestMinute": 58,
                      "offerShown": true,
                      "offerClicked": true,
                      "attended": true,
                      "purchased": true,
                      "purchase": {
                        "at": "2026-11-20T14:20:00.000Z",
                        "amount": "4999.00",
                        "currency": "INR",
                        "minute": 48
                      },
                      "replayUrl": "https://acme.example.com/wbr/AbCdEf1234567890AbCdEf12/replay",
                      "replayMinutes": 0,
                      "createdAt": "2026-11-19T10:00:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "registerWebinar",
        "tags": [
          "Webinars"
        ],
        "summary": "Register someone for a webinar",
        "description": "Gives a person a seat in the next session (or the session you name). They become a contact on your WhatsApp number, get the confirmation reminder, and start any “Registered for a webinar” flows.\n\nRegistering the same number for the same session again returns the same seat (created: false).\n\nroomUrl is their personal room link — send it to them. replayUrl opens after the session when the webinar’s replay is on.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The webinar (must be running)."
            },
            "description": "The webinar (must be running)."
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "00000000-0000-4000-8000-000000000042",
                  "created": true,
                  "sessionId": "00000000-0000-4000-8000-000000000041",
                  "startsAt": "2026-11-20T13:30:00.000Z",
                  "when": "Fri, 20 Nov at 7:00 pm",
                  "roomUrl": "https://acme.example.com/wbr/AbCdEf1234567890AbCdEf12",
                  "replayUrl": "https://acme.example.com/wbr/AbCdEf1234567890AbCdEf12/replay",
                  "contactId": "00000000-0000-4000-8000-000000000005"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to 120 characters."
                  },
                  "phone": {
                    "type": "string",
                    "description": "WhatsApp number with the country code, e.g. +919876543210."
                  },
                  "email": {
                    "type": "string",
                    "description": "Optional."
                  },
                  "sessionId": {
                    "type": "string",
                    "description": "A session from List upcoming sessions, or a just-in-time slot (jit-<epoch ms>, as the registration page offers). Default: the next one."
                  },
                  "source": {
                    "type": "string",
                    "description": "Where they came from, e.g. ADS (default API)."
                  },
                  "utm": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "utm_source, utm_medium, utm_campaign, utm_term, utm_content."
                  }
                },
                "required": [
                  "name",
                  "phone"
                ]
              },
              "example": {
                "name": "Priya Sharma",
                "phone": "+919876543210",
                "email": "priya@example.com"
              }
            }
          }
        }
      }
    },
    "/help/articles": {
      "get": {
        "operationId": "listHelpArticles",
        "tags": [
          "Help centre"
        ],
        "summary": "List help articles",
        "description": "Your help centre articles, in their order. Bodies are left out; get one article for its body.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Search titles, summaries and text."
            },
            "description": "Search titles, summaries and text."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "published",
                "draft"
              ],
              "description": "Only published or draft articles."
            },
            "description": "Only published or draft articles."
          },
          {
            "name": "categoryId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One category’s articles."
            },
            "description": "One category’s articles."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Up to 200 (default 100)."
            },
            "description": "Up to 200 (default 100)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "00000000-0000-4000-8000-000000000021",
                      "title": "How long does delivery take?",
                      "slug": "how-long-does-delivery-take",
                      "summary": "Delivery times in Pune",
                      "status": "PUBLISHED",
                      "categoryId": "…",
                      "categoryName": "Orders & delivery",
                      "sortOrder": 1,
                      "views": 120,
                      "helpfulYes": 14,
                      "helpfulNo": 1,
                      "authorName": "Asha",
                      "publishedAt": "2026-11-05T05:30:00.000Z",
                      "updatedAt": "2026-11-06T05:30:00.000Z",
                      "createdAt": "2026-11-05T05:30:00.000Z",
                      "url": "https://acme.example.com/help/Xy12Ab34/a/how-long-does-delivery-take"
                    }
                  ],
                  "total": 1
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createHelpArticle",
        "tags": [
          "Help centre"
        ],
        "summary": "Create a help article",
        "description": "A new article (a draft unless you publish it). The web address is made from the title.\n\nThe body is Markdown: ## heading, **bold**, *italic*, - list, [link](https://…). HTML in the body is shown as text.\n\nPublished articles appear on your help pages and in the live chat widget, and your AI assistant answers from them.",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "00000000-0000-4000-8000-000000000021",
                  "title": "How long does delivery take?",
                  "slug": "how-long-does-delivery-take",
                  "summary": "Delivery times in Pune",
                  "status": "PUBLISHED",
                  "categoryId": "…",
                  "categoryName": "Orders & delivery",
                  "sortOrder": 1,
                  "views": 120,
                  "helpfulYes": 14,
                  "helpfulNo": 1,
                  "authorName": "Asha",
                  "publishedAt": "2026-11-05T05:30:00.000Z",
                  "updatedAt": "2026-11-06T05:30:00.000Z",
                  "createdAt": "2026-11-05T05:30:00.000Z",
                  "url": "https://acme.example.com/help/Xy12Ab34/a/how-long-does-delivery-take"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Up to 150 characters."
                  },
                  "body": {
                    "type": "string",
                    "description": "Markdown, up to 60,000 characters."
                  },
                  "summary": {
                    "type": "string",
                    "description": "One line for search results."
                  },
                  "categoryId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A category from your help centre."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "published"
                    ],
                    "description": "Default draft."
                  },
                  "slug": {
                    "type": "string",
                    "description": "Web address, e.g. delivery-times. Made from the title when left out."
                  }
                },
                "required": [
                  "title"
                ]
              },
              "example": {
                "title": "How long does delivery take?",
                "body": "We deliver **within 2 days** in Pune.",
                "status": "published"
              }
            }
          }
        }
      }
    },
    "/help/articles/{id}": {
      "get": {
        "operationId": "getHelpArticle",
        "tags": [
          "Help centre"
        ],
        "summary": "Get a help article",
        "description": "One article with its Markdown body and the HTML it shows as.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The article."
            },
            "description": "The article."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "00000000-0000-4000-8000-000000000021",
                  "title": "How long does delivery take?",
                  "slug": "how-long-does-delivery-take",
                  "summary": "Delivery times in Pune",
                  "status": "PUBLISHED",
                  "categoryId": "…",
                  "categoryName": "Orders & delivery",
                  "sortOrder": 1,
                  "views": 120,
                  "helpfulYes": 14,
                  "helpfulNo": 1,
                  "authorName": "Asha",
                  "publishedAt": "2026-11-05T05:30:00.000Z",
                  "updatedAt": "2026-11-06T05:30:00.000Z",
                  "createdAt": "2026-11-05T05:30:00.000Z",
                  "url": "https://acme.example.com/help/Xy12Ab34/a/how-long-does-delivery-take",
                  "body": "We deliver **within 2 days** in Pune.",
                  "html": "<p>We deliver <strong>within 2 days</strong> in Pune.</p>"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateHelpArticle",
        "tags": [
          "Help centre"
        ],
        "summary": "Change a help article",
        "description": "Change any of the fields, or publish / unpublish it with status.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The article."
            },
            "description": "The article."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "00000000-0000-4000-8000-000000000021",
                  "title": "How long does delivery take?",
                  "slug": "how-long-does-delivery-take",
                  "summary": "Delivery times in Pune",
                  "status": "PUBLISHED",
                  "categoryId": "…",
                  "categoryName": "Orders & delivery",
                  "sortOrder": 1,
                  "views": 120,
                  "helpfulYes": 14,
                  "helpfulNo": 1,
                  "authorName": "Asha",
                  "publishedAt": "2026-11-05T05:30:00.000Z",
                  "updatedAt": "2026-11-06T05:30:00.000Z",
                  "createdAt": "2026-11-05T05:30:00.000Z",
                  "url": "https://acme.example.com/help/Xy12Ab34/a/how-long-does-delivery-take"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "New title."
                  },
                  "body": {
                    "type": "string",
                    "description": "New Markdown body."
                  },
                  "summary": {
                    "type": "string",
                    "description": "New summary."
                  },
                  "categoryId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Move to another category (null for none)."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "published"
                    ],
                    "description": "Publish or unpublish."
                  }
                }
              },
              "example": {
                "status": "published"
              }
            }
          }
        }
      }
    },
    "/pipelines": {
      "get": {
        "operationId": "listPipelines",
        "tags": [
          "Leads"
        ],
        "summary": "List pipelines",
        "description": "Your lead pipelines and their stages (in order). Stage kind is OPEN, WON or LOST.\n\nLead capture, stage automations and follow-up sequences are now flows (Flows → “New chat started”, “Lead stage changed”, and flows started from the API). Their old app settings answer 409 MOVED_TO_FLOWS.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "name": "Property sales",
                      "isDefault": true,
                      "template": "REAL_ESTATE",
                      "stages": [
                        {
                          "id": "…",
                          "name": "New enquiry",
                          "kind": "OPEN",
                          "probability": 10,
                          "color": "sky"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/leads": {
      "get": {
        "operationId": "listLeads",
        "tags": [
          "Leads"
        ],
        "summary": "List leads",
        "description": "Leads, most recently active first.",
        "parameters": [
          {
            "name": "pipelineId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One pipeline."
            },
            "description": "One pipeline."
          },
          {
            "name": "stageId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One stage."
            },
            "description": "One stage."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "WON",
                "LOST"
              ],
              "description": "Open, won or lost."
            },
            "description": "Open, won or lost."
          },
          {
            "name": "owner",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A team member id, or none for unassigned."
            },
            "description": "A team member id, or none for unassigned."
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "MANUAL",
                "IMPORT",
                "API",
                "WHATSAPP",
                "INSTAGRAM",
                "WEB",
                "AD",
                "LINK",
                "BOT",
                "FORM",
                "CAMPAIGN"
              ],
              "description": "Where it came from."
            },
            "description": "Where it came from."
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Has this tag."
            },
            "description": "Has this tag."
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Search name, phone, email, company or L-12."
            },
            "description": "Search name, phone, email, company or L-12."
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Created on or after (YYYY-MM-DD, India time)."
            },
            "description": "Created on or after (YYYY-MM-DD, India time)."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Created on or before."
            },
            "description": "Created on or before."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–100, default 50."
            },
            "description": "1–100, default 50."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Skip this many."
            },
            "description": "Skip this many."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "00000000-0000-4000-8000-000000000012",
                      "ref": "L-42",
                      "title": "Priya Sharma — 3 BHK, Baner",
                      "status": "OPEN",
                      "name": "Priya Sharma",
                      "phone": "+919876543210",
                      "email": "priya@example.com",
                      "company": null,
                      "city": "Pune",
                      "value": "8500000.00",
                      "expectedCloseOn": "2026-12-15",
                      "interest": "3 BHK, Baner",
                      "priority": "HIGH",
                      "source": "FORM",
                      "sourceInfo": {
                        "utm": {
                          "utm_source": "instagram"
                        }
                      },
                      "pipeline": {
                        "id": "…",
                        "name": "Property sales"
                      },
                      "stage": {
                        "id": "…",
                        "name": "New enquiry",
                        "kind": "OPEN"
                      },
                      "owner": {
                        "id": "…",
                        "name": "Asha"
                      },
                      "tags": [
                        "hot"
                      ],
                      "fields": {
                        "bhk": "3 BHK"
                      },
                      "score": 55,
                      "lostReason": null,
                      "contactId": "…",
                      "conversationId": "…",
                      "createdAt": "2026-11-05T05:30:00.000Z",
                      "closedAt": null
                    }
                  ],
                  "total": 1
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createLead",
        "tags": [
          "Leads"
        ],
        "summary": "Create a lead",
        "description": "Add a lead from your website, app or another system. Without a stage it starts in the default pipeline’s first stage; without an owner it stays unassigned (a flow can assign it).\n\nNeeds Lead management in your plan; the monthly lead limit applies.\n\nAn open lead with the same phone or email answers 409 DUPLICATE_LEAD (with the existing lead) unless allowDuplicate: true.",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000012",
                    "ref": "L-42",
                    "title": "Priya Sharma — 3 BHK, Baner",
                    "status": "OPEN",
                    "name": "Priya Sharma",
                    "phone": "+919876543210",
                    "email": "priya@example.com",
                    "company": null,
                    "city": "Pune",
                    "value": "8500000.00",
                    "expectedCloseOn": "2026-12-15",
                    "interest": "3 BHK, Baner",
                    "priority": "HIGH",
                    "source": "FORM",
                    "sourceInfo": {
                      "utm": {
                        "utm_source": "instagram"
                      }
                    },
                    "pipeline": {
                      "id": "…",
                      "name": "Property sales"
                    },
                    "stage": {
                      "id": "…",
                      "name": "New enquiry",
                      "kind": "OPEN"
                    },
                    "owner": {
                      "id": "…",
                      "name": "Asha"
                    },
                    "tags": [
                      "hot"
                    ],
                    "fields": {
                      "bhk": "3 BHK"
                    },
                    "score": 55,
                    "lostReason": null,
                    "contactId": "…",
                    "conversationId": "…",
                    "createdAt": "2026-11-05T05:30:00.000Z",
                    "closedAt": null
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The person’s name."
                  },
                  "phone": {
                    "type": "string",
                    "description": "Phone; 10 digits are taken as Indian (+91)."
                  },
                  "email": {
                    "type": "string",
                    "description": "Email."
                  },
                  "title": {
                    "type": "string",
                    "description": "Shown on the board. Default: name and interest."
                  },
                  "interest": {
                    "type": "string",
                    "description": "What they want."
                  },
                  "value": {
                    "type": "string",
                    "description": "Deal value in rupees."
                  },
                  "company": {
                    "type": "string",
                    "description": "Company."
                  },
                  "city": {
                    "type": "string",
                    "description": "City."
                  },
                  "pipelineId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Pipeline (from GET /v1/pipelines)."
                  },
                  "stageId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Stage to start in."
                  },
                  "ownerId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Owner (from GET /v1/team)."
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "LOW",
                      "NORMAL",
                      "HIGH",
                      "URGENT"
                    ],
                    "description": "Default NORMAL."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Up to 20."
                  },
                  "fields": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Your own lead fields, by key."
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "API",
                      "WHATSAPP",
                      "INSTAGRAM",
                      "WEB",
                      "FORM",
                      "IMPORT",
                      "MANUAL"
                    ],
                    "description": "Shown as the source. Default API."
                  },
                  "utm": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "utm_source, utm_campaign… kept with the lead."
                  },
                  "note": {
                    "type": "string",
                    "description": "A first note on the timeline."
                  },
                  "allowDuplicate": {
                    "type": "boolean",
                    "description": "Create even when an open lead for this person exists."
                  }
                }
              },
              "example": {
                "name": "Priya Sharma",
                "phone": "9876543210",
                "interest": "3 BHK, Baner",
                "value": 8500000,
                "source": "WEB",
                "utm": {
                  "utm_source": "google",
                  "utm_campaign": "diwali"
                }
              }
            }
          }
        }
      }
    },
    "/leads/{id}": {
      "get": {
        "operationId": "getLead",
        "tags": [
          "Leads"
        ],
        "summary": "One lead",
        "description": "A lead with its pipeline, stage, owner, source and fields.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The lead id."
            },
            "description": "The lead id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000012",
                    "ref": "L-42",
                    "title": "Priya Sharma — 3 BHK, Baner",
                    "status": "OPEN",
                    "name": "Priya Sharma",
                    "phone": "+919876543210",
                    "email": "priya@example.com",
                    "company": null,
                    "city": "Pune",
                    "value": "8500000.00",
                    "expectedCloseOn": "2026-12-15",
                    "interest": "3 BHK, Baner",
                    "priority": "HIGH",
                    "source": "FORM",
                    "sourceInfo": {
                      "utm": {
                        "utm_source": "instagram"
                      }
                    },
                    "pipeline": {
                      "id": "…",
                      "name": "Property sales"
                    },
                    "stage": {
                      "id": "…",
                      "name": "New enquiry",
                      "kind": "OPEN"
                    },
                    "owner": {
                      "id": "…",
                      "name": "Asha"
                    },
                    "tags": [
                      "hot"
                    ],
                    "fields": {
                      "bhk": "3 BHK"
                    },
                    "score": 55,
                    "lostReason": null,
                    "contactId": "…",
                    "conversationId": "…",
                    "createdAt": "2026-11-05T05:30:00.000Z",
                    "closedAt": null
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateLead",
        "tags": [
          "Leads"
        ],
        "summary": "Update a lead",
        "description": "Change details, move it to another stage (won / lost too), or give it to someone. Send only what changes.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The lead id."
            },
            "description": "The lead id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000012",
                    "ref": "L-42",
                    "title": "Priya Sharma — 3 BHK, Baner",
                    "status": "OPEN",
                    "name": "Priya Sharma",
                    "phone": "+919876543210",
                    "email": "priya@example.com",
                    "company": null,
                    "city": "Pune",
                    "value": "8500000.00",
                    "expectedCloseOn": "2026-12-15",
                    "interest": "3 BHK, Baner",
                    "priority": "HIGH",
                    "source": "FORM",
                    "sourceInfo": {
                      "utm": {
                        "utm_source": "instagram"
                      }
                    },
                    "pipeline": {
                      "id": "…",
                      "name": "Property sales"
                    },
                    "stage": {
                      "id": "…",
                      "name": "New enquiry",
                      "kind": "OPEN"
                    },
                    "owner": {
                      "id": "…",
                      "name": "Asha"
                    },
                    "tags": [
                      "hot"
                    ],
                    "fields": {
                      "bhk": "3 BHK"
                    },
                    "score": 55,
                    "lostReason": null,
                    "contactId": "…",
                    "conversationId": "…",
                    "createdAt": "2026-11-05T05:30:00.000Z",
                    "closedAt": null
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "stageId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Move to this stage (fires lead.stage_changed, and lead.won / lead.lost)."
                  },
                  "lostReason": {
                    "type": "string",
                    "description": "Why it was lost (with a lost stage)."
                  },
                  "ownerId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "New owner, or null."
                  },
                  "value": {
                    "type": "string",
                    "description": "Deal value in rupees."
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "LOW",
                      "NORMAL",
                      "HIGH",
                      "URGENT"
                    ],
                    "description": "Priority."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Replaces the tags."
                  },
                  "fields": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Merged into the lead’s fields (\"\" removes one)."
                  }
                }
              },
              "example": {
                "stageId": "00000000-0000-4000-8000-000000000015",
                "value": 9000000
              }
            }
          }
        }
      }
    },
    "/leads/{id}/notes": {
      "post": {
        "operationId": "leadNote",
        "tags": [
          "Leads"
        ],
        "summary": "Add a note",
        "description": "A note on the lead’s timeline (e.g. a call summary from your dialer).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The lead id."
            },
            "description": "The lead id."
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000012",
                    "ref": "L-42",
                    "title": "Priya Sharma — 3 BHK, Baner",
                    "status": "OPEN",
                    "name": "Priya Sharma",
                    "phone": "+919876543210",
                    "email": "priya@example.com",
                    "company": null,
                    "city": "Pune",
                    "value": "8500000.00",
                    "expectedCloseOn": "2026-12-15",
                    "interest": "3 BHK, Baner",
                    "priority": "HIGH",
                    "source": "FORM",
                    "sourceInfo": {
                      "utm": {
                        "utm_source": "instagram"
                      }
                    },
                    "pipeline": {
                      "id": "…",
                      "name": "Property sales"
                    },
                    "stage": {
                      "id": "…",
                      "name": "New enquiry",
                      "kind": "OPEN"
                    },
                    "owner": {
                      "id": "…",
                      "name": "Asha"
                    },
                    "tags": [
                      "hot"
                    ],
                    "fields": {
                      "bhk": "3 BHK"
                    },
                    "score": 55,
                    "lostReason": null,
                    "contactId": "…",
                    "conversationId": "…",
                    "createdAt": "2026-11-05T05:30:00.000Z",
                    "closedAt": null
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Up to 5,000 characters."
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "Called — visiting on Sunday."
              }
            }
          }
        }
      }
    },
    "/leads/{id}/tasks": {
      "post": {
        "operationId": "leadTasks",
        "tags": [
          "Leads"
        ],
        "summary": "Add a follow-up task",
        "description": "A follow-up with a due time; its owner gets a reminder (and task.due fires) when it is due. GET the same path lists them; PATCH /v1/lead-tasks/{id} with { \"done\": true } completes one.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The lead id."
            },
            "description": "The lead id."
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "title": "Send agreement",
                      "dueAt": "2026-11-10T05:30:00.000Z",
                      "ownerName": "Priya",
                      "doneAt": null,
                      "overdue": false
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "What to do."
                  },
                  "dueAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "ISO 8601 with offset."
                  },
                  "ownerId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Default: the lead’s owner."
                  },
                  "notes": {
                    "type": "string",
                    "description": "Details."
                  }
                },
                "required": [
                  "title",
                  "dueAt"
                ]
              },
              "example": {
                "title": "Send agreement",
                "dueAt": "2026-11-10T11:00:00+05:30"
              }
            }
          }
        }
      }
    },
    "/quotes": {
      "get": {
        "operationId": "listQuotes",
        "tags": [
          "Leads"
        ],
        "summary": "List quotations",
        "description": "Quotations with items, GST, total, status and the customer’s link. GET /v1/quotes/{id} reads one.",
        "parameters": [
          {
            "name": "leadId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "One lead’s quotations."
            },
            "description": "One lead’s quotations."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "ref": "Q-12",
                      "status": "SENT",
                      "subtotal": "8830000",
                      "gst": "506500",
                      "total": "9336500",
                      "validUntil": "2026-11-30",
                      "url": "https://panel.example.com/q/AbCd…"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/quotes/{id}/send": {
      "post": {
        "operationId": "sendQuote",
        "tags": [
          "Leads"
        ],
        "summary": "Send a quotation",
        "description": "Sends it to the customer and marks it sent: whatsapp (the PDF in their chat), email, or link (just marks it sent; share url yourself).",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "…",
                    "ref": "Q-12",
                    "status": "SENT",
                    "url": "https://panel.example.com/q/AbCd…"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "via": {
                    "type": "string",
                    "description": "whatsapp, email or link."
                  }
                },
                "required": [
                  "via"
                ]
              },
              "example": {
                "via": "whatsapp"
              }
            }
          }
        }
      }
    },
    "/contacts": {
      "put": {
        "operationId": "upsertContact",
        "tags": [
          "Contacts"
        ],
        "summary": "Create or update a contact",
        "description": "By phone number. Fields you leave out are kept. Answers 201 when created, 200 when updated.\n\nPlan contact limits apply to new contacts.",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                  "accountId": "6f1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
                  "phone": "+919876543210",
                  "name": "Asha Rao",
                  "email": "asha@example.com",
                  "tags": [
                    "customer",
                    "diwali-2026"
                  ],
                  "attributes": {
                    "city": "Pune",
                    "plan": "gold"
                  },
                  "optedOut": false,
                  "optedOutAt": null,
                  "blocked": false,
                  "blockedAt": null,
                  "blockedOnWhatsapp": false,
                  "source": "API",
                  "lastInboundAt": "2026-10-19T10:20:09.000Z",
                  "createdAt": "2026-10-01T08:00:00.000Z",
                  "updatedAt": "2026-10-19T10:20:09.000Z",
                  "created": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phone": {
                    "type": "string",
                    "description": "With country code."
                  },
                  "defaultCountryCode": {
                    "type": "string",
                    "description": "Used when phone has no country code. Default 91."
                  },
                  "accountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
                  },
                  "name": {
                    "type": "string",
                    "nullable": true,
                    "description": "Up to 120 characters."
                  },
                  "email": {
                    "type": "string",
                    "nullable": true,
                    "description": "Email address."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Replaces all tags."
                  },
                  "addTags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Added to the existing tags."
                  },
                  "removeTags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Taken off."
                  },
                  "attributes": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Custom fields, merged in; null removes one. Up to 30."
                  },
                  "optedOut": {
                    "type": "boolean",
                    "description": "Opt the contact out of (or back in to) marketing."
                  }
                },
                "required": [
                  "phone"
                ]
              },
              "example": {
                "phone": "+919876543210",
                "name": "Asha Rao",
                "email": "asha@example.com",
                "addTags": [
                  "customer",
                  "diwali-2026"
                ],
                "attributes": {
                  "city": "Pune",
                  "plan": "gold"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listContacts",
        "tags": [
          "Contacts"
        ],
        "summary": "List contacts",
        "description": "Your contacts, newest first, with the total that match.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Name, email or number."
            },
            "description": "Name, email or number."
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Only contacts with this tag."
            },
            "description": "Only contacts with this tag."
          },
          {
            "name": "optedOut",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "Only opted-out (true) or subscribed (false) contacts."
            },
            "description": "Only opted-out (true) or subscribed (false) contacts."
          },
          {
            "name": "blocked",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "Only blocked (true) or not blocked (false) contacts."
            },
            "description": "Only blocked (true) or not blocked (false) contacts."
          },
          {
            "name": "accountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
            },
            "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–200, default 50."
            },
            "description": "1–200, default 50."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "nextCursor from the previous page."
            },
            "description": "nextCursor from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                      "accountId": "6f1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
                      "phone": "+919876543210",
                      "name": "Asha Rao",
                      "email": "asha@example.com",
                      "tags": [
                        "customer",
                        "diwali-2026"
                      ],
                      "attributes": {
                        "city": "Pune",
                        "plan": "gold"
                      },
                      "optedOut": false,
                      "optedOutAt": null,
                      "blocked": false,
                      "blockedAt": null,
                      "blockedOnWhatsapp": false,
                      "source": "API",
                      "lastInboundAt": "2026-10-19T10:20:09.000Z",
                      "createdAt": "2026-10-01T08:00:00.000Z",
                      "updatedAt": "2026-10-19T10:20:09.000Z"
                    }
                  ],
                  "total": 1,
                  "nextCursor": null
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/contacts/{phone}": {
      "get": {
        "operationId": "getContact",
        "tags": [
          "Contacts"
        ],
        "summary": "One contact",
        "description": "A contact by phone number. Encode + as %2B, or leave it out.",
        "parameters": [
          {
            "name": "phone",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "e.g. 919876543210."
            },
            "description": "e.g. 919876543210."
          },
          {
            "name": "accountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
            },
            "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                  "accountId": "6f1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
                  "phone": "+919876543210",
                  "name": "Asha Rao",
                  "email": "asha@example.com",
                  "tags": [
                    "customer",
                    "diwali-2026"
                  ],
                  "attributes": {
                    "city": "Pune",
                    "plan": "gold"
                  },
                  "optedOut": false,
                  "optedOutAt": null,
                  "blocked": false,
                  "blockedAt": null,
                  "blockedOnWhatsapp": false,
                  "source": "API",
                  "lastInboundAt": "2026-10-19T10:20:09.000Z",
                  "createdAt": "2026-10-01T08:00:00.000Z",
                  "updatedAt": "2026-10-19T10:20:09.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/contacts/{phone}/block": {
      "post": {
        "operationId": "blockContact",
        "tags": [
          "Contacts"
        ],
        "summary": "Block a contact",
        "description": "Stops everything to and from this contact: sends of any kind are refused with CONTACT_BLOCKED, campaigns leave them out, chatbots stop, and their new messages stay out of the inbox (no message.received webhook).\n\nWhatsApp itself only lets a business block someone within 24 hours of their last message. Then onWhatsapp is true and they can’t message or call your number. Otherwise they are blocked in the panel at once (onWhatsapp: false, with a note) and on WhatsApp automatically the next time they write.\n\nCalling it again for a blocked contact changes nothing.",
        "parameters": [
          {
            "name": "phone",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "e.g. 919876543210."
            },
            "description": "e.g. 919876543210."
          },
          {
            "name": "accountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
            },
            "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "contact": {
                    "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "accountId": "6f1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
                    "phone": "+919876543210",
                    "name": "Asha Rao",
                    "email": "asha@example.com",
                    "tags": [
                      "customer",
                      "diwali-2026"
                    ],
                    "attributes": {
                      "city": "Pune",
                      "plan": "gold"
                    },
                    "optedOut": false,
                    "optedOutAt": null,
                    "blocked": true,
                    "blockedAt": "2026-11-02T16:00:00.000Z",
                    "blockedOnWhatsapp": true,
                    "source": "API",
                    "lastInboundAt": "2026-10-19T10:20:09.000Z",
                    "createdAt": "2026-10-01T08:00:00.000Z",
                    "updatedAt": "2026-10-19T10:20:09.000Z"
                  },
                  "onWhatsapp": true,
                  "note": null
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/contacts/{phone}/unblock": {
      "post": {
        "operationId": "unblockContact",
        "tags": [
          "Contacts"
        ],
        "summary": "Unblock a contact",
        "description": "Undoes a block, on WhatsApp too. note explains if WhatsApp didn’t confirm the unblock.",
        "parameters": [
          {
            "name": "phone",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "e.g. 919876543210."
            },
            "description": "e.g. 919876543210."
          },
          {
            "name": "accountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
            },
            "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "contact": {
                    "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "accountId": "6f1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
                    "phone": "+919876543210",
                    "name": "Asha Rao",
                    "email": "asha@example.com",
                    "tags": [
                      "customer",
                      "diwali-2026"
                    ],
                    "attributes": {
                      "city": "Pune",
                      "plan": "gold"
                    },
                    "optedOut": false,
                    "optedOutAt": null,
                    "blocked": false,
                    "blockedAt": null,
                    "blockedOnWhatsapp": false,
                    "source": "API",
                    "lastInboundAt": "2026-10-19T10:20:09.000Z",
                    "createdAt": "2026-10-01T08:00:00.000Z",
                    "updatedAt": "2026-10-19T10:20:09.000Z"
                  },
                  "note": null
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/campaigns": {
      "get": {
        "operationId": "listCampaigns",
        "tags": [
          "Campaigns"
        ],
        "summary": "List campaigns",
        "description": "Your campaigns with live counts. Create and launch campaigns in the panel.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–200, default 50."
            },
            "description": "1–200, default 50."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "name": "Diwali VIPs",
                      "status": "COMPLETED",
                      "accountId": "6f1c…",
                      "accountName": "Kumar Stores",
                      "templateName": "diwali_offer",
                      "scheduledAt": null,
                      "startedAt": "…",
                      "completedAt": "…",
                      "createdAt": "…",
                      "counts": {
                        "total": 1200,
                        "pending": 0,
                        "accepted": 1188,
                        "sent": 1170,
                        "delivered": 1150,
                        "read": 802,
                        "failed": 12,
                        "skipped": 0,
                        "replied": 64
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/campaigns/{id}": {
      "get": {
        "operationId": "getCampaign",
        "tags": [
          "Campaigns"
        ],
        "summary": "One campaign",
        "description": "A campaign and its counts.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The campaign id."
            },
            "description": "The campaign id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "name": "Diwali VIPs",
                  "status": "SENDING",
                  "counts": {
                    "total": 1200,
                    "accepted": 640,
                    "delivered": 600,
                    "read": 310,
                    "failed": 4,
                    "skipped": 0,
                    "replied": 21
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/forms": {
      "get": {
        "operationId": "listForms",
        "tags": [
          "Forms"
        ],
        "summary": "List forms",
        "description": "Your forms (the Forms app), newest first, with how many responses each has and how many are still New.\n\nlink is the form’s public address on your panel domain (/fm/<key>).",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "key": "AbC123xyz",
                      "name": "Site visit request",
                      "purpose": "LEADS",
                      "enabled": true,
                      "closed": false,
                      "submissions": 128,
                      "newResponses": 4,
                      "link": "/fm/AbC123xyz",
                      "createdAt": "…"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/forms/{id}": {
      "get": {
        "operationId": "getForm",
        "tags": [
          "Forms"
        ],
        "summary": "Get a form",
        "description": "A form and its questions. Each question’s id is the key of its answer in responses, webhooks and POST /v1/forms/{id}/responses.\n\ntype is one of short_text, long_text, email, phone, number, url, dropdown, radio, checkboxes, yes_no, date, time, datetime, rating, file, address, consent, hidden — plus heading and page_break, which take no answer.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The form id (from GET /v1/forms)."
            },
            "description": "The form id (from GET /v1/forms)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "…",
                    "key": "AbC123xyz",
                    "name": "Site visit request",
                    "purpose": "LEADS",
                    "enabled": true,
                    "closed": false,
                    "submissions": 128,
                    "link": "/fm/AbC123xyz",
                    "fields": [
                      {
                        "id": "name",
                        "type": "short_text",
                        "label": "Your name",
                        "required": true,
                        "options": null
                      },
                      {
                        "id": "city",
                        "type": "dropdown",
                        "label": "City",
                        "required": false,
                        "options": [
                          "Pune",
                          "Mumbai"
                        ]
                      }
                    ]
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/forms/{id}/responses": {
      "get": {
        "operationId": "listFormResponses",
        "tags": [
          "Forms"
        ],
        "summary": "List responses",
        "description": "A form’s responses, newest first, with search and filters.\n\nanswers is keyed by question id: text, a list (checkboxes), { fileId, name, size, type } (files — download with the files endpoint) or { line1, city, … } (addresses).\n\nsource holds where it came from: page, referrer, utm_*, device, browser, via.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The form id."
            },
            "description": "The form id."
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Name, phone, email, any answer, or #12 for a number."
            },
            "description": "Name, phone, email, any answer, or #12 for a number."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NEW",
                "SEEN",
                "DONE"
              ],
              "description": "Only this status."
            },
            "description": "Only this status."
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Received at or after (ISO 8601 with offset)."
            },
            "description": "Received at or after (ISO 8601 with offset)."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Received before."
            },
            "description": "Received before."
          },
          {
            "name": "field",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "With value: only responses whose answer to this question contains it."
            },
            "description": "With value: only responses whose answer to this question contains it."
          },
          {
            "name": "value",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "See field."
            },
            "description": "See field."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "1–100, default 25."
            },
            "description": "1–100, default 25."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Skip this many."
            },
            "description": "Skip this many."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "formId": "…",
                      "number": 12,
                      "status": "NEW",
                      "note": null,
                      "name": "Asha Rao",
                      "phone": "+919876543210",
                      "email": "asha@example.com",
                      "answers": {
                        "name": "Asha Rao",
                        "phone": "+919876543210",
                        "city": "Pune",
                        "services": [
                          "Interior",
                          "Painting"
                        ]
                      },
                      "contactId": "…",
                      "leadId": "…",
                      "conversationId": "…",
                      "source": {
                        "page": "https://example.com/contact",
                        "utm_source": "instagram",
                        "device": "Mobile"
                      },
                      "actions": [
                        {
                          "kind": "lead",
                          "ok": true,
                          "text": "Lead L-42 created"
                        }
                      ],
                      "editUrl": null,
                      "createdAt": "…",
                      "updatedAt": "…"
                    }
                  ],
                  "total": 128
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "submitFormResponse",
        "tags": [
          "Forms"
        ],
        "summary": "Submit a response",
        "description": "Adds a response as if someone filled in the form: the same checks (required, formats, choices, conditions) and the same after-submit actions (contact, lead, WhatsApp, team alert, flow, webhooks).\n\nAnswers are keyed by question id. Phone numbers need the country code. A closed form answers FORM_CLOSED; “one response per person” answers ALREADY_RESPONDED.\n\nFile questions can’t be answered through the API.\n\nThe form’s WhatsApp template (if any) is charged like any template message.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The form id."
            },
            "description": "The form id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "ok": true,
                    "number": 13,
                    "thanks": {
                      "title": "Thank you!",
                      "text": "We’ve got your response."
                    },
                    "redirectUrl": null,
                    "editUrl": null
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "answers": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Question id → answer: text, a list for checkboxes, yes/no, { line1, city, … } for an address."
                  },
                  "source": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Optional: where it came from, e.g. { \"utm_source\": \"crm\" }."
                  }
                },
                "required": [
                  "answers"
                ]
              },
              "example": {
                "answers": {
                  "name": "Asha Rao",
                  "phone": "+919876543210",
                  "city": "Pune"
                },
                "source": {
                  "utm_source": "crm"
                }
              }
            }
          }
        }
      }
    },
    "/forms/{id}/responses/{responseId}": {
      "get": {
        "operationId": "getFormResponse",
        "tags": [
          "Forms"
        ],
        "summary": "Get a response",
        "description": "One response, with the same fields as in the list.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The form id."
            },
            "description": "The form id."
          },
          {
            "name": "responseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The response id."
            },
            "description": "The response id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "…",
                    "number": 12,
                    "status": "SEEN",
                    "answers": {
                      "name": "Asha Rao",
                      "city": "Pune"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateFormResponse",
        "tags": [
          "Forms"
        ],
        "summary": "Update a response",
        "description": "Changes a response’s status or team note. A status change sends form.response.updated and can start flows with the trigger “Form response status changed”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The form id."
            },
            "description": "The form id."
          },
          {
            "name": "responseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The response id."
            },
            "description": "The response id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "…",
                    "number": 12,
                    "status": "DONE",
                    "note": "Called back on Monday"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "NEW",
                      "SEEN",
                      "DONE"
                    ],
                    "description": "The new status."
                  },
                  "note": {
                    "type": "string",
                    "description": "The team note (null clears it)."
                  }
                }
              },
              "example": {
                "status": "DONE",
                "note": "Called back on Monday"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteFormResponse",
        "tags": [
          "Forms"
        ],
        "summary": "Delete a response",
        "description": "Deletes a response and its attached files for good. Sends form.response.deleted.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The form id."
            },
            "description": "The form id."
          },
          {
            "name": "responseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The response id."
            },
            "description": "The response id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "ok": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/forms/{id}/responses/{responseId}/files/{field}": {
      "get": {
        "operationId": "getFormResponseFile",
        "tags": [
          "Forms"
        ],
        "summary": "Download an attached file",
        "description": "The file a person attached to a file question.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The form id."
            },
            "description": "The form id."
          },
          {
            "name": "responseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The response id."
            },
            "description": "The response id."
          },
          {
            "name": "field",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The file question’s id."
            },
            "description": "The file question’s id."
          }
        ],
        "responses": {
          "200": {
            "description": "The file itself, with its content type.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/forms/{id}/responses.csv": {
      "get": {
        "operationId": "exportFormResponses",
        "tags": [
          "Forms"
        ],
        "summary": "Export responses (CSV)",
        "description": "All responses matching the same filters as the list, as a CSV file (UTF-8 with BOM, so it opens in Excel).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The form id."
            },
            "description": "The form id."
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Search, as in the list."
            },
            "description": "Search, as in the list."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NEW",
                "SEEN",
                "DONE"
              ],
              "description": "Only this status."
            },
            "description": "Only this status."
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Received at or after."
            },
            "description": "Received at or after."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Received before."
            },
            "description": "Received before."
          }
        ],
        "responses": {
          "200": {
            "description": "A CSV file: number, received, status, then one column per question.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/flows": {
      "get": {
        "operationId": "listBots",
        "tags": [
          "Flows"
        ],
        "summary": "List flows",
        "description": "Your published flows (chatbots and automations). GET /v1/bots still works and returns the same.\n\ntrigger is the business event that starts it (e.g. lead.won, order.shipped, subscription.payment_failed), schedule for a timetable, date for before / after a date, api for flows started only from the API or another flow, or null for chat flows (keywords, first message…).\n\nchannel is ANY for flows that don’t start from a chat: they message each customer on the channel they use (WhatsApp first).",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "name": "Welcome new leads",
                      "channel": "ANY",
                      "accountId": null,
                      "enabled": true,
                      "trigger": "lead.created"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/flows/{id}": {
      "get": {
        "operationId": "getFlow",
        "tags": [
          "Flows"
        ],
        "summary": "Get a flow",
        "description": "A flow’s trigger, whether it’s live and its published version.\n\ntrigger.type is an event (with filter, e.g. { \"status\": \"SHIPPED\" }), schedule (repeat, days, monthDay, time, audience, perMinute), date (source, field, amount, unit, dir, time), api or chat.\n\npausedReason is set when the flow was switched off automatically — e.g. WhatsApp rejected or paused a template it sends. Publishing again or switching it on clears it.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The flow id (from GET /v1/flows)."
            },
            "description": "The flow id (from GET /v1/flows)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "…",
                    "name": "Booking reminder",
                    "channel": "ANY",
                    "accountId": null,
                    "enabled": true,
                    "published": true,
                    "version": 3,
                    "pausedReason": null,
                    "trigger": {
                      "type": "date",
                      "source": "booking.start",
                      "field": "",
                      "amount": 1,
                      "unit": "days",
                      "dir": "before",
                      "time": "10:00"
                    },
                    "steps": 2,
                    "updatedAt": "…"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/flows/{id}/start": {
      "post": {
        "operationId": "startBot",
        "tags": [
          "Flows"
        ],
        "summary": "Start a flow for a customer",
        "description": "Any flow already running in their chat stops. With phone, a new number becomes a contact with a WhatsApp chat (nothing is sent until the flow sends). POST /v1/bots/{id}/start still works.\n\nA new number hasn’t written to you, so the flow should begin with a Template step (or give its first message a fallback template).\n\nNumbers without + use the country of the WhatsApp number it goes from. name, email and tags fill gaps on the contact; they never overwrite.\n\nIf the customer last wrote more than 24 hours ago, only a flow that begins with a Template step can start (WINDOW_CLOSED otherwise).\n\nvalues can be used in the flow’s messages as {{order_no}}.\n\nFlows whose trigger is “Only from the API or another flow” are made for this.\n\nWhatsApp follow-up sequences are now flows like this (“… (moved from Follow-up sequences)”): start one for a lead’s customer here, with their phone or contactId.\n\nA step with a fallback template sends that template instead when the 24-hour window is closed; with “If this fails” on, a message that can’t be sent follows that arrow instead of failing the run.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The flow id (from GET /v1/flows)."
            },
            "description": "The flow id (from GET /v1/flows)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "conversationId": "9c2e…",
                  "sessionId": "…",
                  "status": "ACTIVE"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contactId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The contact (their chat on the flow’s channel). Give this, phone or conversationId."
                  },
                  "phone": {
                    "type": "string",
                    "description": "Or a phone number — new or known. New numbers get a contact and a WhatsApp chat."
                  },
                  "conversationId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Or the chat."
                  },
                  "accountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
                  },
                  "name": {
                    "type": "string",
                    "description": "With phone: the contact’s name (if it has none yet)."
                  },
                  "email": {
                    "type": "string",
                    "description": "With phone: the contact’s email (if it has none yet)."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "With phone: up to 10 tags to add."
                  },
                  "values": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Up to 30 values for the flow; names use lowercase letters, numbers and _."
                  }
                }
              },
              "example": {
                "phone": "+919876543210",
                "name": "Priya",
                "tags": [
                  "website"
                ],
                "values": {
                  "order_no": "10023"
                }
              }
            }
          }
        }
      }
    },
    "/public/flows/hook/{token}": {
      "post": {
        "operationId": "flowHook",
        "tags": [
          "Flows"
        ],
        "summary": "Start a flow from its incoming webhook",
        "description": "Each flow has its own secret address (the flow’s trigger panel → Incoming webhook). No API key: the secret is in the address. Made for n8n, Pabbly and website forms.\n\nphone is required (mobile or whatsapp work too). A new number becomes a contact with a WhatsApp chat.\n\nEvery other key becomes a value in the flow: {\"order_id\": \"A-1042\"} → {{order_id}}. Nested objects are flattened one level ({\"customer\": {\"city\": \"Pune\"}} → {{customer_city}}).\n\nThe flow must be published and on (FLOW_OFF otherwise). Up to 120 calls a minute. Each call shows in the flow’s Runs.\n\n“Make a new address” in the builder stops the old one at once.",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The secret part of the flow’s webhook address."
            },
            "description": "The secret part of the flow’s webhook address."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "ok": true,
                  "started": true,
                  "phone": "+919876543210",
                  "contactCreated": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phone": {
                    "type": "string",
                    "description": "The number to run the flow for (with country code, or national for your WhatsApp number’s country)."
                  },
                  "name": {
                    "type": "string",
                    "description": "Optional: the contact’s name."
                  },
                  "email": {
                    "type": "string",
                    "description": "Optional: the contact’s email."
                  },
                  "tags": {
                    "type": "string",
                    "description": "Optional: tags to add (an array, or comma-separated)."
                  },
                  "…": {
                    "type": "string",
                    "description": "Anything else becomes a value for the flow."
                  }
                }
              },
              "example": {
                "phone": "+919876543210",
                "name": "Priya",
                "email": "priya@example.com",
                "tags": [
                  "website"
                ],
                "order_id": "A-1042",
                "city": "Pune"
              }
            }
          }
        }
      }
    },
    "/instagram/accounts": {
      "get": {
        "operationId": "igAccounts",
        "tags": [
          "Instagram"
        ],
        "summary": "List Instagram accounts",
        "description": "Your connected Instagram professional accounts, with followers, posts and the last 7 / 30 days’ reach.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "a3f1…",
                      "igUserId": "17841400000000000",
                      "username": "kumarstores",
                      "name": "Kumar Stores",
                      "accountType": "BUSINESS",
                      "followers": 12840,
                      "follows": 210,
                      "mediaCount": 342,
                      "status": "active",
                      "inbox": true,
                      "paused": false,
                      "insights": {
                        "last7": {
                          "reach": 5400,
                          "profile_views": 380,
                          "accounts_engaged": 610
                        }
                      },
                      "connectedAt": "…"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/instagram/messages": {
      "post": {
        "operationId": "igSend",
        "tags": [
          "Instagram"
        ],
        "summary": "Send an Instagram message",
        "description": "A reply in an Instagram chat: text, a photo or video, up to 3 buttons, up to 13 quick replies, or a carousel of cards.\n\nInstagram only allows messages within 24 hours of the person’s last message, and only to people who wrote first: otherwise WINDOW_CLOSED or NOT_FOUND.\n\nGive conversationId, or to: their @username or their Instagram id (instagram.id in message.received). With several Instagram accounts, set accountId.\n\nA tapped button or quick reply comes back as message.received with your payload.",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "0b7d…",
                  "conversationId": "9c2e…",
                  "channel": "instagram",
                  "direction": "outbound",
                  "to": "17841400000000001",
                  "type": "interactive",
                  "status": "sent",
                  "source": "api",
                  "createdAt": "…",
                  "sentAt": "…"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "accountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The Instagram account (needed when you have several)."
                  },
                  "conversationId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The chat to reply in (instead of to)."
                  },
                  "to": {
                    "type": "string",
                    "description": "@username or Instagram id of someone who messaged you."
                  },
                  "message": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "text",
                          "media",
                          "buttons",
                          "quick_replies",
                          "cards"
                        ],
                        "description": "What to send."
                      },
                      "text": {
                        "type": "string",
                        "description": "text / buttons / quick_replies / cards: the text (up to 1,000 characters; 640 with buttons)."
                      },
                      "fileId | message": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "description": "media: a file from POST /v1/media, or a public https link. Optional caption."
                          }
                        }
                      },
                      "buttons": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        },
                        "description": "buttons: up to 3 of { title, url } (opens a link) or { title, payload } (comes back to you)."
                      },
                      "replies": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        },
                        "description": "quick_replies: up to 13 { title, payload }. Titles up to 20 characters."
                      },
                      "cards": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        },
                        "description": "cards: up to 10 { title, subtitle?, fileId?, url, button? }."
                      }
                    },
                    "required": [
                      "type"
                    ]
                  }
                }
              },
              "example": {
                "to": "@priya.sharma",
                "message": {
                  "type": "buttons",
                  "text": "Here’s our Diwali collection 🪔",
                  "buttons": [
                    {
                      "title": "Shop now",
                      "url": "https://kumar.example/diwali"
                    },
                    {
                      "title": "Talk to us",
                      "payload": "TALK"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/instagram/comment-rules": {
      "get": {
        "operationId": "igRules",
        "tags": [
          "Instagram"
        ],
        "summary": "List comment-to-DM rules",
        "description": "Your comment-to-DM rules with their numbers: comments, DMs sent, people who wrote back, unlocks and new followers.",
        "parameters": [
          {
            "name": "accountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Only this Instagram account’s rules."
            },
            "description": "Only this Instagram account’s rules."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "accountId": "…",
                      "name": "Diwali reel – price",
                      "mediaId": "1790…",
                      "keywords": [
                        "price"
                      ],
                      "matchType": "CONTAINS",
                      "requireFollow": true,
                      "followUps": 2,
                      "enabled": true,
                      "stats": {
                        "comments": 120,
                        "dms": 118,
                        "replied": 64,
                        "unlocked": 51,
                        "newFollowers": 37
                      },
                      "createdAt": "…"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/instagram/comment-rules/{id}/enabled": {
      "post": {
        "operationId": "igRuleEnabled",
        "tags": [
          "Instagram"
        ],
        "summary": "Switch a comment rule on or off",
        "description": "For example, switch a giveaway rule off when the giveaway ends.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The rule."
            },
            "description": "The rule."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "name": "Diwali reel – price",
                  "enabled": false,
                  "stats": {
                    "comments": 120
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "description": "On or off."
                  }
                },
                "required": [
                  "enabled"
                ]
              },
              "example": {
                "enabled": false
              }
            }
          }
        }
      }
    },
    "/links": {
      "get": {
        "operationId": "listLinks",
        "tags": [
          "Links & QR"
        ],
        "summary": "List chat links",
        "description": "Your chat links and QR codes with their short address, the ready-typed message and the last 30 days’ opens and chats.",
        "parameters": [
          {
            "name": "accountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Only this WhatsApp account’s links."
            },
            "description": "Only this WhatsApp account’s links."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "5b1e…",
                      "accountId": "6f1c…",
                      "name": "Diwali flyer",
                      "slug": "diwali-flyer-k7q2",
                      "kind": "CHAT",
                      "message": "Hi! I want the Diwali offer",
                      "trackRef": true,
                      "refCode": "K7Q2X",
                      "prefill": "Hi! I want the Diwali offer (Ref: K7Q2X)",
                      "tags": [
                        "diwali-flyer"
                      ],
                      "enabled": true,
                      "url": "https://app.yourbrand.com/w/diwali-flyer-k7q2",
                      "qrUrl": "https://app.yourbrand.com/w/diwali-flyer-k7q2?via=qr",
                      "waUrl": "https://wa.me/919855500000?text=Hi!%20I%20want%20the%20Diwali%20offer%20(Ref%3A%20K7Q2X)",
                      "last30": {
                        "opens": 120,
                        "chats": 34
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createLink",
        "tags": [
          "Links & QR"
        ],
        "summary": "Create a chat link",
        "description": "A short link (and QR code) that opens a WhatsApp chat with your number, with an optional ready-typed message.\n\nWith trackRef (default on), the message ends with a short code like “(Ref: K7Q2X)” so chats are matched to the link exactly.\n\nkind: CHAT, AGENT (give assignUserId; chats are assigned to that person) or FEEDBACK (the customer is asked for 1–5 stars and a comment).\n\nWhen someone writes in: tags are added to the contact, then botId starts that chatbot or welcomeReply is sent.\n\nCustom destinations: send target: \"CUSTOM\" and destinations instead of accountId to point the link at any WhatsApp number, a phone call, SMS, Telegram, Instagram, Messenger, email or web address. Nothing comes into your inbox — only clicks are counted — so kind must be CHAT and tags, botId, welcomeReply and assignUserId can’t be used.\n\nEach destination: type (WHATSAPP, CALL, SMS, TELEGRAM, INSTAGRAM, MESSENGER, EMAIL or URL), value (the number with its country code, username, email or https address), and optionally label, message (WhatsApp, SMS, email body), subject (email), start (Telegram bots), igMode (DM or PROFILE) and hours ({ days: [1,2,3,4,5], from: \"09:00\", to: \"18:00\" }, for the HOURS rotation).\n\nWith several destinations, rotation picks one per open: SINGLE (the first), ROUND_ROBIN (in turn), RANDOM, or HOURS (the first whose hours cover now, in your business time zone; one without hours is the fallback).",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "5b1e…",
                  "accountId": "6f1c…",
                  "name": "Diwali flyer",
                  "slug": "diwali-flyer-k7q2",
                  "kind": "CHAT",
                  "message": "Hi! I want the Diwali offer",
                  "trackRef": true,
                  "refCode": "K7Q2X",
                  "prefill": "Hi! I want the Diwali offer (Ref: K7Q2X)",
                  "tags": [
                    "diwali-flyer"
                  ],
                  "enabled": true,
                  "url": "https://app.yourbrand.com/w/diwali-flyer-k7q2",
                  "qrUrl": "https://app.yourbrand.com/w/diwali-flyer-k7q2?via=qr",
                  "waUrl": "https://wa.me/919855500000?text=Hi!%20I%20want%20the%20Diwali%20offer%20(Ref%3A%20K7Q2X)",
                  "last30": {
                    "opens": 120,
                    "chats": 34
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "target": {
                    "type": "string",
                    "enum": [
                      "ACCOUNT",
                      "CUSTOM"
                    ],
                    "description": "ACCOUNT (default) or CUSTOM."
                  },
                  "accountId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Which WhatsApp account sends it. Needed only if you have more than one (see GET /v1/account)."
                  },
                  "destinations": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    },
                    "description": "CUSTOM: up to 10 destinations (see the notes)."
                  },
                  "rotation": {
                    "type": "string",
                    "enum": [
                      "SINGLE",
                      "ROUND_ROBIN",
                      "RANDOM",
                      "HOURS"
                    ],
                    "description": "CUSTOM with several destinations: SINGLE, ROUND_ROBIN, RANDOM or HOURS."
                  },
                  "name": {
                    "type": "string",
                    "description": "Only your team sees it."
                  },
                  "slug": {
                    "type": "string",
                    "description": "The address after /w/ (3–40 lowercase letters, numbers, -). Made from the name when left out."
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "CHAT",
                      "AGENT",
                      "FEEDBACK"
                    ],
                    "description": "CHAT, AGENT or FEEDBACK."
                  },
                  "message": {
                    "type": "string",
                    "description": "Ready-typed message (up to 500 characters)."
                  },
                  "trackRef": {
                    "type": "boolean",
                    "description": "Add the ref code to the message (default true)."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Added to the contact when they write in."
                  },
                  "botId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Chatbot to start when they write in."
                  },
                  "welcomeReply": {
                    "type": "string",
                    "description": "Text to send when they write in (if no chatbot)."
                  },
                  "assignUserId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Team member the chat is assigned to (required for AGENT)."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "Diwali flyer",
                "message": "Hi! I want the Diwali offer",
                "tags": [
                  "diwali-flyer"
                ],
                "welcomeReply": "Welcome! Your coupon: DIWALI20"
              }
            }
          }
        }
      }
    },
    "/links/{id}": {
      "put": {
        "operationId": "updateLink",
        "tags": [
          "Links & QR"
        ],
        "summary": "Change a chat link",
        "description": "Send the whole link, as when creating it. The short address and printed QR codes keep working — handy for pointing a custom-destination link at a new number.\n\nA link keeps its target: a link to a connected account stays on that account, and a custom-destination link stays custom.\n\nKeep each destination’s id to keep its click count.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The link id."
            },
            "description": "The link id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "5b1e…",
                  "target": "CUSTOM",
                  "name": "Sales team",
                  "slug": "sales-team-k7q2",
                  "rotation": "SINGLE",
                  "destinations": [
                    {
                      "id": "a1b2c3d4",
                      "type": "WHATSAPP",
                      "label": "Rahul",
                      "value": "+919876543210",
                      "url": "https://wa.me/919876543210",
                      "display": "+91 98765 43210"
                    }
                  ],
                  "url": "https://app.yourbrand.com/w/sales-team-k7q2"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Only your team sees it."
                  },
                  "destinations": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    },
                    "description": "CUSTOM: the new destinations."
                  },
                  "rotation": {
                    "type": "string",
                    "enum": [
                      "SINGLE",
                      "ROUND_ROBIN",
                      "RANDOM",
                      "HOURS"
                    ],
                    "description": "SINGLE, ROUND_ROBIN, RANDOM or HOURS."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "Sales team",
                "rotation": "SINGLE",
                "destinations": [
                  {
                    "id": "a1b2c3d4",
                    "type": "WHATSAPP",
                    "label": "Rahul",
                    "value": "+91 98765 43210"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/links/{id}/enabled": {
      "post": {
        "operationId": "linkEnabled",
        "tags": [
          "Links & QR"
        ],
        "summary": "Switch a link on or off",
        "description": "A switched-off link (and its printed QR codes) shows “This link isn’t active”.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The link id."
            },
            "description": "The link id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "5b1e…",
                  "enabled": false
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "description": "true = on, false = off."
                  }
                },
                "required": [
                  "enabled"
                ]
              },
              "example": {
                "enabled": false
              }
            }
          }
        }
      }
    },
    "/links/{id}/stats": {
      "get": {
        "operationId": "linkStats",
        "tags": [
          "Links & QR"
        ],
        "summary": "Link stats",
        "description": "Opens (QR scans and clicks), unique visitors, chats started, devices, countries, the people who came in, and ratings for feedback links.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The link id."
            },
            "description": "The link id."
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "7, 30 (default) or 90."
            },
            "description": "7, 30 (default) or 90."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "totals": {
                    "opens": 120,
                    "uniqueVisitors": 98,
                    "scans": 80,
                    "clicks": 40,
                    "chats": 34,
                    "newContacts": 29,
                    "conversion": 28.3
                  },
                  "series": [
                    {
                      "day": "2026-11-02",
                      "opens": 12,
                      "chats": 4
                    }
                  ],
                  "devices": [
                    {
                      "device": "MOBILE",
                      "n": 110
                    }
                  ],
                  "feedback": null
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/links/{id}/qr": {
      "get": {
        "operationId": "linkQr",
        "tags": [
          "Links & QR"
        ],
        "summary": "Download the QR poster",
        "description": "The link’s QR poster in its saved design, as a PNG image or a print-ready PDF.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The link id."
            },
            "description": "The link id."
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "post",
                "story",
                "square",
                "a4",
                "a5",
                "a6",
                "sticker"
              ],
              "description": "Picture size."
            },
            "description": "Picture size."
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "png",
                "pdf"
              ],
              "description": "png (default) or pdf."
            },
            "description": "png (default) or pdf."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": "(the PNG or PDF file)"
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/events": {
      "get": {
        "operationId": "webhookEvents",
        "tags": [
          "Webhooks"
        ],
        "summary": "Events you can subscribe to",
        "description": "The list of event types with a short description of each.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "event": "message.received",
                      "description": "A customer sent a message"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "tags": [
          "Webhooks"
        ],
        "summary": "List integration webhooks",
        "description": "Webhooks added by API (ones added in the panel are managed there).",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "…",
                      "url": "https://n8n.example.com/webhook/7c1e…",
                      "description": "Added by an integration",
                      "events": [
                        "message.received"
                      ],
                      "enabled": true,
                      "disabledReason": null,
                      "createdAt": "…"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Subscribe to events",
        "description": "Adds a webhook. The answer includes its signing secret, shown only this once.\n\nThey show in the panel marked Integration and are removed when the key is revoked. Up to 50 per account.",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "…",
                  "url": "https://n8n.example.com/webhook/7c1e",
                  "events": [
                    "message.received",
                    "contact.opted_out"
                  ],
                  "enabled": true,
                  "secret": "whsec_…"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Your https address that receives the events."
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "message.received",
                        "message.status",
                        "conversation.assigned",
                        "conversation.status",
                        "contact.opted_out",
                        "contact.opted_in",
                        "campaign.completed",
                        "bot.started",
                        "bot.ended",
                        "flow.run.completed",
                        "flow.run.failed",
                        "instagram.comment",
                        "ticket.created",
                        "ticket.updated",
                        "ticket.replied",
                        "ticket.solved",
                        "ticket.rated",
                        "chat.started",
                        "chat.closed",
                        "chat.rated",
                        "chat.reply",
                        "call.started",
                        "call.ended",
                        "call.missed",
                        "call.transferred",
                        "ai_call.started",
                        "ai_call.ended",
                        "ai_call.handed_over",
                        "lead.created",
                        "lead.stage_changed",
                        "lead.assigned",
                        "lead.won",
                        "lead.lost",
                        "task.due",
                        "quote.sent",
                        "quote.accepted",
                        "customer_subscription.created",
                        "customer_subscription.renewed",
                        "customer_subscription.paused",
                        "customer_subscription.cancelled",
                        "customer_subscription.expired",
                        "customer_subscription.payment_failed",
                        "invoice.paid",
                        "store_order.created",
                        "store_order.status_changed",
                        "store_order.paid",
                        "store_order.cancelled",
                        "booking.created",
                        "booking.rescheduled",
                        "booking.cancelled",
                        "booking.completed",
                        "booking.no_show",
                        "form.submitted",
                        "form.response.updated",
                        "form.response.deleted",
                        "app.activated",
                        "app.deactivated"
                      ]
                    },
                    "description": "One or more event types."
                  },
                  "description": {
                    "type": "string",
                    "description": "Shown in the panel."
                  }
                },
                "required": [
                  "url",
                  "events"
                ]
              },
              "example": {
                "url": "https://n8n.example.com/webhook/7c1e",
                "events": [
                  "message.received",
                  "contact.opted_out"
                ]
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}": {
      "delete": {
        "operationId": "deleteWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Unsubscribe",
        "description": "Stop sending events to a webhook added by API.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The webhook id."
            },
            "description": "The webhook id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "ok": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}/test": {
      "post": {
        "operationId": "testWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a test event",
        "description": "Sends one event to a webhook right now, marked \"test\": true with an id starting evt_test_, and answers with what your server replied and exactly what we sent (headers, signature and body). Never retried.\n\nLeave out data and it is filled for you with exactly the fields of a real event: from your last real event of that type, else your latest matching data, else example values.\n\nOr send your own data (the event’s data object). Leave out event for a simple ping.\n\nThe webhook must be subscribed to the event. Works for webhooks added in the panel or by API.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The webhook."
            },
            "description": "The webhook."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "ok": true,
                  "statusCode": 200,
                  "error": null,
                  "response": "ok",
                  "durationMs": 182,
                  "deliveryId": "…",
                  "request": {
                    "url": "https://example.com/hooks",
                    "headers": {
                      "X-Webhook-Event": "message.received",
                      "X-Webhook-Signature": "t=1762240000,v1=…"
                    },
                    "body": {
                      "id": "evt_test_…",
                      "type": "message.received",
                      "test": true,
                      "data": {}
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string",
                    "description": "The event to send, e.g. message.received. Leave out for a ping."
                  },
                  "data": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Optional: the event’s data, with the same fields as a real one."
                  }
                }
              },
              "example": {
                "event": "message.received"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your API key (fs_live_…) from Developers in the panel."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "INVALID_API_KEY",
                  "INSUFFICIENT_FUNDS",
                  "FEATURE_NOT_IN_PLAN",
                  "APP_INACTIVE",
                  "PLAN_LIMIT_REACHED",
                  "ACCOUNT_SUSPENDED",
                  "NOT_FOUND",
                  "WINDOW_CLOSED",
                  "CONTACT_OPTED_OUT",
                  "CONTACT_BLOCKED",
                  "FORM_CLOSED",
                  "ALREADY_RESPONDED",
                  "NO_CHAT",
                  "MEDIA_NOT_READY",
                  "SEND_FAILED",
                  "SEND_UNCERTAIN",
                  "IDEMPOTENCY_IN_PROGRESS",
                  "VALIDATION_FAILED",
                  "RATE_LIMITED"
                ]
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "object"
              },
              "requestId": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        }
      }
    }
  }
}