Skip to main content
WA-Campaigns
API reference

The agent gateway, endpoint by endpoint

48 calls over one authenticated HTTP surface. Every route is listed with its method, path, and the scope it requires — the same catalog the MCP server and CLI are built from.

Base URL and authentication

The gateway is hosted for you — every org calls the same base URL, and every path below is relative to /api/agent. Authenticate with a scoped agent key as a bearer token. Agent keys are a separate rail from the human app — the master key is not honoured here, and an agent key cannot reach human admin routes.

export WA_AGENT_KEY=<your agent key>

curl "https://rcs-templates-api-dot-msg2ai-server.ue.r.appspot.com/api/agent/capabilities" \
  -H "Authorization: Bearer $WA_AGENT_KEY"

Keys are minted by an org admin, shown once, stored only as a SHA-256 hash, and revocable. Revocation fails closed.

Prefer tools over HTTP? The same catalog is exposed as an MCP server and a CLI.

OpenAPI document

Every route on this page is also published as OpenAPI 3.1, generated from the gateway's own tool catalog — so paths, scopes, and request arguments are the schemas it actually validates against, not a restatement. Responses are described loosely: the catalog types inputs but not outputs yet.

Reference

Discovery

1 call

One call that describes the rest. Ask the gateway what it can do and which of those things your key is allowed to do, then plan from the answer instead of from documentation that may be older than the deployment.

Reference

Templates

10 calls

Author, clone, render, approve, and send message templates. This is the core loop: find or write a template, render it to check the payload and its SMS fallback, submit it for provider approval, then broadcast it.

Reference

Surveys

13 calls

Conversational surveys are multi-turn templates: a question set with branching, sent to an audience, with answers that come back as structured data. They go through the same approval gate as templates.

Reference

Grounding knowledge

5 calls

A template can carry a grounding document — the source of truth a reply bot answers from. These calls attach it, read it, remove it, and switch it on or off without deleting it.

Reference

Audiences

6 calls

Named contact lists to send against. Import E.164 contacts once, then reference the audience instead of passing recipient arrays around.

Reference

Contacts

3 calls

The org-level record of a person — one per number, shared across every audience they appear in. Read their consent, opt-out, merge fields and tags, and correct the details that are yours to correct. Consent itself is readable here and deliberately not writable: recording or clearing it is compliance-sensitive and belongs to a human.

Reference

Inbox

4 calls

Threads, one per phone number, and replying into them. An agent can triage the whole inbox read-only; replying is the one call here that reaches a real phone, bills the org, and honours every gate a human composer hits — opt-out, allowance, and the WhatsApp 24-hour window.

Reference

Webhooks

5 calls

Outbound event subscriptions: register an HTTPS endpoint and the platform posts signed events to it as messages are delivered, replies arrive, and campaigns finish. The signing secret is shown exactly once, when the endpoint is created.

Reference

Account

1 call

Read-only view of the org's metered usage — the same ledger the human dashboard and the billing meter count.

Reference

All routes at a glance

MethodPathToolScope
GET/capabilitiescapabilitiesany key
GET/templatessearch_templatestemplates:read
GET/templates/:idget_templatetemplates:read
POST/templates/:id/renderrender_templatetemplates:read
POST/templatescreate_templatetemplates:write
PUT/templates/:idupdate_templatetemplates:write
POST/templates/:id/duplicateduplicate_templatetemplates:write
DELETE/templates/:iddelete_templatetemplates:write
POST/marketplace/:id/cloneclone_templatemarketplace:clone
POST/templates/:id/submitsubmit_templatetemplates:submit
POST/messages/sendsend_messagemessages:send
GET/surveyssearch_surveyssurveys:read
GET/surveys/:idget_surveysurveys:read
POST/surveys/:id/renderrender_surveysurveys:read
POST/surveyscreate_surveysurveys:write
POST/surveys/:id/cloneclone_surveymarketplace:clone
DELETE/surveys/:iddelete_surveysurveys:write
POST/surveys/:id/submitsubmit_surveysurveys:submit
POST/surveys/:id/sendsend_surveysurveys:send
PATCH/surveys/:idupdate_surveysurveys:write
GET/surveys/:id/sendslist_survey_sendssurveys:read
POST/surveys/:id/send-testsend_survey_testsurveys:send
GET/surveys/:id/resultsget_resultsresults:read
POST/media/uploadupload_mediasurveys:write
GET/templates/:id/knowledgeget_knowledgetemplates:read
PUT/templates/:id/knowledgeset_knowledgetemplates:write
DELETE/templates/:id/knowledgedelete_knowledgetemplates:write
POST/templates/:id/knowledge/enableenable_knowledgetemplates:write
POST/templates/:id/knowledge/disabledisable_knowledgetemplates:write
GET/usageget_usageusage:read
GET/audiencessearch_audiencesaudiences:read
GET/audiences/:idget_audienceaudiences:read
GET/audiences/:id/contactslist_audience_contactsaudiences:read
POST/audiencescreate_audienceaudiences:write
POST/audiences/:id/contactsimport_contactsaudiences:write
DELETE/audiences/:iddelete_audienceaudiences:write
GET/conversationslist_conversationsconversations:read
GET/conversations/:idget_conversationconversations:read
POST/conversations/:id/replyreplyconversations:write
POST/conversations/:id/assignassign_conversationconversations:write
GET/webhookslist_webhookswebhooks:manage
POST/webhookscreate_webhookwebhooks:manage
PUT/webhooks/:idupdate_webhookwebhooks:manage
DELETE/webhooks/:iddelete_webhookwebhooks:manage
POST/webhooks/:id/testtest_webhookwebhooks:manage
GET/contactslist_contactscontacts:read
GET/contacts/:idget_contactcontacts:read
PATCH/contacts/:idupdate_contactcontacts:write

Scopes

An agent key is a capability token: it carries exactly the scopes it was minted with and nothing more. A call outside a key's scopes is rejected before it reaches the handler.

templates:read

Search, fetch, and render templates, and read grounding docs

templates:write

Author, revise, duplicate, and delete drafts, and manage grounding

templates:submit

Submit drafts for provider approval

marketplace:clone

Clone marketplace templates and surveys into your org

messages:send

Broadcast templates to recipients

surveys:read

Search, fetch, render, and list sends for surveys

surveys:write

Author, patch, and delete surveys, and upload media

surveys:submit

Submit surveys for provider approval

surveys:send

Send survey tests and live survey runs

results:read

Read survey responses

audiences:read

List audiences and their contacts

audiences:write

Create and delete audiences, and import contacts

conversations:read

List threads, and read a thread with its messages

conversations:write

Reply into a thread, and assign or release it

webhooks:manage

Register, update, delete, and test outbound webhook endpoints

contacts:read

Search and read the org-level contact record

contacts:write

Correct names, email, merge fields and tags — never consent

usage:read

Read metered usage for the org