Track and retry

Status and progress of a run, automatic wait on Meta rate limits, and smart retry of what failed.

🇧🇷 Ler em português

After POST /campaigns (or POST /audiences/engagement), the creation runs on the server. Closing the connection or stopping your automation interrupts nothing: just poll again with the job_id.

Check the progress

curl -s $BASE/executions/<job_id>/progress -H "Authorization: Bearer $KEY"
{
  "status": "running",
  "progress": {
    "phase": null,
    "throttle": null,
    "steps": [
      { "id": "campaign", "label": "Criando campanha...", "status": "success", "resultId": "120210…" },
      { "id": "adset_0", "label": "Criando conjunto de anúncios \"…\"", "status": "running" }
    ]
  }
}
  • status: queued → running → success | partial | error.
  • progress.phase describes the preparation (reading the Drive folder, videos, audience validation).
  • progress.throttle.paused = true means Meta throttled the account: items wait and are resent automatically (for up to 30 min).
  • steps[].label is a Brazilian Portuguese label meant for display; rely on id and status in code.
  • Poll every 3–5 s. GET /executions/{job_id} returns the full summary with every ID created. The step list stays available after the run ends.

Logs

GET /executions/{job_id}/logs lists the calls made to Meta and Drive, with Brazilian Portuguese error messages and Meta error codes. It also accepts the job_id returned by lookups. Retention: successful calls are kept for 24h and errors for 14 days — after that the list comes back empty, while the execution summary stays available.

Retry what failed

curl -s -X POST $BASE/executions/<job_id>/retry -H "Authorization: Bearer $KEY"

The retry keeps the same job_id and reuses the campaign, ad sets, media, creatives and ads that were already created — it only redoes what failed. To repeat a single call: POST /logs/{log_id}/retry (idempotent).

Rules enforced by the server (summary)

  • Campaign failed → nothing else is created. Ad set failed → its ads are skipped; the others continue (partial).
  • Upload failed → one automatic retry; if it fails again, the ad is skipped.
  • Creatives are created once and reused across ad sets.
  • Custom audiences from another ad account are blocked before any write (pre-flight).
  • Limits: up to 50 ad sets and 500 ads per run; carousels take 2 to 10 cards.

Did this page help you?