---
title: ثبت سفارش ری‌اکشن استارزی — POST /api/v1/star-reactions/orders | Stard API
url: https://stard-market.ir/docs/reference/star-reactions-order
markdown: https://stard-market.ir/docs/reference/star-reactions-order.md
language: fa
updated: 2026-11-18
description: ری‌اکشن استارزی روی یک یا چند پست متوالی، با امکان ناشناس و زمان‌بندی. از Idempotency-Key پشتیبانی می‌کند و تغییر وضعیت با وب‌هوک order.* خبر داده می‌شود.
---

# ثبت سفارش ری‌اکشن استارزی

`POST /api/v1/star-reactions/orders`

> ری‌اکشن استارزی روی یک یا چند پست متوالی، با امکان ناشناس و زمان‌بندی. از `Idempotency-Key` پشتیبانی می‌کند و تغییر وضعیت با وب‌هوک `order.*` خبر داده می‌شود.

## درخواست

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

### بدنه (JSON)

| فیلد | نوع |  | توضیح |
|---|---|---|---|
| `post_url` | `string` | الزامی | لینک پست |
| `stars` | `integer` | الزامی | استارز برای هر پست |
| `posts` | `integer` | اختیاری | تعداد پست (۱ تا ۵۰) |
| `anonymous` | `boolean` | اختیاری | ناشناس |
| `scheduled_at` | `string` | اختیاری | زمان ارسال (ISO 8601) |
| `max_price` | `integer` | اختیاری | سقف مبلغ؛ بیشتر شد → 409 price_changed |
| `pay_currency` | `string` | اختیاری | TON یا IRT |
| `metadata` | `object` | اختیاری | داده‌ی دلخواه |

## نمونه

```bash
curl -X POST "https://stard-market.ir/api/v1/star-reactions/orders" \
  -H "Authorization: Bearer $STARD_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: rx-1001" \
  -d '{"post_url": "https://t.me/your_channel/42", "stars": 50, "posts": 3, "anonymous": true}'
```

```javascript
const res = await fetch("https://stard-market.ir/api/v1/star-reactions/orders", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STARD_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": "rx-1001",
  },
  body: JSON.stringify({
    "post_url": "https://t.me/your_channel/42",
    "stars": 50,
    "posts": 3,
    "anonymous": true
  }),
});
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/star-reactions/orders", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STARD_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": "rx-1001",
  },
  body: JSON.stringify({
    "post_url": "https://t.me/your_channel/42",
    "stars": 50,
    "posts": 3,
    "anonymous": true
  }),
});
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/star-reactions/orders",
    headers={
    "Authorization": f"Bearer {os.environ['STARD_API_KEY']}",
    "Idempotency-Key": "rx-1001",
    },
    json={
        "post_url": "https://t.me/your_channel/42",
        "stars": 50,
        "posts": 3,
        "anonymous": True
    },
    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/star-reactions/orders");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("STARD_API_KEY"),
    "Content-Type: application/json",
    "Idempotency-Key: rx-1001",
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "post_url" => "https://t.me/your_channel/42",
    "stars" => 50,
    "posts" => 3,
    "anonymous" => true
  ]),
  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(`{"post_url": "https://t.me/your_channel/42", "stars": 50, "posts": 3, "anonymous": true}`)
	req, _ := http.NewRequest("POST", "https://stard-market.ir/api/v1/star-reactions/orders", body)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("STARD_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Idempotency-Key", "rx-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))
}
```

## خطاها

| HTTP | code | کی |
|---|---|---|
| `400` | `post_url_invalid` | لینک پست نامعتبر است |
| `400` | `quantity_out_of_range` | تعداد استارز خارج از بازه |
| `403` | `service_disabled` | ری‌اکشن استارزی موقتاً غیرفعال است |
| `409` | `price_changed` | مبلغ از max_price بیشتر شد؛ پولی کسر نشده |
| `402` | `insufficient_funds` | موجودی کیف پول API (یا موجودی آزمایشی) کافی نیست |
| `403` | `insufficient_scope` | کلید scope `orders:write` را ندارد |
| `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).
