{"openapi":"3.1.0","info":{"title":"Autobot360 Partner API","version":"1.0.0","description":"Create customer workspaces, connect their WhatsApp Business accounts, send messages and receive signed webhooks. Errors are `{ error: { code, message, request_id } }`. Webhooks are signed: `Autobot360-Signature: t=<unix>,v1=<hmac_sha256(secret, t + '.' + body)>`."},"servers":[{"url":"https://whitelabel.queroxa.in"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"ab360_live_… or ab360_test_… (sandbox: nothing is sent)"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}},"CreateCustomer":{"type":"object","required":["organization_name","owner_name","email"],"properties":{"organization_name":{"type":"string"},"business_type":{"type":"string"},"owner_name":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"country":{"type":"string"},"state":{"type":"string"},"city":{"type":"string"},"website":{"type":"string"},"gstin":{"type":"string"},"external_customer_id":{"type":"string"},"plan_code":{"type":"string"}}},"UpdateCustomer":{"type":"object","properties":{"organization_name":{"type":"string"},"business_type":{"type":"string"},"owner_name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"country":{"type":"string"},"state":{"type":"string"},"city":{"type":"string"},"website":{"type":"string"},"gstin":{"type":"string"}}},"SendMessage":{"type":"object","required":["customer_id","to","type"],"properties":{"customer_id":{"type":"string"},"phone_number_id":{"type":"string"},"to":{"type":"string","pattern":"^\\+?[1-9]\\d{7,14}$"},"type":{"enum":["template","text"]},"template":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"language":{"type":"string"},"components":{"type":"array","items":{"type":"object"}}}},"text":{"type":"object","required":["body"],"properties":{"body":{"type":"string","maxLength":4096}}},"reference_id":{"type":"string"}}},"RecordConsent":{"type":"object","required":["customer_id","phone","action"],"properties":{"customer_id":{"type":"string"},"phone":{"type":"string"},"action":{"enum":["opt_in","opt_out"]},"purpose":{"enum":["marketing","all"]},"source":{"enum":["manual","csv_import","web_form","inbound_keyword","api","qr","click_to_whatsapp","agent"]},"evidence":{"type":"string","maxLength":500,"description":"Required for opt_in: how and when the person agreed."}}},"BulkSend":{"type":"object","required":["messages"],"properties":{"messages":{"type":"array","minItems":1,"maxItems":100,"items":{"$ref":"#/components/schemas/SendMessage"}}}},"CreateWebhook":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"event_types":{"type":"array","items":{"enum":["customer.created","customer.updated","customer.suspended","contact.opted_in","contact.opted_out","whatsapp.connected","whatsapp.disconnected","whatsapp.connection_failed","template.approved","template.rejected","message.accepted","message.sent","message.delivered","message.read","message.failed","campaign.completed","usage.threshold_reached","invoice.created","invoice.paid","payment.failed"]}},"status":{"enum":["ACTIVE","DISABLED"]},"description":{"type":"string"}}}}},"paths":{"/v1/partner/customers":{"get":{"summary":"List customers","tags":["partner"],"x-required-scope":"customers:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"string"}},{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a customer workspace","tags":["partner"],"x-required-scope":"customers:write","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomer"},"example":{"organization_name":"Acme School","owner_name":"Asha Rao","email":"owner@acme.example","external_customer_id":"your-id-123"}}}},"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/partner/customers/{id}":{"get":{"summary":"Get a customer (by id or external id)","tags":["partner"],"x-required-scope":"customers:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Update a customer","tags":["partner"],"x-required-scope":"customers:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCustomer"},"example":{"phone":"+919876543210"}}}},"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/partner/customers/{id}/suspend":{"post":{"summary":"Suspend a customer","tags":["partner"],"x-required-scope":"customers:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/partner/customers/{id}/whatsapp":{"get":{"summary":"WhatsApp connection status for a customer","tags":["partner"],"x-required-scope":"whatsapp:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/partner/customers/{id}/whatsapp/onboarding":{"post":{"summary":"Start WhatsApp onboarding (Embedded Signup) for a customer","tags":["partner"],"x-required-scope":"whatsapp:onboard","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/whatsapp/connections":{"get":{"summary":"List WhatsApp connections","tags":["whatsapp"],"x-required-scope":"whatsapp:read","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/phone-numbers":{"get":{"summary":"List phone numbers","tags":["phone-numbers"],"x-required-scope":"whatsapp:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"customer_id","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/whatsapp/templates":{"get":{"summary":"List templates","tags":["whatsapp"],"x-required-scope":"templates:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"customer_id","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/whatsapp/templates/{id}":{"get":{"summary":"Get a template","tags":["whatsapp"],"x-required-scope":"templates:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/whatsapp/templates/sync":{"post":{"summary":"Sync templates from Meta","tags":["whatsapp"],"x-required-scope":"templates:sync","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messages":{"post":{"summary":"Send a message","tags":["messages"],"x-required-scope":"messages:send","security":[{"bearerAuth":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":128},"description":"Repeat a request safely: the same key returns the original result."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessage"},"example":{"customer_id":"cus_…","to":"919876543210","type":"template","template":{"name":"exam_result","language":"en","components":[{"type":"body","parameters":[{"type":"text","text":"Asha"}]}]},"reference_id":"order-42"}}}},"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"summary":"List messages","tags":["messages"],"x-required-scope":"messages:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"customer_id","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"reference_id","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"string"}},{"name":"cursor","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messages/bulk":{"post":{"summary":"Send up to 100 messages","tags":["messages"],"x-required-scope":"messages:send","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkSend"},"example":{"messages":[]}}}},"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messages/{id}":{"get":{"summary":"Get a message","tags":["messages"],"x-required-scope":"messages:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/consent":{"post":{"summary":"Record a contact's opt-in or opt-out with evidence","tags":["consent"],"x-required-scope":"customers:write","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordConsent"},"example":{"customer_id":"cus_…","phone":"919876543210","action":"opt_in","source":"web_form","evidence":"Ticked the WhatsApp updates box on checkout, 3 Mar 2026"}}}},"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"summary":"Consent history for a contact","tags":["consent"],"x-required-scope":"customers:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"customer_id","in":"query","schema":{"type":"string"}},{"name":"phone","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/partner/usage":{"get":{"summary":"Usage for a period","tags":["partner"],"x-required-scope":"usage:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"from","in":"query","schema":{"type":"string"}},{"name":"to","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/partner/wallet":{"get":{"summary":"Partner wallet balance, rates and ledger","tags":["partner"],"x-required-scope":"usage:read","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/partner/invoices":{"get":{"summary":"Partner plan invoices","tags":["partner"],"x-required-scope":"usage:read","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks":{"get":{"summary":"List webhooks","tags":["webhooks"],"x-required-scope":"webhooks:manage","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a webhook (signing secret shown once)","tags":["webhooks"],"x-required-scope":"webhooks:manage","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhook"},"example":{"url":"https://example.com/hooks/autobot360","event_types":["message.delivered","message.failed"]}}}},"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks/{id}":{"patch":{"summary":"Update a webhook","tags":["webhooks"],"x-required-scope":"webhooks:manage","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhook"},"example":{"status":"DISABLED"}}}},"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"Delete a webhook","tags":["webhooks"],"x-required-scope":"webhooks:manage","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"202":{"description":"Accepted (messages)"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}