قیمت فروش TON (کیف به کیف / کیف پول تلگرام)
GET
/api/v1/ton/sell/quotescope: prices:readاحراز هویت: Bearerlive و test
مبلغی که از کیف پول حساب کسر میشود تا گیرنده دقیقاً amount_ton بگیرد. قیمت هر تون = نرخ لحظهای TON + کارمزد هر تون استارد؛ کارمزد شبکه را استارد میپردازد. برای هر دو مقصد (آدرس و یوزرنیم) یکی است. سقف هر ارسال و سقف ۲۴ ساعته هم در پاسخ میآید.
درخواست
| نام | محل | نوع | توضیح | |
|---|---|---|---|---|
Authorization | header | string | الزامی | Bearer sk_live_… یا Bearer sk_test_… |
amount_ton | query | string | الزامی | مقداری که گیرنده میگیرد؛ حداقل 0.1 |
source | query | string | اختیاری | toman (پیشفرض، از کیف تومانی) یا ton (از موجودی TON) |
نمونه
curl "https://stard-market.ir/api/v1/ton/sell/quote?amount_ton=1.5&source=toman" \
-H "Authorization: Bearer $STARD_API_KEY"const res = await fetch("https://stard-market.ir/api/v1/ton/sell/quote?amount_ton=1.5&source=toman", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.STARD_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
console.log(data);type StardError = { error: { type: string; code: string; message: string; param: string | null; request_id: string } };
const res = await fetch("https://stard-market.ir/api/v1/ton/sell/quote?amount_ton=1.5&source=toman", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.STARD_API_KEY}`,
},
});
if (!res.ok) {
const { error } = (await res.json()) as StardError;
throw new Error(`${error.code}: ${error.message} (${error.request_id})`);
}
const data: Record<string, unknown> = await res.json();import os
import requests
r = requests.get(
"https://stard-market.ir/api/v1/ton/sell/quote?amount_ton=1.5&source=toman",
headers={
"Authorization": f"Bearer {os.environ['STARD_API_KEY']}",
},
timeout=20,
)
data = r.json()
if r.status_code >= 400:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")
print(data)<?php
$ch = curl_init("https://stard-market.ir/api/v1/ton/sell/quote?amount_ton=1.5&source=toman");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("STARD_API_KEY"),
],
CURLOPT_TIMEOUT => 20,
]);
$data = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) {
throw new RuntimeException($data["error"]["code"] . ": " . $data["error"]["message"]);
}
print_r($data);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://stard-market.ir/api/v1/ton/sell/quote?amount_ton=1.5&source=toman", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("STARD_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
b, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(b))
}پاسخ — 200
{
"object": "ton_sell_quote",
"receive_ton": "1.5",
"source": "toman",
"pay": {
"amount": 645000,
"currency": "IRT"
},
"ton_rate_toman": 400000,
"price_per_ton_toman": 430000,
"network_fee": "paid by Stard",
"min_ton": "0.1",
"environment": "live",
"limits": {
"max_per_request_ton": "20",
"max_per_24h_ton": "50"
}
}خطاها
| HTTP | code | کی |
|---|---|---|
400 | parameter_invalid | مقدار کمتر از 0.1 یا نامعتبر |
503 | unavailable | نرخ لحظهای TON در دسترس نیست |
403 | insufficient_scope | کلید scope prices:read را ندارد |
401 | invalid_api_key / missing_api_key / api_key_revoked / api_key_expired | کلید نیامده، نامعتبر، باطل یا منقضی است |
429 | rate_limit_exceeded | سقف درخواست در دقیقه پر شده؛ بعد از Retry-After ثانیه دوباره بفرست |
محدودیت نرخ
پیشفرض ۶۰ درخواست در دقیقه برای هر کلید (قابل تنظیم در داشبورد). وضعیت در هدرهای X-RateLimit-* برمیگردد — جزئیات.
