EnglishUser APICampaigns & media

Campaigns & media endpoints

Create, edit, and manage campaigns, fetch the subscriber deep link, and upload welcome media.


List campaigns

GET /api/camp/list.json

Returns all non-deleted campaigns with aggregate counters.

{
  "status": "ok",
  "data": [
    {
      "id": 12,
      "code": "abc123",
      "bot": 7,
      "bot_username": "mytrackbot",
      "chat": -1001234567890,
      "chat_title": "My Channel",
      "status": 0,
      "starts": 120,
      "confirms": 98,
      "unsubs": 12,
      "created": "2026-05-10 09:00:00"
    }
  ]
}
statusMeaning
0Active
1Paused
2Deleted (soft — leads and stats are preserved)

Get one campaign

GET /api/camp/get.json

Returns the full campaign record including postback templates and unsub window.

ParameterDescription
idCampaign id
{
  "status": "ok",
  "data": {
    "id": 12,
    "code": "abc123",
    "bot": 7,
    "bot_username": "mytrackbot",
    "chat": -1001234567890,
    "chat_title": "My Channel",
    "status": 0,
    "welcome": "Join *{title}* — exclusive content inside!",
    "media": "",
    "button_text": "Get access",
    "button_url": "https://example.com/lander?click={click}",
    "pb_wait": "",
    "pb_hold": "",
    "pb_approve": "",
    "pb_cancel": "",
    "pb_trash": "",
    "unsub_window": 2592000,
    "starts": 120,
    "confirms": 98,
    "unsubs": 12,
    "created": "2026-05-10 09:00:00"
  }
}

Empty pb_* fields mean the campaign inherits the global postback templates. unsub_window is in seconds; 0 means the window never closes (cancel/trash postbacks always fire, regardless of when the leave happens).


Create a campaign

POST /api/camp/add.json

Creates a new campaign. The chat must come from bots/chats — it must be a chat where the chosen bot is currently admin and that is not already tracked by another campaign.

ParameterRequiredDescription
botBot id
chatChat id (from bots/chats)
welcomeWelcome message text (Telegram Markdown)
mediaMedia ref from media/upload; omit for text-only
button_textCPA button label shown in the welcome message
button_urlCPA button URL — may contain {click} and other macros
pb_waitPostback URL template for the wait event
pb_holdPostback URL template for the hold event
pb_approvePostback URL template for the approve event
pb_cancelPostback URL template for the cancel event
pb_trashPostback URL template for the trash event
unsub_windowSeconds after join within which cancel/trash postbacks fire; 0 = always
notify_levelLead notification level: 0 off (default), 1 approve only, 2 approve + wait, 3 all statuses
{ "status": "ok", "data": { "id": 12, "code": "abc123" } }

Postback override rule: if you set at least one pb_* field, the campaign uses its own templates for all five events (an empty one disables that specific event). If you leave all five pb_* fields empty, the campaign inherits your global templates.

ErrorMeaning
existsThis chat is already tracked by another campaign
nochatNo free chat slots available for the chosen bot
limitYou have reached your tariff’s campaign limit — upgrade at Billing

Edit a campaign

POST /api/camp/edit.json

Updates the welcome creative, postback templates, or unsub window. The bot and chat cannot be changed after creation.

ParameterRequiredDescription
idCampaign id
welcomeNew welcome message text
mediaNew media ref (pass "" to remove the current media)
button_textNew CPA button label
button_urlNew CPA button URL
pb_waitpb_trashNew postback URL templates (all five are rewritten together)
unsub_windowNew unsub window in seconds
notify_levelNew lead notification level (0–3)
{ "status": "ok" }

GET /api/camp/link.json

Returns the subscriber deep link for this campaign. Distribute this link in your traffic sources — when a subscriber opens it, the bot greets them and the conversion is tracked.

ParameterDescription
idCampaign id
clickOptional click ID to embed in the link
{
  "status": "ok",
  "data": {
    "link": "https://t.me/mytrackbot?start=abc123-{click}"
  }
}

When you pass a click value, that ID is embedded in the returned link directly: https://t.me/mytrackbot?start=abc123-xyz789. When you omit click, the {click} placeholder is left as-is for you to substitute before distributing.


Pause or resume

POST /api/camp/pause.json

ParameterDescription
idCampaign id
pause1 to pause, 0 to resume
{ "status": "ok" }

Delete a campaign

POST /api/camp/del.json

Soft-deletes the campaign. Existing leads, journal rows, and stats are preserved and continue to reference it.

ParameterDescription
idCampaign id
{ "status": "ok" }

Upload media

POST /api/media/upload.json

Uploads an image or video to use as the welcome media for a campaign. Returns a media reference to pass when creating or editing a campaign.

Send as multipart/form-data with the file in the file field.

{ "status": "ok", "data": { "media": "img_abc123xyz" } }

Pass the returned media value as the media parameter in camp/add or camp/edit.