Skip to main content
POST
Error

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
text
string
required

The ad text as the advertiser wrote it, markup included. Formatting is written the way Telegram writes it — bold, italic, underline, strikethrough, ||spoiler||, monospace, >quote to the end of the line — plus two of ours: -- becomes an em dash, and {these words} become the post's link to destinationUrl. A premium custom emoji is written ![😀](tg://emoji?id=5368324170671202286): the emoji with that document id is drawn over the character in the brackets, which has to be a single emoji itself — it is what a reader whose client cannot resolve the id goes on seeing, and it is what the visible length counts. Only the ten characters that mean something need escaping (* _ ~ ` | { } > - \); full stops, brackets and percent signs are plain text, unlike Bot API MarkdownV2. An exclamation mark is plain text too, everywhere except in front of a [, where it would begin the custom-emoji form: \! there is the character itself, and it is how a text carrying ![😀](tg://emoji?id=...) as literal characters is written down. Inside a recognised web address none of them mean anything at all: mysite.com/my_page_2 keeps both underscores, /a--b keeps both hyphens and ?utm_campaign={campaign} keeps its braces, so nobody has to escape his own URL. The cap here is a bound on work per request, an order of magnitude above any text that could pass the 700-character visible limit; exceeding it is a 400, not a validation error.

Maximum string length: 8000
destinationUrl
string
required

Where the campaign's link goes. Required because it is what defines the advertiser's own domain, and the rule that no other domain may appear in the text cannot be evaluated without it. Accepted with or without a scheme while the advertiser is still typing the form field; anything that is not a URL either way is a 400.

Required string length: 1 - 2048

Response

Success

valid
boolean
required

True only when errors is empty. Campaign creation will accept exactly the texts this is true for

visibleLength
integer<int32>
required

Length of what the reader will see — markup characters removed, -- already an em dash — counted in UTF-16 code units, so an emoji counts as 2. This is the number the 700 limit applies to and the number an editor should put in its character counter

errors
object[]
required