Orbitoads
浏览文档

创建广告活动与上传媒体

每个请求可在一个账户内创建最多 100 项活动。选择频道、机器人、搜索或受众定向,提供唯一操作键并跟踪返回的任务。需要媒体时先上传。

Markdown

POST /v1/campaigns 在一个账户中创建广告活动。需要有管理权限的密钥以及 Idempotency-Key 请求头。202 响应包含任务信息,任务完成后才会出现新活动。

创建广告活动示例

示例
curl -s -X POST https://orbitoads.pro/api/v1/campaigns \
  -H "X-API-Key: $ORBITO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "account_id": 53,
    "title": "Crypto channels — notes",
    "text": "Daily market notes in 3 minutes. No noise.",
    "promote_url": "https://t.me/yourchannel",
    "cpm": 1.5,
    "budget": 20,
    "target_type": "channels",
    "channels": ["@durov", "t.me/telegram"]
  }'
示例
{ "success": true, "data": { "id": 81234, "type": "create", "status": "pending", "account_id": 53, "total": 1, "ad_ids": [] } }

批量创建

将运动设置为campaigns个(最多为100个). account_id个组域保留在顶层,并适用于所有组域.

示例
{
  "account_id": 53,
  "new_group_name": "October test",
  "campaigns": [
    { "title": "A", "text": "Variant A", "promote_url": "https://t.me/yourchannel", "cpm": 1.5, "budget": 10,
      "target_type": "channels", "channels": ["@durov"] },
    { "title": "B", "text": "Variant B", "promote_url": "https://t.me/yourchannel", "cpm": 1.5, "budget": 10,
      "target_type": "channels", "channels": ["@telegram"] }
  ]
}

运动是逐个创建的。 如果第一个失败, 任务停止了 —— 修正输入而不是重复同样的错误100次。 每个失败都列在任务errors 中, 它的index 在您的数组中 。

字段

田野需要意义
title是的内部名称,显示在面板上.
text是的Ad text people see. Telegram自身长度和内容规则适用——任务errors回回回拒绝.
promote_url是的广告内容:https://t.me/channel、t.me/bot?start=ref、@channel或网站URL。
cpm是的内阁货币的比价(bid / 1000)大于0. 。 目标 — — Telegram — 的最小值太低了。
budget是的钱从内阁平衡转向广告活动:0,至少是内阁的min_budget (广告账户 ) 。 有了0,广告已经创建,但直到你增加预算才能运行。
target_type是的channels、bots、search或users——见下文。
active无false 创建它关闭。默认 true 。
daily_budget无每日支出上限。
views_per_user无1–4号,有多少人能看到广告?
media无POST /v1/media的图像或视频标志。
picture无true在广告中展示了被推广的频道的相声.
button无广告下键:subscribe,view,read,learn_more,download,open,sign_up,buy,order,play,try,leave_request. 只有内阁的features.ad_button是true的.
website_name无在网站广告上显示的品牌名称.
schedule无仅在选定的工作日及时间播放广告, e.g . 工作日 9: 00–18: 00。 格式: 时间表 。 没有广告, 广告会全天候播放 。

顶级仅:account_id(当密钥到达多个柜子时需要),group_id(现存团体)或new_group_name(创建组,或再用取名后需要).

以400 VALIDATION_ERROR拒绝未知字段,以param拒绝字段名——一个twico从不默不作声地放弃一个设置.

定向设置

channels — 在具体频道显示广告

示例
{ "target_type": "channels", "channels": ["@durov", "t.me/telegram"],
  "languages": ["en"], "topics": [7, 26], "exclude_topics": [2], "add_similar_channels": true }
田野意义
channels1–100 公共频道:@name个,name个或t.me/name个。
languages, topics, exclude_topics按频道语言和话题划分的收缩(代码.
add_similar_channels同时加入类似这些频道.

bots — 以 bots 显示广告

示例
{ "target_type": "bots", "bots": ["@somebot"] }

bots: 1–100 个公共bots. required.

search — 显示Telegram搜索查询的广告

示例
{ "target_type": "search", "search_keywords": ["crypto wallet", "bitcoin"] }

search_keywords: 1–100 个短语,每个短语最多64个字符。 需要 。

users — 向观众展示广告

示例
{ "target_type": "users", "countries": ["DE", "AT"], "languages": ["de"],
  "topics": [26], "exclude_topics": [2], "audience_channels": ["@somechannel"] }
田野意义
countriesISO国道代码.
languages语言代码.
topics, exclude_topics兴趣,按专题编号。
audience_channels读这些频道的人。

至少需要其中之一。代码:目标代码 。

当任务进行时,频道、bots和关键词被解决到Telegram自己的ID上。 Telegram号无法找到;如果找不到的话,这场广告活动失败了 — — No targets found: …个频道和boots,No valid search queries found个关键词 — — 而任务errors号也这么说。

创建广告活动后

  1. GET /v1/tasks/{id}号投票直到completed. ad_ids举行新的广告活动.
  2. Telegram评出每条新广告:开始In Review个,然后变成Active(或Declined个). A网页告诉你什么时候.
  3. 用管理活动来改变、资助或暂停

上传媒体文件

POST /v1/media将一个图像或视频上传到一个柜子,并返回POST /v1/campaigns、PATCH和副本的media个代币。 该代币属于该柜子,上传到您将要创建的柜子中。

示例
curl -s -X POST "https://orbitoads.pro/api/v1/media?account_id=53" \
  -H "X-API-Key: $ORBITO_API_KEY" \
  -F "file=@banner.jpg"
示例
{ "success": true, "data": { "media": "BQACAgIAAx0…", "account_id": 53 } }
  • JPG,PNG,GIF,WEBP或MP4,至10 MB,以multipart/form-data发于场上file.
  • 有些柜子只接受16:9的图像, 至少640px宽;如果一个文件不合适, Telegram的理由在error回.

错误

代码当时
VALIDATION_ERROR一个字段丢失, 未知, 类型错误, 或不属于这个target_type — param说。
IDEMPOTENCY_KEY_REQUIRED编号为Idempotency-Key.
ACCOUNT_ID_REQUIRED / ACCOUNT_NOT_FOUND说哪个柜子是无法到达的。
VIEW_ONLY_ACCESS你可进入这个柜子
QUEUE_FULL5 创建此内阁中已经排队的 。
CABINET_LOCKED, SUBSCRIPTION_REQUIRED内阁现在无法接受手动修改。

个人广告活动故障(Telegram拒绝文本、提议、链接)不会失败请求 - 它们在任务中出现 errors.

API 参考

完整广告接口需要为此工作区单独配置供应商凭据。客户端请求使用自己的 Orbito API 密钥。账户订购、开通和外部账单分别处理。

POST /api/v1/campaigns

在一个账户中排队创建单条或最多 100 条广告。

参数位置格式必填
Idempotency-Keyheaderstring是
X-API-Keyheaderstring是
cURL
curl -X POST https://orbitoads.pro/api/v1/campaigns \
  -H 'X-API-Key: YOUR_ORBITO_KEY' \
  -H 'Idempotency-Key: 2033d50c-b32b-44aa-8e40-3e236c474805' \
  -H 'Content-Type: application/json' \
  --data '{
  "title": "November club · draft",
  "text": "Explore this month’s language club schedule.",
  "promote_url": "https://school.example/club",
  "cpm": 1.25,
  "budget": 0,
  "active": false,
  "target_type": "users",
  "countries": [
    "GB"
  ],
  "languages": [
    "en"
  ],
  "account_id": 7401,
  "group_id": 516
}'
HTTP 202
{
  "success": true,
  "data": {
    "id": 96203,
    "type": "create",
    "status": "pending",
    "account_id": 7401,
    "total": 1,
    "ad_ids": []
  }
}
请求体结构
JSON Schema
{
  "oneOf": [
    {
      "properties": {
        "account_id": {
          "type": "integer"
        },
        "active": {
          "default": true,
          "type": "boolean"
        },
        "add_similar_channels": {
          "type": "boolean"
        },
        "audience_channels": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "bots": {
          "items": {
            "type": "string"
          },
          "maxItems": 100,
          "minItems": 1,
          "type": "array"
        },
        "budget": {
          "minimum": 0,
          "type": "number"
        },
        "button": {
          "enum": [
            "subscribe",
            "view",
            "read",
            "learn_more",
            "download",
            "open",
            "sign_up",
            "buy",
            "order",
            "play",
            "try",
            "leave_request"
          ],
          "type": "string"
        },
        "channels": {
          "items": {
            "type": "string"
          },
          "maxItems": 100,
          "minItems": 1,
          "type": "array"
        },
        "countries": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "cpm": {
          "exclusiveMinimum": 0,
          "type": "number"
        },
        "daily_budget": {
          "minimum": 0,
          "type": "number"
        },
        "exclude_topics": {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "group_id": {
          "type": "integer"
        },
        "languages": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "media": {
          "type": "string"
        },
        "new_group_name": {
          "maxLength": 100,
          "type": "string"
        },
        "picture": {
          "type": "boolean"
        },
        "promote_url": {
          "maxLength": 2048,
          "type": "string"
        },
        "schedule": {
          "additionalProperties": false,
          "properties": {
            "days": {
              "additionalProperties": false,
              "properties": {
                "fri": {
                  "items": {
                    "maximum": 23,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "maxItems": 24,
                  "type": "array"
                },
                "mon": {
                  "items": {
                    "maximum": 23,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "maxItems": 24,
                  "type": "array"
                },
                "sat": {
                  "items": {
                    "maximum": 23,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "maxItems": 24,
                  "type": "array"
                },
                "sun": {
                  "items": {
                    "maximum": 23,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "maxItems": 24,
                  "type": "array"
                },
                "thu": {
                  "items": {
                    "maximum": 23,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "maxItems": 24,
                  "type": "array"
                },
                "tue": {
                  "items": {
                    "maximum": 23,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "maxItems": 24,
                  "type": "array"
                },
                "wed": {
                  "items": {
                    "maximum": 23,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "maxItems": 24,
                  "type": "array"
                }
              },
              "type": "object"
            },
            "timezone": {
              "type": "string"
            }
          },
          "required": [
            "days",
            "timezone"
          ],
          "type": [
            "object",
            "null"
          ]
        },
        "search_keywords": {
          "items": {
            "maxLength": 64,
            "type": "string"
          },
          "maxItems": 100,
          "minItems": 1,
          "type": "array"
        },
        "target_type": {
          "enum": [
            "channels",
            "bots",
            "search",
            "users"
          ],
          "type": "string"
        },
        "text": {
          "maxLength": 4096,
          "type": "string"
        },
        "title": {
          "maxLength": 255,
          "type": "string"
        },
        "topics": {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "views_per_user": {
          "maximum": 4,
          "minimum": 1,
          "type": "integer"
        },
        "website_name": {
          "maxLength": 255,
          "type": "string"
        }
      },
      "required": [
        "title",
        "text",
        "promote_url",
        "cpm",
        "budget",
        "target_type"
      ],
      "type": "object"
    },
    {
      "properties": {
        "account_id": {
          "type": "integer"
        },
        "campaigns": {
          "items": {
            "properties": {
              "active": {
                "default": true,
                "type": "boolean"
              },
              "add_similar_channels": {
                "type": "boolean"
              },
              "audience_channels": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "bots": {
                "items": {
                  "type": "string"
                },
                "maxItems": 100,
                "minItems": 1,
                "type": "array"
              },
              "budget": {
                "minimum": 0,
                "type": "number"
              },
              "button": {
                "enum": [
                  "subscribe",
                  "view",
                  "read",
                  "learn_more",
                  "download",
                  "open",
                  "sign_up",
                  "buy",
                  "order",
                  "play",
                  "try",
                  "leave_request"
                ],
                "type": "string"
              },
              "channels": {
                "items": {
                  "type": "string"
                },
                "maxItems": 100,
                "minItems": 1,
                "type": "array"
              },
              "countries": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "cpm": {
                "exclusiveMinimum": 0,
                "type": "number"
              },
              "daily_budget": {
                "minimum": 0,
                "type": "number"
              },
              "exclude_topics": {
                "items": {
                  "type": "integer"
                },
                "type": "array"
              },
              "languages": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "media": {
                "type": "string"
              },
              "picture": {
                "type": "boolean"
              },
              "promote_url": {
                "maxLength": 2048,
                "type": "string"
              },
              "schedule": {
                "additionalProperties": false,
                "properties": {
                  "days": {
                    "additionalProperties": false,
                    "properties": {
                      "fri": {
                        "items": {
                          "maximum": 23,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "maxItems": 24,
                        "type": "array"
                      },
                      "mon": {
                        "items": {
                          "maximum": 23,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "maxItems": 24,
                        "type": "array"
                      },
                      "sat": {
                        "items": {
                          "maximum": 23,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "maxItems": 24,
                        "type": "array"
                      },
                      "sun": {
                        "items": {
                          "maximum": 23,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "maxItems": 24,
                        "type": "array"
                      },
                      "thu": {
                        "items": {
                          "maximum": 23,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "maxItems": 24,
                        "type": "array"
                      },
                      "tue": {
                        "items": {
                          "maximum": 23,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "maxItems": 24,
                        "type": "array"
                      },
                      "wed": {
                        "items": {
                          "maximum": 23,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "maxItems": 24,
                        "type": "array"
                      }
                    },
                    "type": "object"
                  },
                  "timezone": {
                    "type": "string"
                  }
                },
                "required": [
                  "days",
                  "timezone"
                ],
                "type": [
                  "object",
                  "null"
                ]
              },
              "search_keywords": {
                "items": {
                  "maxLength": 64,
                  "type": "string"
                },
                "maxItems": 100,
                "minItems": 1,
                "type": "array"
              },
              "target_type": {
                "enum": [
                  "channels",
                  "bots",
                  "search",
                  "users"
                ],
                "type": "string"
              },
              "text": {
                "maxLength": 4096,
                "type": "string"
              },
              "title": {
                "maxLength": 255,
                "type": "string"
              },
              "topics": {
                "items": {
                  "type": "integer"
                },
                "type": "array"
              },
              "views_per_user": {
                "maximum": 4,
                "minimum": 1,
                "type": "integer"
              },
              "website_name": {
                "maxLength": 255,
                "type": "string"
              }
            },
            "required": [
              "title",
              "text",
              "promote_url",
              "cpm",
              "budget",
              "target_type"
            ],
            "type": "object"
          },
          "maxItems": 100,
          "minItems": 1,
          "type": "array"
        },
        "group_id": {
          "type": "integer"
        },
        "new_group_name": {
          "maxLength": 100,
          "type": "string"
        }
      },
      "required": [
        "campaigns"
      ],
      "type": "object"
    }
  ]
}
请求结果与响应字段
APIHTTP含义
VALIDATION_ERROR400核对请求字段,修正非法输入后重试。
IDEMPOTENCY_KEY_REQUIRED400写请求中需提供 Idempotency-Key 请求头。
VIEW_ONLY_ACCESS403Viewer 可查看该账户,修改则需要账户级写权限。
QUEUE_FULL429该账户的创建队列已有五项任务,请等待空位。

POST /api/v1/media

上传广告素材并取得该账户专用的文件令牌。

参数位置格式必填
account_idqueryinteger—
X-API-Keyheaderstring是
Idempotency-Keyheaderstring—
cURL
curl -X POST 'https://orbitoads.pro/api/v1/media?account_id=7401' \
  -H 'X-API-Key: YOUR_ORBITO_KEY' \
  -F file=@./club-cover.png
HTTP 200
{
  "success": true,
  "data": {
    "media": "example-media-718",
    "account_id": 7401
  }
}
请求体结构
JSON Schema
{
  "properties": {
    "account_id": {
      "type": "integer"
    },
    "file": {
      "format": "binary",
      "type": "string"
    }
  },
  "required": [
    "file"
  ],
  "type": "object"
}
示例 · JSON
{
  "account_id": 7401,
  "new_group_name": "Language club variants",
  "campaigns": [
    {
      "title": "November club · draft",
      "text": "Explore this month’s language club schedule.",
      "promote_url": "https://school.example/club",
      "cpm": 1.25,
      "budget": 0,
      "active": false,
      "target_type": "users",
      "countries": [
        "GB"
      ],
      "languages": [
        "en"
      ]
    },
    {
      "title": "Conversation club · second draft",
      "text": "Explore this month’s language club schedule.",
      "promote_url": "https://school.example/club?from=variant2",
      "cpm": 1.25,
      "budget": 0,
      "active": false,
      "target_type": "users",
      "countries": [
        "GB"
      ],
      "languages": [
        "en"
      ]
    }
  ]
}

实施说明

单条与批量创建

单条创建在根级传 title、text、promote_url、cpm、budget、target_type。批量创建在 campaigns 中放 1–100 个对象,根级共享账户和分组。预算可为零或至少达到 min_budget。

定向与文件

定向可选 channels、bots、search 或 users。频道、机器人、关键词各 1–100 项,搜索词最多 64 字符。受众模式至少有一项筛选。JPG、PNG、GIF、WebP、MP4 最大 10 MB,素材令牌属于上传账户。

受理与完成

创建、复制和批量操作返回 HTTP 202 及任务 ID。按 Retry-After 轮询 GET /api/v1/tasks/{id}。即使状态为 completed,也要检查 failed 和 errors。

操作与字段

POST /api/v1/campaigns POST /api/v1/media channels bots search users

  • POST /api/v1/campaigns
  • POST /api/v1/media
  • channels
  • bots
  • search
  • users

请求示例

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

结构字段与限制

本表依据公开的 v1 契约。参数与字段名称区分大小写。各操作的 HTTP 状态码分别表示成功、输入校验和访问检查。链接规范给出了完整的请求与响应结构。

受众测试设置

创建结构区分四种定向方式。频道使用 channels,机器人名使用 bots,搜索词使用 search_keywords。国家、语言与主题用于描述用户受众。构建测试前应先读取账户所支持的选项。

协议参考

方法路径参数请求内容响应码
POST/api/v1/campaignsIdempotency-Keyapplication/json · CreateSingleRequest | CreateBatchRequest202, 400, 401, 403, 404, 409, 422, 429, 503
POST/api/v1/mediaaccount_idmultipart/form-data · file, account_id200, 400, 401, 403, 413
GET/api/v1/targeting——200, 401
GET/api/v1/tasks/{id}id—200, 400, 401, 404

来源 · 数据来源

结构字段与限制 · 创建广告活动与上传媒体

字段文档取值
target_typechannels | bots | search | users
campaigns[]1 … 100
active =true
views_per_user1 … 4
budget≥ 0
Idempotency-KeyUUID

来源 · 数据来源

CampaignInput

字段字段类型
titlestring
textstring
promote_urlstring
cpmnumber
daily_budgetnumber · 0 … ∞
views_per_userinteger · 1 … 4
mediastring
pictureboolean
buttonsubscribe | view | read | learn_more | download | open | sign_up | buy | order | play | try | leave_request
website_namestring
scheduleSchedule
budgetnumber · 0 … ∞
activeboolean · = true
target_typechannels | bots | search | users
channelsarray · [string] · 1 … 100
botsarray · [string] · 1 … 100
search_keywordsarray · [string] · 1 … 100
countriesarray · [string]
languagesarray · [string]
topicsarray · [integer]
exclude_topicsarray · [integer]
audience_channelsarray · [string]
add_similar_channelsboolean

来源 · 数据来源

CreateBatchRequest

字段字段类型
account_idinteger
group_idinteger
new_group_namestring
campaignsarray · [CampaignInput] · 1 … 100

来源 · 数据来源

CreativeFields

字段字段类型
titlestring
textstring
promote_urlstring
cpmnumber
daily_budgetnumber · 0 … ∞
views_per_userinteger · 1 … 4
mediastring
pictureboolean
buttonsubscribe | view | read | learn_more | download | open | sign_up | buy | order | play | try | leave_request
website_namestring
scheduleSchedule

来源 · 数据来源

参考资料更新日期

Pro Panel
Pro Panel