01Run it
Replace the <placeholders> with your own values, or use the builder below.
p202 attribution export create02What you get
Pick the shape you need. People get a table. Add
--json, --csv or --ndjson for scripts, or -q for ids only. An AI agent gets compact JSON without asking. All output formats03Build your command
Pick values and the command line writes itself, quoted and ready to paste.
p202 attribution export createSet flags below; the command updates as you type.
04Flags
10 flags, plus the global flags every command takes.
| Flag | What it does |
|---|---|
| --compare-modelstring | A second model id, side by side |
| --group-bystring ยท default campaign | Dimension: campaign, traffic_source, landing_page, keyword, c1, c2, c3, c4, country, device, daycampaigntraffic_sourcelanding_pagekeywordc1c2c3c4countrydeviceday |
| --idempotency-keystring | Retry-safe create: the server records the response under this key and replays it on a retry with the same key and payload instead of creating a duplicate |
| --modelstring | Model id (default: the account default model) |
| --periodstring | Range (default: the last 30 days): today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltimetodayyesterdaylast7last14last30last90thismonthlastmonththisyearlastyearalltime |
| --run-atstring | When to run it, unix seconds (default: the next export run, within a minute) |
| --time-fromstring | Range start, unix seconds |
| --time-tostring | Range end, unix seconds |
| --webhook-secretstring | HMAC secret for the webhook signature, 16-255 characters (default: generated and returned once) |
| --webhook-urlstring | Also POST the CSV here: https, public address, no redirects |
05How it works
Queue an export. Without --model it exports the account default model (stored as its id, so the job reads a fixed model); without a range, the last 30 days. The response carries webhook_secret once when the export has a webhook: keep it with the receiver.
06For agents
Running this from an agent
- Read the same facts as JSON:
p202 commands attribution export create --json. - With
AI_AGENT,CLAUDECODEor another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with ahint. - Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
- This command writes. Add
--stagedto record it as a proposal a person applies withp202 change apply.
{
"path": "p202 attribution export create",
"use": "create",
"short": "Queue an export of a breakdown: now, or at --run-at; optionally to a signed https webhook",
"long": "Queue an export. Without --model it exports the account default model (stored as its id, so\nthe job reads a fixed model); without a range, the last 30 days. The response carries\nwebhook_secret once when the export has a webhook: keep it with the receiver.",
"runnable": true,
"flags": [
{
"name": "compare-model",
"type": "string",
"default": "",
"usage": "A second model id, side by side",
"required": false
},
{
"name": "group-by",
"type": "string",
"default": "campaign",
"usage": "Dimension: campaign, traffic_source, landing_page, keyword, c1, c2, c3, c4, country, device, day",
"allowed_values": [
"campaign",
"traffic_source",
"landing_page",
"keyword",
"c1",
"c2",
"c3",
"c4",
"country",
"device",
"day"
],
"required": false
},
{
"name": "idempotency-key",
"type": "string",
"default": "",
"usage": "Retry-safe create: the server records the response under this key and replays it on a retry with the same key and payload instead of creating a duplicate",
"required": false
},
{
"name": "model",
"type": "string",
"default": "",
"usage": "Model id (default: the account default model)",
"required": false
},
{
"name": "period",
"type": "string",
"default": "",
"usage": "Range (default: the last 30 days): today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime",
"allowed_values": [
"today",
"yesterday",
"last7",
"last14",
"last30",
"last90",
"thismonth",
"lastmonth",
"thisyear",
"lastyear",
"alltime"
],
"required": false
},
{
"name": "run-at",
"type": "string",
"default": "",
"usage": "When to run it, unix seconds (default: the next export run, within a minute)",
"required": false
},
{
"name": "time-from",
"type": "string",
"default": "",
"usage": "Range start, unix seconds",
"required": false
},
{
"name": "time-to",
"type": "string",
"default": "",
"usage": "Range end, unix seconds",
"required": false
},
{
"name": "webhook-secret",
"type": "string",
"default": "",
"usage": "HMAC secret for the webhook signature, 16-255 characters (default: generated and returned once)",
"required": false
},
{
"name": "webhook-url",
"type": "string",
"default": "",
"usage": "Also POST the CSV here: https, public address, no redirects",
"required": false
}
]
}