Criar campanhas e enviar mídia
Uma solicitação aceita até 100 campanhas de uma conta. Escolha canais, bots, busca ou público e envie uma chave de operação. Carregue a mídia antes e acompanhe a tarefa.
POST /v1/campaigns cria campanhas em uma conta. Exige uma chave com permissão de gerenciamento e o cabeçalho Idempotency-Key. A resposta 202 contém uma tarefa. As campanhas aparecem quando ela termina.
Exemplo de criação de campanha
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": [] } }Criação em lote
Coloque as campanhas em campaigns (até 100). account_id e os campos do grupo permanecem no nível superior e se aplicam a todos eles.
{
"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"] }
]
}As campanhas são criadas uma após a outra. Se a primeira falhar, a tarefa pára — corrija a entrada em vez de repetir o mesmo erro 100 vezes. Cada falha está listada no errors da tarefa com o seu index no seu array.
Campos
| Campo | necessária | significado |
|---|---|---|
title | Sim | Nome interno, mostrado no painel. |
text | Sim | As pessoas do texto do anúncio ver. Telegram próprio comprimento e regras de conteúdo se aplicam — uma recusa volta no errors da tarefa. |
promote_url | Sim | O que o anúncio abre: https://t.me/channel, t.me/bot?start=ref , @channel ou um site URL . |
cpm | Sim | Licitação por 1.000 visualizações na moeda do gabinete, maior que 0. Muito baixo para o alvo → Telegram 's mínimo volta no erro. |
budget | Sim | Dinheiro movido do saldo do gabinete para a campanha: 0, ou pelo menos min_budget do gabinete ( Conta de publicidade ). Com 0 o anúncio é criado, mas não pode ser executado até que você adicionar orçamento. |
target_type | Sim | channels , bots , search ou users — ver abaixo. |
active | Não | false cria-o desligado. padrão true . |
daily_budget | Não | Boné de gastos diários. |
views_per_user | Não | Quantas vezes uma pessoa pode ver o anúncio, 1-4. |
media | Não | Imagem ou vídeo token de POST /v1/media . |
picture | Não | true mostra o avatar do canal promovido no anúncio. |
button | Não | Botão sob o anúncio: subscribe, view, read, learn_more, download, open, sign_up, buy, order, play, try, leave_request . Apenas onde features.ad_button do armário é true. |
website_name | Não | Marca mostrada acima de um anúncio do Web site. |
schedule | Não | Mostrar o anúncio apenas nos dias e horas escolhidos, por exemplo, dias da semana 9:00–18:00. Formato de forma: calendário. Sem ele, o anúncio corre em torno do relógio. |
Apenas nível superior: account_id (necessário quando a chave atinge vários gabinetes), group_id (um existente Grupo ) ou new_group_name (cria o grupo, ou reutiliza um com esse nome).
Campos desconhecidos são recusados com 400 VALIDATION_ERROR e o nome do campo em param — um erro de digitação nunca deixa cair silenciosamente uma configuração.
Segmentação
channels — mostrar o anúncio em canais específicos
{ "target_type": "channels", "channels": ["@durov", "t.me/telegram"],
"languages": ["en"], "topics": [7, 26], "exclude_topics": [2], "add_similar_channels": true }| Campo | significado |
|---|---|
channels | 1–100 canais públicos: @name , name ou t.me/name . |
languages, topics, exclude_topics | Estreita por canal linguagem e tópico ( Códigos ). |
add_similar_channels | Adicione também canais semelhantes a estes. |
bots — mostrar o anúncio em bots
{ "target_type": "bots", "bots": ["@somebot"] }bots : 1–100 bots públicos. Necessário.
search — mostrar o anúncio para Telegram consultas de pesquisa
{ "target_type": "search", "search_keywords": ["crypto wallet", "bitcoin"] }search_keywords : 1–100 frases, até 64 caracteres cada. Requerido.
users — mostrar o anúncio a uma audiência
{ "target_type": "users", "countries": ["DE", "AT"], "languages": ["de"],
"topics": [26], "exclude_topics": [2], "audience_channels": ["@somechannel"] }| Campo | significado |
|---|---|
countries | ISO códigos de países. |
languages | Códigos de linguagem. |
topics, exclude_topics | Interesses por id tópico. |
audience_channels | Pessoas que lêem estes canais. |
Pelo menos um destes é necessário. Códigos: Código de Targeting .
Canais, bots e palavras-chave são resolvidos para os próprios IDs de Telegram quando a tarefa é executada. Os Telegram não conseguem encontrar são ignorados; se nenhum for encontrado, essa campanha falha — No targets found: … para canais e bots, No valid search queries found para palavras-chave — e a tarefa errors diz isso.
Após criar a campanha
- Poll
GET /v1/tasks/{id}atécompleted.ad_idsrealiza as novas campanhas. - Telegram avaliações cada novo anúncio: ele começa
In Review, em seguida, torna-seActive(ouDeclined). Um Webhook diz-lhe quando. - Mude, financie ou pause com Gestão de Campanhas .
Enviar arquivos de mídia
POST /v1/media carrega uma imagem ou vídeo em um gabinete e retorna um media token para POST /v1/campaigns, PATCH e copiar. O token pertence a esse gabinete — upload para o gabinete que você vai criar.
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 ou MP4, até 10 MB, enviados como
multipart/form-datano campofile. - Alguns gabinetes aceitam apenas 16:9 imagens de pelo menos 640 px de largura; se um arquivo não cabe, Telegram 's razão volta em
error.
Erros
| Código | Quando |
|---|---|
VALIDATION_ERROR | Falta um campo, desconhecido, do tipo errado, ou não pertence a este target_type — param diz qual. |
IDEMPOTENCY_KEY_REQUIRED | No Idempotency-Key . |
ACCOUNT_ID_REQUIRED / ACCOUNT_NOT_FOUND | Diga qual armário / esse gabinete não é acessível. |
VIEW_ONLY_ACCESS | Você tem acesso ao Viewer neste gabinete. |
QUEUE_FULL | 5 cria já em fila neste gabinete. |
CABINET_LOCKED, SUBSCRIPTION_REQUIRED | O gabinete não pode tomar mudanças manuais agora. |
Falhas de campanha individuais (Telegram recusaram um texto, um lance, um link) não falham no pedido — aparecem no errors da tarefa.
Referência da API
O contrato completo de anúncios exige uma credencial do provedor dedicada a este espaço. O cliente usa a chave de API Orbito. Pedidos, provisionamento e cobrança externa têm fluxos separados.
POST /api/v1/campaigns
Enfileira uma campanha ou um lote de até 100 em uma conta.
| Parâmetro | Local | Formato | Obrigatório |
|---|---|---|---|
Idempotency-Key | header | string | Sim |
X-API-Key | header | string | Sim |
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
}'{
"success": true,
"data": {
"id": 96203,
"type": "create",
"status": "pending",
"account_id": 7401,
"total": 1,
"ad_ids": []
}
}Esquema do corpo
{
"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"
}
]
}| API | HTTP | Significado |
|---|---|---|
| VALIDATION_ERROR | 400 | Revise os campos e corrija os valores antes de tentar novamente. |
| IDEMPOTENCY_KEY_REQUIRED | 400 | Inclua o cabeçalho obrigatório Idempotency-Key na escrita. |
| VIEW_ONLY_ACCESS | 403 | O perfil Viewer permite consulta. Para alterar a conta é necessária permissão de escrita. |
| QUEUE_FULL | 429 | A conta já tem cinco tarefas de criação na fila. Aguarde uma vaga. |
POST /api/v1/media
Envia mídia e recebe um token da conta selecionada.
| Parâmetro | Local | Formato | Obrigatório |
|---|---|---|---|
account_id | query | integer | — |
X-API-Key | header | string | Sim |
Idempotency-Key | header | string | — |
curl -X POST 'https://orbitoads.pro/api/v1/media?account_id=7401' \
-H 'X-API-Key: YOUR_ORBITO_KEY' \
-F file=@./club-cover.png{
"success": true,
"data": {
"media": "example-media-718",
"account_id": 7401
}
}Esquema do corpo
{
"properties": {
"account_id": {
"type": "integer"
},
"file": {
"format": "binary",
"type": "string"
}
},
"required": [
"file"
],
"type": "object"
}{
"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"
]
}
]
}Notas de implementação
Uma campanha ou um lote
Para uma campanha use title, text, promote_url, cpm, budget e target_type na raiz. Para lote use entre 1 e 100 em campaigns e compartilhe conta e grupo na raiz. O orçamento é zero ou no mínimo min_budget.
Segmentação e arquivos
Use channels, bots, search ou users. Listas de canais, bots e buscas aceitam 1–100 itens e frases de até 64 caracteres. Público exige um filtro. JPG, PNG, GIF, WebP e MP4 até 10 MB ficam vinculados à conta de envio.
Aceitação e conclusão
Criação, cópia e operações em lote retornam HTTP 202 com id da tarefa. Consulte GET /api/v1/tasks/{id}, respeitando Retry-After. Verifique failed e errors mesmo em completed.
Operações e campos
POST /api/v1/campaigns POST /api/v1/media channels bots search users
- POST /api/v1/campaigns
- POST /api/v1/media
- channels
- bots
- search
- users
Exemplo de requisição
GET /api/v1/targeting HTTP/1.1 Host: orbitoads.pro X-API-Key: {key}
Campos e limites do esquema
A tabela segue o contrato público v1. Campos e parâmetros diferenciam maiúsculas. Os códigos HTTP distinguem sucesso, validação da entrada e controle de acesso de cada operação. A especificação vinculada define as estruturas completas.
Configuração do teste de público
O esquema de criação distingue quatro modos. Os canais vão em channels, os bots em bots e os termos em search_keywords. Países, idiomas e temas descrevem o público de usuários. Consulte os recursos da conta antes do teste.
Referência do protocolo
| Método | Rota | Parâmetros | Conteúdo da solicitação | Códigos de resposta |
|---|---|---|---|---|
| POST | /api/v1/campaigns | Idempotency-Key | application/json · CreateSingleRequest | CreateBatchRequest | 202, 400, 401, 403, 404, 409, 422, 429, 503 |
| POST | /api/v1/media | account_id | multipart/form-data · file, account_id | 200, 400, 401, 403, 413 |
| GET | /api/v1/targeting | — | — | 200, 401 |
| GET | /api/v1/tasks/{id} | id | — | 200, 400, 401, 404 |
Fonte · Fonte dos dados
Campos e limites do esquema · Criar campanhas e enviar mídia
| Campo | Valor documentado |
|---|---|
| target_type | channels | bots | search | users |
| campaigns[] | 1 … 100 |
| active = | true |
| views_per_user | 1 … 4 |
| budget | ≥ 0 |
| Idempotency-Key | UUID |
Fonte · Fonte dos dados
CampaignInput
| Campo | Tipo do campo |
|---|---|
| title | string |
| text | string |
| promote_url | string |
| cpm | number |
| daily_budget | number · 0 … ∞ |
| views_per_user | integer · 1 … 4 |
| media | string |
| picture | boolean |
| button | subscribe | view | read | learn_more | download | open | sign_up | buy | order | play | try | leave_request |
| website_name | string |
| schedule | Schedule |
| budget | number · 0 … ∞ |
| active | boolean · = true |
| target_type | channels | bots | search | users |
| channels | array · [string] · 1 … 100 |
| bots | array · [string] · 1 … 100 |
| search_keywords | array · [string] · 1 … 100 |
| countries | array · [string] |
| languages | array · [string] |
| topics | array · [integer] |
| exclude_topics | array · [integer] |
| audience_channels | array · [string] |
| add_similar_channels | boolean |
Fonte · Fonte dos dados
CreateBatchRequest
| Campo | Tipo do campo |
|---|---|
| account_id | integer |
| group_id | integer |
| new_group_name | string |
| campaigns | array · [CampaignInput] · 1 … 100 |
Fonte · Fonte dos dados
CreativeFields
| Campo | Tipo do campo |
|---|---|
| title | string |
| text | string |
| promote_url | string |
| cpm | number |
| daily_budget | number · 0 … ∞ |
| views_per_user | integer · 1 … 4 |
| media | string |
| picture | boolean |
| button | subscribe | view | read | learn_more | download | open | sign_up | buy | order | play | try | leave_request |
| website_name | string |
| schedule | Schedule |
Fonte · Fonte dos dados
Revisão da referência