On this page

POST/campaigns/:campaignId/template

Credits: 0
Rate limit: 30 / minute (shared control bucket)
Idempotency: Idempotency-Key → POST:/campaigns/:id/template


Purpose

Assign an existing agent to a campaign, or clear the assignment. The agent name always comes from the saved agent (never from the client body).

BodyBehavior
{ "templateId": "<id>" }Assign
{ "templateId": null }Clear (same cursor / batch clears as dashboard)

Omit templateId or empty string → 400.

While the campaign is in progress → 409 conflict. Pause first.

Template accounts that are inactive or disconnected → 403 account_disconnected (same code as create/update template). Missing accounts / no message content → 400 validation_error.


Request

POST /campaigns/:campaignId/template
X-API-Key: sk_live_...
Content-Type: application/json
Idempotency-Key: optional-uuid

Response 200

Allowlisted campaign detail (GET /campaigns/:id), including assignedTemplateId after assign or null after clear.


MCP

Tool: assign_template — templateId: string | null; optional idempotencyKey. Confirm before clearing an in-use agent.