Credits API — التحقق من الرصيد وتكاليف النقاط | YEB

استعلم عن تكاليف نقاط النهاية وتحقق من رصيدك برمجياً. خطط الميزانية وادمج بيانات الرصيد الفوري في لوحات التحكم وتجنب نفاد الأرصدة أثناء التنفيذ.

حالات الاستخدام
تخطيط الميزانية

احسب التكاليف قبل إجراء استدعاءات API لإدارة إنفاق أرصدتك.

تكامل لوحة التحكم

اعرض الرصيد في الوقت الفعلي ومعلومات التكاليف في لوحة الإدارة الخاصة بك.

أتمتة ذكية

تحقق من الرصيد قبل المهام الدفعية لتجنب نفاد الأرصدة أثناء التنفيذ.

99.9 % وقت التشغيل
الاستجابة
20 req/s
0 الأرصدة / الطلب

Look up endpoint cost


POST https://api.yeb.to/v1/credits/cost
المعاملالنوعمطلوبالوصف
api_key string نعم Your API key
endpoint string اختياري Single endpoint key, e.g. youtube/channel/audit
endpoints array اختياري Array of up to 50 endpoint keys (use instead of endpoint)

مثال

curl -X POST https://api.yeb.to/v1/credits/cost \
  -H "Content-Type: application/json" \
  -d '{
  "api_key": "YOUR_KEY",
  "endpoint": "youtube/channel/audit"
}'

مثال الاستجابة

{
  "endpoint": "youtube/channel/audit",
  "credits": 0.01,
  "credits_spent": 0.0001,
  "credits_left": 142.5,
  "response_code": 200,
  "response_time_ms": 12
}
{"error":"Provide \"endpoint\" (string) or \"endpoints\" (array).","code":422}

رموز الاستجابة

الرمزالوصف
200 Successتمت معالجة الطلب بنجاح.
400 Bad Requestفشل التحقق من المدخلات.
401 Unauthorizedمفتاح API مفقود أو خاطئ.
403 Forbiddenالمفتاح غير نشط أو غير مسموح.
429 Rate Limitطلبات كثيرة جدًا.
500 Server Errorفشل غير متوقع.

Look up cost

credits/cost 0.0001 credits

Parameters

API Key
body · string · required
Endpoint
body · string
Endpoints
body · string

Code Samples


                
                
                
            

Response

Status:
Headers

                
Body

                

Check credit balance


POST https://api.yeb.to/v1/credits/balance
المعاملالنوعمطلوبالوصف
api_key string نعم Your API key

مثال

curl -X POST https://api.yeb.to/v1/credits/balance \
  -H "Content-Type: application/json" \
  -d '{
  "api_key": "YOUR_KEY"
}'

مثال الاستجابة

{
  "credits": 142.5,
  "credits_spent": 0.0001,
  "credits_left": 142.5,
  "response_code": 200,
  "response_time_ms": 8
}
{"error":"Cannot resolve user from API key.","code":401}

رموز الاستجابة

الرمزالوصف
200 Successتمت معالجة الطلب بنجاح.
400 Bad Requestفشل التحقق من المدخلات.
401 Unauthorizedمفتاح API مفقود أو خاطئ.
403 Forbiddenالمفتاح غير نشط أو غير مسموح.
429 Rate Limitطلبات كثيرة جدًا.
500 Server Errorفشل غير متوقع.

Check balance

credits/balance 0.0001 credits

Parameters

API Key
body · string · required

Code Samples


                
                
                
            

Response

Status:
Headers

                
Body

                

Credits API — التحقق من الرصيد وتكاليف النقاط | YEB — Practical Guide

Look up how many credits any API endpoint costs and check your balance — all programmatically. Ideal for budget control, dashboards, and pre-flight checks before batch jobs.

#What the Credits API does

The Credits API lets you look up endpoint costs and check your balance without making an actual API call. Use it to build cost-aware workflows, display pricing in your UI, or validate you have enough credits before launching a batch job.

Each Credits API call costs only 0.0001 credits — essentially free.

#Endpoints

# POST /v1/credits/cost

  • Best for: Looking up the credit cost of any endpoint before calling it.
  • Single lookup: Send "endpoint": "youtube/channel/audit" to get one cost.
  • Bulk lookup: Send "endpoints": ["screenshot/capture", "qr/code"] for up to 50 at once.

# POST /v1/credits/balance

  • Best for: Checking your current credit balance from code.
  • Returns: Your total available credits.

#Quick start

# Look up a single endpoint cost
curl -X POST "https://api.yeb.to/v1/credits/cost" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: <YOUR_API_KEY>" \
  -d '{"endpoint": "screenshot/capture"}'
# Bulk lookup (up to 50 endpoints)
curl -X POST "https://api.yeb.to/v1/credits/cost" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: <YOUR_API_KEY>" \
  -d '{"endpoints": ["youtube/channel/audit", "qr/code", "geoip/city"]}'
# Check your balance
curl -X POST "https://api.yeb.to/v1/credits/balance" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: <YOUR_API_KEY>"

#Parameters

Cost endpoint

Param Type Required Description
endpoint string One of the two Single endpoint key, e.g. youtube/channel/audit
endpoints array One of the two Array of up to 50 endpoint keys for bulk lookup

Balance endpoint

No extra parameters — just authenticate with your API key.

#Reading responses

Single cost lookup

{
  "endpoint": "youtube/channel/audit",
  "credits": 0.01,
  "credits_spent": 0.0001,
  "credits_left": 142.5,
  "response_code": 200,
  "response_time_ms": 12
}

Bulk cost lookup

{
  "costs": {
    "screenshot/capture": 0.05,
    "qr/code": 0.009,
    "chatbot/message": 0.05
  },
  "credits_spent": 0.0001,
  "credits_left": 142.5,
  "response_code": 200,
  "response_time_ms": 8
}

Balance response

{
  "credits": 142.5,
  "credits_spent": 0.0001,
  "credits_left": 142.5,
  "response_code": 200,
  "response_time_ms": 8
}

#Endpoint key format

Endpoint keys follow the pattern module/action. Here are some examples:

KeyCreditsAPI
youtube/channel/audit0.01YouTube Channel
screenshot/capture0.05Screenshot
qr/code0.009QR Code Generator
geoip/city0.009GeoIP
chatbot/message0.05ChatBot
bot/detect/detect0.003Bot Detect
captions/transcribe1Captions
Use the /v1/credits/cost endpoint itself to discover costs for any key — if a key doesn't exist, it returns null.

#Practical recipes

  • Pre-flight check: Call /balance before a batch job. If credits < estimated cost, abort early and notify.
  • Pricing page: Fetch all costs with /cost and display them dynamically — always in sync with reality.
  • Usage dashboard: Combine /balance with your transaction history to show spend over time.

#Errors

HTTPWhenWhat to do
422 Neither endpoint nor endpoints provided Send at least one of the two parameters.
422 More than 50 endpoints in array Split into multiple requests.
401 Invalid or missing API key Check your API key in X-API-Key header or api_key param.

#API Changelog

2026-02-07
Initial release — /cost (single + bulk) and /balance endpoints.

الأسئلة الشائعة

تقريباً — كل استدعاء يكلف 0.0001 رصيد (مجاني فعلياً). هذا يمنع إساءة الاستخدام مع الحفاظ على إمكانية الوصول.

نعم — أرسل مصفوفة "endpoints" تحتوي على ما يصل إلى 50 مفتاح نقطة نهاية واحصل على جميع التكاليف في استجابة واحدة.

نعم — تُقرأ التكاليف مباشرة من الإعدادات الحية، لذا تحصل دائماً على الأسعار الحالية.

نعم. كل طلب، حتى تلك التي تؤدي إلى أخطاء، تستهلك أرصدة. هذا لأن أرصدتك مرتبطة بعدد الطلبات، بغض النظر عن النجاح أو الفشل. إذا كان الخطأ بسبب مشكلة في المنصة من جانبنا، سنستعيد الأرصدة المتأثرة (بدون استرداد نقدي).

تواصل معنا على [email protected]. نأخذ الملاحظات بجدية—إذا كان تقرير الخطأ أو طلب الميزة ذا معنى، يمكننا إصلاح أو تحسين الواجهة بسرعة ومنحك 50 رصيدًا مجانيًا كشكر لك.

يعتمد على الواجهة وأحيانًا حتى على نقطة النهاية. بعض النقاط النهائية تستخدم بيانات من مصادر خارجية، والتي قد تكون لها حدود أكثر صرامة. نفرض أيضًا حدودًا لمنع إساءة الاستخدام والحفاظ على استقرار منصتنا. راجع الوثائق لمعرفة الحد المحدد لكل نقطة نهاية.

نعمل بنظام الأرصدة. الأرصدة هي وحدات مسبقة الدفع وغير قابلة للاسترداد تنفقها على استدعاءات API والأدوات. تُستهلك الأرصدة بنظام FIFO (الأقدم أولاً) وصالحة لمدة 12 شهرًا من تاريخ الشراء. تعرض لوحة التحكم تاريخ كل عملية شراء وانتهاء صلاحيتها.

نعم. جميع الأرصدة المشتراة (بما في ذلك الأرصدة الجزئية) صالحة لمدة 12 شهرًا من الشراء. تنتهي صلاحية الأرصدة غير المستخدمة تلقائيًا وتُحذف نهائيًا في نهاية فترة الصلاحية. لا يمكن استعادة الأرصدة المنتهية أو تحويلها إلى نقد أو قيمة أخرى. قاعدة انتقالية: الأرصدة المشتراة قبل 22 سبتمبر 2025 تُعامل كمشتراة في 22 سبتمبر 2025 وتنتهي في 22 سبتمبر 2026 (ما لم يُذكر تاريخ انتهاء أبكر عند الشراء).

نعم—ضمن فترة الصلاحية. تبقى الأرصدة غير المستخدمة متاحة وتُترحل من شهر لآخر حتى تنتهي صلاحيتها بعد 12 شهرًا من الشراء.

الأرصدة غير قابلة للاسترداد. اشترِ فقط ما تحتاجه—يمكنك دائمًا إعادة الشحن لاحقًا. إذا تسبب خطأ في المنصة في فشل الشحن، قد نستعيد الأرصدة المتأثرة بعد التحقيق. لا استرداد نقدي.

الأسعار محددة بالأرصدة وليس بالدولارات. كل نقطة نهاية لها تكلفتها الخاصة—انظر شارة "الأرصدة / الطلب" أعلاه. ستعرف دائمًا بالضبط ما تنفقه.
← العودة إلى واجهات البرمجة