واجهة API للمبرمجين
واجهة الربط الرسمية للمتاجر والبوتات. جميع مسارات V53 الأصلية باقية كما هي، وتمت إضافة مسارات توافق V81 لتغطية البرامج التي تتوقع JSON Object بدل Array.
Base URL
https://ASWAD TOP UP.com/
Authentication
api-token: YOUR_API_TOKEN
يدعم أيضاً Authorization: Bearer YOUR_API_TOKEN. لا تضع التوكن داخل الرابط.
مهم جداً عند الاستيراد
/client/api/content/0 يعيد الأقسام الرئيسية فقط. من الطبيعي أن تكون products: [] في الجذر لأن المنتجات موجودة داخل أقسام متفرعة أعمق. البرنامج يجب أن يفتح كل category.id بشكل recursive، أو يستخدم /client/api/tree أو /client/api/catalog.
/client/api/products يعيد JSON Array مباشرة. إذا برنامجك يشترط products/data/items داخل Object استخدم /client/api/products-wrapped.
أسرع إعداد حسب نوع البرنامج
| الحالة | المسار |
|---|---|
| FastCard / Ahminix compatible | /client/api/products + /client/api/content/0 |
| برنامج يتطلب products/data/items | /client/api/products-wrapped |
| استيراد الشجرة كاملة دفعة واحدة | /client/api/tree |
| كل شيء دفعة واحدة | /client/api/catalog |
| كل الأقسام كقائمة مسطحة | /client/api/categories/all |
1) فحص الاتصال
GET /client/api/ping
curl 'https://ASWAD TOP UP.com/client/api/ping'
لا يحتاج توكن.
2) معلومات الربط الآلي
GET /client/api/integration
يعيد Base URL، Header، وكل المسارات الرسمية بصيغة قابلة للقراءة آلياً.
3) الحساب والرصيد
GET /client/api/profile
curl 'https://ASWAD TOP UP.com/client/api/profile' \ -H 'api-token: YOUR_API_TOKEN'
4) الأقسام — Recursive Content
GET /client/api/content/0
GET /client/api/content/{category_id}
{
"status": "OK",
"categories": [
{
"id": 759,
"name": "قسم الألعاب 🎮",
"parent_id": null,
"category_img": "https://ASWAD TOP UP.com/..."
}
],
"products": [],
"category_id": 0
}
افتح كل id يرجع داخل categories حتى تصل للمستويات التي تحتوي products.
5) المنتجات — FastCard/Ahminix shape
GET /client/api/products
الاستجابة Array مباشرة:
[
{
"id": 1618,
"name": "BISHAR CHAT",
"price": 0.000016,
"currency": "USD",
"parent_id": 242,
"category_id": 242,
"category_name": "تطبيقات الدردشة",
"available": true,
"product_type": "amount",
"input_schema": [],
"params": [],
"qty_values": null,
"image": "https://ASWAD TOP UP.com/...",
"category_img": "https://ASWAD TOP UP.com/..."
}
]
?products_id=1618 لمنتج محدد، و ?base=1 لرد مختصر.
6) Wrapped compatibility
GET /client/api/products-wrapped
{
"status": "OK",
"products": [ ... ],
"data": [ ... ],
"items": [ ... ],
"count": 1882
}
مخصص للبرامج التي لا تقبل Array في جذر JSON.
7) الشجرة الكاملة
GET /client/api/tree
يرجع الأقسام متداخلة، وكل عقدة تحتوي categories وproducts.
8) Full Catalog
GET /client/api/catalog
{
"status": "OK",
"categories": [ ... nested tree ... ],
"flat_categories": [ ... ],
"products": [ ... ],
"categories_count": 924,
"products_count": 1882
}
الأعداد تتغير تلقائياً حسب العناصر المتاحة والظاهرة لحساب API وقت الطلب.
9) كل الأقسام Flat
GET /client/api/categories/all
{
"status":"OK",
"categories":[ ... ],
"data":[ ... ],
"items":[ ... ],
"count":924
}
10) إنشاء طلب
GET /client/api/newOrder/{product_id}/params
استخدم نفس product.id القادم من API، مع UUIDv4 جديد لكل طلب فريد.
curl 'https://ASWAD TOP UP.com/client/api/newOrder/PRODUCT_ID/params?qty=1&order_uuid=550e8400-e29b-41d4-a716-446655440000&playerId=123456' \ -H 'api-token: YOUR_API_TOKEN'
حقول الحساب المطلوبة تأتي من input_schema / params للمنتج.
11) فحص الطلب
GET /client/api/check?orders=[ORDER_ID]
curl 'https://ASWAD TOP UP.com/client/api/check?orders=[ORDER_ID]' \ -H 'api-token: YOUR_API_TOKEN'
أمثلة سريعة
Python — Full Catalog
import requests
BASE = "https://ASWAD TOP UP.com"
TOKEN = "YOUR_API_TOKEN"
r = requests.get(
BASE + "/client/api/catalog",
headers={"api-token": TOKEN},
timeout=30,
)
r.raise_for_status()
catalog = r.json()
print("categories:", catalog["categories_count"])
print("products:", catalog["products_count"])
JavaScript — Root Categories
const r = await fetch(
"https://ASWAD TOP UP.com/client/api/content/0",
{ headers: { "api-token": "YOUR_API_TOKEN" } }
);
const data = await r.json();
console.log(data.categories);
أخطاء الحماية
120 | API Token غير موجود |
121 | API Token غير صحيح |
122 | API غير مسموح للحساب |
123 | عنوان IP غير مسموح — راجع Allowed IPs بحساب API |
130 | API في وضع الصيانة |
109 | القسم/المنتج محذوف أو غير موجود |
OpenAPI: /openapi.json
English integration note
Base URL: https://ASWAD TOP UP.com/. Preferred authentication header: api-token. The canonical /client/api/products endpoint returns a top-level JSON array. Use /client/api/products-wrapped when your client requires an object containing products, data, or items. For a complete one-request import use /client/api/catalog.