---
title: فروش و ارسال TON — POST /api/v1/ton/sell | Stard API
url: https://stard-market.ir/docs/reference/ton-sell
markdown: https://stard-market.ir/docs/reference/ton-sell.md
language: fa
updated: 2026-11-18
description: کسر از کیف پول حساب و ارسال TON. destination=address: به هر آدرس TON، کاملاً خودکار از کیف پول استارد (معمولاً زیر یک دقیقه)؛ موارد غیرعادی status=review م
---

# فروش و ارسال TON

`POST /api/v1/ton/sell`

> کسر از کیف پول حساب و ارسال TON. `destination=address`: به **هر آدرس TON**، کاملاً خودکار از کیف پول استارد (معمولاً زیر یک دقیقه)؛ موارد غیرعادی `status=review` می‌گیرند و بعد از بررسی ارسال یا کامل برگشت داده می‌شوند.`destination=telegram_username`: به **کیف پول تلگرامِ** یک یوزرنیم؛ پشتیبانی ارسال می‌کند (`pending` → `done`؛ رد = برگشت کامل).امنیت: scope ِ `ton:send` پیش‌فرض **نیست** و باید هنگام ساخت کلید انتخاب شود؛ سقف هر ارسال و سقف ۲۴ ساعته‌ی هر حساب اعمال می‌شود؛ `Idempotency-Key` الزامی است و تکرار آن دوباره پول نمی‌فرستد؛ `max_pay` جلوی کسر بیشتر از انتظار را می‌گیرد. با کلید test فقط شبیه‌سازی می‌شود.

## درخواست

| نام | محل | نوع |  | توضیح |
|---|---|---|---|---|
| `Authorization` | header | `string` | الزامی | `Bearer sk_live_…` یا `Bearer sk_test_…` |
| `Idempotency-Key` | header | `string` | الزامی | الزامی؛ تکرار همان کلید همان نتیجه را برمی‌گرداند |

### بدنه (JSON)

| فیلد | نوع |  | توضیح |
|---|---|---|---|
| `destination` | `string` | الزامی | `address` یا `telegram_username` |
| `amount_ton` | `string` | الزامی | مقداری که گیرنده دقیقاً می‌گیرد (حداقل 0.1) |
| `source` | `string` | اختیاری | `toman` (پیش‌فرض) یا `ton` |
| `address` | `string` | اختیاری | برای destination=address: آدرس TON (UQ… / EQ… / raw) |
| `username` | `string` | اختیاری | برای destination=telegram_username: یوزرنیم گیرنده (با یا بدون @) |
| `max_pay` | `integer` | اختیاری | محافظ لغزش نرخ: حداکثر تومان قابل کسر (فقط source=toman) |

## نمونه

```bash
curl -X POST "https://stard-market.ir/api/v1/ton/sell" \
  -H "Authorization: Bearer $STARD_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ts-1001" \
  -d '{"destination": "address", "address": "UQBvW8Z5huBkMJYdnfAEM5JqTNkuWX3diqYENkWsIL0XggGG", "amount_ton": "2", "source": "toman", "max_pay": 900000}'
```

```javascript
const res = await fetch("https://stard-market.ir/api/v1/ton/sell", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STARD_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": "ts-1001",
  },
  body: JSON.stringify({
    "destination": "address",
    "address": "UQBvW8Z5huBkMJYdnfAEM5JqTNkuWX3diqYENkWsIL0XggGG",
    "amount_ton": "2",
    "source": "toman",
    "max_pay": 900000
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
console.log(data);
```

```typescript
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", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STARD_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": "ts-1001",
  },
  body: JSON.stringify({
    "destination": "address",
    "address": "UQBvW8Z5huBkMJYdnfAEM5JqTNkuWX3diqYENkWsIL0XggGG",
    "amount_ton": "2",
    "source": "toman",
    "max_pay": 900000
  }),
});
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();
```

```python
import os
import requests

r = requests.post(
    "https://stard-market.ir/api/v1/ton/sell",
    headers={
    "Authorization": f"Bearer {os.environ['STARD_API_KEY']}",
    "Idempotency-Key": "ts-1001",
    },
    json={
        "destination": "address",
        "address": "UQBvW8Z5huBkMJYdnfAEM5JqTNkuWX3diqYENkWsIL0XggGG",
        "amount_ton": "2",
        "source": "toman",
        "max_pay": 900000
    },
    timeout=20,
)
data = r.json()
if r.status_code >= 400:
    raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")
print(data)
```

```php
<?php
$ch = curl_init("https://stard-market.ir/api/v1/ton/sell");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("STARD_API_KEY"),
    "Content-Type: application/json",
    "Idempotency-Key: ts-1001",
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "destination" => "address",
    "address" => "UQBvW8Z5huBkMJYdnfAEM5JqTNkuWX3diqYENkWsIL0XggGG",
    "amount_ton" => "2",
    "source" => "toman",
    "max_pay" => 900000
  ]),
  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);
```

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{"destination": "address", "address": "UQBvW8Z5huBkMJYdnfAEM5JqTNkuWX3diqYENkWsIL0XggGG", "amount_ton": "2", "source": "toman", "max_pay": 900000}`)
	req, _ := http.NewRequest("POST", "https://stard-market.ir/api/v1/ton/sell", body)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("STARD_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Idempotency-Key", "ts-1001")
	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))
}
```

**پاسخ — 201**

```json
{
  "object": "ton_sell",
  "id": 24,
  "destination": "address",
  "address": "UQBvW8Z5huBkMJYdnfAEM5JqTNkuWX3diqYENkWsIL0XggGG",
  "receive_ton": "2",
  "status": "queued",
  "status_fa": "در صف ارسال",
  "tracking_code": "9U7KXQ2M",
  "review_reason": null,
  "pay": {
    "amount": 860000,
    "currency": "IRT"
  },
  "ton_rate_toman": 400000,
  "price_per_ton_toman": 430000
}
```

## خطاها

| HTTP | code | کی |
|---|---|---|
| `400` | `parameter_missing` | Idempotency-Key یا address/username لازم است |
| `400` | `parameter_invalid` | آدرس TON یا مقدار نامعتبر |
| `400` | `amount_too_large` | بیشتر از سقف هر ارسال |
| `400` | `send_failed` | موجودی کافی نیست یا ارسال ممکن نیست |
| `403` | `insufficient_scope` | کلید scope ِ ton:send ندارد |
| `409` | `price_changed` | قیمت از max_pay بیشتر شد؛ چیزی کسر نشد |
| `429` | `daily_limit` | سقف ۲۴ ساعته پر شده |
| `403` | `insufficient_scope` | کلید scope `ton:send` را ندارد |
| `401` | `invalid_api_key / missing_api_key / api_key_revoked / api_key_expired` | کلید نیامده، نامعتبر، باطل یا منقضی است |
| `429` | `rate_limit_exceeded` | سقف درخواست در دقیقه پر شده؛ بعد از `Retry-After` ثانیه دوباره بفرست |

## محدودیت نرخ

پیش‌فرض ۶۰ درخواست در دقیقه برای هر کلید (قابل تنظیم در داشبورد). وضعیت در هدرهای `X-RateLimit-*` برمی‌گردد — [جزئیات](https://stard-market.ir/docs/rate-limits).
