Create an order
Changed onPre-flight the recipient, quote the price, and create an order in awaiting_payment. The response payment block tells you exactly how much to send, to which address, and with which memo (the order id). An ineligible recipient returns 422 recipient_ineligible and creates no order (you are never charged for an undeliverable recipient). The check also opens the order at Fragment (since 2.3.0): it checks the order's own quantity or months and payment_currency, so an order Fragment refuses only at that point (for example "You can buy a minimum of 12,500 stars") is also 422 recipient_ineligible with Fragment's text in telegram_message, before any order exists. If eligibility cannot be verified right now (a transient upstream blip), the call returns a retryable 503 and creates no order — retry shortly with the same Idempotency-Key. Where USDT payments are not offered, usdt_ton returns 422 currency_not_available and creates no order; so does an idempotent replay of a usdt_ton order once USDT payments are no longer offered.
A retry with the same Idempotency-Key and body answers 200 with the existing order without running the daily caps or the recipient check again; its payment is null once that order is no longer awaiting_payment. Any create can answer 429 from the order-lifecycle bucket; a new order can also meet the daily intake cap (every order accepted today, cancelled and expired ones included), the daily order cap (today's orders, cancelled and expired ones excluded) or the guard on unfinished orders to one recipient. A 429 creates no order.
Daily budget of ineligible-recipient refusals. Each tenant may collect a limited number of 422 recipient_ineligible refusals per UTC day (by default 200). Once today's budget is used up, a new create answers 429 rate_limited before the recipient is checked, until 00:00 UTC: the message reads today's budget of ineligible-recipient refusals is used up; new orders are accepted again after 00:00 UTC, and the answer carries Retry-After and error.retry_after, both the seconds left until 00:00 UTC. Do not retry before then. It shares the rate_limited code with the other 429s: tell it apart by error.retry_after (absent on the others), never by the message. Like the caps, it carries the RateLimit-* headers of the order bucket the request passed, often with RateLimit-Remaining above zero. Only a 422 recipient_ineligible from this route counts; an eligible recipient, a 503 and any other refusal do not, and neither does POST /v1/recipients/check — check doubtful handles there first. A create whose recipient check is still running holds a place in the budget until that check answers. While every place left is held by your own checks still running, a create answers a short 429 rate_limited instead: a Retry-After of a few seconds and no error.retry_after, with the message too many of your order checks are still in flight against the daily budget of ineligible-recipient refusals; retry in a few seconds. Retry it after Retry-After, with the same Idempotency-Key if you like (a 429 creates no order). A retry with the key of an order that already exists still answers 200.
Request
- Base URLhttps://api.mystars.tg
- AuthAPI key in header X-Api-Key
Headers
A unique key for this create attempt, at most 255 characters (surrounding spaces are trimmed), scoped to your tenant. Derive it from your own order id. Retrying with the same key and an identical body returns the original order with 200; the same key with a different body is 409 conflict. The key stays bound to its order for as long as the order exists: reusing it later never creates a second order. A missing, empty or longer key is 400 bad_request, and so is a key starting with campaign: (any case): that prefix is reserved for the orders a campaign creates.
Request body
Example request
{
"recipient": {
"username": "durov"
}
}Response
Idempotent replay — the same key + body returns the original order.
Example response
{
"quantity": 500,
"payment": {
"chain": "ton",
"amount": "5.757",
"amount_smallest_unit": "5757000000",
"fee": {
"subtotal": "13.18",
"processing_fee": "0.92",
"total": "14.1",
"description": "1% swap + 0.5 GRAM gas",
"kind": "swap"
}
}
}Changes
- breaking
the response property
expires_atbecame nullable for the status - breaking
the response property
expires_atbecame nullable for the status - breaking
added
subschema #2to thepaymentresponse propertyoneOflist for the response status
283 more changes in this revision
- breaking