Endpoint
Request rewrite
POST/api/public/v1/campaigns/{campaign_id}/rewriteswrite
Rewrite drafted messages per an instruction (e.g. 'shorter, drop the exclamation, lead with the talk'). Targets specific speakers via speaker_ids, specific drafts via message_ids (rewrites all slots for those speakers), or the whole campaign if neither is given. Rewrites pass the same hard-fail QA gate as fresh drafts; a rewrite that violates it is skipped, not saved. Pass dry_run=true to see cost_preview (model calls, no credits) before committing.
Request
curl -X POST "https://sayintel.com/api/public/v1/campaigns/<campaign_id>/rewrites" \
-H "Authorization: Bearer $SAYINTEL_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"instruction": "<instruction>"}'Try it out
Try it outPOST/api/public/v1/campaigns/{campaign_id}/rewriteswrite
Sent as a bearer token to this site only, and kept in this tab's session storage. It is never written to disk or sent anywhere else.
Paste an API key to run.
Path parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| campaign_id | path | string | yes | — |
Body
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| instruction | body | string | yes | — |
| speaker_ids | body | array | no | — |
| message_ids | body | array | no | — |
| dry_run | body | boolean | no | When true nothing is written, started, or spent. The tool returns only cost_preview so an agent can estimate credits first. |
| idempotency_key | body | string | no | Optional retry guard. Reusing the same key with the same arguments replays the first result instead of running the action twice; reusing it with different arguments is rejected. |
Response
{
"ok": true,
"tool": "request_rewrite",
"kind": "write",
"data": { ... },
"error": null
}Notes
- Scope required: write. How scopes work.
- Accepts Idempotency-Key. A retry with the same key replays the first result instead of repeating the work.
- Accepts dry_run: true and always returns cost_preview before spending anything.
- Same capability over MCP as the tool request_rewrite. MCP setup.