---
title: "Get the results"
method: GET
path: "/v1/giveaways/{id}/results"
tags: ["Giveaways"]
---

# Get the results

`GET /v1/giveaways/{id}/results`

## Request

- Base URL: `https://api.mystars.tg`
- URL: `https://api.mystars.tg/v1/giveaways/{id}/results`
- Auth: API key in header `X-Api-Key`

The draw data (entrant root, TON block beacon, revealed seeds), the
winners with their delivery state and transactions, unused slots, any
reversals of unused value, and what the proof page verifies (conditions
hash and format, anti-bot policy, recheck coverage, frozen attestation
counts). Delivery states are `in_progress`, `delivered`, `failed` and
`manual_review`. A reversal of unused value (unused slots and prizes that
could not be delivered) is released after review, to the address the
funding payment came from, and reported by `giveaway.reversal_resolved`.

**Verifying a draw (`algorithm_version: pf-2`).** Every input is
published before the outcome could be known, so you can recompute the
draw yourself. Hex values are lowercase; hashes are SHA-256.

1. **Commitment.** `draw.server_seed` (published at the draw) is 32
   bytes in hex. `commit_hash`, published when the giveaway opened and
   before any entry, must equal `hex(SHA-256(server_seed bytes))`.
2. **Entrant list.** Once the set is frozen at the close, it is served as
   plain text at `/api/v1/public/giveaways/{public_id}/entrants` on the
   host of `proof_url` (`409` until then). The results carry no
   `public_id`: take it from `GET /v1/giveaways/{id}`, or from the
   `/d/{public_id}` segment of `proof_url`. One line per eligible entrant,
   `SEQ:LEAF`, in ascending `seq` order, joined by a single line feed
   with no trailing newline; filtered and withdrawn entrants are not in
   it. `LEAF` is `hex(SHA-256(utf8("TELEGRAM_ID:SALT")))` with a random
   salt per entrant that only the entrant is shown, so the list names
   nobody. `draw.entrants_root` must equal the SHA-256 of the list's
   exact bytes, and the line count must equal `draw.eligible`.
3. **Beacon.** `draw.beacon` is the first masterchain block (workchain
   `-1`) of the TON blockchain generated at or after second
   `floor(closed_at) + min_delay_sec` (block times are whole seconds).
   `entrants_root` is always fixed before that second, so the block did
   not exist yet: when a close's entrant list is fixed later than its
   own close time allows, `closed_at` is the moment the list was fixed.
   Check that `beacon.at` is not earlier than that second, and that block
   `seqno - 1` was generated BEFORE it: two blocks of one second are
   still ordered by seqno, so only the first of them qualifies. A
   beacon generated before 2027-01-01T00:00:00Z (by its time on chain)
   was chosen to the second, not to the block: when its `seqno - 1`
   shares its second, the public verifier reports that check as
   unchecked, neither a pass nor a failure. From that time on, a
   same-second `seqno - 1` fails, and an earlier qualifying second fails
   at any date. Look the blocks up by `seqno` in a TON explorer:
   `beacon.root_hash` is its root hash in hex (explorers often show it
   in base64).
4. **Final seed.** `final_seed = hex(SHA-256(server_seed ‖ root_hash ‖
   entrants_root))`, the three values concatenated as raw bytes (32
   bytes each, decoded from hex), not as hex text.
5. **Winners.** Let `pool` be the list's entrants in `seq` order. For
   `i` = 0, 1, … up to `min(winner_count, len(pool)) − 1`: with
   `n = len(pool)`, compute `HMAC-SHA256(key = final_seed bytes,
   message = utf8("winner:i"))` (`i` in decimal) and read it as a
   256-bit big-endian integer `r`. If `r ≥ floor(2^256 / n) × n`, repeat
   with the messages `winner:i:retry:1`, `winner:i:retry:2`, … until it
   is not (this removes modulo bias). Winner `i` is `pool[r mod n]`;
   remove it from `pool` before the next `i`. The selected `seq`s are the
   `seq`s of `winners` (compare them as a set). With fewer eligible
   entrants than `winner_count` everyone eligible wins and the unused
   slots are reversed.
6. **Conditions.** `conditions_hash` is written once, when the giveaway
   opens, together with `commit_hash`: the SHA-256 (hex) of the
   canonical text of its participation conditions, in the form
   `conditions_format` names (`v2` when an attestation condition is part
   of it). A giveaway with no conditions carries the digest of an empty
   set; it is `null` until the giveaway opens. The proof page
   publishes the conditions as they were frozen and recomputes the
   digest from them.

The proof page at `proof_url` publishes the same inputs and formula, and
lets an entrant find their own leaf in the list.

## Path parameters

- `id` string, uuid, required

## Response `200`

The results.

- GiveawayResults
  - `giveaway_id` string, uuid, required
  - `status` 'draft' | 'awaiting_funding' | 'open' | 'closed' | 'drawn' | 'settling' | 'settled' | 'cancelled', required: `draft` → `awaiting_funding` (the first fund opened its funding order) → `open` (paid and public) → `closed` (entrant list frozen) → `drawn` (winners picked from a TON block beacon) → `settling` (prizes being delivered) → `settled`. `cancelled` only from `draft` or `awaiting_funding`: by you, an expired draft (a draft never funded is cancelled 72 hours after its creation), or a funding order that expired unpaid after its 2-hour window or was reversed (`giveaway.cancelled` reason `cancelled`, `draft_expired` or `funding_expired`). An `open` giveaway always runs on to `settled`; it ends with close, never cancel. Fund and cancel apply in `draft` and `awaiting_funding`, close in `open`, attestations in `draft`, `awaiting_funding` and `open`. Terminal: `settled`, `cancelled`.
  - `proof_url` string, required
  - `commit_hash` string, nullable, required
  - `conditions_hash` string, nullable, required
  - `conditions_format` 'v1' | 'v2', required
  - `antibot` GiveawayAntibot, required
    - `mode` 'shadow' | 'enforce', required
    - `threshold` string, required: Decimal string, for example `"0.70"`.
    - `require_premium` boolean, required
    - `audience_language` string, nullable, required
  - `draw` object, nullable, required: Set once the entrant list is frozen. How to recompute the draw from it: **Verifying a draw** under `GET /v1/giveaways/{id}/results`.
    - `entrants_root` string: SHA-256 (hex) of the published entrant list, set at the close.
    - `eligible` integer, nullable: Entrants in the draw — the lines of the entrant list.
    - `filtered` integer, nullable
    - `beacon` object, nullable: The TON block whose hash was mixed into the seed; `null` until the draw.
      - `seqno` string, nullable: The masterchain block's sequence number.
      - `root_hash` string: The block's root hash, hex.
      - `at` string, date-time, nullable: When the block was generated.
      - `min_delay_sec` integer, nullable: The margin in seconds: the beacon is the first masterchain block generated at or after second floor(closed_at) + min_delay_sec. Block times are whole seconds, so the block can come up to 1 s less than the margin after the exact close.
    - `server_seed` string, nullable: The committed seed (32 bytes, hex), revealed at the draw.
    - `final_seed` string, nullable: SHA-256 (hex) of `server_seed`, `beacon.root_hash` and `entrants_root` as raw bytes.
    - `algorithm_version` string, nullable: The draw algorithm, `pf-2`.
    - `drawn_at` string, date-time, nullable
    - `recheck_coverage` RecheckCoverage, nullable: How many eligible entrants had their conditions re-checked before the draw.
      - `checked` integer
      - `unverifiable` integer
      - `total` integer
    - `attestations` object[], nullable
      - `condition_key` string
      - `satisfied` integer
      - `unsatisfied` integer
  - `winners` object[], required
    - `seq` string, nullable: The winning entry's ID (see `GiveawayEntrant.seq`).
    - `telegram_user_id` string, required
    - `username` string, nullable
    - `delivery` object, required
      - `id` string, required
      - `status` 'in_progress' | 'delivered' | 'failed' | 'manual_review', required
      - `delivered_at` string, date-time, nullable
      - `purchase_tx` string, nullable
      - `funding_tx` string, nullable
      - `failure_reason` 'resolved_by_operator' | 'no_username' | 'gift_sold_out' | 'recipient_ineligible' | 'order_failed' | 'other' | 'null', nullable: Set only when `status` is `failed`; a stable code, not free text. New codes may be added.
  - `slots` object, nullable, required
    - `total` integer
    - `delivered` integer
    - `unused` integer
  - `reversals` GiveawayReversal[], required
    - `id` string, required
    - `kind` 'unused_slots' | 'unconverted_surcharge', required
    - `status` 'pending_approval' | 'approved' | 'sending' | 'sent' | 'skipped' | 'cancelled' | 'manual', required
    - `currency` 'ton' | 'usdt_ton', required: The asset the order is paid in. `ton` = the native coin GRAM (ex TON), sent as a plain transfer — it is not USDT on TON. `usdt_ton` = USDT (TON), sent as a jetton transfer. Required on every create and pricing request: a request without it is rejected with `400 bad_request`.
    - `slots` integer, required
    - `gross_amount` string, required
    - `fee_amount` string, required
    - `net_amount` string, required
    - `tx_hash` string, nullable, required: The payment's on-chain transaction hash (64 hex characters or the 44-character base64 form), to look up in a TON explorer as given; `null` until it is sent, or when no hash was recorded.
    - `sent_at` string, date-time, nullable, required

## Other responses

- `401`: Missing or invalid `X-Api-Key`.
- `403`: The API key is valid, but the tenant is suspended (for example after `/api_revoke` — run `/api_rotate` in the bot to restore access) or banned, or the product (campaigns, giveaways) is not enabled for it. Products are enabled per tenant on request. A source address blocked at our edge gets `403 forbidden` with the message `source blocked`, whatever the key.
- `404`: No such resource for this tenant (another tenant's id is also `404`).
- `429`: A rate limit was reached (`rate_limited`). See **Rate limits** in the overview. Which `429`s carry headers: - **Per-minute buckets** — the general request budget, the order-lifecycle bucket, the pricing/recipient-check probe cap (60 req/min), the campaign bucket, and your giveaway read, write, quote and attestation buckets. Every answer metered by one carries `RateLimit-Policy`, `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds); a `429` adds `Retry-After` (seconds). - **Caps, no `Retry-After`** — the daily intake cap and the daily order cap on `POST /v1/orders` (UTC day), the per-recipient guard on unfinished orders to one `@username`, and the cap on live campaigns. These `429`s carry no `Retry-After`, but they do carry the `RateLimit-*` headers of the per-minute bucket the request passed (often with `RateLimit-Remaining` above zero): branch on `Retry-After`, never on `RateLimit-Remaining`. Back off; the daily intake and order caps clear at the next UTC midnight. - **The daily budget of ineligible-recipient refusals** on `POST /v1/orders` — its `429` carries `Retry-After` and `error.retry_after`, both the seconds until 00:00 UTC, when the budget resets, plus the `RateLimit-*` headers of the order bucket it passed. `error.retry_after` is what sets it apart from the other `429`s. While the budget's places are held only by your own checks still running, the create answers a short `429` instead: `Retry-After` of a few seconds and no `error.retry_after` — retry after `Retry-After`. - **The giveaway quote budget shared by all tenants** — its `429` carries `Retry-After` (seconds until the shared budget reopens) and the `RateLimit-*` headers of your own quote bucket, never figures for the shared budget. - **Edge throttle** — a coarse per-IP throttle in front of the API answers the same envelope with `Retry-After: 1` and no `RateLimit-*` headers.
- `503`: A required source was temporarily unavailable (`unavailable`): the price source, recipient eligibility that could not be verified right now, the payment check a cancel runs first, or (order create, rarely) no fulfilment capacity assigned to your tenant right now. The `message` is generic (`internal error`), so it does not say which: treat every `unavailable` as **retryable** — reuse the same `Idempotency-Key` and try again shortly. An app `503 unavailable` creates and cancels nothing and charges nothing. If `503 unavailable` on order create persists, contact support with the `X-Request-ID`. The edge's own `502`, `503` and `504` (the service restarting or timing out) answer the same envelope with `unavailable`, and may follow a request that did land: retry with the same `Idempotency-Key`, and an order create that landed is replayed, never duplicated. On the campaign, gift and giveaway routes a `503` may also be a gift catalog that cannot be read right now (`gift_catalog_unavailable` — retry later) or an option that is not enabled for your tenant yet (`prize_type_unavailable`, `partner_conditions_unavailable`, `antibot_enforce_unavailable`, `autopost_unavailable`, `series_unavailable` — do not retry, ask support); the `code` says which.

## Changes

- **2026-10-31** `9f589c4dd26b`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/mystars/apis/mystars-faas-fulfilment-api/changes/v1/giveaways/:id/results/get.md)

---

[API](https://skmtc.dev/mystars/apis/mystars-faas-fulfilment-api.md) - [All operations](https://skmtc.dev/mystars/apis/mystars-faas-fulfilment-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mystars/apis/mystars-faas-fulfilment-api/revisions/b6cdc8aff8c2?raw)
