WaMarketing API and MCP server
Version 1 · REST at /api/v1 · MCP at /mcp
Connect your shop, CRM or AI assistant to your WA Marketing account. You can add contacts, write templates, create campaigns, launch or schedule them and read the results, all with the same rules as the web portal.
- REST API:
https://wamarketing.co/api/v1 - MCP server:
https://wamarketing.co/mcp(for Claude, ChatGPT, Cursor and other MCP clients)
Getting a key
Keys are issued by the WA Marketing team. Contact us with your account email and tell us:
- what the key is for: the REST API, the MCP server, or both;
- whether it should be read only or full (full keys can add contacts, create templates and send campaigns);
- an expiry date, if you want one.
Each key belongs to one business or partner account and can only see that account. The key is shown to us once and we only store a fingerprint of it, so keep it somewhere safe. If it leaks, ask us to revoke it and we will issue a new one.
Keys look like wam_live_ followed by 40 characters.
Authentication
Send the key in the Authorization header on every request:
Authorization: Bearer wam_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
If your tool cannot set that header, X-Api-Key: wam_live_... also works. Never put the key in a URL.
curl https://wamarketing.co/api/v1/me \
-H "Authorization: Bearer $WAM_KEY"
Rules the API enforces
The API is not a way around the portal's rules. It applies the same ones:
- Consent. Every contact you add must have agreed to receive WhatsApp marketing from you. You confirm this with
"consent": trueon each request. - STOP is final. A contact who opted out stays opted out, even if you add them again, and is skipped by every campaign.
- Approved templates only. Campaigns use templates that passed review. Templates are for promotional messages.
- Credits. Each message costs 1 credit. Launching a campaign reserves 1 credit per recipient; credits for messages that fail are released.
- Your account only. A key cannot see or change any other account.
- No message contents. Customer replies are not available through the API.
Requests and responses
- Send JSON with
Content-Type: application/json. All responses are JSON. - Times are ISO 8601 in UTC, e.g.
2026-12-01T06:00:00Z. When you send a time, include a timezone, e.g.2026-12-01T10:00:00+04:00. - Phone numbers use the international format with the country code, e.g.
+971501234567. - Lists return
{"data": [...]}; contact lists also returnpage,pagesandtotal.
Errors
Errors use the HTTP status code and this body:
{"error": {"code": "consent_required", "message": "Set \"consent\": true to confirm ..."}}
| Status | Code | Meaning |
|---|---|---|
| 400 | confirm_required | MCP only: a sending tool was called without confirm: true |
| 401 | unauthorized | Missing, wrong, revoked or expired key |
| 402 | insufficient_credits | Not enough credits for this campaign |
| 403 | read_only_key | The key is read only |
| 403 | wrong_surface | The key is for the MCP server only, or the REST API only |
| 403 | account_inactive | The account is suspended |
| 404 | not_found | No such item in your account |
| 409 | not_cancellable | The campaign cannot be cancelled in its current state |
| 422 | invalid, consent_required, too_many | Check the message and fix the request |
| 429 | rate_limited | More than 60 requests in a minute. Wait for the time in Retry-After |
| 503 | api_disabled | The API is switched off for maintenance |
Rate limit
60 requests per minute per key. Use the bulk contacts endpoint instead of many single calls.
Idempotency
POST requests that create or send accept an Idempotency-Key header (any unique string up to 100 characters, e.g. a UUID). If you retry with the same key within 24 hours, you get the first response back, with the header Idempotent-Replayed: true, and nothing is created or sent twice. Always use one when launching campaigns.
Account
GET /api/v1/me
The account and key you are using.
{"account": {"type": "business", "id": 42, "name": "Al Noor Perfumes", "verified": true},
"key": {"name": "Shopify sync", "prefix": "wam_live_3f9a1c", "access": "full", "kind": "both", "expires_at": null}}
GET /api/v1/wallet
Your credits. available is what you can spend now; reserved is held by running campaigns.
{"available": 4800, "balance": 5000, "reserved": 200, "lots": [{"credits": 5000, "expires_at": "2027-11-22T00:00:00Z"}]}
GET /api/v1/senders
The WhatsApp numbers you can send from: id, name, phone, status (active or paused).
GET /api/v1/tags
Your contact tags, with the number of contacts in each. Campaigns are sent to tags.
Contacts
A contact looks like this:
{"id": 812, "phone": "+971501234567", "name": "Asha", "fields": {"city": "Dubai"}, "tags": ["vip"],
"opted_out": false, "consent_source": "In-store sign-up", "created_at": "...", "updated_at": "..."}
GET /api/v1/contacts
Query parameters: q (name or phone fragment), tag (tag name), status (active or opted_out), page, per_page (up to 200, default 50).
?phone=+971501234567 looks up one number and also tells you whether it is opted out.
GET /api/v1/contacts/{id}
One contact.
POST /api/v1/contacts
Adds a contact, or updates it if the phone number already exists.
{"phone": "+971501234567", "name": "Asha", "fields": {"city": "Dubai"}, "tags": ["vip"],
"consent": true, "consent_source": "In-store sign-up"}
consent must be true. consent_source is one of: Website form, In-store sign-up, Existing customers, Event / exhibition, WhatsApp opt-in, Other written consent (the default). Returns {"result": "created" | "updated", "contact": {...}}.
POST /api/v1/contacts/bulk
Up to 1000 contacts per call. consent, consent_source and tags apply to all of them.
{"consent": true, "consent_source": "Website form", "tags": ["newsletter"],
"contacts": [{"phone": "+971501234567", "name": "Asha"}, {"phone": "+971551112222"}]}
Returns {"created": 1, "updated": 1, "invalid": 0, "opted_out": 0, "errors": []}. errors lists the index of each invalid row.
DELETE /api/v1/contacts/{id}
Deletes a contact. If they opted out, they stay on your opt-out list.
Templates
GET /api/v1/templates
Returns your templates (data), your template allowance (limit and used), and sendable: the templates you can use in a campaign right now. Pass the template value from sendable when you create a campaign.
{"data": [{"id": 7, "label": "Eid offer", "status": "submitted", "body": "Hi {{1}}, ...", ...}],
"limit": 5, "used": 2,
"sendable": [{"template": "eid_offer_42|en", "label": "Eid offer", "language": "en", "variables": 1, "body": "Hi {{1}}, ..."}]}
Add ?archived=1 to include archived templates.
GET /api/v1/templates/{id}
One template, with its review status and any review note. status is draft, review (with our team), rejected (see review_note), submitted (passed our review and sent for final approval) or failed. Once a template is approved it appears in sendable.
POST /api/v1/templates
Saves a promotional template. Add "submit": true to send it for review straight away; otherwise it is saved as a draft.
{"label": "Eid offer", "language": "en", "header": "Eid Mubarak",
"body": "Hi {{1}}, enjoy {{2}} off all perfumes until Sunday.", "samples": ["Asha", "20%"],
"footer": "Reply STOP to opt out", "cta_text": "Show me", "submit": false}
Use {{1}}, {{2}}… for personal details and give a sample for each. Submitting uses one slot of your allowance.
POST /api/v1/templates/{id}/submit
Sends a draft, or a rejected template you have edited, for review.
POST /api/v1/test
Sends a free test of one of your templates to your verified test number: {"template_id": 7}. Returns 202 with {"queued": true, "test_id": 3, "free": true}.
Campaigns
A campaign looks like this:
{"id": 31, "name": "Eid weekend", "status": "draft", "template": "eid_offer_42|en", "senders": [3, 4], "tags": ["vip"],
"recipients": 0, "skipped": 0, "skip_reasons": {}, "scheduled_at": null, "launched_at": null, "finished_at": null, "created_at": "..."}
status is one of draft, scheduled, running, paused, completed, cancelled.
GET /api/v1/campaigns
Your campaigns, newest first.
GET /api/v1/campaigns/{id}
One campaign, with stats.
GET /api/v1/campaigns/{id}/stats
Delivery counts only: queued (waiting to send), accepted (sent to WhatsApp), delivered, read, failed (could not be delivered), not_sent, cancelled and credits used.
POST /api/v1/campaigns
Saves a draft. Nothing is sent yet.
{"name": "Eid weekend", "template": "eid_offer_42|en", "tags": ["vip"],
"variables": [{"source": "name", "fallback": "there"}, {"source": "text", "value": "20%"}]}
tags: who receives it, by tag name.variables: one entry per{{n}}, in order.sourceisname(the contact's name),field:<key>(one of the contact's fields) ortext(the samevaluefor everyone).fallbackis used when a contact has no value; contacts with no value and no fallback are skipped.senders: optional sender ids. By default every active sender you can use.
POST /api/v1/campaigns/{id}/launch
Sends the campaign now, or schedules it with {"scheduled_at": "2026-12-01T10:00:00+04:00"} (at least a minute and at most 90 days ahead). This reserves 1 credit per recipient and skips opted-out contacts and contacts missing a variable.
{"queued": 1180, "skipped": {"Opted out": 12, "Missing variable {{1}}": 3}, "campaign": {...}}
Returns 402 if you do not have enough credits. Send an Idempotency-Key.
POST /api/v1/campaigns/{id}/cancel
Stops a scheduled, running or paused campaign. Messages not yet sent are cancelled and their credits released.
MCP server
The MCP server lets an AI assistant work with your account in plain language: "add these customers", "draft an Eid offer", "how did last week's campaign do?".
- URL:
https://wamarketing.co/mcp - Transport: Streamable HTTP. Send one JSON-RPC message per
POST; responses are JSON. - Authentication:
Authorization: Bearer wam_live_..., with a key issued for MCP.
Most MCP clients only need the URL and the header. For example, in a client that reads an mcpServers config:
{"mcpServers": {"wamarketing": {"type": "http", "url": "https://wamarketing.co/mcp",
"headers": {"Authorization": "Bearer wam_live_..."}}}}
Tools
| Tool | What it does |
|---|---|
get_account | The account the key belongs to |
get_wallet | Credits available and reserved |
list_senders | Numbers you can send from |
list_tags | Tags and how many contacts each has |
list_contacts | Search contacts |
add_contacts | Add or update up to 1000 contacts (needs consent: true) |
list_templates | Your templates, allowance and sendable templates |
create_template_draft | Save a template draft |
submit_template | Send a draft for review |
list_campaigns | Your campaigns |
create_campaign | Save a campaign draft |
campaign_stats | A campaign with delivery counts |
launch_campaign | Sends a campaign now or at a time (needs confirm: true) |
cancel_campaign | Stop a campaign |
send_test | Sends a free test to your test number (needs confirm: true) |
The tools take the same fields as the matching REST endpoints. The two sending tools refuse to run unless the assistant passes confirm: true, so a well-behaved assistant asks you before anything is sent. A read-only key cannot use the tools that change anything.
Changes
- 2026-11-22: version 1.
See it on your own phone in 2 minutes
Create a free account and send yourself a test message. No card, no monthly fee.
Send a free test