Orbitoads
Browse documentation

Tasks (async operations)

Create, copy and batch changes can return HTTP 202 with a task ID. Poll the task to see progress, totals and individual failures. Keep the final list of affected campaign IDs for reconciliation.

Markdown

Some operations talk to Telegram once per campaign, so they can take longer than an HTTP request should wait. These return 202 Accepted with a task instead of the final result:

  • POST /v1/campaigns — create
  • POST /v1/campaigns/{ad_id}/copy — copy
  • POST /v1/campaigns/bulk — pause, resume, budget, CPM or delete many

Single-campaign changes (PATCH, pause, resume, budget, delete) answer directly — no task.

The 202 response

Example
HTTP/1.1 202 Accepted
Location: /api/v1/tasks/81234
Retry-After: 2
Example
{
  "success": true,
  "data": {
    "id": 81234,
    "type": "create",
    "status": "pending",
    "account_id": 53,
    "progress": 0,
    "total": 3,
    "succeeded": null,
    "failed": null,
    "ad_ids": [],
    "errors": [],
    "paused_reason": null,
    "error": null,
    "created_at": "2026-10-08T10:15:02.411Z",
    "started_at": null,
    "completed_at": null
  }
}

GET /v1/tasks/{id}

Example
curl -s https://orbitoads.pro/api/v1/tasks/81234 -H "X-API-Key: $ORBITO_API_KEY"

Same shape as above. Poll it until status is final; while a task is pending or running the response carries Retry-After: 2 — wait that long between polls. Any key of the same owner can read the task.

FieldMeaning
typecreate, copy, status (bulk pause/resume), budget, cpm, delete
statussee below
progress / totalcampaigns processed so far / in total
succeeded / failedcounts, once known
ad_idscampaigns the task created (create, copy) or changed (bulk)
errors[]up to 50 failures: { ad_id, index, error } — index is the position in your campaigns array for creates
paused_reasonwhy a task stopped to wait, e.g. the cabinet ran out of balance
errorwhy the whole task failed

Statuses

StatusMeaningFinal?
pendingqueued — the cabinet runs one create and one other operation at a timeno
runningin progressno
pausedstopped to wait — usually the cabinet balance ran out mid-way. Top up the cabinet; resume it from the panelno
completedfinished. Check failed and errors — a completed task can contain individual failuresyes
failedthe task as a whole failed — see erroryes
cancelledcancelled from the panelyes

Things to know about creates

  • New campaign ids appear in ad_ids when the task completes (they are found by syncing the cabinet after the last campaign is created).
  • If the first campaign of a batch fails, the task stops there rather than repeat the same mistake 100 times. Fix the input and send again.
  • If Telegram can’t resolve any of a campaign’s channels or bots, that campaign fails with No targets found: … listing them.
  • Telegram reviews every new ad. A created campaign usually starts In Review; a webhook tells you when that changes.

A polling loop

Example
async function waitForTask(id) {
  for (;;) {
    const res = await fetch(`https://orbitoads.pro/api/v1/tasks/${id}`, {
      headers: { 'X-API-Key': process.env.ORBITO_API_KEY },
    });
    const { data } = await res.json();
    if (['completed', 'failed', 'cancelled'].includes(data.status)) return data;
    if (data.status === 'paused') throw new Error(`Task paused: ${data.paused_reason}`);
    await new Promise(r => setTimeout(r, Number(res.headers.get('Retry-After') || 2) * 1000));
  }
}
Example
import time, requests

def wait_for_task(task_id):
    while True:
        r = requests.get(f"https://orbitoads.pro/api/v1/tasks/{task_id}",
                         headers={"X-API-Key": API_KEY}, timeout=30)
        task = r.json()["data"]
        if task["status"] in ("completed", "failed", "cancelled"):
            return task
        if task["status"] == "paused":
            raise RuntimeError(f"Task paused: {task['paused_reason']}")
        time.sleep(int(r.headers.get("Retry-After", 2)))

API reference

The full advertising contract requires a dedicated provider credential for this workspace. Use your Orbito API key for client calls. Account orders, provisioning and external billing are separate workflows.

GET /api/v1/tasks/{id}

Read job progress, resulting ad identifiers and individual failures.

ParameterLocationFormatRequired
idpathintegerYes
X-API-KeyheaderstringYes
cURL
curl -X GET https://orbitoads.pro/api/v1/tasks/96203 \
  -H 'X-API-Key: YOUR_ORBITO_KEY'
HTTP 200
{
  "success": true,
  "data": {
    "id": 96203,
    "type": "create",
    "status": "completed",
    "account_id": 7401,
    "total": 1,
    "ad_ids": [
      38019
    ],
    "progress": 1,
    "succeeded": 1,
    "failed": 0,
    "errors": [],
    "paused_reason": null,
    "error": null,
    "created_at": "2026-11-03T12:01:00Z",
    "started_at": "2026-11-03T12:01:02Z",
    "completed_at": "2026-11-03T12:01:04Z"
  }
}

Implementation notes

Accepted work and completion

Create, copy and bulk requests return HTTP 202 with a task id. Poll GET /api/v1/tasks/{id}, respecting Retry-After. Check failed and errors even when status is completed.

Job outcomes

pending, running and paused are nonterminal states. completed, failed and cancelled end the job. Use progress, total, ad_ids and up to 50 item errors. A paused_reason can identify a budget shortage that the operator resolves in the panel.

Operations and fields

GET /api/v1/tasks/{id} pending running paused completed failed cancelled succeeded failed errors

  • GET /api/v1/tasks/{id}
  • pending
  • running
  • paused
  • completed
  • failed
  • cancelled
  • succeeded
  • failed
  • errors

Request example

GET /api/v1/tasks/{id} HTTP/1.1 Host: orbitoads.pro X-API-Key: {key}

Schema fields and limits

This table follows the public v1 contract. Parameter and field names are case-sensitive. For each operation, the HTTP response codes distinguish a successful result, input validation and access checks. The linked specification defines the full request and response shapes.

Report dimensions

The API accepts up to 100 campaigns in a create request, up to 100 copies in one copy request, and up to 1,000 existing campaigns in one bulk operation. A 202 response identifies the queued task. Inspect failed and errors on completion before changing the next group.

Protocol reference

MethodRouteParametersRequest contentResponse codes
GET/api/v1/tasks/{id}id—200, 400, 401, 404
POST/api/v1/campaignsIdempotency-Keyapplication/json · CreateSingleRequest | CreateBatchRequest202, 400, 401, 403, 404, 409, 422, 429, 503
POST/api/v1/campaigns/bulkIdempotency-Keyapplication/json · BulkRequest202, 400, 401, 403, 404, 409, 422, 429
POST/api/v1/campaigns/{ad_id}/copyad_id, account_id, Idempotency-Keyapplication/json · CopyRequest202, 400, 401, 403, 404, 409, 422, 429

Source · Data source

Schema fields and limits · Tracking a queued operation

FieldDocumented value
HTTP 202Location, Retry-After
statuspending, running, paused, completed, failed, cancelled
progress / totalinteger / integer
succeeded / failedinteger | null
errors[]≤ 50
ad_ids[]integer

Source · Data source

Task

FieldField type
idinteger
typecreate | copy | status | budget | cpm | delete | edit | recreate
statuspending | running | paused | completed | failed | cancelled
account_idinteger
progressinteger
totalinteger
succeededinteger | null
failedinteger | null
ad_idsarray · [integer]
errorsarray · [object] · 0 … 50
paused_reasonstring | null
errorstring | null
created_atstring · date-time
started_atstring | null · date-time
completed_atstring | null · date-time

Source · Data source

Reference revision

Pro Panel
Pro Panel