Create a campaign
Changed onCreate an outreach campaign as a draft: one product (stars, premium or star_gift) delivered to every recipient on a list of Telegram usernames, paid with ONE on-chain transfer after you confirm. Every submitted entry is stored in submission order and validated in the background: read the verdicts with GET /v1/campaigns/{id}/recipients or wait for the campaign.validated event. Malformed and duplicate entries are kept as rejected rows (invalid_format, duplicate), so the counts always add up.
Availability. Campaigns are enabled per tenant on request: a tenant without access receives 403 forbidden on create, append, validate, confirm, resume and GET /v1/capacity. If access is withdrawn later, you can still read your campaigns (list, get, recipients, stats) and pause or cancel them, but nothing is sent: a paid campaign waits until access returns, or you cancel it to have the undelivered value returned. star_gift answers 422 product_not_available where gift campaigns are not offered, and usdt_ton answers 422 currency_not_available where USDT payments are not offered.
Star gifts. A star_gift create checks gift_id against the catalog GET /v1/gifts lists: an unknown, sold-out or unsendable gift answers 422 product_not_available (a gift_id that is not a string of 1–20 digits is a 400), and a catalog that cannot be read right now answers 503 gift_catalog_unavailable — retry later. Confirm checks the gift again.
Limits. Up to 5,000 recipients per request (append more with POST /v1/campaigns/{id}/recipients) and 10,000 per campaign. Live (non-terminal) campaigns per tenant are capped — over the cap the create answers 429 rate_limited.
Idempotency. Idempotency-Key is required. The same key with the same body returns the original campaign with 200; the same key with a different body is 409 idempotency_conflict.
Campaign events go to your tenant webhook endpoint, never to a per-order callback, so callback_url is refused with 400.
Request
- Base URLhttps://api.mystars.tg
- AuthAPI key in header X-Api-Key
Headers
A unique key for this write, at most 255 characters, scoped to your tenant. Retrying with the same key and the same request returns the original answer instead of acting twice; the same key with a different request is 409 idempotency_conflict while the key is held (its first request still running, or its answer kept). On the giveaway and series writes, while the first request with the key is still running, a retry is 409 idempotency_in_flight with Retry-After: 1 — retry with the same key. A campaign create or recipient append retry waits for the first one and gets its answer. Derive the key from your own record id to stay safe across process restarts.
How long a key is remembered: a campaign create or recipient append key stays bound to what it created, and so does a giveaway or series create key. On the other giveaway and series writes (chat register and re-check, fund, cancel, close, auto-post, attestations, the series pause, resume and cancel) only a 2xx answer is remembered, for 7 days; after that the same key runs the request again. Within those 7 days a same-key retry of a write that timed out or answered 503 gets the first 2xx the write produced, as it was, normally instead of a second run of the write or a state refusal caused by the first attempt having landed. In the rare case that 2xx could not be recorded, the retry answers 409 idempotency_in_flight for up to 5 minutes and then runs the write again; if the first attempt stopped answering altogether, or its 2xx could not be stored by the API, that wait is up to 10 minutes. A refusal (any 4xx) and a 5xx are never kept: after one, the same key runs the request again against the state at that moment, so once you have fixed the cause you may send the corrected request with the same key.
An answer replayed from the API's stored copy of an earlier 2xx carries Idempotent-Replayed: true; a first answer recovered after the API answered 503 or timed out comes without it. Do not use the header to decide whether the write was applied; read the body.
Request body
Response
Idempotent replay — the campaign the first request created.
Example response
{
"payment": {
"chain": "ton"
}
}Changes
- info
endpoint added
- info