همهٔ سیستم‌ها عملیاتی‌اند

مرجع API · نسخهٔ v1

API ترافیک ماهانه

سهمیهٔ ترافیک ماهانهٔ هر سرور و خرید بستهٔ ترافیک اضافه از کیف پول. این گروه با شناسهٔ traffic در فایل OpenAPI آمده و ۳ endpoint دارد.

نمونه‌های curl توکن را از متغیر محیطی IRANCLAUD_TOKEN می‌خوانند؛ ساخت توکن و تنظیم این متغیر در راهنمای شروع سریع آمده است.

GET /api/v1/traffic/packs #

List extra-traffic packs and prices

دسترسی لازم: traffic:read محدودیت نرخ: خواندن
پاسخ‌ها (۴)
  • 200 Packs (slugs 10gb, 50gb, 100gb, 500gb, 1tb) data[]: sluggbprice_centsprice_toman
  • 401 unauthenticated — Authorization header missing or not "Bearer …"; token_invalid — token unknown, expired, revoked or the account is not active
  • 403 scope_missing — the token lacks traffic:read (details.required_scope)
  • 429 rate_limited — read limit reached; wait Retry-After seconds (details.retry_after_sec)
نمونهٔ curl
curl
curl \
  -H "Authorization: Bearer $IRANCLAUD_TOKEN" \
  "https://iranclaud.ir/api/v1/traffic/packs"
GET /api/v1/vms/{uuid}/traffic/quota #

Monthly traffic quota, usage and block state of a server

دسترسی لازم: traffic:read محدودیت نرخ: خواندن
پارامترهای مسیر (۱)
uuid string
الزامی Server UUID
پاسخ‌ها (۵)
  • 200 Current calendar-month period data: period_startperiod_endgb_quota_basegb_topupgb_totalgb_usedgb_remainingpct_usedblocked_atunblocked_at
  • 401 unauthenticated — Authorization header missing or not "Bearer …"; token_invalid — token unknown, expired, revoked or the account is not active
  • 403 scope_missing — the token lacks traffic:read (details.required_scope)
  • 404 not_found — unknown server or owned by another account
  • 429 rate_limited — read limit reached; wait Retry-After seconds (details.retry_after_sec)
نمونهٔ curl
curl
curl \
  -H "Authorization: Bearer $IRANCLAUD_TOKEN" \
  "https://iranclaud.ir/api/v1/vms/YOUR_UUID/traffic/quota"
POST /api/v1/vms/{uuid}/traffic/topup #

Buy an extra-traffic pack for a server (debits the wallet)

دسترسی لازم: traffic:topup محدودیت نرخ: تغییر
پارامترهای مسیر (۱)
uuid string
الزامی Server UUID
فیلدهای بدنه (JSON) (۱)
pack string
الزامی Slug from GET /api/v1/traffic/packs — one of: 10gb | 50gb | 100gb | 500gb | 1tb
نمونهٔ بدنهٔ درخواست (JSON)
application/json
{
    "pack": "50gb"
}
پاسخ‌ها (۷)
  • 200 Pack added; a quota block is lifted automatically data: topup_idgb_addedprice_centsnew_total_gb
  • 401 unauthenticated — Authorization header missing or not "Bearer …"; token_invalid — token unknown, expired, revoked or the account is not active
  • 402 topup_failed — insufficient wallet balance (error.message = insufficient_balance)
  • 403 scope_missing — the token lacks traffic:topup (details.required_scope)
  • 404 not_found — unknown server or owned by another account
  • 422 validation_failed — unknown pack; or topup_failed — the pack could not be applied (the charge is refunded)
  • 429 rate_limited — write limit reached; wait Retry-After seconds (details.retry_after_sec)
نمونهٔ curl
curl
curl -X POST \
  -H "Authorization: Bearer $IRANCLAUD_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"pack":"50gb"}' \
  "https://iranclaud.ir/api/v1/vms/YOUR_UUID/traffic/topup"

همهٔ گروه‌های API