sayintel
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, or the whole campaign if neither is given. By default rewrites EVERY slot (M1/M2/M3) for each targeted speaker — pass slots (e.g. [1] to touch only M1) to scope it to specific slot numbers instead; when message_ids is given without an explicit slots, it's inferred from those messages' own slot numbers, so 'fix this one M1' only touches that M1, not the M2/M3 next to it. Untouched slots are never reworded or re-scored. Rewrites pass the same hard-fail QA gate as fresh drafts, scoped to the slots being rewritten: a rewrite is skipped (not saved) if it introduces a hard fail anywhere or leaves one on a slot it touched; hard fails that already sat on untouched slots do not block it and are listed in the summary so you can rewrite those slots next. 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

NameInTypeRequiredDescription
campaign_idpathstringyes—

Body

NameInTypeRequiredDescription
instructionbodystringyes—
speaker_idsbodyarrayno—
message_idsbodyarrayno—
slotsbodyarraynoRestrict the rewrite to these slot numbers (1=M1, 2=M2, 3=M3). Omit to rewrite every slot the speaker has. When message_ids is given and this is omitted, it's inferred from those messages' own slots.
dry_runbodybooleannoWhen true nothing is written, started, or spent. The tool returns only cost_preview so an agent can estimate credits first.
idempotency_keybodystringnoOptional 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.