Giveaways

Assert a condition for entrants

Changed on

Tell us that your own attestation condition (condition_key) is met — or, with satisfied: false, no longer met — for up to 1,000 Telegram user ids per request. Batch rather than send one call per user. Accepted while the giveaway is draft, awaiting_funding or open; once it closes, 409 attestations_frozen with status (a cancelled giveaway included). A revocation counts until the close. MyStars applies your assertion as sent and does not verify it. A condition_key that is not one of the giveaway's attestation conditions is 400 on condition_key. Ids are JSON numbers or decimal strings; an id repeated in one batch counts once. Ids need not have entered yet: an entry_and_close condition is asserted before the entry it admits.

Attestations have their own per-tenant rate bucket, so a burst never throttles fund, close or cancel. One condition holds at most 100,000 distinct Telegram users by default: a batch that would take it past its cap is refused whole with 409 attestation_limit_reached and limit (the cap), and records nothing. The cap applies only to a batch that adds ids: a batch made only of ids the condition already holds (a revocation or a re-assertion) is always accepted, even when the condition holds more than the current cap. A revoked id (satisfied: false) still counts toward the cap; revoking does not make room for new ids. A batch waits at most about 2 seconds for another batch of this giveaway to finish: past that it is refused with 409 busy (attestations for this giveaway are being recorded, try again in a moment) and writes nothing, so send it again as it is, with the same Idempotency-Key.

Recorded attestations stay part of the giveaway's record, except on a cancelled giveaway: its attestations are deleted from 7 days after the cancellation (by default), after which GET /attestations returns an empty page; a large set may take a few minutes to clear. Idempotency-Key is required.

post/v1/giveaways/{id}/attestations

Request

  • Base URL
    https://api.mystars.tg
  • Auth
    API key in header X-Api-Key

Path parameters

idstring uuid required

The giveaway id (UUID).

Headers

Idempotency-Keystring required

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

condition_keystring required
satisfiedboolean required

false revokes an earlier assertion.

Response

The batch was recorded.

giveaway_idstring uuid required
condition_keystring required
satisfiedboolean required
receivedinteger required

Ids in the request.

changedinteger required

Ids whose assertion changed.

Changes