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

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

API CDN

روشن و خاموش کردن CDN و SSL خودکار هر رکورد، تنظیمات CDN و آمار مصرف. این گروه با شناسهٔ edge در فایل OpenAPI آمده و ۴ endpoint دارد.

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

GET /api/v1/edge/records #

List the records that are routed through the CDN

دسترسی لازم: edge:read محدودیت نرخ: خواندن
پاسخ‌ها (۴)
  • 200 Only records with the CDN enabled (not paginated; meta.total = count) data[]: record_idzone_uuiddomainnamefqdntypereal_originedge_ipsslsettings
  • 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 edge: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/edge/records"

بازگشت به فهرست این بخش

GET /api/v1/edge/usage #

Per-hostname CDN usage over the last 30 days

دسترسی لازم: edge:read محدودیت نرخ: خواندن
پاسخ‌ها (۴)
  • 200 Usage rows data[]: fqdnrequeststraffic_gbcache_hit_pctblockedwindow_days
  • 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 edge: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/edge/usage"

بازگشت به فهرست این بخش

PATCH /api/v1/edge/records/{rid} #

Enable/disable the CDN (and automatic SSL) on a DNS record

دسترسی لازم: edge:toggle محدودیت نرخ: تغییر
پارامترهای مسیر (۱)
rid integer
الزامی DNS record id (id from GET /api/v1/dns/zones/{uuid}/records)
فیلدهای بدنه (JSON) (۱)
enabled boolean
الزامی true = route through the CDN + issue SSL; false = direct
نمونهٔ بدنهٔ درخواست (JSON)
application/json
{
    "enabled": true
}
پاسخ‌ها (۷)
  • 200 New state data: record_idproxy_enabled
  • 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 edge:toggle (details.required_scope)
  • 404 not_found — unknown record or not in one of your zones
  • 422 validation_failed — enabled missing, record type not proxiable (only A/AAAA or an in-zone CNAME), or the zone is disabled
  • 429 rate_limited — write limit reached; wait Retry-After seconds (details.retry_after_sec)
  • 500 internal_error — the change could not be applied; retry or send the request_id to support
نمونهٔ curl
curl
curl -X PATCH \
  -H "Authorization: Bearer $IRANCLAUD_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true}' \
  "https://iranclaud.ir/api/v1/edge/records/42"

بازگشت به فهرست این بخش

PATCH /api/v1/edge/records/{rid}/settings #

Update the CDN settings of a record (WAF, caching, headers, IP lists, rate limits)

دسترسی لازم: edge:toggle محدودیت نرخ: تغییر
پارامترهای مسیر (۱)
rid integer
الزامی DNS record id
فیلدهای بدنه (JSON) (۱۷)

All fields optional; omitted fields keep their value

waf boolean
اختیاری
cache_static boolean
اختیاری
api_cache boolean
اختیاری
large_file boolean
اختیاری
video_streaming boolean
اختیاری
hsts boolean
اختیاری
security_headers boolean
اختیاری
cors boolean
اختیاری
hide_server_header boolean
اختیاری
origin_host string | null
اختیاری Host header sent to the origin; empty = forward the incoming Host
origin_timeout integer | null
اختیاری Origin timeout in seconds (1-300); empty = default
cache_max_age integer | null
اختیاری Static-asset cache TTL in seconds (60-2592000); empty = default (3600)
respect_origin_cache boolean
اختیاری true = follow the origin Cache-Control instead of the CDN TTL
blocked_ips array<string>
اختیاری IPs/CIDRs rejected at the CDN (array, or a comma/newline separated string)
allowed_ips array<string>
اختیاری If set, ONLY these IPs/CIDRs are allowed
rate_limit_per_sec integer
اختیاری Clamped to 1-10000 — min 1; max 10000
rate_limit_per_min integer
اختیاری Clamped to 1-100000 and raised to at least rate_limit_per_sec — min 1; max 100000
نمونهٔ بدنهٔ درخواست (JSON)
application/json
{
    "hsts": true,
    "cors": true,
    "security_headers": true,
    "blocked_ips": [
        "203.0.113.10"
    ]
}
پاسخ‌ها (۵)
  • 200 All settings after the update data: record_idsettings
  • 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 edge:toggle (details.required_scope)
  • 404 not_found — unknown record or not in one of your zones
  • 429 rate_limited — write limit reached; wait Retry-After seconds (details.retry_after_sec)
نمونهٔ curl
curl
curl -X PATCH \
  -H "Authorization: Bearer $IRANCLAUD_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"hsts":true,"cors":true,"security_headers":true,"blocked_ips":["203.0.113.10"]}' \
  "https://iranclaud.ir/api/v1/edge/records/42/settings"

بازگشت به فهرست این بخش

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