مرجع API

سرورهای ابری

ساخت، حذف، مصرف و تغییر پلن سرور. ساخت در صف اجرا می‌شود؛ وضعیت سرور را دوباره بخوانید.

فهرست سرورها

سرورهای تیم.

دسترسی کلید: servers:read
GET/teams/{team}/servers

پارامترهای مسیر

teamstringضروری

شناسه‌ی تیم (id در فهرست تیم‌ها).

پارامترهای Query

pageinteger

شماره‌ی صفحه، از ۱.

per_pageinteger

تعداد در هر صفحه؛ پیش‌فرض ۲۰ و حداکثر ۱۰۰.

Request
curl -X GET "https://api.amiran.fun/api/v1/teams/01a18fc6-31fc-73a8-9b99-ac5fd1d672a4/servers" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
Response
{
  "status": true,
  "message": "Servers",
  "servers": [
    {
      "id": "01a1c2f0-7b1e-7d3a-9c41-5e2f8a6b0d19",
      "name": "web-1",
      "status": "active",
      "busy": false,
      "location": {
        "slug": "tehran-1",
        "name": "Tehran 1",
        "fa_name": "تهران ۱",
        "is_default": true
      },
      "plan": {
        "id": 2,
        "name": "vps.medium",
        "fa_name": "متوسط",
        "description": null,
        "vcpus": 2,
        "ram_mb": 4096,
        "disk_gb": 80,
        "hourly_price": "2500.0000",
        "monthly_price": "1825000.0000",
        "unlimited_traffic": false,
        "traffic_price": "3000.0000",
        "free_traffic_gb": 100
      },
      "os": {
        "family": "Ubuntu",
        "icon": "ubuntu",
        "platform": "linux",
        "version": "24.04"
      },
      "suspended_at": null,
      "created_at": "2026-11-10T09:12:00.000000Z"
    }
  ],
  "pages": 1,
  "total": 1,
  "code": 200
}

ساخت سرور

سرور تازه‌ای با یک پلن و یک سیستم‌عامل یا اسنپ‌شات می‌سازد. بدون کلید SSH رمز root یک بار در پاسخ برمی‌گردد و دیگر نمایش داده نمی‌شود. موجودی تیم باید هزینه‌ی ۲۴ ساعت همه‌ی منابع را پوشش دهد.

دسترسی کلید: servers:writeحداکثر ۱۰ درخواست در دقیقه
POST/teams/{team}/servers

پارامترهای مسیر

teamstringضروری

شناسه‌ی تیم (id در فهرست تیم‌ها).

بدنه‌ی درخواست (JSON)

namestringضروری

نام سرور؛ حروف کوچک انگلیسی، عدد و خط تیره، حداکثر ۶۳ کاراکتر.

locationstring

slug جای سرور از کاتالوگ سرور؛ بدون آن جای پیش‌فرض، یا جای اسنپ‌شات.

plan_idintegerضروری

شناسه‌ی پلن از کاتالوگ سرور.

os_version_idinteger

شناسه‌ی نسخه‌ی سیستم‌عامل؛ بدون snapshot_id لازم است.

snapshot_idstring

ساخت از یکی از اسنپ‌شات‌های تیم، به جای سیستم‌عامل.

ssh_key_idsinteger[]

کلیدهای SSH شما یا اعضای تیم؛ حداکثر ۲۰.

Request
curl -X POST "https://api.amiran.fun/api/v1/teams/01a18fc6-31fc-73a8-9b99-ac5fd1d672a4/servers" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"name": "web-1", "location": "tehran-1", "plan_id": 2, "os_version_id": 1, "ssh_key_ids": [3]}'
Response
{
  "status": true,
  "message": "The server is being created.",
  "server": {
    "id": "01a1c2f0-7b1e-7d3a-9c41-5e2f8a6b0d19",
    "name": "web-1",
    "status": "pending",
    "busy": true,
    "location": {
      "slug": "tehran-1",
      "name": "Tehran 1",
      "fa_name": "تهران ۱",
      "is_default": true
    },
    "plan": {
      "id": 2,
      "name": "vps.medium",
      "fa_name": "متوسط",
      "description": null,
      "vcpus": 2,
      "ram_mb": 4096,
      "disk_gb": 80,
      "hourly_price": "2500.0000",
      "monthly_price": "1825000.0000",
      "unlimited_traffic": false,
      "traffic_price": "3000.0000",
      "free_traffic_gb": 100
    },
    "os": {
      "family": "Ubuntu",
      "icon": "ubuntu",
      "platform": "linux",
      "version": "24.04"
    },
    "suspended_at": null,
    "login": "password",
    "suspend_reason": null,
    "traffic": {
      "month_start": "2026-10-22T20:30:00+00:00",
      "sent_bytes": 0,
      "received_bytes": 0,
      "free_bytes": 107374182400,
      "free_left_bytes": 107374182400
    },
    "created_at": "2026-11-10T09:12:00.000000Z"
  },
  "password": "q7Lm2xV9pR4sT8wK1nB6",
  "code": 201
}

مشخصات سرور

یک سرور با شیوه‌ی ورود و ترافیک این ماه. busy یعنی عملیاتی در صف است.

دسترسی کلید: servers:read
GET/teams/{team}/servers/{server}

پارامترهای مسیر

teamstringضروری

شناسه‌ی تیم (id در فهرست تیم‌ها).

serverstringضروری

شناسه‌ی سرور.

Request
curl -X GET "https://api.amiran.fun/api/v1/teams/01a18fc6-31fc-73a8-9b99-ac5fd1d672a4/servers/01a1c2f0-7b1e-7d3a-9c41-5e2f8a6b0d19" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
Response
{
  "status": true,
  "message": "Server",
  "server": {
    "id": "01a1c2f0-7b1e-7d3a-9c41-5e2f8a6b0d19",
    "name": "web-1",
    "status": "active",
    "busy": false,
    "location": {
      "slug": "tehran-1",
      "name": "Tehran 1",
      "fa_name": "تهران ۱",
      "is_default": true
    },
    "plan": {
      "id": 2,
      "name": "vps.medium",
      "fa_name": "متوسط",
      "description": null,
      "vcpus": 2,
      "ram_mb": 4096,
      "disk_gb": 80,
      "hourly_price": "2500.0000",
      "monthly_price": "1825000.0000",
      "unlimited_traffic": false,
      "traffic_price": "3000.0000",
      "free_traffic_gb": 100
    },
    "os": {
      "family": "Ubuntu",
      "icon": "ubuntu",
      "platform": "linux",
      "version": "24.04"
    },
    "suspended_at": null,
    "login": "ssh_keys",
    "suspend_reason": null,
    "traffic": {
      "month_start": "2026-10-22T20:30:00+00:00",
      "sent_bytes": 1288490188,
      "received_bytes": 5368709120,
      "free_bytes": 107374182400,
      "free_left_bytes": 102005473280
    },
    "created_at": "2026-11-10T09:12:00.000000Z"
  },
  "code": 200
}

حذف سرور

سرور و دیسک آن را حذف می‌کند. برگشت‌پذیر نیست.

دسترسی کلید: servers:write
DELETE/teams/{team}/servers/{server}

پارامترهای مسیر

teamstringضروری

شناسه‌ی تیم (id در فهرست تیم‌ها).

serverstringضروری

شناسه‌ی سرور.

Request
curl -X DELETE "https://api.amiran.fun/api/v1/teams/01a18fc6-31fc-73a8-9b99-ac5fd1d672a4/servers/01a1c2f0-7b1e-7d3a-9c41-5e2f8a6b0d19" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
Response
{
  "status": true,
  "message": "The server is being deleted.",
  "code": 200
}

مصرف سرور

نمودار پردازنده، حافظه، دیسک و شبکه.

دسترسی کلید: servers:read
GET/teams/{team}/servers/{server}/usage

پارامترهای مسیر

teamstringضروری

شناسه‌ی تیم (id در فهرست تیم‌ها).

serverstringضروری

شناسه‌ی سرور.

پارامترهای Query

rangestring

یکی از 1h، 6h، 24h، 7d یا 30d؛ پیش‌فرض 1h.

Request
curl -X GET "https://api.amiran.fun/api/v1/teams/01a18fc6-31fc-73a8-9b99-ac5fd1d672a4/servers/01a1c2f0-7b1e-7d3a-9c41-5e2f8a6b0d19/usage" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
Response
{
  "status": true,
  "message": "Server usage",
  "range": "1h",
  "labels": [
    "2026-11-10T09:28:00+00:00",
    "2026-11-10T09:29:00+00:00"
  ],
  "series": {
    "cpu_percent": [
      null,
      null
    ],
    "memory_used_mb": [
      null,
      null
    ],
    "memory_host_mb": [
      null,
      null
    ],
    "disk_read_bps": [
      null,
      null
    ],
    "disk_write_bps": [
      null,
      null
    ],
    "net_rx_bps": [
      null,
      null
    ],
    "net_tx_bps": [
      null,
      null
    ]
  },
  "code": 200
}

تغییر پلن سرور

سرور را به پلنی بزرگ‌تر می‌برد؛ هیچ منبعی نباید کمتر شود. سرور چند دقیقه در دسترس نیست.

دسترسی کلید: servers:writeحداکثر ۵ درخواست در دقیقه
POST/teams/{team}/servers/{server}/resize

پارامترهای مسیر

teamstringضروری

شناسه‌ی تیم (id در فهرست تیم‌ها).

serverstringضروری

شناسه‌ی سرور.

بدنه‌ی درخواست (JSON)

plan_idintegerضروری

پلن تازه.

Request
curl -X POST "https://api.amiran.fun/api/v1/teams/01a18fc6-31fc-73a8-9b99-ac5fd1d672a4/servers/01a1c2f0-7b1e-7d3a-9c41-5e2f8a6b0d19/resize" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"plan_id": 3}'
Response
{
  "status": true,
  "message": "The plan change was queued.",
  "action": {
    "id": 481,
    "action": "resize",
    "status": "queued",
    "error": null,
    "user": {
      "id": 12,
      "first_name": "سارا",
      "last_name": "احمدی",
      "full_name": "سارا احمدی"
    },
    "started_at": null,
    "finished_at": null,
    "created_at": "2026-11-10T09:30:00.000000Z"
  },
  "code": 202
}