Crear campañas y medios
Una solicitud admite hasta 100 campañas de una cuenta. Elige canales, bots, búsqueda o audiencia y envía una clave de operación. Carga los medios antes y sigue la tarea devuelta.
POST /v1/campaigns crea campañas en una cuenta. Requiere una clave con permiso de gestión y la cabecera Idempotency-Key. La respuesta 202 contiene una tarea. Las campañas aparecen cuando esta finaliza.
Ejemplo de creación de una campaña
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": [] } }Creación por lotes
Poner las campañas en campaigns (hasta 100). account_id y los campos del grupo permanecen en el nivel superior y se aplican a todos ellos.
{
"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"] }
]
}Las campañas se crean una tras otra. Si el primero falla, la tarea se detiene — soluciona la entrada en lugar de repetir el mismo error 100 veces. Cada fallo se enumera en el errors de la tarea con su index en su matriz.
Campos
| Campo | Requisitos | Significa |
|---|---|---|
title | Sí | Nombre interno, mostrado en el panel. |
text | Sí | La gente del texto de anuncio ve. Se aplican reglas de longitud y contenido propias de Telegram ; una negativa vuelve en la tarea de errors . |
promote_url | Sí | Lo que el anuncio abre: https://t.me/channel, t.me/bot?start=ref , @channel o un sitio web URL . |
cpm | Sí | Bid por 1.000 puntos de vista en la moneda del gabinete, mayor que 0. Demasiado bajo para el objetivo → Telegram ’s mínimo vuelve en el error. |
budget | Sí | El dinero pasó del balance del gabinete a la campaña: 0 , o por lo menos el min_budget del gabinete ( Cuentas de publicidad ). Con 0 el anuncio se crea pero no puede funcionar hasta que usted agrega presupuesto. |
target_type | Sí | channels, bots , search o users — ver a continuación. |
active | No | false crea que se apaga. Predeterminado true . |
daily_budget | No | Gorra de gasto diario. |
views_per_user | No | Cuantas veces una persona puede ver el anuncio, 1–4. |
media | No | Imagen o video token de POST /v1/media . |
picture | No | true muestra el avatar del canal ascendido en el anuncio. |
button | No | Botón bajo el anuncio: subscribe, view, read, learn_more, download, open, sign_up, buy, order, play, try, leave_request. Solo donde la cuenta de publicidad features.ad_button Es true. |
website_name | No | Nombre de marca mostrado por encima de un anuncio del sitio web. |
schedule | No | Mostrar el anuncio sólo en días y horas elegidos, e.g . días de semana 9:00-18:00. Formato: Calendario . Sin él el anuncio funciona alrededor del reloj. |
Nivel superior sólo: account_id (necesitado cuando la clave alcanza varios armarios), group_id (un existente Grupo ) o new_group_name (crea el grupo, o reutiliza uno con ese nombre).
Los campos desconocidos se niegan con 400 VALIDATION_ERROR y el nombre de campo en param — un tipo nunca deja caer silenciosamente un entorno.
Segmentación
channels — mostrar el anuncio en canales específicos
{ "target_type": "channels", "channels": ["@durov", "t.me/telegram"],
"languages": ["en"], "topics": [7, 26], "exclude_topics": [2], "add_similar_channels": true }| Campo | Significa |
|---|---|
channels | 1–100 canales públicos: @name , name o t.me/name . Necesario. |
languages, topics, exclude_topics | Límite por lenguaje de canal y tema ( Códigos ). |
add_similar_channels | También añadir canales similares a estos. |
bots — mostrar el anuncio en bots
{ "target_type": "bots", "bots": ["@somebot"] }bots : 1–100 bots públicos.
search — mostrar el anuncio para Telegram consultas de búsqueda
{ "target_type": "search", "search_keywords": ["crypto wallet", "bitcoin"] }search_keywords : 1–100 frases, hasta 64 caracteres cada uno.
users — mostrar el anuncio a un público
{ "target_type": "users", "countries": ["DE", "AT"], "languages": ["de"],
"topics": [26], "exclude_topics": [2], "audience_channels": ["@somechannel"] }| Campo | Significa |
|---|---|
countries | ISO códigos de país. |
languages | Códigos de idiomas. |
topics, exclude_topics | Intereses por tema id. |
audience_channels | Gente que leyó estos canales. |
Por lo menos uno de estos es requerido. Códigos: Código de meta .
Canales, bots y palabras clave se resuelven a Telegram ’ s propios ids cuando la tarea funciona. Unos Telegram no se puede encontrar son saltados; si no se encuentra ninguno, esa campaña falla — No targets found: … para canales y bots, No valid search queries found para palabras clave — y el errors de la tarea lo dice.
Después de crear la campaña
- La encuesta
GET /v1/tasks/{id}hastacompleted.ad_idsmantiene las nuevas campañas. - Telegram reseñas cada nuevo anuncio: comienza
In Review, luego se convierte enActive(oDeclined). Un Webhook le dice cuándo. - Cambiar, financiar o pausar con Gestión de campañas .
Subir archivos multimedia
POST /v1/media carga una imagen o vídeo en un armario y devuelve un token de media para POST /v1/campaigns , PATCH y copia. El token pertenece a ese gabinete — subir en el gabinete en el que crearás.
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 o MP4, hasta 10 MB , enviado como
multipart/form-dataen el campofile. - Algunos armarios aceptan sólo 16:9 imágenes por lo menos 640 px de ancho; si un archivo no cabe, Telegram ’ la razón vuelve en
error.
Errores
| Código | cuando |
|---|---|
VALIDATION_ERROR | Falta un campo, desconocido, del tipo equivocado, o no pertenece a este target_type — param dice cuál. |
IDEMPOTENCY_KEY_REQUIRED | No Idempotency-Key. |
ACCOUNT_ID_REQUIRED / ACCOUNT_NOT_FOUND | Diga qué armario / que gabinete no es accesible. |
VIEW_ONLY_ACCESS | Tiene acceso de Viewer a este armario. |
QUEUE_FULL | 5 crea ya apagado en este armario. |
CABINET_LOCKED, SUBSCRIPTION_REQUIRED | El gabinete no puede tomar cambios manuales ahora mismo. |
Las fallas individuales de la campaña (Telegram rechazaron un texto, una oferta, un enlace) no fallan en la solicitud — aparecen en el errors de la tarea.
Referencia de la API
El contrato publicitario completo requiere una credencial del proveedor dedicada al espacio de trabajo. El cliente usa su clave API de Orbito. Pedidos, aprovisionamiento y facturación externa siguen procesos separados.
POST /api/v1/campaigns
Programa la creación de una campaña o hasta 100 en una cuenta.
| Parámetro | Ubicación | Formato | Obligatorio |
|---|---|---|---|
Idempotency-Key | header | string | Sí |
X-API-Key | header | string | Sí |
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 del cuerpo
{
"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 | Revisa los campos y corrige los valores antes de reintentar. |
| IDEMPOTENCY_KEY_REQUIRED | 400 | Incluye la cabecera obligatoria Idempotency-Key en la escritura. |
| VIEW_ONLY_ACCESS | 403 | El rol Viewer permite consultar la cuenta. Para cambiarla se requiere escritura. |
| QUEUE_FULL | 429 | La cuenta ya tiene cinco trabajos de creación en cola. Espera a que haya espacio. |
POST /api/v1/media
Sube un archivo creativo y obtiene un token de esa cuenta.
| Parámetro | Ubicación | Formato | Obligatorio |
|---|---|---|---|
account_id | query | integer | — |
X-API-Key | header | string | Sí |
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 del cuerpo
{
"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 implementación
Una campaña o un lote
Para una campaña coloca title, text, promote_url, cpm, budget y target_type en la raíz. Para un lote usa entre 1 y 100 en campaigns, con cuenta y grupo compartidos en la raíz. El presupuesto es cero o al menos min_budget.
Segmentación y archivos
Usa channels, bots, search o users. Canales, bots y búsquedas admiten 1–100 entradas y frases de hasta 64 caracteres. La audiencia requiere algún filtro. JPG, PNG, GIF, WebP y MP4 de hasta 10 MB se vinculan a la cuenta de carga.
Aceptación y finalización
Crear, copiar y operar en lote devuelve HTTP 202 con un id. Consulta GET /api/v1/tasks/{id} respetando Retry-After. Revisa failed y errors incluso si el estado es completed.
Operaciones y 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
Ejemplo de solicitud
GET /api/v1/targeting HTTP/1.1 Host: orbitoads.pro X-API-Key: {key}
Campos y límites del esquema
La tabla procede del contrato público v1. Los nombres de campos y parámetros distinguen mayúsculas. Los códigos HTTP separan el resultado correcto, la validación de entrada y el control de acceso. La especificación enlazada define las estructuras completas.
Ajustes de prueba de audiencias
El esquema de creación distingue cuatro modos. Los canales van en channels, los bots en bots y los términos en search_keywords. Los filtros de países, idiomas y temas describen la audiencia de usuarios. Consulta las capacidades de la cuenta antes de probar.
Referencia del protocolo
| Método | Ruta | Parámetros | Contenido de la solicitud | Códigos de respuesta |
|---|---|---|---|---|
| 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 |
Fuente · Fuente de datos
Campos y límites del esquema · Crear campañas y medios
| Campo | Valor documentado |
|---|---|
| target_type | channels | bots | search | users |
| campaigns[] | 1 … 100 |
| active = | true |
| views_per_user | 1 … 4 |
| budget | ≥ 0 |
| Idempotency-Key | UUID |
Fuente · Fuente de datos
CampaignInput
| Campo | Tipo de 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 |
Fuente · Fuente de datos
CreateBatchRequest
| Campo | Tipo de campo |
|---|---|
| account_id | integer |
| group_id | integer |
| new_group_name | string |
| campaigns | array · [CampaignInput] · 1 … 100 |
Fuente · Fuente de datos
CreativeFields
| Campo | Tipo de 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 |
Fuente · Fuente de datos
Revisión de la referencia