p202 attribution export create

Queue an export of a breakdown: now, or at --run-at; optionally to a signed https webhook

Writessupports --staged
All commands

01Run it

Replace the <placeholders> with your own values, or use the builder below.

p202 attribution export create

02What 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 formats

03Build your command

Pick values and the command line writes itself, quoted and ready to paste.

p202 attribution export create

Set flags below; the command updates as you type.

04Flags

10 flags, plus the global flags every command takes.

FlagWhat it does
--compare-modelstringA second model id, side by side
--group-bystring ยท default campaignDimension: campaign, traffic_source, landing_page, keyword, c1, c2, c3, c4, country, device, day
campaigntraffic_sourcelanding_pagekeywordc1c2c3c4countrydeviceday
--idempotency-keystringRetry-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
--modelstringModel id (default: the account default model)
--periodstringRange (default: the last 30 days): today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime
todayyesterdaylast7last14last30last90thismonthlastmonththisyearlastyearalltime
--run-atstringWhen to run it, unix seconds (default: the next export run, within a minute)
--time-fromstringRange start, unix seconds
--time-tostringRange end, unix seconds
--webhook-secretstringHMAC secret for the webhook signature, 16-255 characters (default: generated and returned once)
--webhook-urlstringAlso 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, CLAUDECODE or another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with a hint.
  • Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
  • This command writes. Add --staged to record it as a proposal a person applies with p202 change apply.
p202 commands attribution export create --json
{
  "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
    }
  ]
}