---
title: "Fund a giveaway"
method: POST
path: "/v1/giveaways/{id}/fund"
tags: ["Giveaways"]
---

# Fund a giveaway

`POST /v1/giveaways/{id}/fund`

## Request

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

Open the giveaway's funding order (`201`, the giveaway becomes
`awaiting_funding`) or serve the open one again (`200`), and get the
payment instruction. Unlike an order, a giveaway is paid to its OWN
one-time deposit address: `memo` is `null` and `address_kind` is
`one_time_deposit` — send exactly `amount_smallest_unit` of `asset` to
`pay_to_address` before `expires_at`, with no comment needed. When the
payment arrives the giveaway opens (`giveaway.opened`). A late, short or
excess payment to the deposit address is returned to the sender
automatically.

**Currency.** `currency` chooses the asset of a NEW funding order: `ton`
pays in GRAM, `usdt_ton` in USDT on TON; no body means `ton`. While a
payable order is open, a call naming its currency serves it again (`200`); a call
naming the other currency is refused `409 funding_order_open_in_other_currency`
with `currency` set to the open order's currency — fund again with that
currency (a USDT order is served again only with `usdt_ton`, never with no
body). `usdt_ton` answers `422 currency_not_available` while USDT funding
is not offered only where a NEW order would be opened: an open USDT order
is still served again with `usdt_ton`.

**Expiry.** `expires_at` is the end of the funding window (2 hours from
the moment the order opened; serving it again keeps that deadline). An
expired instruction cannot be paid or replaced: `/fund` answers
`409 funding_order_not_payable` with the order's `status` (for example
`expired`, `failed`, `reversed` or `missing`; whatever the value, the
order cannot be paid). An expired or reversed funding order
then cancels the giveaway (`giveaway.cancelled`, reason
`funding_expired`), after which `/fund` answers `409 not_fundable` with
`status: cancelled`. To try again, create a new giveaway.

**Already paid.** Once the payment arrived, `/fund` answers
`409 funding_order_not_payable` with `status: completed` while the
giveaway is still opening, then `409 not_fundable` with the giveaway's
`status` — as in any status other than `draft` and `awaiting_funding`.

**Other refusals.** A gift prize is re-priced live before a new order
opens: a price that moved since the create is `409 gift_price_changed`
with the new `stars` (the giveaway's `gift.stars` is the price it was
created with); create a new giveaway at the new price. A gift that sold
out since the create is `400` on `gift.gift_id`, and one with fewer left
than `winner_count` is `400` on `winner_count`, each with `details.code`.
`503 gift_catalog_unavailable` (retry later) and `503 prize_type_unavailable`
(not enabled — do not retry) apply to gift prizes; `503 unavailable` means
no deposit address can be issued right now (retry).

`Idempotency-Key` is required; a retry with the same key returns the same
instruction. A refusal keeps no answer, so the corrected call (for
example in the open order's currency) may reuse the key.

## Path parameters

- `id` string, uuid, required

## Headers

- `Idempotency-Key` string, required

## Request body

- FundGiveawayRequest
  - `currency` 'ton' | 'usdt_ton': `ton` = GRAM; `usdt_ton` = USDT (TON) where USDT funding is offered. Chooses the asset of a NEW funding order. While an order is open, the same currency serves it again and the other currency is `409 funding_order_open_in_other_currency` with `currency` set to the open order's currency.

## Response `200`

The open funding order, served again.

- GiveawayFunding
  - `giveaway_id` string, uuid, required
  - `status` 'awaiting_funding', required
  - `payment` FundingPaymentInstruction, required: How to fund a giveaway. A new funding order is paid to its own one-time deposit address: `memo` is `null` and `address_kind` is `one_time_deposit` — send exactly `amount_smallest_unit` of `asset` to `pay_to_address`, no comment needed. (`shared_wallet` with a string `memo` is the older form: attach the memo as the comment.)
    - `payment_id` string, 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`.
    - `chain` string, required
    - `pay_to_address` string, required
    - `memo` string, nullable, required
    - `address_kind` 'one_time_deposit' | 'shared_wallet', required
    - `amount` string, required
    - `amount_smallest_unit` string, required
    - `asset` 'GRAM' | 'USDT', required
    - `decimals` 9 | 6, required
    - `transfer` 'native' | 'jetton', required
    - `jetton_master` string, nullable, required
    - `amount_usd` string, required
    - `expires_at` string, date-time, required: Pay before this.

## Other responses

- `201`: A funding order was opened.
- `400`: Malformed request (`bad_request`): a missing or invalid field, header or query parameter (the `message` names it), a malformed `cursor`, a body that is not valid JSON, or a body nested deeper than 64 levels. Send integer query parameters as plain decimal digits: the pricing, order, giveaway and series routes refuse any other spelling (a sign, decimal point, exponent, hex prefix or surrounding spaces) with a `400` naming the parameter. Fix the request; retrying it unchanged gets the same answer.
- `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`).
- `409`: The request conflicts with the resource's state or with an earlier request: `idempotency_conflict`, `idempotency_in_flight` (with `Retry-After`), `conflict` (also an order `Idempotency-Key` reused with a different body, or an order cancel in a status other than `awaiting_payment`), or a giveaway refusal with its own code (`funding_received`, `use_close`, `limit_reached`, `attestations_frozen`, `attestation_limit_reached` with `limit`, `funding_order_open_in_other_currency` with `currency`, …).
- `413`: The request body is too large (`bad_request`, `request body too large`). On the giveaway and series routes the limit is about 64 KB of JSON; a series template or an attestation batch of 1,000 ids fits well inside it.
- `415`: A request body was sent with a `Content-Type` other than `application/json` (a missing one included), or with an unsupported charset or `Content-Encoding` (`bad_request`). A POST without a body needs no `Content-Type`.
- `422`: The request is well-formed but cannot be served: `recipient_ineligible` (order create: the recipient cannot receive the item, and no order is created), `product_not_available`, `currency_not_available` (the currency is not offered on this service; nothing is created), `channel_checks_failed` (with `checks`), `schedule_out_of_bounds` (with `bound` and `limit`) or `unprocessable`.
- `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/fund/post.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)
