{"openapi":"3.0.3","info":{"title":"WA-Blaster API","version":"1.0.0","description":"REST API for sending WhatsApp messages and emails programmatically via WA-Blaster. Authenticate every request using your API key in the `X-API-Key` header.\n\n## Getting your API key\n1. Log in to the WA-Blaster dashboard.\n2. Go to **Settings → API Keys**.\n3. Click **Generate New Key**, choose scopes, and copy the key — it is shown only once.\n\n## Scopes\n| Scope | Access |\n|---|---|\n| `whatsapp` | Send WhatsApp messages and templates |\n| `email` | Send emails and email templates |\n"},"servers":[{"url":"https://wa-blaster-backend.dev-api.softweirdo.com/api/v1","description":"Production"},{"url":"http://localhost:4052/api/v1","description":"Local development"}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Your WA-Blaster API key. Generate one from Settings → API Keys."}},"schemas":{"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string"}}},"Variables":{"type":"object","additionalProperties":{"type":"string"},"description":"Key-value pairs to interpolate into message content. Use `{key}` placeholders in your message.","example":{"name":"Rahul","phone":"9999999999","company":"Acme"}}}},"security":[{"ApiKeyAuth":[]}],"paths":{"/me":{"get":{"summary":"Get account info","description":"Returns the authenticated user's info and available sending methods.","operationId":"getMe","tags":["Account"],"responses":{"200":{"description":"Account info","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"user":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"}}},"sendingMethods":{"type":"object","properties":{"meta":{"type":"boolean","description":"Meta Cloud API connected"},"textmebot":{"type":"boolean","description":"TextMeBot API key configured"}}},"apiKeyScopes":{"type":"array","items":{"type":"string"}}}}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/whatsapp/send":{"post":{"summary":"Send a WhatsApp message","description":"Send a plain text or image WhatsApp message to a single recipient. Requires the `whatsapp` scope. Variables like `{name}` in the message body are replaced with values from the `variables` object.","operationId":"sendWhatsApp","tags":["WhatsApp"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["to","message"],"properties":{"to":{"type":"string","description":"Recipient phone number in international format.","example":"+919999999999"},"message":{"type":"string","description":"Message text. Supports `{variable}` placeholders.","example":"Hello {name}, your order is ready!"},"imageUrl":{"type":"string","description":"Optional public URL of an image to attach.","example":"https://example.com/image.jpg"},"variables":{"$ref":"#/components/schemas/Variables"}}}}}},"responses":{"200":{"description":"Message sent","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"messageId":{"type":"string","description":"Provider message ID."},"resolvedMessage":{"type":"string","description":"Final message after variable substitution."}}}}}},"400":{"description":"Validation error or no sending method configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"API key lacks the `whatsapp` scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/whatsapp/send-template":{"post":{"summary":"Send a WhatsApp template message","description":"Send a message using a saved WA-Blaster template. For Meta-submitted templates the status must be `APPROVED`. Variables are interpolated into the template body.","operationId":"sendWhatsAppTemplate","tags":["WhatsApp"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["to","templateId"],"properties":{"to":{"type":"string","description":"Recipient phone number.","example":"+919999999999"},"templateId":{"type":"string","description":"WA-Blaster Template `_id`.","example":"64a3f..."},"variables":{"$ref":"#/components/schemas/Variables"}}}}}},"responses":{"200":{"description":"Template sent","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"waMessageId":{"type":"string"},"resolvedMessage":{"type":"string"}}}}}},"400":{"description":"Template not approved or missing config","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","enum":["template_pending","template_rejected","template_unavailable"]},"message":{"type":"string"},"metaStatus":{"type":"string"},"reason":{"type":"string"}}}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"API key lacks the `whatsapp` scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Template not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/email/send":{"post":{"summary":"Send an email","description":"Send a single email via AWS SES using your verified sender. Requires the `email` scope. Variables like `{name}` in subject, htmlBody, and textBody are replaced.","operationId":"sendEmail","tags":["Email"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["to","subject","htmlBody"],"properties":{"to":{"type":"string","format":"email","example":"customer@example.com"},"subject":{"type":"string","example":"Hello {name}"},"htmlBody":{"type":"string","example":"<p>Hi {name}, thanks for signing up!</p>"},"textBody":{"type":"string","description":"Optional plain-text fallback."},"fromEmailId":{"type":"string","description":"Optional SenderEmail `_id`. Defaults to your default verified sender."},"variables":{"$ref":"#/components/schemas/Variables"}}}}}},"responses":{"200":{"description":"Email sent","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"sesMessageId":{"type":"string"}}}}}},"400":{"description":"Validation error or no verified sender","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"API key lacks the `email` scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/email/send-template":{"post":{"summary":"Send an email using a template","description":"Send an email using a saved WA-Blaster email template. Subject and HTML body are loaded from the template and variables are interpolated.","operationId":"sendEmailTemplate","tags":["Email"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["to","templateId"],"properties":{"to":{"type":"string","format":"email","example":"customer@example.com"},"templateId":{"type":"string","description":"WA-Blaster Template `_id` with type `email`.","example":"64b7c..."},"fromEmailId":{"type":"string","description":"Optional SenderEmail `_id`."},"variables":{"$ref":"#/components/schemas/Variables"}}}}}},"responses":{"200":{"description":"Email sent","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"sesMessageId":{"type":"string"},"resolvedSubject":{"type":"string"}}}}}},"400":{"description":"Wrong template type or no verified sender","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"API key lacks the `email` scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Template not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"tags":[{"name":"Account","description":"Account and API key info"},{"name":"WhatsApp","description":"Send WhatsApp messages"},{"name":"Email","description":"Send emails via AWS SES"}]}