Recipes
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
# 1. (optional) build an audience segment
SEG=$(curl -s -X POST https://api.platformdtc.com/api/v1/agent/v1/segments \
-H "X-Agent-Key: sq_agt_xxx" -H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"name":"US buyers","filters":[{"field":"country","operator":"equals","value":"US"}]}' \
| jq -r '.data.id')
# 2. create a DRAFT campaign
CID=$(curl -s -X POST https://api.platformdtc.com/api/v1/agent/v1/campaigns \
-H "X-Agent-Key: sq_agt_xxx" -H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d "{\"name\":\"Launch\",\"type\":\"EMAIL\",\"audience_id\":\"$SEG\",\"subject\":\"We're live\",\"email_html_content\":\"<h1>Hello</h1>\"}" \
| jq -r '.data.id')
# 3. send (SPENDS money / contacts customers)
curl -s -X POST "https://api.platformdtc.com/api/v1/agent/v1/campaigns/$CID/send" \
-H "X-Agent-Key: sq_agt_xxx" -H "Idempotency-Key: $(uuidgen)" | jq '.data'
# -> { "job_id": "...", "status": "queued" } # or "pending_approval"