{
  "openapi": "3.1.0",
  "info": {
    "title": "ایران ناتیفیکیشن API",
    "version": "1",
    "description": "مرجع وب‌سرویس ایران ناتیفیکیشن. احراز هویت با کلید دسترسی در هدر Authorization: Bearer. مبلغ‌ها عدد صحیح به ریال و به‌صورت رشته‌اند. مستندات کامل: https://irnoti.com/docs"
  },
  "servers": [
    {
      "url": "https://api.irnoti.com/v1"
    }
  ],
  "externalDocs": {
    "description": "مستندات فارسی",
    "url": "https://irnoti.com/docs"
  },
  "tags": [
    {
      "name": "sms",
      "description": "پیامک"
    },
    {
      "name": "broker",
      "description": "بروکر تلگرام"
    },
    {
      "name": "phonebook",
      "description": "دفترچه تلفن"
    },
    {
      "name": "account",
      "description": "حساب و اعتبار"
    },
    {
      "name": "email",
      "description": "ایمیل"
    },
    {
      "name": "tts",
      "description": "تبدیل متن به گفتار (TTS)"
    },
    {
      "name": "ai",
      "description": "هوش مصنوعی (سازگار با OpenAI)"
    },
    {
      "name": "video",
      "description": "ساخت ویدئو با هوش مصنوعی"
    },
    {
      "name": "verify",
      "description": "تأیید هویت و کد یک‌بارمصرف"
    },
    {
      "name": "services",
      "description": "سفارش سرویس‌ها (منطقه‌ای، هدفمند، پیام‌رسان، صوتی، بین‌المللی)"
    },
    {
      "name": "voip",
      "description": "تماس و VoIP"
    },
    {
      "name": "linktracker",
      "description": "لینک‌ساز، ردیابی کلیک و آزمون A/B"
    },
    {
      "name": "numberbank",
      "description": "بانک شماره (ارسال هدفمند)"
    },
    {
      "name": "project-sms",
      "description": "پیامک سازمانی (پروژه)"
    },
    {
      "name": "bot",
      "description": "ربات‌ساز (تلگرام و بله)"
    },
    {
      "name": "push",
      "description": "SDK پوش: اپ، وب، فرم و اتوماسیون"
    },
    {
      "name": "voip-routing",
      "description": "VoIP: مسیر ورودی، گروه زنگ، IVR، شرط زمانی و داخلی"
    },
    {
      "name": "voip-sip",
      "description": "VoIP: حساب‌های SIP (سافت‌فون)"
    },
    {
      "name": "voip-live",
      "description": "VoIP: تماس زنده و کنفرانس"
    },
    {
      "name": "voip-campaign",
      "description": "VoIP: کمپین تماس و تأیید صوتی"
    },
    {
      "name": "voip-records",
      "description": "VoIP: ضبط مکالمه و پیام صوتی"
    },
    {
      "name": "voip-reports",
      "description": "VoIP: گزارش و فهرست مسدودی"
    },
    {
      "name": "voip-flow",
      "description": "VoIP: بوم طراحی مسیر تماس"
    },
    {
      "name": "voip-notify",
      "description": "VoIP: اعلان تماس و کدهای شماره‌گیری"
    }
  ],
  "paths": {
    "/sms/sos": {
      "post": {
        "operationId": "sendSos",
        "tags": [
          "sms"
        ],
        "summary": "ارسال تضمین‌شده (SOS)",
        "description": "ارسال پیام حیاتی از مسیرهای پلتفرم با جایگزینی خودکار پرووایدر.\n\nبرخلاف ارسال عادی که به پرووایدر خط شما وابسته است، پیام از مسیرهای فعال پلتفرم (به‌ترتیب اولویت) ارسال می‌شود و اگر یک پرووایدر خطا بدهد، خودکار پرووایدر بعدی امتحان می‌شود. فقط برای پیام‌های فوری و حداکثر ۲۰۰ گیرنده؛ با تعرفهٔ جدا (`sms.sos`) محاسبه می‌شود و اگر برای گروه کاربری شما تعرفهٔ SOS تعریف نشده باشد خطای ۴۲۲ می‌گیرید.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، پیام تکراری نمی‌سازد و نتیجه قبلی را برمی‌گرداند."
            },
            "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، پیام تکراری نمی‌سازد و نتیجه قبلی را برمی‌گرداند.",
            "example": "alert-77"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "شماره(های) گیرنده؛ حداکثر ۲۰۰."
                  },
                  "text": {
                    "type": "string",
                    "description": "متن پیام (حداکثر ۱۰۰۰ نویسه)."
                  }
                },
                "required": [
                  "to",
                  "text"
                ]
              },
              "example": {
                "to": [
                  "09121234567"
                ],
                "text": "هشدار: قطعی سرویس"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "count": 1,
                  "batchId": "920",
                  "replayed": false,
                  "totalPrice": "5000"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: بیش از ۲۰۰ گیرنده یا ورودی نامعتبر."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "409": {
            "description": "conflict: در حال حاضر هیچ مسیر ارسالی در دسترس نیست."
          },
          "422": {
            "description": "no_price: برای سرویس SOS تعرفه‌ای تعریف نشده است."
          }
        }
      }
    },
    "/sms/send": {
      "post": {
        "operationId": "sendSms",
        "tags": [
          "sms"
        ],
        "summary": "ارسال پیامک",
        "description": "ارسال یک متن به یک یا چند گیرنده، یا به گروه‌های دفترچه تلفن.\n\nمتن را به شماره‌های گیرنده ارسال می‌کند. شماره‌ها به‌صورت خودکار نرمال‌سازی و تکراری‌ها حذف می‌شوند؛ اگر حتی یک شماره نامعتبر باشد کل درخواست رد می‌شود و هزینه‌ای کسر نمی‌شود. هزینه پیش از ارسال رزرو و پس از ارسال قطعی می‌شود؛ پیام‌های ناموفق به‌طور خودکار بازگردانده می‌شوند. برای تست بدون هزینه از کلید آزمایشی و `lineId: \"sandbox\"` استفاده کنید.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) هم قابل‌استفاده است.",
        "x-required-scope": "sms.send",
        "x-sandbox": true,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، پیام تکراری نمی‌سازد و نتیجه قبلی را برمی‌گرداند."
            },
            "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، پیام تکراری نمی‌سازد و نتیجه قبلی را برمی‌گرداند.",
            "example": "order-1042"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lineId": {
                    "type": "string",
                    "description": "شناسه خط فرستنده (از `GET /sms/lines`). برای کلید آزمایشی مقدار `sandbox`."
                  },
                  "to": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "شماره(های) گیرنده؛ فرمت‌های `09121234567`، `+989121234567` و ارقام فارسی پذیرفته می‌شود. حداکثر ۱۰٬۰۰۰ شماره."
                  },
                  "groupIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شناسه گروه‌های دفترچه تلفن؛ مخاطبین لغو عضویت‌شده حذف می‌شوند. حداقل یکی از `to` یا `groupIds` الزامی است."
                  },
                  "text": {
                    "type": "string",
                    "description": "متن پیام (حداکثر ۱۰۰۰ نویسه). فارسی: ۷۰ نویسه در پیام تک‌بخشی و ۶۷ نویسه در هر بخش پیام چندبخشی."
                  },
                  "scheduledAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "زمان ارسال در آینده (حداقل ۱ دقیقه و حداکثر ۶۰ روز بعد). هزینه همان لحظه رزرو می‌شود و پیام در زمان مقرر ارسال می‌گردد؛ تا پیش از آن با `POST /sms/batches/{batchId}/cancel` قابل لغو است. فهرست: `GET /sms/scheduled`."
                  },
                  "gradual": {
                    "description": "ارسال تدریجی: در هر `intervalMinutes` دقیقه (۱ تا ۱۴۴۰)، `chunkSize` پیام (۱ تا ۱۰٬۰۰۰) آزاد می‌شود. هزینهٔ کل از ابتدا رزرو می‌شود؛ توقف/ادامه/لغو: `POST /sms/batches/{batchId}/pause|resume|cancel` (لغو، فقط باقی‌مانده را بازمی‌گرداند). با `scheduledAt` قابل ترکیب است."
                  },
                  "sosFallback": {
                    "type": "boolean",
                    "description": "اگر پیام نهایتاً نرسید (پرووایدر رد کرد یا گزارش «تحویل نشد» آمد)، یک بار با ارسال تضمین‌شده (SOS) از خطوط SOS و با تعرفهٔ SOS دوباره فرستاده شود. پیش‌فرض false."
                  }
                },
                "required": [
                  "lineId",
                  "text"
                ]
              },
              "example": {
                "to": [
                  "09121234567",
                  "09351234567"
                ],
                "text": "سفارش شما ارسال شد",
                "lineId": "1"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "count": 2,
                  "batchId": "918",
                  "replayed": false,
                  "totalPrice": "1960"
                }
              }
            }
          },
          "400": {
            "description": "invalid_recipients: یک یا چند شماره نامعتبر است (فهرست در `details`)."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "403": {
            "description": ": احراز هویت حساب تکمیل نشده، یا کلید فاقد دسترسی `sms.send` است."
          },
          "404": {
            "description": ": خط وجود ندارد یا در دسترس شما نیست."
          },
          "422": {
            "description": "no_price: برای این سرویس تعرفه‌ای تعریف نشده است."
          }
        }
      }
    },
    "/sms/quote": {
      "post": {
        "operationId": "quoteSms",
        "tags": [
          "sms"
        ],
        "summary": "برآورد هزینه",
        "description": "هزینه دقیق یک ارسال را بدون ارسال و بدون کسر اعتبار برمی‌گرداند.\n\nهمان محاسبه `POST /sms/send` را انجام می‌دهد (تعداد بخش‌ها، تعرفه اپراتور و حجم) ولی چیزی ایجاد نمی‌کند.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) هم قابل‌استفاده است.",
        "x-required-scope": "sms.read",
        "x-sandbox": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lineId": {
                    "type": "string",
                    "description": "شناسه خط فرستنده."
                  },
                  "to": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "گیرندگان."
                  },
                  "groupIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "گروه‌های دفترچه تلفن."
                  },
                  "text": {
                    "type": "string",
                    "description": "متن پیام."
                  }
                },
                "required": [
                  "lineId",
                  "text"
                ]
              },
              "example": {
                "to": [
                  "09121234567"
                ],
                "text": "سلام",
                "lineId": "1"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "count": 1,
                  "parts": 1,
                  "totalPrice": "980"
                }
              }
            }
          }
        }
      }
    },
    "/sms/pattern": {
      "post": {
        "operationId": "sendPattern",
        "tags": [
          "sms"
        ],
        "summary": "ارسال پترن (قالب)",
        "description": "ارسال پیام بر اساس یک قالب تأییدشده با جایگذاری پارامترها — مناسب کد تأیید و پیام‌های تراکنشی.\n\nابتدا قالب را در پنل («الگوهای پیام») بسازید و منتظر تأیید بمانید. متغیرها در متن به شکل `{name}` نوشته می‌شوند و باید همگی در `params` بیایند.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) هم قابل‌استفاده است.",
        "x-required-scope": "sms.send",
        "x-sandbox": true,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، پیام تکراری نمی‌سازد و نتیجه قبلی را برمی‌گرداند."
            },
            "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، پیام تکراری نمی‌سازد و نتیجه قبلی را برمی‌گرداند."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "کد الگو که پس از ساخت قالب در پنل نمایش داده می‌شود."
                  },
                  "to": {
                    "type": "string",
                    "description": "شماره گیرنده (یک شماره)."
                  },
                  "params": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "مقادیر متغیرهای قالب، مثلا `{\"code\": \"4821\"}`."
                  },
                  "sosFallback": {
                    "type": "boolean",
                    "description": "جایگزین SOS برای همین ارسال؛ اگر نیاید، تنظیم خود الگو (روشن/خاموش در پنل) اعمال می‌شود. پیام SOS با همان متن رندرشده می‌رود."
                  }
                },
                "required": [
                  "code",
                  "to"
                ]
              },
              "example": {
                "to": "09121234567",
                "code": "k3f9a2",
                "params": {
                  "code": "4821"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "count": 1,
                  "batchId": "919",
                  "replayed": false,
                  "totalPrice": "980"
                }
              }
            }
          },
          "400": {
            "description": "missing_params: یکی از متغیرهای قالب در `params` نیست."
          },
          "403": {
            "description": ": الگو هنوز تأیید نشده است."
          },
          "404": {
            "description": ": الگو یافت نشد."
          }
        }
      }
    },
    "/sms/messages": {
      "get": {
        "operationId": "listMessages",
        "tags": [
          "sms"
        ],
        "summary": "فهرست پیام‌ها",
        "description": "پیام‌های ارسالی اخیر با وضعیت تحویل.\n\nجدیدترین‌ها اول. برای صفحه‌بندی از `before` (شناسه آخرین پیام صفحه قبل) استفاده کنید. وضعیت‌ها: `queued`، `sent`، `delivered`، `failed`.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) هم قابل‌استفاده است.",
        "x-required-scope": "sms.read",
        "x-sandbox": true,
        "parameters": [
          {
            "name": "take",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "تعداد (پیش‌فرض ۵۰، حداکثر ۲۰۰)."
            },
            "description": "تعداد (پیش‌فرض ۵۰، حداکثر ۲۰۰).",
            "example": "2"
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط پیام‌های با شناسه کوچک‌تر."
            },
            "description": "فقط پیام‌های با شناسه کوچک‌تر."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "5521",
                    "to": "09121234567",
                    "body": "سلام",
                    "kind": "normal",
                    "error": null,
                    "parts": 1,
                    "sentAt": "2026-10-07T10:20:01.000Z",
                    "status": "delivered",
                    "sandbox": false,
                    "createdAt": "2026-10-07T10:20:00.000Z",
                    "totalPrice": "980",
                    "deliveredAt": "2026-10-07T10:20:03.000Z"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/sms/messages/{id}": {
      "get": {
        "operationId": "getMessage",
        "tags": [
          "sms"
        ],
        "summary": "جزئیات یک پیام",
        "description": "وضعیت و جزئیات یک پیام با شناسه.\n\nشناسه در پاسخ فهرست پیام‌ها آمده است.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) هم قابل‌استفاده است.",
        "x-required-scope": "sms.read",
        "x-sandbox": true,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسه پیام."
            },
            "description": "شناسه پیام.",
            "example": "5521"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "5521",
                  "to": "09121234567",
                  "body": "سلام",
                  "parts": 1,
                  "status": "delivered",
                  "totalPrice": "980"
                }
              }
            }
          },
          "404": {
            "description": ": پیام یافت نشد."
          }
        }
      }
    },
    "/sms/lines": {
      "get": {
        "operationId": "listLines",
        "tags": [
          "sms"
        ],
        "summary": "خطوط من",
        "description": "خطوطی که می‌توانید از آن‌ها ارسال کنید.\n\nشامل خطوط اختصاصی شما و خطوط اشتراکی در دسترس حساب شما.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "1",
                    "kind": "shared",
                    "number": "30001234"
                  },
                  {
                    "id": "7",
                    "kind": "dedicated",
                    "number": "50009876"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/sms/scheduled": {
      "get": {
        "operationId": "smsScheduled",
        "tags": [
          "sms"
        ],
        "summary": "ارسال‌های زمان‌بندی‌شده و تدریجی",
        "description": "دسته‌های زمان‌بندی‌شده یا تدریجی که هنوز تمام نشده‌اند.\n\nبرای هر دسته: شناسه، تعداد کل، هزینهٔ رزروشده (ریال، رشته)، وضعیت، زمان ارسال (`scheduledAt`)، و برای ارسال تدریجی `chunkSize`، `intervalMinutes` و زمان آزادسازی بعدی (`nextReleaseAt`). با `batchId` می‌توانید دسته را لغو، متوقف یا ادامه دهید.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "918",
                    "total": 500,
                    "status": "scheduled",
                    "chunkSize": null,
                    "createdAt": "2026-10-30T10:00:00.000Z",
                    "totalPrice": "490000",
                    "scheduledAt": "2026-11-01T08:00:00.000Z",
                    "nextReleaseAt": null,
                    "intervalMinutes": null
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/sms/batches/{id}/cancel": {
      "post": {
        "operationId": "smsBatchCancel",
        "tags": [
          "sms"
        ],
        "summary": "لغو دستهٔ زمان‌بندی‌شده",
        "description": "پیام‌های ارسال‌نشدهٔ یک دسته را لغو و هزینهٔ آن‌ها را برمی‌گرداند.\n\nفقط پیام‌هایی لغو می‌شوند که هنوز به صف ارسال نرفته‌اند (دستهٔ زمان‌بندی‌شده یا باقی‌ماندهٔ ارسال تدریجی). مبلغ بازگشتی به کیف پول برمی‌گردد.\n\n**فیلدهای پاسخ:** `cancelled` تعداد پیام لغوشده، `refunded` مبلغ بازگشتی به ریال.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دسته (`batchId` پاسخ ارسال)."
            },
            "description": "شناسهٔ دسته (`batchId` پاسخ ارسال).",
            "example": "918"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "batchId": "918",
                  "refunded": "490000",
                  "cancelled": 500
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: دسته پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sms/batches/{id}/pause": {
      "post": {
        "operationId": "smsBatchPause",
        "tags": [
          "sms"
        ],
        "summary": "توقف ارسال تدریجی",
        "description": "آزادسازی نوبت‌های بعدی یک دستهٔ تدریجی را متوقف می‌کند.\n\nپاسخ موفق بدون بدنه (۲۰۴) است. پیام‌هایی که تا حالا به صف رفته‌اند ارسال می‌شوند؛ بقیه تا `resume` منتظر می‌مانند و هزینه‌شان رزرو می‌ماند.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دستهٔ تدریجی."
            },
            "description": "شناسهٔ دستهٔ تدریجی.",
            "example": "918"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: دسته پیدا نشد یا متعلق به شما نیست."
          },
          "409": {
            "description": "conflict: دسته تدریجی نیست یا قبلاً تمام شده است."
          }
        }
      }
    },
    "/sms/batches/{id}/resume": {
      "post": {
        "operationId": "smsBatchResume",
        "tags": [
          "sms"
        ],
        "summary": "ادامهٔ ارسال تدریجی",
        "description": "ارسال تدریجیِ متوقف‌شده را از سر می‌گیرد.\n\nپاسخ موفق بدون بدنه (۲۰۴) است. نوبت بعدی در همان بازهٔ تعریف‌شده آزاد می‌شود.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دستهٔ تدریجی."
            },
            "description": "شناسهٔ دستهٔ تدریجی.",
            "example": "918"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: دسته پیدا نشد یا متعلق به شما نیست."
          },
          "409": {
            "description": "conflict: دسته تدریجی نیست یا قبلاً تمام شده است."
          }
        }
      }
    },
    "/sms/messages/{id}/check": {
      "post": {
        "operationId": "smsCheck",
        "tags": [
          "sms"
        ],
        "summary": "استعلام فوری وضعیت تحویل",
        "description": "وضعیت نهایی پیام را همین حالا از اپراتور می‌پرسد.\n\nپلتفرم وضعیت تحویل را خودکار و در پس‌زمینه هم بررسی می‌کند؛ این مسیر برای وقتی است که نتیجه را فوری می‌خواهید. سقف ۳۰ درخواست در دقیقه. پاسخ همان ساختار `GET /sms/messages/{id}` را دارد.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ پیام."
            },
            "description": "شناسهٔ پیام.",
            "example": "5521"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "5521",
                  "status": "delivered",
                  "deliveredAt": "2026-10-30T10:20:03.000Z"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: پیام پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/broker/bots": {
      "get": {
        "operationId": "brokerList",
        "tags": [
          "broker"
        ],
        "summary": "فهرست ربات‌ها",
        "description": "فهرست رباتِ ثبت‌شده در بروکر با لینک اختصاصی و وضعیت.\n\n`entitled` نشان می‌دهد الان به بروکر دسترسی دارید یا نه. وقتی اشتراک/افزونه فعال نباشد، لینک‌ها `suspended` می‌شوند و با فعال‌شدن دوباره، خودکار برمی‌گردند.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "bots": [
                    {
                      "id": "31",
                      "link": "https://broker.irnoti.com/b3f9a1c2/9e1f0c…",
                      "label": "ربات فروشگاه",
                      "syncing": false,
                      "username": "my_shop_bot",
                      "createdAt": "2026-10-12T08:00:00.000Z",
                      "suspended": false,
                      "syncError": null,
                      "webhookUrl": null,
                      "webhookSetAt": null
                    }
                  ],
                  "maxBots": 3,
                  "entitled": true,
                  "needsSubscription": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "brokerCreate",
        "tags": [
          "broker"
        ],
        "summary": "ثبت ربات",
        "description": "توکن ربات را ثبت کنید و لینک اختصاصی بگیرید.\n\nتوکن از طریق بروکر با `getMe` سنجیده می‌شود و رمزنگاری‌شده ذخیره می‌شود؛ هرگز در پاسخ‌ها برنمی‌گردد. کلید API فقط وقتی کار می‌کند که اشتراک شما قابلیت «کلید وب‌سرویس» و بروکر را داشته باشد.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "description": "نام دلخواه (حداکثر ۸۰ نویسه)."
                  },
                  "service": {
                    "type": "string",
                    "description": "نوع سرویس؛ پیش‌فرض telegram."
                  },
                  "token": {
                    "type": "string",
                    "description": "توکن ربات از BotFather."
                  }
                },
                "required": [
                  "label",
                  "token"
                ]
              },
              "example": {
                "label": "ربات فروشگاه",
                "token": "123456789:AAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "31",
                  "link": "https://broker.irnoti.com/b3f9a1c2/9e1f0c…",
                  "label": "ربات فروشگاه",
                  "username": "my_shop_bot",
                  "suspended": false,
                  "webhookUrl": null
                }
              }
            }
          },
          "400": {
            "description": "invalid_token: تلگرام توکن را نپذیرفت."
          },
          "403": {
            "description": "subscription_required: برای استفاده اشتراک فعال لازم است."
          },
          "409": {
            "description": "bot_limit: به سقف تعداد ربات رسیده‌اید.\nbot_exists: این ربات قبلاً ثبت شده است."
          }
        }
      }
    },
    "/broker/bots/{id}": {
      "get": {
        "operationId": "brokerGet",
        "tags": [
          "broker"
        ],
        "summary": "مشاهدهٔ یک ربات",
        "description": "جزئیات یک ربات شامل لینک و آدرس وب‌هوک ثبت‌شده.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسه ربات در بروکر."
            },
            "description": "شناسه ربات در بروکر.",
            "example": "31"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "31",
                  "link": "https://broker.irnoti.com/b3f9a1c2/9e1f0c…",
                  "label": "ربات فروشگاه",
                  "syncing": false,
                  "username": "my_shop_bot",
                  "createdAt": "2026-10-12T08:00:00.000Z",
                  "suspended": false,
                  "syncError": null,
                  "webhookUrl": null,
                  "webhookSetAt": null
                }
              }
            }
          },
          "404": {
            "description": ": ربات پیدا نشد."
          }
        }
      },
      "patch": {
        "operationId": "brokerRename",
        "tags": [
          "broker"
        ],
        "summary": "ویرایش نام",
        "description": "نام نمایشی ربات را عوض کنید.\n\nپاسخ موفق بدون بدنه (۲۰۴) است.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسه ربات در بروکر."
            },
            "description": "شناسه ربات در بروکر.",
            "example": "31"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "description": "نام جدید."
                  }
                },
                "required": [
                  "label"
                ]
              },
              "example": {
                "label": "ربات پشتیبانی"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "brokerDelete",
        "tags": [
          "broker"
        ],
        "summary": "حذف ربات",
        "description": "ربات را از بروکر حذف کنید؛ لینک و ثبت بروکر پاک می‌شود.\n\nپاسخ موفق بدون بدنه (۲۰۴) است. ربات خود در تلگرام دست‌نخورده می‌ماند.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسه ربات در بروکر."
            },
            "description": "شناسه ربات در بروکر.",
            "example": "31"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          }
        }
      }
    },
    "/broker/bots/{id}/token": {
      "put": {
        "operationId": "brokerToken",
        "tags": [
          "broker"
        ],
        "summary": "تعویض توکن",
        "description": "بعد از ساخت توکن جدید در BotFather، آن را برای همین ربات جایگزین کنید.\n\nلینک جدید ساخته می‌شود، ثبت قبلی حذف می‌شود و وب‌هوک قبلی پاک می‌شود (دوباره تنظیمش کنید).\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسه ربات در بروکر."
            },
            "description": "شناسه ربات در بروکر.",
            "example": "31"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "description": "توکن جدید."
                  }
                },
                "required": [
                  "token"
                ]
              },
              "example": {
                "token": "987654321:BBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "link": "https://broker.irnoti.com/c7d2e4aa/1a2b3c…"
                }
              }
            }
          },
          "409": {
            "description": "same_token: همان توکن فعلی است."
          }
        }
      }
    },
    "/broker/bots/{id}/rotate": {
      "post": {
        "operationId": "brokerRotate",
        "tags": [
          "broker"
        ],
        "summary": "لینک جدید",
        "description": "اگر لینک لو رفت، لینک تازه بسازید؛ لینک قبلی از کار می‌افتد.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسه ربات در بروکر."
            },
            "description": "شناسه ربات در بروکر.",
            "example": "31"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "link": "https://broker.irnoti.com/b3f9a1c2/77aa00…"
                }
              }
            }
          }
        }
      }
    },
    "/broker/bots/{id}/request": {
      "post": {
        "operationId": "brokerRequest",
        "tags": [
          "broker"
        ],
        "summary": "ارسال درخواست به تلگرام",
        "description": "هر متد Bot API (sendMessage، sendPhoto، getChat، …) را از طریق بروکر اجرا کنید.\n\n`method` نام متد تلگرام و `params` پارامترهای آن (JSON) است. جواب خودِ تلگرام در `response` و کد HTTP آن در `status` برمی‌گردد؛ خطای تلگرام هم همین‌جا می‌آید. آپلود فایل مستقیم (multipart) پشتیبانی نمی‌شود؛ `file_id` یا URL بدهید، یا مستقیم با لینک ربات کار کنید. متدهای `logOut` و `close` مجاز نیستند و `setWebhook` / `deleteWebhook` مثل نقطه‌های وب‌هوک ثبت می‌شوند.\n\nدسترسی لازم (scope): `broker.request`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.request",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسه ربات در بروکر."
            },
            "description": "شناسه ربات در بروکر.",
            "example": "31"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "method": {
                    "type": "string",
                    "description": "نام متد Bot API."
                  },
                  "params": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "پارامترهای متد."
                  }
                },
                "required": [
                  "method"
                ]
              },
              "example": {
                "method": "sendMessage",
                "params": {
                  "text": "سلام از ایران 👋",
                  "chat_id": 123456789
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "status": 200,
                  "response": {
                    "ok": true,
                    "result": {
                      "chat": {
                        "id": 123456789
                      },
                      "text": "سلام از ایران 👋",
                      "message_id": 55
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_method: نام متد معتبر یا مجاز نیست."
          },
          "403": {
            "description": "subscription_required: اشتراک یا افزونهٔ بروکر فعال نیست."
          },
          "503": {
            "description": "broker_unavailable: اتصال به بروکر برقرار نشد؛ کمی بعد دوباره تلاش کنید."
          }
        }
      }
    },
    "/broker/bots/{id}/updates": {
      "post": {
        "operationId": "brokerUpdates",
        "tags": [
          "broker"
        ],
        "summary": "دریافت درخواست‌ها (Polling)",
        "description": "پیام‌های رسیده به ربات را بخوانید (getUpdates)، بدون نیاز به سرور وب‌هوک.\n\nفقط وقتی وب‌هوک تنظیم نیست کار می‌کند (قانون تلگرام). برای تأیید دریافت، `offset` را برابر `update_id` آخر + ۱ بگذارید. `timeout` تا ۲۵ ثانیه برای long polling.\n\nدسترسی لازم (scope): `broker.request`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.request",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسه ربات در بروکر."
            },
            "description": "شناسه ربات در بروکر.",
            "example": "31"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "offset": {
                    "type": "number",
                    "description": "شناسهٔ اولین آپدیت موردنظر."
                  },
                  "limit": {
                    "type": "number",
                    "description": "۱ تا ۱۰۰ (پیش‌فرض ۱۰۰)."
                  },
                  "timeout": {
                    "type": "number",
                    "description": "ثانیه، حداکثر ۲۵."
                  },
                  "allowedUpdates": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "نوع آپدیت‌های موردنظر."
                  }
                },
                "required": []
              },
              "example": {
                "limit": 10,
                "timeout": 10
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق\n: اگر وب‌هوک فعال باشد، تلگرام در response خطای 409 می‌دهد؛ اول وب‌هوک را حذف کنید."
          }
        }
      }
    },
    "/broker/bots/{id}/webhook": {
      "get": {
        "operationId": "brokerWebhookGet",
        "tags": [
          "broker"
        ],
        "summary": "وضعیت وب‌هوک",
        "description": "آدرس بازگشتی (وب‌هوک) تنظیم‌شده و وضعیت تحویل آن.\n\n`url` همان آدرس سرور شماست (نه آدرس داخلی بروکر). `info` پاسخ getWebhookInfo تلگرام است (آپدیت‌های در صف، آخرین خطا).\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسه ربات در بروکر."
            },
            "description": "شناسه ربات در بروکر.",
            "example": "31"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "url": "https://shop.example.ir/telegram",
                  "info": {
                    "ok": true,
                    "result": {
                      "url": "https://shop.example.ir/telegram",
                      "pending_update_count": 0
                    }
                  },
                  "setAt": "2026-10-12T08:30:00.000Z",
                  "status": 200
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "brokerWebhookSet",
        "tags": [
          "broker"
        ],
        "summary": "تنظیم آدرس بازگشتی (وب‌هوک)",
        "description": "آدرس سرور خودتان را بدهید؛ آپدیت‌های تلگرام از طریق بروکر به همان آدرس POST می‌شوند.\n\nآدرس باید http/https عمومی باشد (آدرس شبکهٔ داخلی رد می‌شود). اگر `secretToken` بدهید، بروکر آن را در هدر `X-Telegram-Bot-Api-Secret-Token` هر درخواست می‌فرستد تا اصالت را بسنجید. آدرس در پنل هم نمایش داده می‌شود. پاسخ سرور شما (مثلاً reply درون‌خطی) به تلگرام برمی‌گردد.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسه ربات در بروکر."
            },
            "description": "شناسه ربات در بروکر.",
            "example": "31"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "آدرس وب‌هوک سرور شما."
                  },
                  "secretToken": {
                    "type": "string",
                    "description": "حداکثر ۲۵۶ نویسه: حروف لاتین، عدد، _ و -."
                  },
                  "allowedUpdates": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "مثلاً [\"message\", \"callback_query\"]."
                  },
                  "dropPendingUpdates": {
                    "type": "boolean",
                    "description": "پاک‌کردن آپدیت‌های معلق."
                  }
                },
                "required": [
                  "url"
                ]
              },
              "example": {
                "url": "https://shop.example.ir/telegram",
                "secretToken": "my_secret_123"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "status": 200,
                  "response": {
                    "ok": true,
                    "result": true,
                    "description": "Webhook was set"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_webhook_url: آدرس نامعتبر یا داخلی است."
          }
        }
      },
      "delete": {
        "operationId": "brokerWebhookDelete",
        "tags": [
          "broker"
        ],
        "summary": "حذف وب‌هوک",
        "description": "وب‌هوک را بردارید (برای استفاده از getUpdates).\n\nبدنهٔ اختیاری: `{ \"dropPendingUpdates\": true }`.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسه ربات در بروکر."
            },
            "description": "شناسه ربات در بروکر.",
            "example": "31"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "status": 200,
                  "response": {
                    "ok": true,
                    "result": true
                  }
                }
              }
            }
          }
        }
      }
    },
    "/broker/bots/{id}/move": {
      "post": {
        "operationId": "brokerMove",
        "tags": [
          "broker"
        ],
        "summary": "انتقال ربات به پروژه",
        "description": "ربات را به یک پروژهٔ سازمانی منتقل می‌کند.\n\nفقط مالک حساب می‌تواند. پس از انتقال، اعضای پروژه طبق نقش خود به ربات دسترسی دارند.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ربات."
            },
            "description": "شناسهٔ ربات.",
            "example": "31"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "projectId": {
                    "type": "string",
                    "description": "شناسهٔ پروژهٔ مقصد."
                  }
                },
                "required": [
                  "projectId"
                ]
              },
              "example": {
                "projectId": "4"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "31",
                  "projectId": "4"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ربات یا پروژه پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/phonebook/groups": {
      "get": {
        "operationId": "listGroups",
        "tags": [
          "phonebook"
        ],
        "summary": "گروه‌های دفترچه تلفن",
        "description": "فهرست گروه‌ها با تعداد مخاطبین.\n\nشناسه گروه را در `groupIds` ارسال گروهی استفاده کنید.\n\nدسترسی لازم (scope): `phonebook.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "12",
                    "name": "مشتریان",
                    "contacts": 1840,
                    "createdAt": "2026-09-20T08:00:00.000Z"
                  }
                ]
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createGroup",
        "tags": [
          "phonebook"
        ],
        "summary": "ساخت گروه",
        "description": "یک گروه جدید در دفترچه تلفن بسازید.\n\nنام گروه باید یکتا باشد.\n\nدسترسی لازم (scope): `phonebook.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.write",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام گروه (حداکثر ۱۲۰ نویسه)."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "مشتریان وفادار"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "13",
                  "name": "مشتریان وفادار"
                }
              }
            }
          },
          "409": {
            "description": ": گروهی با این نام وجود دارد."
          }
        }
      }
    },
    "/phonebook/groups/{id}/contacts": {
      "post": {
        "operationId": "addContacts",
        "tags": [
          "phonebook"
        ],
        "summary": "افزودن مخاطب",
        "description": "افزودن چند مخاطب به یک گروه.\n\nشماره‌های نامعتبر و تکراری رد می‌شوند و در پاسخ شمارش می‌شوند؛ باقی ثبت می‌شود. حداکثر ۱۰٬۰۰۰ مخاطب در هر درخواست.\n\nدسترسی لازم (scope): `phonebook.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسه گروه."
            },
            "description": "شناسه گروه.",
            "example": "12"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contacts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "description": "آرایه‌ای از `{ mobile, name? }`."
                  }
                },
                "required": [
                  "contacts"
                ]
              },
              "example": {
                "contacts": [
                  {
                    "name": "علی",
                    "mobile": "09121234567"
                  },
                  {
                    "mobile": "09351234567"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "added": 2,
                  "invalid": 0,
                  "duplicates": 0
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "pbGroupContacts",
        "tags": [
          "phonebook"
        ],
        "summary": "مخاطبین یک گروه",
        "description": "فهرست اعضای گروه با جست‌وجو و صفحه‌بندی.\n\nیا صفحه‌بندی عددی (`page`/`pageSize`) یا مکان‌نمایی (`take`/`after`). `q` در نام، شماره و ایمیل جست‌وجو می‌کند.\n\nدسترسی لازم (scope): `phonebook.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ گروه."
            },
            "description": "شناسهٔ گروه.",
            "example": "12"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "عبارت جست‌وجو."
            },
            "description": "عبارت جست‌وجو."
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "شمارهٔ صفحه."
            },
            "description": "شمارهٔ صفحه."
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "اندازهٔ صفحه."
            },
            "description": "اندازهٔ صفحه."
          },
          {
            "name": "take",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "تعداد (حالت مکان‌نما)."
            },
            "description": "تعداد (حالت مکان‌نما).",
            "example": "2"
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "شناسهٔ آخرین ردیف صفحهٔ قبل."
            },
            "description": "شناسهٔ آخرین ردیف صفحهٔ قبل."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "801",
                    "name": "علی",
                    "mobile": "09121234567",
                    "optedOut": false
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: گروه پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/phonebook/groups/{id}": {
      "get": {
        "operationId": "pbGroupGet",
        "tags": [
          "phonebook"
        ],
        "summary": "جزئیات گروه",
        "description": "مشخصات یک گروه و تعداد اعضا.\n\nشامل نام، توضیح، تعداد مخاطب و تعداد لغو عضویت‌شده‌ها.\n\nدسترسی لازم (scope): `phonebook.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ گروه."
            },
            "description": "شناسهٔ گروه.",
            "example": "12"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "12",
                  "name": "مشتریان ویژه",
                  "optedOut": 4,
                  "description": null,
                  "contactCount": 340
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: گروه پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "patch": {
        "operationId": "pbGroupUpdate",
        "tags": [
          "phonebook"
        ],
        "summary": "ویرایش گروه",
        "description": "نام یا توضیح گروه را تغییر می‌دهد.\n\nفقط فیلدهای ارسالی تغییر می‌کنند.\n\nدسترسی لازم (scope): `phonebook.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ گروه."
            },
            "description": "شناسهٔ گروه.",
            "example": "12"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام جدید (حداکثر ۱۲۰ نویسه)."
                  },
                  "description": {
                    "type": "string",
                    "description": "توضیح (حداکثر ۳۰۰ نویسه)."
                  }
                },
                "required": []
              },
              "example": {
                "name": "مشتریان طلایی"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "12",
                  "name": "مشتریان طلایی"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: گروه پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "pbGroupDelete",
        "tags": [
          "phonebook"
        ],
        "summary": "حذف گروه",
        "description": "گروه را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴). خود مخاطبان حذف نمی‌شوند و در «همهٔ مخاطبان» می‌مانند.\n\nدسترسی لازم (scope): `phonebook.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ گروه."
            },
            "description": "شناسهٔ گروه.",
            "example": "12"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: گروه پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/phonebook/groups/{id}/import": {
      "post": {
        "operationId": "pbGroupImport",
        "tags": [
          "phonebook"
        ],
        "summary": "درون‌ریزی مخاطب از فایل",
        "description": "فایل CSV/TXT را به گروه اضافه می‌کند.\n\nدرخواست `multipart/form-data` با فیلد `file` (حداکثر ۵ مگابایت). هر خط: `شماره[,نام]`. پاسخ مثل افزودن مخاطب شامل `added`، `duplicates` و `invalid` است.\n\nدسترسی لازم (scope): `phonebook.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ گروه."
            },
            "description": "شناسهٔ گروه.",
            "example": "12"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "description": "فایل CSV یا TXT."
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "added": 120,
                  "invalid": 1,
                  "duplicates": 3
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: گروه پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/phonebook/groups/{id}/members": {
      "post": {
        "operationId": "pbGroupMembersAdd",
        "tags": [
          "phonebook"
        ],
        "summary": "افزودن مخاطب موجود به گروه",
        "description": "مخاطبین موجود را به گروه هم اضافه می‌کند (عضویت در چند گروه ممکن است).\n\nتا ۵۰۰۰ شناسه در هر درخواست.\n\nدسترسی لازم (scope): `phonebook.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ گروه."
            },
            "description": "شناسهٔ گروه.",
            "example": "12"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contactIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شناسهٔ مخاطبین."
                  }
                },
                "required": [
                  "contactIds"
                ]
              },
              "example": {
                "contactIds": [
                  "801",
                  "802"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "added": 2
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: گروه پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/phonebook/groups/{id}/contacts/{contactId}": {
      "delete": {
        "operationId": "pbGroupMemberRemove",
        "tags": [
          "phonebook"
        ],
        "summary": "خروج یک مخاطب از گروه",
        "description": "مخاطب را فقط از این گروه خارج می‌کند.\n\nپاسخ بدون بدنه (۲۰۴). خود مخاطب حذف نمی‌شود.\n\nدسترسی لازم (scope): `phonebook.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ گروه."
            },
            "description": "شناسهٔ گروه.",
            "example": "12"
          },
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ مخاطب."
            },
            "description": "شناسهٔ مخاطب.",
            "example": "801"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: گروه یا مخاطب پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/phonebook/groups/{id}/members/remove": {
      "post": {
        "operationId": "pbGroupMembersRemove",
        "tags": [
          "phonebook"
        ],
        "summary": "خروج چند مخاطب از گروه",
        "description": "چند مخاطب را یک‌جا از گروه بیرون می‌آورد.\n\nتا ۵۰۰ شناسه. پاسخ تعداد خارج‌شده‌ها را می‌دهد.\n\nدسترسی لازم (scope): `phonebook.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ گروه."
            },
            "description": "شناسهٔ گروه.",
            "example": "12"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contactIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شناسهٔ مخاطبین."
                  }
                },
                "required": [
                  "contactIds"
                ]
              },
              "example": {
                "contactIds": [
                  "801",
                  "802"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "removed": 2
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: گروه پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/phonebook/contacts": {
      "get": {
        "operationId": "pbContacts",
        "tags": [
          "phonebook"
        ],
        "summary": "همهٔ مخاطبان",
        "description": "همهٔ افراد دفترچه (پیامک، ایمیل، دستگاه‌های اپ، فرم‌ها).\n\n`groupless=1` فقط مخاطبانی را می‌دهد که در هیچ گروهی نیستند.\n\nدسترسی لازم (scope): `phonebook.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "عبارت جست‌وجو."
            },
            "description": "عبارت جست‌وجو."
          },
          {
            "name": "groupless",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "`1` یا `true` برای مخاطبان بدون گروه."
            },
            "description": "`1` یا `true` برای مخاطبان بدون گروه.",
            "example": "1"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "شمارهٔ صفحه."
            },
            "description": "شمارهٔ صفحه."
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "اندازهٔ صفحه."
            },
            "description": "اندازهٔ صفحه."
          },
          {
            "name": "take",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "تعداد (حالت مکان‌نما)."
            },
            "description": "تعداد (حالت مکان‌نما).",
            "example": "20"
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "شناسهٔ آخرین ردیف."
            },
            "description": "شناسهٔ آخرین ردیف."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "801",
                    "name": "علی",
                    "email": null,
                    "mobile": "09121234567"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "pbContactCreate",
        "tags": [
          "phonebook"
        ],
        "summary": "ساخت مخاطب",
        "description": "یک مخاطب با جزئیات کامل می‌سازد و می‌تواند هم‌زمان به گروه‌ها اضافه کند.\n\nحداقل یکی از `mobile` یا `email` لازم است. `birth` را شمسی بدهید (`YYYY/MM/DD` یا `MM/DD`) و در پایگاه داده میلادی ذخیره می‌شود. `fields` تا ۱۲ فیلد دلخواه (کلید ≤۴۰، مقدار ≤۲۰۰ نویسه).\n\nدسترسی لازم (scope): `phonebook.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.write",
        "x-sandbox": false,
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mobile": {
                    "type": "string",
                    "description": "شمارهٔ موبایل."
                  },
                  "email": {
                    "type": "string",
                    "description": "ایمیل."
                  },
                  "name": {
                    "type": "string",
                    "description": "نام."
                  },
                  "lastName": {
                    "type": "string",
                    "description": "نام خانوادگی."
                  },
                  "company": {
                    "type": "string",
                    "description": "شرکت."
                  },
                  "city": {
                    "type": "string",
                    "description": "شهر."
                  },
                  "note": {
                    "type": "string",
                    "description": "یادداشت."
                  },
                  "birth": {
                    "type": "string",
                    "description": "تولد شمسی."
                  },
                  "fields": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "فیلدهای دلخواه."
                  },
                  "groupIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "گروه‌هایی که مخاطب به آن‌ها اضافه شود (حداکثر ۵۰)."
                  },
                  "optedOut": {
                    "type": "boolean",
                    "description": "لغو عضویت از ارسال‌ها."
                  }
                },
                "required": []
              },
              "example": {
                "name": "علی",
                "birth": "1370/05/12",
                "mobile": "09121234567",
                "groupIds": [
                  "12"
                ],
                "lastName": "رضایی"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "801",
                  "name": "علی",
                  "mobile": "09121234567"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/phonebook/contacts/delete": {
      "post": {
        "operationId": "pbContactsDelete",
        "tags": [
          "phonebook"
        ],
        "summary": "حذف گروهی مخاطبان",
        "description": "چند مخاطب را از همهٔ گروه‌ها، ایمیل و دستگاه‌ها حذف می‌کند.\n\nتا ۵۰۰ شناسه در هر درخواست؛ برگشت‌پذیر نیست.\n\nدسترسی لازم (scope): `phonebook.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.write",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contactIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شناسهٔ مخاطبین."
                  }
                },
                "required": [
                  "contactIds"
                ]
              },
              "example": {
                "contactIds": [
                  "801",
                  "802"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "deleted": 2
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/phonebook/contacts/{id}": {
      "patch": {
        "operationId": "pbContactUpdate",
        "tags": [
          "phonebook"
        ],
        "summary": "ویرایش مخاطب",
        "description": "فیلدهای مخاطب را به‌روز می‌کند.\n\nفقط فیلدهای ارسالی تغییر می‌کنند. `optedOut: true` مخاطب را از همهٔ ارسال‌ها کنار می‌گذارد.\n\nدسترسی لازم (scope): `phonebook.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ مخاطب."
            },
            "description": "شناسهٔ مخاطب.",
            "example": "801"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mobile": {
                    "type": "string",
                    "description": "موبایل."
                  },
                  "name": {
                    "type": "string",
                    "description": "نام."
                  },
                  "email": {
                    "type": "string",
                    "description": "ایمیل."
                  },
                  "optedOut": {
                    "type": "boolean",
                    "description": "لغو عضویت."
                  },
                  "fields": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "فیلدهای دلخواه."
                  }
                },
                "required": []
              },
              "example": {
                "name": "علی‌اکبر"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "801",
                  "name": "علی‌اکبر"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: مخاطب پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "pbContactDelete",
        "tags": [
          "phonebook"
        ],
        "summary": "حذف مخاطب",
        "description": "مخاطب را از همه‌جا حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `phonebook.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "phonebook.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ مخاطب."
            },
            "description": "شناسهٔ مخاطب.",
            "example": "801"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: مخاطب پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/wallet": {
      "get": {
        "operationId": "getWallet",
        "tags": [
          "account"
        ],
        "summary": "اعتبار",
        "description": "موجودی کیف پول به ریال.\n\nمبلغ‌ها همیشه عدد صحیح به ریال و به‌صورت رشته برگردانده می‌شوند تا دقت از بین نرود.\n\nدسترسی لازم (scope): `wallet.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "wallet.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "balance": "1840000",
                  "currency": "IRR"
                }
              }
            }
          }
        }
      }
    },
    "/wallet/transactions": {
      "get": {
        "operationId": "walletTransactions",
        "tags": [
          "account"
        ],
        "summary": "تراکنش‌های کیف پول",
        "description": "تاریخچهٔ تراکنش‌های مالی (شارژ، کسر، بازگشت).\n\nبا `page`/`pageSize` صفحه‌بندی می‌شود؛ بدون آن‌ها کل تاریخچهٔ اخیر برمی‌گردد. مبالغ ریال و رشته‌اند، تاریخ‌ها UTC (ISO 8601).\n\nدسترسی لازم (scope): `wallet.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "wallet.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "شمارهٔ صفحه."
            },
            "description": "شمارهٔ صفحه.",
            "example": "1"
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "اندازهٔ صفحه."
            },
            "description": "اندازهٔ صفحه.",
            "example": "20"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "items": [
                    {
                      "id": "5001",
                      "type": "debit",
                      "amount": "980",
                      "createdAt": "2026-10-30T10:20:00.000Z",
                      "description": "ارسال پیامک",
                      "balanceAfter": "499020"
                    }
                  ],
                  "total": 1
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/send": {
      "post": {
        "operationId": "sendEmail",
        "tags": [
          "email"
        ],
        "summary": "ارسال ایمیل",
        "description": "ارسال ایمیل تراکنشی با متن/HTML، پیوست، قالب و زمان‌بندی.\n\nنامه از صف عبور می‌کند و پاسخ `202` فوراً برمی‌گردد؛ وضعیت نهایی (ارسال، تحویل، بازگشت) را با `GET /email/outbound/{id}` یا وب‌هوک‌های `email.sent`، `email.delivered`، `email.bounced`، `email.complained` و `email.failed` دریافت کنید.\n\n**فرستنده (`from`)** باید یکی از صندوق‌های شما یا نشانی‌ای از یکی از دامنه‌های **تأییدشدهٔ** شما باشد. **هزینه** به‌ترتیب از سهمیهٔ ماهانهٔ بسته، بستهٔ ارسال و در پایان کیف پول (در صورت فعال بودن پرداخت به‌ازای ارسال) کم می‌شود و اگر نامه هرگز ارسال نشود برمی‌گردد. گیرندگانی که در فهرست ممنوعه (بازگشتی، شکایت، لغو اشتراک) باشند حذف می‌شوند؛ اگر همه حذف شوند خطای `422 all_suppressed` می‌گیرید.\n\nبا فیلد `template` می‌توانید به‌جای `subject/html/text` نام قالب و مقدار متغیرها را بدهید (`{{name}}` در قالب).\n\n**فیلدهای پاسخ:** `id`، `status` (`queued|sent|failed`)، `recipients`، `billedVia` (`plan|pack|wallet|mixed`)، `cost` و `duplicate` (اگر همان `Idempotency-Key` قبلاً دیده شده باشد).\n\nدسترسی لازم (scope): `email.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "کلید یکتا؛ تکرار درخواست نه دوباره می‌فرستد و نه دوباره هزینه می‌گیرد."
            },
            "description": "کلید یکتا؛ تکرار درخواست نه دوباره می‌فرستد و نه دوباره هزینه می‌گیرد.",
            "example": "order-1042"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "description": "نشانی فرستنده (صندوق شما یا دامنهٔ تأییدشده)."
                  },
                  "fromName": {
                    "type": "string",
                    "description": "نام نمایشی فرستنده."
                  },
                  "to": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "گیرنده(ها)؛ حداکثر به تعداد مجاز بسته (پیش‌فرض ۵۰ در کل to/cc/bcc)."
                  },
                  "cc": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "رونوشت."
                  },
                  "bcc": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "رونوشت مخفی."
                  },
                  "replyTo": {
                    "type": "string",
                    "description": "نشانی پاسخ."
                  },
                  "subject": {
                    "type": "string",
                    "description": "موضوع (حداکثر ۵۰۰ نویسه)."
                  },
                  "text": {
                    "type": "string",
                    "description": "متن ساده."
                  },
                  "html": {
                    "type": "string",
                    "description": "متن HTML؛ اگر `text` نباشد از روی آن ساخته می‌شود."
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "description": "پیوست‌ها: `{filename, contentBase64, contentType?, cid?}` (حداکثر ۲۰ پیوست؛ مجموع طبق سقف بسته). با `cid` تصویر درون‌متنی می‌شود."
                  },
                  "headers": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "سرایند دلخواه (حداکثر ۱۰)، مثل `List-Unsubscribe`."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "برچسب‌های آماری (حداکثر ۱۰)."
                  },
                  "scheduledAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "ارسال در آینده (تا یک سال)."
                  },
                  "template": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "`{name, variables}` برای استفاده از قالب ذخیره‌شده."
                  }
                },
                "required": [
                  "from",
                  "to"
                ]
              },
              "example": {
                "to": [
                  "customer@gmail.com"
                ],
                "from": "noreply@example.ir",
                "html": "<p>سلام! سفارش <b>۱۰۴۲</b> ثبت شد.</p>",
                "tags": [
                  "order"
                ],
                "subject": "سفارش شما ثبت شد",
                "fromName": "فروشگاه نمونه"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "5012",
                  "to": [
                    "customer@gmail.com"
                  ],
                  "cost": "0",
                  "from": "noreply@example.ir",
                  "error": null,
                  "sentAt": "2026-10-21T10:00:01.000Z",
                  "status": "sent",
                  "subject": "سفارش شما ثبت شد",
                  "billedVia": "plan",
                  "createdAt": "2026-10-21T10:00:00.000Z",
                  "duplicate": false,
                  "recipients": 1,
                  "scheduledAt": null
                }
              }
            }
          },
          "400": {
            "description": "bad_recipient: نشانی گیرنده معتبر نیست."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "email_no_credit: سهمیهٔ بسته، بستهٔ ارسال و موجودی کیف پول برای این ارسال کافی نیست."
          },
          "403": {
            "description": "sender_not_allowed: فرستنده متعلق به شما نیست.\ndomain_not_verified: دامنهٔ فرستنده هنوز تأیید نشده است.\nemail_sending_blocked: ارسال حساب به‌علت نرخ بازگشت/شکایت بالا مسدود شده است.\nfeature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          },
          "422": {
            "description": "all_suppressed: همهٔ گیرندگان در فهرست ممنوعه‌اند."
          },
          "429": {
            "description": "daily_limit: سقف ارسال روزانهٔ بسته پر شده است."
          }
        }
      }
    },
    "/email/outbound/{id}": {
      "get": {
        "operationId": "getEmailStatus",
        "tags": [
          "email"
        ],
        "summary": "وضعیت و رویدادهای یک ایمیل",
        "description": "وضعیت ارسال و خط زمانی رویدادها (ارسال، تحویل، بازگشت، شکایت).\n\nفیلد `events` شامل `sent`، `delivered`، `bounced`، `complained` یا `failed` همراه با گیرنده و توضیح سرور مقصد است. وضعیت‌ها: `queued`، `sending`، `sent`، `delivered`، `bounced`، `failed`، `complained`، `canceled`.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ برگشتی از `POST /email/send`."
            },
            "description": "شناسهٔ برگشتی از `POST /email/send`.",
            "example": "5012"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "5012",
                  "events": [
                    {
                      "id": "1",
                      "type": "sent",
                      "detail": null,
                      "createdAt": "2026-10-21T10:00:01.000Z",
                      "recipient": null
                    },
                    {
                      "id": "2",
                      "type": "delivered",
                      "detail": null,
                      "createdAt": "2026-10-21T10:00:04.000Z",
                      "recipient": "customer@gmail.com"
                    }
                  ],
                  "source": "api",
                  "status": "delivered",
                  "subject": "سفارش شما ثبت شد",
                  "toAddrs": [
                    "customer@gmail.com"
                  ],
                  "fromAddr": "noreply@example.ir",
                  "billedVia": "plan",
                  "recipients": 1
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          },
          "404": {
            "description": "not_found: ایمیل پیدا نشد."
          }
        }
      }
    },
    "/email/outbound": {
      "get": {
        "operationId": "listEmailOutbound",
        "tags": [
          "email"
        ],
        "summary": "فهرست ایمیل‌های ارسالی",
        "description": "ارسال‌های شما با فیلتر وضعیت و جستجو؛ صفحه‌بندی با `before`.\n\nپاسخ `{items, next}` است؛ `next` را به‌عنوان `before` بفرستید. خروجی CSV: `GET /email/outbound.csv`.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "`queued|sending|sent|delivered|bounced|failed|complained|canceled`"
            },
            "description": "`queued|sending|sent|delivered|bounced|failed|complained|canceled`",
            "example": "bounced"
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "`panel|api|smtp|system`"
            },
            "description": "`panel|api|smtp|system`"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "جستجو در موضوع و فرستنده."
            },
            "description": "جستجو در موضوع و فرستنده."
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "شناسه برای صفحهٔ بعد."
            },
            "description": "شناسه برای صفحهٔ بعد."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "description": "تا ۲۰۰ (پیش‌فرض ۵۰)."
            },
            "description": "تا ۲۰۰ (پیش‌فرض ۵۰).",
            "example": "20"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "next": null,
                  "items": [
                    {
                      "id": "5012",
                      "cost": "0",
                      "source": "api",
                      "status": "delivered",
                      "subject": "سفارش شما ثبت شد",
                      "toAddrs": [
                        "customer@gmail.com"
                      ],
                      "fromAddr": "noreply@example.ir",
                      "billedVia": "plan",
                      "recipients": 1
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          }
        }
      }
    },
    "/email/outbound/{id}/cancel": {
      "post": {
        "operationId": "cancelEmail",
        "tags": [
          "email"
        ],
        "summary": "لغو ایمیل زمان‌بندی‌شده",
        "description": "نامهٔ زمان‌بندی‌شدهٔ هنوز ارسال‌نشده را لغو و هزینه را برمی‌گرداند.\n\nفقط برای نامه‌های `queued` با `scheduledAt` در آینده؛ در غیر این صورت `409 cannot_cancel`.\n\nدسترسی لازم (scope): `email.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ایمیل."
            },
            "description": "شناسهٔ ایمیل.",
            "example": "5012"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          },
          "409": {
            "description": "cannot_cancel: نامه دیگر قابل لغو نیست."
          }
        }
      }
    },
    "/email/otp": {
      "get": {
        "operationId": "emailOtp",
        "tags": [
          "email"
        ],
        "summary": "آخرین کدهای تأیید در صندوق",
        "description": "کدهای OTP که در نامه‌های رسیده شناسایی شده‌اند (جدیدترین اول).\n\nکدها فارسی و انگلیسی شناسایی می‌شوند و فقط برای نامه‌های ۶ ساعت اخیر. با `since` فقط کدهای رسیده پس از آن زمان (زمان رسیدن به سامانه) را بگیرید.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "mailboxId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط یک صندوق."
            },
            "description": "فقط یک صندوق.",
            "example": "12"
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "کدهای رسیده پس از این زمان."
            },
            "description": "کدهای رسیده پس از این زمان."
          },
          {
            "name": "sender",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "بخشی از نام یا نشانی فرستنده (مثلاً `github`)."
            },
            "description": "بخشی از نام یا نشانی فرستنده (مثلاً `github`)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "description": "تا ۱۰۰."
            },
            "description": "تا ۱۰۰.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "9001",
                    "code": "905566",
                    "ageSec": 4,
                    "isRead": false,
                    "subject": "GitHub launch code",
                    "fromAddr": "noreply@github.com",
                    "mailboxId": "12",
                    "otpSender": "GitHub",
                    "receivedAt": "2026-10-21T10:00:00.000Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          }
        }
      }
    },
    "/email/otp/wait": {
      "get": {
        "operationId": "emailOtpWait",
        "tags": [
          "email"
        ],
        "summary": "انتظار برای کد تأیید جدید",
        "description": "تا رسیدن کد جدید (حداکثر ۶۰ ثانیه) صندوق را بررسی می‌کند؛ مناسب تست خودکار ورود.\n\nهر ۱–۲ ثانیه صندوق همگام و جست‌وجو می‌شود تا کدی پس از `since` برسد. اگر در مهلت `timeout` نرسد `409 otp_timeout` برمی‌گردد.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "mailboxId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "صندوقی که کد به آن می‌رسد."
            },
            "description": "صندوقی که کد به آن می‌رسد.",
            "example": "12"
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "پیش‌فرض: یک دقیقه پیش."
            },
            "description": "پیش‌فرض: یک دقیقه پیش."
          },
          {
            "name": "sender",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فیلتر فرستنده."
            },
            "description": "فیلتر فرستنده.",
            "example": "github"
          },
          {
            "name": "timeout",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "description": "ثانیه، ۱ تا ۶۰ (پیش‌فرض ۳۰)."
            },
            "description": "ثانیه، ۱ تا ۶۰ (پیش‌فرض ۳۰).",
            "example": "30"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "9001",
                  "code": "905566",
                  "ageSec": 2,
                  "subject": "GitHub launch code",
                  "fromAddr": "noreply@github.com",
                  "mailboxId": "12",
                  "otpSender": "GitHub",
                  "receivedAt": "2026-10-21T10:00:00.000Z"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          },
          "409": {
            "description": "otp_timeout: در مهلت تعیین‌شده کدی نرسید."
          }
        }
      }
    },
    "/email/messages": {
      "get": {
        "operationId": "listEmailMessages",
        "tags": [
          "email"
        ],
        "summary": "فهرست نامه‌های دریافتی",
        "description": "نامه‌های صندوق با پوشه، دسته، جستجو و صفحه‌بندی.\n\n`folder`: `inbox|sent|drafts|spam|trash|archive|all`. `category`: `primary|otp|updates|promotions|social`. پاسخ `{items, next}`.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "mailboxId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "یک صندوق (پیش‌فرض: همهٔ صندوق‌ها)."
            },
            "description": "یک صندوق (پیش‌فرض: همهٔ صندوق‌ها).",
            "example": "12"
          },
          {
            "name": "folder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "پیش‌فرض `inbox`."
            },
            "description": "پیش‌فرض `inbox`."
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "دستهٔ صندوق ورودی."
            },
            "description": "دستهٔ صندوق ورودی.",
            "example": "otp"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "جستجو در همهٔ پوشه‌ها."
            },
            "description": "جستجو در همهٔ پوشه‌ها."
          },
          {
            "name": "unread",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "فقط خوانده‌نشده."
            },
            "description": "فقط خوانده‌نشده."
          },
          {
            "name": "starred",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "فقط ستاره‌دار."
            },
            "description": "فقط ستاره‌دار."
          },
          {
            "name": "hasAttachment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "فقط با پیوست."
            },
            "description": "فقط با پیوست."
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "صفحهٔ بعد."
            },
            "description": "صفحهٔ بعد."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "description": "تا ۱۰۰."
            },
            "description": "تا ۱۰۰."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "next": null,
                  "items": [
                    {
                      "id": "9001",
                      "folder": "inbox",
                      "isRead": false,
                      "otpCode": "905566",
                      "snippet": "Your GitHub code: 905566",
                      "subject": "GitHub launch code",
                      "category": "otp",
                      "fromAddr": "noreply@github.com",
                      "fromName": "GitHub",
                      "isStarred": false,
                      "mailboxId": "12",
                      "receivedAt": "2026-10-21T10:00:00.000Z",
                      "hasAttachments": false
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          }
        }
      }
    },
    "/email/messages/{id}": {
      "get": {
        "operationId": "getEmailMessage",
        "tags": [
          "email"
        ],
        "summary": "خواندن یک نامه",
        "description": "متن کامل نامه با HTML امن‌شده و فهرست پیوست‌ها.\n\nHTML نامه از اسکریپت و فرم پاک و تصاویر خارجی مسدود می‌شود (`blockedImages` تعداد را می‌گوید؛ با `images=1` نمایش داده می‌شود). خواندن، نامه را «خوانده» می‌کند.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ نامه."
            },
            "description": "شناسهٔ نامه.",
            "example": "9001"
          },
          {
            "name": "images",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "`1` برای نمایش تصاویر خارجی."
            },
            "description": "`1` برای نمایش تصاویر خارجی."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "9001",
                  "html": null,
                  "otpCode": "905566",
                  "subject": "GitHub launch code",
                  "bodyText": "Your GitHub code: 905566",
                  "fromAddr": "noreply@github.com",
                  "attachments": [],
                  "blockedImages": 0
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          },
          "404": {
            "description": "not_found: نامه پیدا نشد."
          }
        }
      }
    },
    "/email/messages/actions": {
      "post": {
        "operationId": "emailMessageActions",
        "tags": [
          "email"
        ],
        "summary": "عملیات روی نامه‌ها",
        "description": "خوانده/ستاره/انتقال/حذف/هرزنامه/برچسب برای چند نامه.\n\n`action`: `read unread star unstar trash delete spam notspam archive inbox move label unlabel`. `delete` در سطل زباله برای همیشه حذف می‌کند و در غیر آن به سطل می‌برد. تغییر روی سرور ایمیل هم اعمال می‌شود تا سایر برنامه‌ها هماهنگ بمانند.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "تا ۵۰۰ شناسه."
                  },
                  "action": {
                    "type": "string",
                    "description": "یکی از عملیات بالا."
                  },
                  "folder": {
                    "type": "string",
                    "description": "برای `move`."
                  },
                  "labelId": {
                    "type": "string",
                    "description": "برای `label` و `unlabel`."
                  }
                },
                "required": [
                  "ids",
                  "action"
                ]
              },
              "example": {
                "ids": [
                  "9001",
                  "9002"
                ],
                "action": "archive"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "affected": 2
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          }
        }
      }
    },
    "/email/domains": {
      "get": {
        "operationId": "listEmailDomains",
        "tags": [
          "email"
        ],
        "summary": "فهرست دامنه‌ها",
        "description": "دامنه‌های شما با وضعیت تأیید و شمار صندوق.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "3",
                    "name": "example.ir",
                    "_count": {
                      "aliases": 1,
                      "mailboxes": 4
                    },
                    "status": "verified",
                    "dnsState": {
                      "mx": true,
                      "spf": true,
                      "txt": true,
                      "dkim": true,
                      "dmarc": false
                    }
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          }
        }
      },
      "post": {
        "operationId": "addEmailDomain",
        "tags": [
          "email"
        ],
        "summary": "افزودن دامنه",
        "description": "دامنه را ثبت و رکوردهای DNS لازم را برمی‌گرداند.\n\n`mode`: `hosted` (ایمیل سازمانی؛ دریافت و ارسال) یا `sending` (فقط ارسال). رکوردها را در DNS دامنه ثبت و سپس `POST /email/domains/{id}/check` را صدا بزنید.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام دامنه."
                  },
                  "mode": {
                    "type": "string",
                    "description": "`hosted` (پیش‌فرض) یا `sending`."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "mode": "hosted",
                "name": "example.ir"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "3",
                  "name": "example.ir",
                  "status": "pending",
                  "records": [
                    {
                      "host": "example.ir",
                      "type": "TXT",
                      "value": "irnoti-verify=…",
                      "purpose": "verify"
                    },
                    {
                      "host": "example.ir",
                      "type": "MX",
                      "value": "mail.irnoti.com",
                      "purpose": "mx",
                      "priority": 10
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "plan_limit: سقف دامنهٔ بسته پر است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          },
          "409": {
            "description": "domain_taken: دامنه قبلاً ثبت شده است."
          }
        }
      }
    },
    "/email/domains/{id}/check": {
      "post": {
        "operationId": "checkEmailDomain",
        "tags": [
          "email"
        ],
        "summary": "بررسی رکوردهای DNS",
        "description": "DNS را بررسی و در صورت کامل بودن دامنه را تأیید می‌کند.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دامنه."
            },
            "description": "شناسهٔ دامنه.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "ready": true,
                  "state": {
                    "mx": true,
                    "spf": true,
                    "txt": true,
                    "dkim": true,
                    "dmarc": true
                  },
                  "status": "verified"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          }
        }
      }
    },
    "/email/mailboxes": {
      "post": {
        "operationId": "createEmailMailbox",
        "tags": [
          "email"
        ],
        "summary": "ساخت صندوق سازمانی",
        "description": "برای دامنهٔ خود صندوق (و زیرمجموعه) بسازید.\n\nاگر `password` ندهید رمز خودکار ساخته و **فقط همین یک‌بار** در پاسخ برگردانده می‌شود (روی سرور فقط هش آن می‌ماند). `parentId` صندوق را زیرمجموعهٔ صندوق دیگر می‌کند. نیازمند احراز هویت تأییدشده.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domainId": {
                    "type": "string",
                    "description": "شناسهٔ دامنه."
                  },
                  "local": {
                    "type": "string",
                    "description": "بخش قبل از @."
                  },
                  "displayName": {
                    "type": "string",
                    "description": "نام نمایشی."
                  },
                  "password": {
                    "type": "string",
                    "description": "حداقل ۱۰ نویسه."
                  },
                  "quotaMb": {
                    "type": "number",
                    "description": "حجم؛ حداکثر سقف بسته."
                  },
                  "parentId": {
                    "type": "string",
                    "description": "صندوق والد."
                  }
                },
                "required": [
                  "domainId",
                  "local"
                ]
              },
              "example": {
                "local": "support",
                "domainId": "3",
                "displayName": "پشتیبانی"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "mailbox": {
                    "id": "15",
                    "kind": "hosted",
                    "status": "active",
                    "address": "support@example.ir"
                  },
                  "password": "p9Kx…"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "plan_limit: سقف صندوق‌های بسته پر است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          },
          "409": {
            "description": "address_taken: این نشانی قبلاً استفاده شده است."
          }
        }
      },
      "get": {
        "operationId": "emailListMailboxes",
        "tags": [
          "email"
        ],
        "summary": "فهرست صندوق‌ها",
        "description": "صندوق‌های سازمانی و حساب‌های شخصی متصل‌شدهٔ شما، و صندوق‌هایی که به شما تخصیص داده شده است.\n\n`kind` برابر `hosted` (صندوق روی دامنهٔ شما) یا `external` (Gmail، Yahoo، Outlook و سرور شخصی) است. `lastError` آخرین خطای همگام‌سازی را نشان می‌دهد؛ مثلاً رمز برنامهٔ منقضی‌شده.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "12",
                    "kind": "hosted",
                    "status": "active",
                    "address": "sales@example.ir",
                    "quotaMb": 2048,
                    "lastError": null,
                    "usedBytes": 5242880,
                    "lastSyncAt": "2026-10-24T08:30:00.000Z",
                    "displayName": "فروش"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/templates": {
      "put": {
        "operationId": "putEmailTemplate",
        "tags": [
          "email"
        ],
        "summary": "ساخت یا بروزرسانی قالب",
        "description": "قالب ایمیل تراکنشی با متغیر `{{name}}`.\n\nمقدار متغیرها در HTML امن‌سازی می‌شود. در ارسال: `\"template\": {\"name\":\"welcome\",\"variables\":{\"name\":\"علی\"}}`.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام انگلیسی یکتا."
                  },
                  "subject": {
                    "type": "string",
                    "description": "موضوع (می‌تواند متغیر داشته باشد)."
                  },
                  "html": {
                    "type": "string",
                    "description": "HTML."
                  },
                  "text": {
                    "type": "string",
                    "description": "متن ساده."
                  }
                },
                "required": [
                  "name",
                  "subject"
                ]
              },
              "example": {
                "html": "<p>سلام {{name}}!</p>",
                "name": "welcome",
                "subject": "خوش آمدید {{name}}"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "7",
                  "name": "welcome"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          }
        }
      },
      "get": {
        "operationId": "emailListTemplates",
        "tags": [
          "email"
        ],
        "summary": "فهرست قالب‌ها",
        "description": "قالب‌های ذخیره‌شدهٔ ارسال.\n\nبا `template: {name, variables}` در `POST /email/send` استفاده می‌شوند.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "8",
                    "html": "<p>سلام {{name}}</p>",
                    "name": "welcome",
                    "text": null,
                    "subject": "خوش آمدید {{name}}"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/suppressions": {
      "post": {
        "operationId": "addEmailSuppression",
        "tags": [
          "email"
        ],
        "summary": "افزودن به فهرست ممنوعه",
        "description": "به نشانی اضافه‌شده دیگر ایمیل ارسال نمی‌شود.\n\nبازگشتی‌های دائمی و شکایت‌ها خودکار ثبت می‌شوند. حذف: `DELETE /email/suppressions?address=…`؛ فهرست: `GET /email/suppressions`.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string",
                    "description": "نشانی ایمیل."
                  }
                },
                "required": [
                  "address"
                ]
              },
              "example": {
                "address": "unsubscribed@example.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "feature_disabled: قابلیت ایمیل (یا دامنهٔ دسترسی لازم) برای کلید/حساب شما فعال نیست."
          }
        }
      },
      "get": {
        "operationId": "emailListSuppressions",
        "tags": [
          "email"
        ],
        "summary": "فهرست ممنوعه",
        "description": "نشانی‌هایی که ارسال به آن‌ها انجام نمی‌شود.\n\nنشانی‌ها پس از بازگشت سخت (bounce)، شکایت یا لغو عضویت خودکار اضافه می‌شوند (`reason`) و با `POST /email/suppressions` دستی هم اضافه می‌شوند (`manual`). حداکثر ۵۰۰ مورد آخر برمی‌گردد. ارسال به این نشانی‌ها از گیرندگان حذف می‌شود.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "40",
                    "reason": "bounce",
                    "address": "old@example.com",
                    "createdAt": "2026-10-02T09:00:00.000Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "delete": {
        "operationId": "emailRemoveSuppression",
        "tags": [
          "email"
        ],
        "summary": "خارج‌کردن از فهرست ممنوعه",
        "description": "یک نشانی را دوباره مجاز می‌کند.\n\nفقط وقتی مطمئنید مشکل نشانی رفع شده این کار را بکنید؛ ارسال مکرر به نشانی بازگشتی اعتبار دامنهٔ شما را پایین می‌آورد.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "نشانی ایمیل."
            },
            "description": "نشانی ایمیل.",
            "example": "old@example.com"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/me": {
      "get": {
        "operationId": "emailMe",
        "tags": [
          "email"
        ],
        "summary": "وضعیت اشتراک و مصرف ایمیل",
        "description": "اشتراک فعال، سقف‌ها، سهمیهٔ ماهانه، بستهٔ ارسال و موجودی کیف پول برای ایمیل.\n\nپیش از ارسال انبوه یا در داشبورد خودتان از این مسیر مصرف و باقی‌ماندهٔ سهمیه را بخوانید. `sends.planLeft` سهمیهٔ باقی‌ماندهٔ اشتراک، `sends.packLeft` مجموع بستهٔ ارسال و `sends.todaySent` ارسال امروز (UTC) است. اگر حساب به‌دلیل سوءاستفادهٔ خودکار مسدود شده باشد، علت در `blocked` می‌آید.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "sends": {
                    "packLeft": 0,
                    "planLeft": 18800,
                    "planUsed": 1200,
                    "planQuota": 20000,
                    "todaySent": 35,
                    "dailyLimit": 2000
                  },
                  "blocked": null,
                  "subscription": {
                    "id": "4",
                    "period": "monthly",
                    "planName": "حرفه‌ای",
                    "autoRenew": true,
                    "expiresAt": "2026-11-23T10:00:00.000Z"
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/info": {
      "get": {
        "operationId": "emailInfo",
        "tags": [
          "email"
        ],
        "summary": "نشانی SMTP و رویدادهای وب‌هوک",
        "description": "میزبان و پورت درگاه SMTP و فهرست رویدادهایی که می‌توان به آن‌ها مشترک شد.\n\nاگر درگاه SMTP روشن باشد `smtp` شامل `host`، `port` و `security` است، وگرنه `null`. نام کاربری و رمز SMTP را از پنل («ایمیل ← API و SMTP») بسازید؛ آن‌ها با کلید API فرق دارند و از طریق API ساخته نمی‌شوند.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "smtp": {
                    "host": "smtp.irnoti.ir",
                    "port": 587,
                    "security": "STARTTLS"
                  },
                  "webhookEvents": [
                    "email.sent",
                    "email.delivered",
                    "email.bounced",
                    "email.complained",
                    "email.failed",
                    "email.received",
                    "email.otp"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/report": {
      "get": {
        "operationId": "emailReport",
        "tags": [
          "email"
        ],
        "summary": "گزارش مصرف و کیفیت ارسال",
        "description": "جمع ارسال، تحویل، بازگشت، شکایت و دریافت به‌همراه روند روزانه.\n\nگزارش `days` روز گذشته (پیش‌فرض ۳۰). نرخ‌های `rates` درصدی از کل ارسال است و نرخ بالای بازگشت یا شکایت ارسال را به‌صورت خودکار محدود می‌کند؛ پس این گزارش را دوره‌ای بررسی کنید. `problems` ده نامهٔ ناموفق آخر را نشان می‌دهد.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "description": "تعداد روز گذشته؛ پیش‌فرض ۳۰."
            },
            "description": "تعداد روز گذشته؛ پیش‌فرض ۳۰.",
            "example": "7"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "days": 7,
                  "daily": [
                    {
                      "day": "2026-10-23",
                      "otp": 1,
                      "sent": 60,
                      "spam": 2,
                      "bounced": 1,
                      "received": 14,
                      "delivered": 59
                    }
                  ],
                  "rates": {
                    "bounced": 1.5,
                    "delivered": 98,
                    "complained": 0
                  },
                  "totals": {
                    "otp": 9,
                    "sent": 410,
                    "spam": 12,
                    "bounced": 6,
                    "received": 88,
                    "delivered": 402,
                    "complained": 0
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/outbound.csv": {
      "get": {
        "operationId": "emailOutboundCsv",
        "tags": [
          "email"
        ],
        "summary": "خروجی CSV ارسال‌ها",
        "description": "همان فهرست ارسال‌ها با فیلترهای یکسان، به‌صورت فایل CSV.\n\nپارامترها مانند `GET /email/outbound` است. پاسخ `text/csv` با نام فایل `email-outbound.csv` است.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "وضعیت: queued، sent، delivered، bounced، complained یا failed."
            },
            "description": "وضعیت: queued، sent، delivered، bounced، complained یا failed.",
            "example": "bounced"
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "از تاریخ."
            },
            "description": "از تاریخ.",
            "example": "2026-10-01T00:00:00Z"
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "تا تاریخ."
            },
            "description": "تا تاریخ."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/counts": {
      "get": {
        "operationId": "emailCounts",
        "tags": [
          "email"
        ],
        "summary": "تعداد خوانده‌نشده‌ها",
        "description": "تعداد نامهٔ خوانده‌نشده به تفکیک پوشه و دسته، به‌همراه ستاره‌دارها و پیش‌نویس‌ها.\n\nبرای نمایش نشان عددی صندوق ورودی. اگر `mailboxId` ندهید جمع همهٔ صندوق‌های شما محاسبه می‌شود.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "mailboxId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط یک صندوق."
            },
            "description": "فقط یک صندوق.",
            "example": "12"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "drafts": 1,
                  "folders": {
                    "spam": 2,
                    "inbox": 5
                  },
                  "starred": 4,
                  "categories": {
                    "primary": 3,
                    "updates": 2
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/threads/{threadId}": {
      "get": {
        "operationId": "emailThread",
        "tags": [
          "email"
        ],
        "summary": "رشتهٔ گفتگو",
        "description": "همهٔ نامه‌های یک گفتگو به ترتیب زمان.\n\n`threadId` در فهرست و جزئیات هر نامه (`threadId`) آمده است. نامه‌ها بر پایهٔ سرایندهای `In-Reply-To` و `References` گروه می‌شوند.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ گفتگو."
            },
            "description": "شناسهٔ گفتگو.",
            "example": "a1b2c3d4e5"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: گفتگو پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/messages/{id}/check-sender": {
      "post": {
        "operationId": "emailCheckSender",
        "tags": [
          "email"
        ],
        "summary": "بررسی اصالت فرستنده",
        "description": "سرایند احراز هویت همان نامه را از سرور دوباره می‌خواند و می‌گوید چرا «تیک آبی» ندارد یا دارد.\n\nتیک آبی «ایمیل رسمی سازمان» فقط برای فرستندگان تأییدشدهٔ سکو و وقتی نشان داده می‌شود که SPF، DKIM و DMARC نامه معتبر باشد. `state` یکی از `ok`، `failed`، `no_header` یا `unreachable` است. سقف: ۳۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ نامه."
            },
            "description": "شناسهٔ نامه.",
            "example": "9812"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "state": "ok",
                  "evidence": "dmarc=pass; spf=pass; dkim=pass"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: نامه پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: سقف تعداد درخواست رد شده است؛ بعد از چند ثانیه دوباره تلاش کنید."
          }
        }
      }
    },
    "/email/drafts": {
      "post": {
        "operationId": "emailSaveDraft",
        "tags": [
          "email"
        ],
        "summary": "ذخیرهٔ پیش‌نویس",
        "description": "پیش‌نویس جدید می‌سازد یا با `id` پیش‌نویس موجود را ویرایش می‌کند.\n\nپیش‌نویس در پوشهٔ `drafts` همان صندوق ذخیره می‌شود. برای ارسال آن، `draftId` را در `POST /email/send` بدهید.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "شناسهٔ پیش‌نویس برای ویرایش."
                  },
                  "mailboxId": {
                    "type": "string",
                    "description": "صندوق مبدا."
                  },
                  "to": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "گیرندگان."
                  },
                  "cc": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "رونوشت."
                  },
                  "bcc": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "رونوشت مخفی."
                  },
                  "subject": {
                    "type": "string",
                    "description": "موضوع."
                  },
                  "text": {
                    "type": "string",
                    "description": "متن ساده."
                  },
                  "html": {
                    "type": "string",
                    "description": "متن HTML."
                  }
                },
                "required": [
                  "mailboxId"
                ]
              },
              "example": {
                "to": [
                  "customer@gmail.com"
                ],
                "html": "<p>سلام</p>",
                "subject": "پیشنهاد همکاری",
                "mailboxId": "12"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "9930"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: صندوق پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/messages/empty": {
      "post": {
        "operationId": "emailEmptyFolder",
        "tags": [
          "email"
        ],
        "summary": "خالی‌کردن سطل زباله یا هرزنامه",
        "description": "همهٔ نامه‌های پوشهٔ `trash` یا `spam` را برای همیشه حذف می‌کند.\n\nاین کار بازگشت‌پذیر نیست. بدون `mailboxId` روی همهٔ صندوق‌های شما اعمال می‌شود.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "folder": {
                    "type": "string",
                    "description": "`trash` یا `spam`."
                  },
                  "mailboxId": {
                    "type": "string",
                    "description": "فقط یک صندوق."
                  }
                },
                "required": [
                  "folder"
                ]
              },
              "example": {
                "folder": "spam"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "removed": 14
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/sync": {
      "post": {
        "operationId": "emailSync",
        "tags": [
          "email"
        ],
        "summary": "همگام‌سازی فوری صندوق",
        "description": "نامه‌های جدید را همین الان از سرور می‌گیرد، به‌جای انتظار برای همگام‌سازی دوره‌ای.\n\nبدون `mailboxId` همهٔ صندوق‌ها همگام می‌شوند. اگر همین صندوق کمتر از ۳ ثانیه پیش همگام شده باشد درخواست نادیده گرفته می‌شود. بعد از همگام‌سازی از `GET /email/otp/wait` یا `GET /email/messages` بخوانید. سقف: ۶۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mailboxId": {
                    "type": "string",
                    "description": "فقط یک صندوق."
                  }
                },
                "required": []
              },
              "example": {
                "mailboxId": "12"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: صندوق پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: سقف تعداد درخواست رد شده است؛ بعد از چند ثانیه دوباره تلاش کنید."
          }
        }
      }
    },
    "/email/mailboxes/{id}/settings": {
      "get": {
        "operationId": "emailMailboxSettings",
        "tags": [
          "email"
        ],
        "summary": "تنظیمات اتصال نرم‌افزار ایمیل",
        "description": "میزبان، پورت و امنیت IMAP، POP3 و SMTP برای وصل‌کردن Outlook، Thunderbird یا موبایل.\n\nنام کاربری همان نشانی صندوق است. رمز عبور هنگام ساخت صندوق فقط یک‌بار نمایش داده می‌شود و بعداً قابل‌خواندن نیست؛ اگر گم شد با `POST /email/mailboxes/{id}/password` رمز جدید بگیرید.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ صندوق."
            },
            "description": "شناسهٔ صندوق.",
            "example": "12"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "imap": {
                    "host": "mail.example.com",
                    "port": 993,
                    "security": "SSL/TLS"
                  },
                  "pop3": {
                    "host": "mail.example.com",
                    "port": 995,
                    "security": "SSL/TLS"
                  },
                  "smtp": {
                    "host": "mail.example.com",
                    "port": 587,
                    "security": "STARTTLS"
                  },
                  "username": "sales@example.ir"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: صندوق پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/mailboxes/{id}": {
      "patch": {
        "operationId": "emailUpdateMailbox",
        "tags": [
          "email"
        ],
        "summary": "ویرایش صندوق",
        "description": "نام نمایشی، امضا، پاسخ خودکار، تخصیص به همکار و سهمیهٔ فضا را تغییر می‌دهد.\n\nفقط فیلدهای ارسال‌شده تغییر می‌کنند. با `null` می‌توان امضا یا پاسخ خودکار را پاک کرد. پاسخ خودکار به خبرنامه‌ها و ربات‌ها فرستاده نمی‌شود. `quotaMb` از سقف بسته بیشتر نمی‌شود؛ برای فضای بیشتر افزونهٔ فضا بخرید.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ صندوق."
            },
            "description": "شناسهٔ صندوق.",
            "example": "12"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "displayName": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "نام نمایشی."
                  },
                  "signature": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "امضای خودکار (حداکثر ۵۰۰۰ نویسه)."
                  },
                  "autoReply": {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": true
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "`{enabled, subject, body, until?}`."
                  },
                  "assigneeUserId": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "شناسهٔ همکاری که صندوق به او تخصیص می‌یابد."
                  },
                  "quotaMb": {
                    "type": "number",
                    "description": "سهمیهٔ فضا (۵۰ تا ۱٬۰۰۰٬۰۰۰ مگابایت)."
                  },
                  "portalEnabled": {
                    "type": "boolean",
                    "description": "دسترسی به وب‌میل."
                  }
                },
                "required": []
              },
              "example": {
                "autoReply": {
                  "body": "تا شنبه پاسخ می‌دهیم.",
                  "until": "2026-10-31",
                  "enabled": true,
                  "subject": "خارج از دفتر"
                },
                "displayName": "تیم فروش"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "12",
                  "kind": "hosted",
                  "status": "active",
                  "address": "sales@example.ir",
                  "quotaMb": 2048,
                  "lastError": null,
                  "usedBytes": 5242880,
                  "lastSyncAt": "2026-10-24T08:30:00.000Z",
                  "displayName": "فروش"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: صندوق پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "emailDeleteMailbox",
        "tags": [
          "email"
        ],
        "summary": "حذف صندوق",
        "description": "صندوق و همهٔ نامه‌های آن را حذف می‌کند.\n\nبرگشت‌پذیر نیست. برای صندوق سازمانی، صندوق از سرور ایمیل هم پاک می‌شود؛ برای حساب شخصی فقط اتصال و نسخهٔ ذخیره‌شده در IRNoti حذف می‌شود و صندوق اصلی شما (Gmail و …) دست‌نخورده می‌ماند. پاسخ موفق `204` بدون بدنه است.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ صندوق."
            },
            "description": "شناسهٔ صندوق.",
            "example": "12"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: صندوق پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/mailboxes/{id}/password": {
      "post": {
        "operationId": "emailResetMailboxPassword",
        "tags": [
          "email"
        ],
        "summary": "رمز جدید صندوق",
        "description": "برای صندوق سازمانی رمز تازه می‌سازد (یا رمز دلخواه شما را می‌گذارد) و همان‌جا یک‌بار برمی‌گرداند.\n\nرمز فقط روی سرور ایمیل به‌صورت هش ذخیره می‌شود و دوباره قابل‌نمایش نیست. نرم‌افزارهای ایمیل کارمند باید با رمز جدید دوباره وارد شوند. رمز دلخواه حداقل ۱۰ نویسه است.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ صندوق."
            },
            "description": "شناسهٔ صندوق.",
            "example": "12"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "password": {
                    "type": "string",
                    "description": "رمز دلخواه؛ اگر نباشد رمز تصادفی ساخته می‌شود."
                  }
                },
                "required": []
              },
              "example": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "password": "Qx7-mT2pVn9aLc4e"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد.\nfeature_disabled: قابلیت ایمیل (یا ایمیل سازمانی `email.hosted`) برای حساب شما فعال نیست."
          },
          "404": {
            "description": "not_found: صندوق پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/domains/{id}": {
      "get": {
        "operationId": "emailGetDomain",
        "tags": [
          "email"
        ],
        "summary": "جزئیات دامنه و رکوردهای DNS",
        "description": "وضعیت دامنه و رکوردهای DNS که باید بسازید (تأیید مالکیت، MX، SPF، DKIM، DMARC).\n\nرکوردها را عیناً در DNS دامنه بگذارید و سپس `POST /email/domains/{id}/check` را بزنید. تا وقتی `status` برابر `verified` نشده، ارسال و دریافت فعال نیست. انتشار DNS گاهی تا چند ساعت طول می‌کشد.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دامنه."
            },
            "description": "شناسهٔ دامنه.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "3",
                  "mode": "hosted",
                  "name": "example.ir",
                  "hosted": true,
                  "status": "pending",
                  "records": [
                    {
                      "host": "example.ir",
                      "type": "TXT",
                      "value": "irnoti-verify=abc123",
                      "purpose": "verify"
                    },
                    {
                      "host": "example.ir",
                      "type": "MX",
                      "value": "mail.example.com",
                      "purpose": "mx",
                      "priority": 10
                    },
                    {
                      "host": "example.ir",
                      "type": "TXT",
                      "value": "v=spf1 mx ~all",
                      "purpose": "spf"
                    },
                    {
                      "host": "irnoti._domainkey.example.ir",
                      "type": "TXT",
                      "value": "v=DKIM1; k=rsa; p=MIIB…",
                      "purpose": "dkim"
                    },
                    {
                      "host": "_dmarc.example.ir",
                      "type": "TXT",
                      "value": "v=DMARC1; p=none; rua=mailto:dmarc@example.ir; adkim=s; aspf=s",
                      "purpose": "dmarc"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد.\nfeature_disabled: قابلیت ایمیل (یا ایمیل سازمانی `email.hosted`) برای حساب شما فعال نیست."
          },
          "404": {
            "description": "not_found: دامنه پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "emailDeleteDomain",
        "tags": [
          "email"
        ],
        "summary": "حذف دامنه",
        "description": "دامنه با همهٔ صندوق‌ها، نام‌های مستعار و نامه‌هایش حذف می‌شود.\n\nبرگشت‌پذیر نیست. بعد از حذف، رکوردهای DNS دامنه را هم از سمت خودتان پاک کنید.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دامنه."
            },
            "description": "شناسهٔ دامنه.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد.\nfeature_disabled: قابلیت ایمیل (یا ایمیل سازمانی `email.hosted`) برای حساب شما فعال نیست."
          },
          "404": {
            "description": "not_found: دامنه پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/domains/{id}/catch-all": {
      "put": {
        "operationId": "emailSetCatchAll",
        "tags": [
          "email"
        ],
        "summary": "تنظیم Catch-all",
        "description": "نامهٔ ارسال‌شده به هر نشانی ناموجود دامنه را به یک صندوق می‌رساند.\n\n`address` باید یکی از صندوق‌ها یا نام‌های مستعار همین دامنه باشد. با `null` Catch-all خاموش می‌شود و نامهٔ نشانی ناموجود رد می‌شود. Catch-all هرزنامه بیشتری می‌گیرد؛ فیلتر هرزنامه روی آن هم اعمال می‌شود.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دامنه."
            },
            "description": "شناسهٔ دامنه.",
            "example": "3"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "address": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "نشانی مقصد یا null."
                  }
                },
                "required": [
                  "address"
                ]
              },
              "example": {
                "address": "info@example.ir"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد.\nfeature_disabled: قابلیت ایمیل (یا ایمیل سازمانی `email.hosted`) برای حساب شما فعال نیست."
          },
          "404": {
            "description": "not_found: دامنه پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/domains/{id}/aliases": {
      "get": {
        "operationId": "emailListAliases",
        "tags": [
          "email"
        ],
        "summary": "فهرست نام‌های مستعار",
        "description": "نام‌های مستعار (فوروارد) یک دامنه.\n\nهر نام مستعار نامه را به یک یا چند صندوق می‌رساند؛ مثلاً `info@` به همهٔ اعضای تیم.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دامنه."
            },
            "description": "شناسهٔ دامنه.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "7",
                    "local": "info",
                    "address": "info@example.ir",
                    "targets": [
                      "sales@example.ir",
                      "support@example.ir"
                    ]
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد.\nfeature_disabled: قابلیت ایمیل (یا ایمیل سازمانی `email.hosted`) برای حساب شما فعال نیست."
          },
          "404": {
            "description": "not_found: دامنه پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "post": {
        "operationId": "emailAddAlias",
        "tags": [
          "email"
        ],
        "summary": "افزودن نام مستعار",
        "description": "نشانی تازه می‌سازد که نامه‌هایش به صندوق‌های مقصد می‌رسد.\n\n`local` بخش پیش از `@` است. تعداد نام‌های مستعار از سقف بسته می‌آید. هر نام مستعار حداکثر ۲۰ مقصد دارد.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دامنه."
            },
            "description": "شناسهٔ دامنه.",
            "example": "3"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "local": {
                    "type": "string",
                    "description": "بخش محلی نشانی (حداکثر ۶۴ نویسه)."
                  },
                  "targets": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "نشانی‌های مقصد."
                  }
                },
                "required": [
                  "local",
                  "targets"
                ]
              },
              "example": {
                "local": "info",
                "targets": [
                  "sales@example.ir"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "7",
                  "local": "info",
                  "address": "info@example.ir",
                  "targets": [
                    "sales@example.ir",
                    "support@example.ir"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد.\nfeature_disabled: قابلیت ایمیل (یا ایمیل سازمانی `email.hosted`) برای حساب شما فعال نیست."
          },
          "404": {
            "description": "not_found: دامنه پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/aliases/{id}": {
      "patch": {
        "operationId": "emailUpdateAlias",
        "tags": [
          "email"
        ],
        "summary": "ویرایش مقصدهای نام مستعار",
        "description": "فهرست مقصدهای یک نام مستعار را جایگزین می‌کند.\n\nفهرست جدید به‌طور کامل جای قبلی را می‌گیرد.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ نام مستعار."
            },
            "description": "شناسهٔ نام مستعار.",
            "example": "7"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "targets": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "نشانی‌های مقصد."
                  }
                },
                "required": [
                  "targets"
                ]
              },
              "example": {
                "targets": [
                  "support@example.ir"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "7",
                  "local": "info",
                  "address": "info@example.ir",
                  "targets": [
                    "sales@example.ir",
                    "support@example.ir"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد.\nfeature_disabled: قابلیت ایمیل (یا ایمیل سازمانی `email.hosted`) برای حساب شما فعال نیست."
          },
          "404": {
            "description": "not_found: نام مستعار پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "emailDeleteAlias",
        "tags": [
          "email"
        ],
        "summary": "حذف نام مستعار",
        "description": "نام مستعار را حذف می‌کند.\n\nنامه‌های بعدی به آن نشانی رد می‌شود (مگر Catch-all روشن باشد).\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ نام مستعار."
            },
            "description": "شناسهٔ نام مستعار.",
            "example": "7"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد.\nfeature_disabled: قابلیت ایمیل (یا ایمیل سازمانی `email.hosted`) برای حساب شما فعال نیست."
          },
          "404": {
            "description": "not_found: نام مستعار پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/contacts": {
      "get": {
        "operationId": "emailListContacts",
        "tags": [
          "email"
        ],
        "summary": "فهرست مخاطبین",
        "description": "مخاطبین ایمیل با جستجو و فیلتر گروه.\n\nمخاطبین هنگام نوشتن نامه تکمیل خودکار می‌شوند و فرستندگان ناشناس هم پس از اولین نامه اضافه می‌شوند.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "جستجو در نام و نشانی."
            },
            "description": "جستجو در نام و نشانی.",
            "example": "علی"
          },
          {
            "name": "group",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "نام گروه."
            },
            "description": "نام گروه."
          },
          {
            "name": "blocked",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "فقط مسدودشده‌ها."
            },
            "description": "فقط مسدودشده‌ها."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "31",
                    "name": "علی رضایی",
                    "note": null,
                    "email": "ali@example.com",
                    "phone": "09120000000",
                    "groups": [
                      "مشتری"
                    ],
                    "company": "نمونه",
                    "isBlocked": false
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "emailAddContact",
        "tags": [
          "email"
        ],
        "summary": "افزودن مخاطب",
        "description": "مخاطب جدید می‌سازد.\n\nنشانی تکراری خطا می‌دهد.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "نشانی ایمیل."
                  },
                  "name": {
                    "type": "string",
                    "description": "نام."
                  },
                  "company": {
                    "type": "string",
                    "description": "شرکت."
                  },
                  "phone": {
                    "type": "string",
                    "description": "تلفن."
                  },
                  "note": {
                    "type": "string",
                    "description": "یادداشت (حداکثر ۵۰۰ نویسه)."
                  },
                  "groups": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "گروه‌ها (حداکثر ۱۰)."
                  },
                  "isBlocked": {
                    "type": "boolean",
                    "description": "مسدود؛ نامهٔ این فرستنده به هرزنامه می‌رود."
                  }
                },
                "required": [
                  "email"
                ]
              },
              "example": {
                "name": "علی رضایی",
                "email": "ali@example.com",
                "groups": [
                  "مشتری"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "31",
                  "name": "علی رضایی",
                  "note": null,
                  "email": "ali@example.com",
                  "phone": "09120000000",
                  "groups": [
                    "مشتری"
                  ],
                  "company": "نمونه",
                  "isBlocked": false
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/contacts/{id}": {
      "patch": {
        "operationId": "emailUpdateContact",
        "tags": [
          "email"
        ],
        "summary": "ویرایش مخاطب",
        "description": "فقط فیلدهای ارسال‌شده تغییر می‌کنند.\n\nمسدودکردن مخاطب با `isBlocked: true` انجام می‌شود.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ مخاطب."
            },
            "description": "شناسهٔ مخاطب.",
            "example": "31"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "نشانی ایمیل."
                  },
                  "name": {
                    "type": "string",
                    "description": "نام."
                  },
                  "company": {
                    "type": "string",
                    "description": "شرکت."
                  },
                  "phone": {
                    "type": "string",
                    "description": "تلفن."
                  },
                  "note": {
                    "type": "string",
                    "description": "یادداشت (حداکثر ۵۰۰ نویسه)."
                  },
                  "groups": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "گروه‌ها (حداکثر ۱۰)."
                  },
                  "isBlocked": {
                    "type": "boolean",
                    "description": "مسدود؛ نامهٔ این فرستنده به هرزنامه می‌رود."
                  }
                },
                "required": []
              },
              "example": {
                "isBlocked": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "31",
                  "name": "علی رضایی",
                  "note": null,
                  "email": "ali@example.com",
                  "phone": "09120000000",
                  "groups": [
                    "مشتری"
                  ],
                  "company": "نمونه",
                  "isBlocked": true
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: مخاطب پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "emailDeleteContact",
        "tags": [
          "email"
        ],
        "summary": "حذف مخاطب",
        "description": "مخاطب را حذف می‌کند.\n\nنامه‌های قبلی دست‌نخورده می‌مانند.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ مخاطب."
            },
            "description": "شناسهٔ مخاطب.",
            "example": "31"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: مخاطب پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/contacts.csv": {
      "get": {
        "operationId": "emailContactsCsv",
        "tags": [
          "email"
        ],
        "summary": "خروجی CSV مخاطبین",
        "description": "همهٔ مخاطبین به‌صورت فایل CSV.\n\nپاسخ `text/csv` با نام `contacts.csv` است و در اکسل فارسی (UTF-8) درست باز می‌شود.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/contacts/import/csv": {
      "post": {
        "operationId": "emailImportContactsCsv",
        "tags": [
          "email"
        ],
        "summary": "ورود مخاطبین از CSV",
        "description": "متن CSV را می‌خواند و مخاطبین تازه را اضافه می‌کند.\n\nستون‌های `email`، `name`، `company`، `phone` و `groups` پشتیبانی می‌شود و ستون اول نشانی است. ردیف‌های نامعتبر یا تکراری رد می‌شوند و در پاسخ شمرده می‌شوند. سقف: ۱۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "محتوای فایل CSV."
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "email,name\nali@example.com,علی\n"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "added": 1,
                  "skipped": 0
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: سقف تعداد درخواست رد شده است؛ بعد از چند ثانیه دوباره تلاش کنید."
          }
        }
      }
    },
    "/email/contacts/import/vcard": {
      "post": {
        "operationId": "emailImportContactsVcard",
        "tags": [
          "email"
        ],
        "summary": "ورود مخاطبین از vCard",
        "description": "فایل vCard (‎.vcf) را می‌خواند و مخاطبین را اضافه می‌کند.\n\nخروجی مخاطبین گوشی و Gmail را می‌توان مستقیم داد. سقف: ۱۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "محتوای فایل vCard."
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "BEGIN:VCARD\nVERSION:3.0\nFN:علی رضایی\nEMAIL:ali@example.com\nEND:VCARD"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "added": 1,
                  "skipped": 0
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: سقف تعداد درخواست رد شده است؛ بعد از چند ثانیه دوباره تلاش کنید."
          }
        }
      }
    },
    "/email/labels": {
      "get": {
        "operationId": "emailListLabels",
        "tags": [
          "email"
        ],
        "summary": "فهرست برچسب‌ها",
        "description": "برچسب‌های شما.\n\nبا `POST /email/messages/actions` و `action: label` به نامه‌ها زده می‌شود.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "5",
                    "name": "مالی",
                    "color": "#FF3300"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "emailAddLabel",
        "tags": [
          "email"
        ],
        "summary": "ساخت برچسب",
        "description": "برچسب جدید.\n\n`color` به‌صورت `#RRGGBB` است.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام (حداکثر ۶۰ نویسه)."
                  },
                  "color": {
                    "type": "string",
                    "description": "رنگ مانند `#FF3300`."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "مالی",
                "color": "#FF3300"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "5",
                  "name": "مالی",
                  "color": "#FF3300"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/labels/{id}": {
      "patch": {
        "operationId": "emailUpdateLabel",
        "tags": [
          "email"
        ],
        "summary": "ویرایش برچسب",
        "description": "نام یا رنگ برچسب.\n\nپاسخ موفق `204` است.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ برچسب."
            },
            "description": "شناسهٔ برچسب.",
            "example": "5"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام."
                  },
                  "color": {
                    "type": "string",
                    "description": "رنگ."
                  }
                },
                "required": []
              },
              "example": {
                "name": "حسابداری"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: برچسب پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "emailDeleteLabel",
        "tags": [
          "email"
        ],
        "summary": "حذف برچسب",
        "description": "برچسب را از همهٔ نامه‌ها برمی‌دارد.\n\nخود نامه‌ها حذف نمی‌شوند.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ برچسب."
            },
            "description": "شناسهٔ برچسب.",
            "example": "5"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: برچسب پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/rules": {
      "get": {
        "operationId": "emailListRules",
        "tags": [
          "email"
        ],
        "summary": "فهرست قوانین",
        "description": "قوانین خودکار پردازش نامهٔ ورودی.\n\nقوانین به ترتیب `sort` روی نامهٔ ورودی اجرا می‌شوند تا به عمل `stop` برسند.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "2",
                    "name": "صورت‌حساب‌ها",
                    "sort": 0,
                    "actions": [
                      {
                        "type": "label",
                        "labelId": "5"
                      },
                      {
                        "type": "markRead"
                      }
                    ],
                    "enabled": true,
                    "matchAll": true,
                    "mailboxId": null,
                    "conditions": [
                      {
                        "op": "contains",
                        "field": "from",
                        "value": "billing@"
                      }
                    ]
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "emailAddRule",
        "tags": [
          "email"
        ],
        "summary": "ساخت قانون",
        "description": "قانون جدید برای نامه‌های ورودی.\n\nنمونه: هر نامه‌ای که فرستنده‌اش شامل `billing@` است برچسب «مالی» بخورد و خوانده شود. فوروارد خودکار فقط به نشانی‌های معتبر انجام می‌شود.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام قانون."
                  },
                  "mailboxId": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "فقط یک صندوق؛ null یعنی همه."
                  },
                  "matchAll": {
                    "type": "boolean",
                    "description": "true یعنی همهٔ شرط‌ها (و)، false یعنی هرکدام (یا). پیش‌فرض true."
                  },
                  "conditions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "description": "`{field, op, value?}`؛ field: from، to، subject، body، hasAttachment، category؛ op: contains، equals، startsWith، endsWith، not_contains، is_true (حداکثر ۱۰)."
                  },
                  "actions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "description": "یکی از: `{type:\"move\",folder}`، `{type:\"label\",labelId}`، `markRead`، `star`، `{type:\"forward\",to}`، `{type:\"category\",category}`، `stop` (حداکثر ۱۰)."
                  },
                  "sort": {
                    "type": "number",
                    "description": "ترتیب اجرا؛ کوچک‌تر زودتر."
                  },
                  "enabled": {
                    "type": "boolean",
                    "description": "فعال یا غیرفعال."
                  }
                },
                "required": [
                  "name",
                  "conditions",
                  "actions"
                ]
              },
              "example": {
                "name": "صورت‌حساب‌ها",
                "actions": [
                  {
                    "type": "label",
                    "labelId": "5"
                  },
                  {
                    "type": "markRead"
                  }
                ],
                "matchAll": true,
                "conditions": [
                  {
                    "op": "contains",
                    "field": "from",
                    "value": "billing@"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "2",
                  "name": "صورت‌حساب‌ها",
                  "sort": 0,
                  "actions": [
                    {
                      "type": "label",
                      "labelId": "5"
                    },
                    {
                      "type": "markRead"
                    }
                  ],
                  "enabled": true,
                  "matchAll": true,
                  "mailboxId": null,
                  "conditions": [
                    {
                      "op": "contains",
                      "field": "from",
                      "value": "billing@"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/rules/{id}": {
      "patch": {
        "operationId": "emailUpdateRule",
        "tags": [
          "email"
        ],
        "summary": "ویرایش قانون",
        "description": "فقط فیلدهای ارسال‌شده تغییر می‌کنند.\n\nپاسخ موفق `204` است.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ قانون."
            },
            "description": "شناسهٔ قانون.",
            "example": "2"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام قانون."
                  },
                  "mailboxId": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "فقط یک صندوق؛ null یعنی همه."
                  },
                  "matchAll": {
                    "type": "boolean",
                    "description": "true یعنی همهٔ شرط‌ها (و)، false یعنی هرکدام (یا). پیش‌فرض true."
                  },
                  "conditions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "description": "`{field, op, value?}`؛ field: from، to، subject، body، hasAttachment، category؛ op: contains، equals، startsWith، endsWith، not_contains، is_true (حداکثر ۱۰)."
                  },
                  "actions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "description": "یکی از: `{type:\"move\",folder}`، `{type:\"label\",labelId}`، `markRead`، `star`، `{type:\"forward\",to}`، `{type:\"category\",category}`، `stop` (حداکثر ۱۰)."
                  },
                  "sort": {
                    "type": "number",
                    "description": "ترتیب اجرا؛ کوچک‌تر زودتر."
                  },
                  "enabled": {
                    "type": "boolean",
                    "description": "فعال یا غیرفعال."
                  }
                },
                "required": []
              },
              "example": {
                "enabled": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: قانون پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "emailDeleteRule",
        "tags": [
          "email"
        ],
        "summary": "حذف قانون",
        "description": "قانون را حذف می‌کند.\n\nنامه‌های پردازش‌شدهٔ قبلی تغییر نمی‌کنند.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ قانون."
            },
            "description": "شناسهٔ قانون.",
            "example": "2"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: قانون پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/templates/{id}": {
      "delete": {
        "operationId": "emailDeleteTemplate",
        "tags": [
          "email"
        ],
        "summary": "حذف قالب",
        "description": "قالب را حذف می‌کند.\n\nارسال‌هایی که بعد از حذف به این نام ارجاع دهند خطای `template_not_found` می‌گیرند.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ قالب."
            },
            "description": "شناسهٔ قالب.",
            "example": "8"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: قالب پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/otp-relays": {
      "get": {
        "operationId": "emailListOtpRelays",
        "tags": [
          "email"
        ],
        "summary": "فهرست بازارسال کد تأیید",
        "description": "قوانینی که کد تأیید رسیده به ایمیل را به پیامک، بله یا تلگرام می‌فرستند.\n\nمقصد باید با کد تأیید شود (`verified`) تا کد کسی به شمارهٔ دیگران نرود.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "3",
                    "label": "کد گیت‌هاب",
                    "target": "09120000000",
                    "channel": "sms",
                    "enabled": true,
                    "mailbox": "login@example.ir",
                    "verified": true,
                    "lastError": null,
                    "sentTotal": 12,
                    "lastSentAt": "2026-10-23T18:00:00.000Z",
                    "senderContains": "github"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "emailAddOtpRelay",
        "tags": [
          "email"
        ],
        "summary": "ساخت بازارسال کد تأیید",
        "description": "کد OTP تشخیص‌داده‌شده در صندوق را خودکار به مقصد دلخواه می‌فرستد.\n\nپس از ساخت، یک کد ۶ رقمی به مقصد فرستاده می‌شود؛ با `POST /email/otp-relays/{id}/verify` تأیید کنید. `mailbox` و `senderContains` دامنهٔ بازارسال را محدود می‌کنند. `channel` یکی از `sms`، `bale` یا `telegram` است.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "channel": {
                    "type": "string",
                    "description": "کانال مقصد."
                  },
                  "target": {
                    "type": "string",
                    "description": "شمارهٔ موبایل یا شناسهٔ گفتگو."
                  },
                  "mailbox": {
                    "type": "string",
                    "description": "فقط این صندوق."
                  },
                  "senderContains": {
                    "type": "string",
                    "description": "فقط فرستنده‌ای که نشانی‌اش شامل این متن است."
                  },
                  "label": {
                    "type": "string",
                    "description": "برچسب نمایشی."
                  }
                },
                "required": [
                  "channel",
                  "target"
                ]
              },
              "example": {
                "target": "09120000000",
                "channel": "sms",
                "senderContains": "github"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "3",
                  "label": "کد گیت‌هاب",
                  "target": "09120000000",
                  "channel": "sms",
                  "enabled": false,
                  "mailbox": "login@example.ir",
                  "verified": false,
                  "lastError": null,
                  "sentTotal": 12,
                  "lastSentAt": "2026-10-23T18:00:00.000Z",
                  "senderContains": "github"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/email/otp-relays/{id}/verify": {
      "post": {
        "operationId": "emailVerifyOtpRelay",
        "tags": [
          "email"
        ],
        "summary": "تأیید مقصد بازارسال",
        "description": "کد ۶ رقمی رسیده به مقصد را تأیید می‌کند.\n\nسقف: ۱۰ درخواست در دقیقه. پاسخ موفق `204` است.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ بازارسال."
            },
            "description": "شناسهٔ بازارسال.",
            "example": "3"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "کد ۶ رقمی."
                  }
                },
                "required": [
                  "code"
                ]
              },
              "example": {
                "code": "482913"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است؛ خطای هر فیلد در `details` آمده است."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: بازارسال پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: سقف تعداد درخواست رد شده است؛ بعد از چند ثانیه دوباره تلاش کنید."
          }
        }
      }
    },
    "/email/otp-relays/{id}/resend": {
      "post": {
        "operationId": "emailResendOtpRelay",
        "tags": [
          "email"
        ],
        "summary": "ارسال دوباره کد تأیید مقصد",
        "description": "کد تأیید مقصد را دوباره می‌فرستد.\n\nسقف: ۵ درخواست در دقیقه. پاسخ موفق `204` است.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ بازارسال."
            },
            "description": "شناسهٔ بازارسال.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: بازارسال پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: سقف تعداد درخواست رد شده است؛ بعد از چند ثانیه دوباره تلاش کنید."
          }
        }
      }
    },
    "/email/otp-relays/{id}/test": {
      "post": {
        "operationId": "emailTestOtpRelay",
        "tags": [
          "email"
        ],
        "summary": "ارسال آزمایشی",
        "description": "یک کد نمونه به مقصد می‌فرستد تا مسیر را امتحان کنید.\n\nفقط برای مقصد تأییدشده. اگر ارسال به مقصد شکست بخورد `ok: false` و متن خطا در `error` برمی‌گردد. سقف: ۵ درخواست در دقیقه.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ بازارسال."
            },
            "description": "شناسهٔ بازارسال.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "ok": true
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: بازارسال پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: سقف تعداد درخواست رد شده است؛ بعد از چند ثانیه دوباره تلاش کنید."
          }
        }
      }
    },
    "/email/otp-relays/{id}": {
      "patch": {
        "operationId": "emailToggleOtpRelay",
        "tags": [
          "email"
        ],
        "summary": "روشن یا خاموش کردن بازارسال",
        "description": "بازارسال را بدون حذف فعال یا غیرفعال می‌کند.\n\nپاسخ موفق `204` است.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ بازارسال."
            },
            "description": "شناسهٔ بازارسال.",
            "example": "3"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "description": "فعال یا غیرفعال."
                  }
                },
                "required": [
                  "enabled"
                ]
              },
              "example": {
                "enabled": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: بازارسال پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "emailDeleteOtpRelay",
        "tags": [
          "email"
        ],
        "summary": "حذف بازارسال",
        "description": "بازارسال را حذف می‌کند.\n\nپاسخ موفق `204` است.\n\nدسترسی لازم (scope): `email.manage`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.manage",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ بازارسال."
            },
            "description": "شناسهٔ بازارسال.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: بازارسال پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/email/sender-icon/{domain}": {
      "get": {
        "operationId": "emailSenderIcon",
        "tags": [
          "email"
        ],
        "summary": "آیکن فرستنده",
        "description": "تصویر نمادِ دامنهٔ فرستنده برای نمایش در صندوق.\n\nپاسخ تصویر باینری است (نه JSON) و برای دامنه‌هایی که آیکن ندارند یک نمادِ پیش‌فرض برمی‌گردد. سقف ۳۰۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `email.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "email.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "دامنه، مثلاً `example.com`."
            },
            "description": "دامنه، مثلاً `example.com`.",
            "example": "example.com"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/tts/say": {
      "get": {
        "operationId": "ttsSayGet",
        "tags": [
          "tts"
        ],
        "summary": "تبدیل متن به گفتار (GET)",
        "description": "متن فارسی ← فایل صوتی ۸ کیلوهرتز برای IVR و VoIP؛ مناسب آدرس ttsUrl سانترال.\n\nمتن فارسی را به فایل صوتی تک‌کانالهٔ آمادهٔ سانترال تبدیل می‌کند و **خود فایل** را برمی‌گرداند (نه JSON). روی دامنهٔ اختصاصی همین سرویس، همین عملیات با مسیر کوتاه `https://tts.irnoti.com/say?text=...` هم در دسترس است.\n\n**هزینه:** به‌ازای هر حرفِ جملهٔ تازه (با حداقل هر جمله). هر جملهٔ تکراری (همان متن، صدا و قالب) برای شما فقط یک‌بار حساب می‌شود، حتی اگر سانترال صدها بار آن را بگیرد. متن داخل `[ ]` و `( )` و علائم مارک‌داون خوانده و حساب نمی‌شود.\n\n**بدون کلید:** درخواست بدون `key` آزمایش رایگان است (متن کوتاه، محدودیت نرخ و سقف روزانهٔ پلتفرم). **با کلید:** هزینه از کیف پول صاحب کلید کم می‌شود؛ کلید آزمایشی (Sandbox) صدای آزمایشی می‌دهد و هزینه‌ای ندارد.\n\n**امنیت:** سانترال‌ها معمولاً فقط می‌توانند آدرس باز کنند، پس کلید را می‌توان در `key=` گذاشت؛ برای کلید حتماً فهرست IP مجاز تعریف کنید. در برنامه‌ها از هدر `Authorization: Bearer` استفاده کنید.\n\n**هدرهای پاسخ:** `X-TTS-Chars` (حرف‌های خوانده‌شده)، `X-TTS-Price` (ریال؛ ۰ برای دریافت مجدد)، `X-TTS-Duration-Ms`. پاسخ برای یک روز قابل کش است.\n\nدسترسی لازم (scope): `tts.say`\n\nبا کلید آزمایشی (sandbox) هم قابل‌استفاده است.",
        "x-required-scope": "tts.say",
        "x-sandbox": true,
        "parameters": [
          {
            "name": "text",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "متن فارسی؛ حداکثر ۱۵۰۰ حرف (تنظیم سامانه؛ در آزمایش رایگان کوتاه‌تر)."
            },
            "description": "متن فارسی؛ حداکثر ۱۵۰۰ حرف (تنظیم سامانه؛ در آزمایش رایگان کوتاه‌تر).",
            "example": "سلام، به شرکت ما خوش آمدید"
          },
          {
            "name": "voice",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "شناسهٔ صدا مثل char_teacher_lady؛ فهرست در GET /public/tts/info. پیش‌فرض: صدای پیش‌فرض سامانه."
            },
            "description": "شناسهٔ صدا مثل char_teacher_lady؛ فهرست در GET /public/tts/info. پیش‌فرض: صدای پیش‌فرض سامانه.",
            "example": "char_teacher_lady"
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "wav8k (پیش‌فرض)، wav16k، sln، ulaw یا alaw."
            },
            "description": "wav8k (پیش‌فرض)، wav16k، sln، ulaw یا alaw.",
            "example": "wav8k"
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "کلید API با دامنهٔ tts.say (به‌جای هدر Authorization، برای سانترال‌ها)."
            },
            "description": "کلید API با دامنهٔ tts.say (به‌جای هدر Authorization، برای سانترال‌ها)."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": "(باینری audio/wav) — X-TTS-Chars: 25, X-TTS-Price: 500, X-TTS-Duration-Ms: 2400"
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید نامعتبر است، یا آزمایش رایگان بسته شده و کلیدی نفرستاده‌اید (key_required)."
          },
          "402": {
            "description": "insufficient_balance: اعتبار برای این جمله کافی نیست؛ قبل از تولید صدا رد می‌شود و هزینه‌ای ندارد."
          },
          "403": {
            "description": "forbidden: کلید دامنهٔ tts.say ندارد یا ویژگی TTS برای حساب شما فعال نیست."
          },
          "409": {
            "description": "kyc_required: احراز هویت تأیید نشده است."
          },
          "422": {
            "description": "text_too_long: متن از سقف مجاز طولانی‌تر است (در آزمایش رایگان کوتاه‌تر).\nempty_text: متن چیزی برای خواندن ندارد (مثلاً فقط توضیح داخل [ ] یا ( ) است).\nunknown_voice: صدای خواسته‌شده در دسترس نیست؛ فهرست را از GET /public/tts/info بگیرید.\nunknown_format: قالب خواسته‌شده در دسترس نیست.\ndaily_limit: سقف حرف روزانهٔ کلید پر شده است."
          },
          "429": {
            "description": "demo_limit: سقف روزانهٔ آزمایش رایگان پر شده است یا درخواست‌ها در دقیقه زیاد بوده؛ با کلید API ادامه دهید."
          },
          "502": {
            "description": "tts_failed: موتور صدا پاسخ نداد؛ هزینه‌ای کم نشده است، دوباره تلاش کنید."
          },
          "503": {
            "description": "tts_disabled: سرویس موقتاً غیرفعال است."
          }
        }
      },
      "post": {
        "operationId": "ttsSayPost",
        "tags": [
          "tts"
        ],
        "summary": "تبدیل متن به گفتار (POST)",
        "description": "همان عملیات GET با بدنهٔ JSON؛ برای متن‌های بلند یا وقتی نمی‌خواهید متن در آدرس بیاید.\n\nمتن فارسی را به فایل صوتی تک‌کانالهٔ آمادهٔ سانترال تبدیل می‌کند و **خود فایل** را برمی‌گرداند (نه JSON). قواعد هزینه، صداها، قالب‌ها و خطاها دقیقاً مثل `GET /tts/say` است. کلید را در هدر `Authorization: Bearer irn_…` بفرستید.\n\nدسترسی لازم (scope): `tts.say`\n\nبا کلید آزمایشی (sandbox) هم قابل‌استفاده است.",
        "x-required-scope": "tts.say",
        "x-sandbox": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "متن فارسی."
                  },
                  "voice": {
                    "type": "string",
                    "description": "شناسهٔ صدا."
                  },
                  "format": {
                    "type": "string",
                    "description": "wav8k، wav16k، sln، ulaw یا alaw."
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "کد تأیید شما چهار هشت دو نه یک سه است",
                "format": "alaw"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": "(باینری) — X-TTS-Chars: 36, X-TTS-Price: 720"
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید نامعتبر است، یا آزمایش رایگان بسته شده و کلیدی نفرستاده‌اید (key_required)."
          },
          "402": {
            "description": "insufficient_balance: اعتبار برای این جمله کافی نیست؛ قبل از تولید صدا رد می‌شود و هزینه‌ای ندارد."
          },
          "403": {
            "description": "forbidden: کلید دامنهٔ tts.say ندارد یا ویژگی TTS برای حساب شما فعال نیست."
          },
          "409": {
            "description": "kyc_required: احراز هویت تأیید نشده است."
          },
          "422": {
            "description": "text_too_long: متن از سقف مجاز طولانی‌تر است (در آزمایش رایگان کوتاه‌تر).\nempty_text: متن چیزی برای خواندن ندارد (مثلاً فقط توضیح داخل [ ] یا ( ) است).\nunknown_voice: صدای خواسته‌شده در دسترس نیست؛ فهرست را از GET /public/tts/info بگیرید.\nunknown_format: قالب خواسته‌شده در دسترس نیست.\ndaily_limit: سقف حرف روزانهٔ کلید پر شده است."
          },
          "429": {
            "description": "demo_limit: سقف روزانهٔ آزمایش رایگان پر شده است یا درخواست‌ها در دقیقه زیاد بوده؛ با کلید API ادامه دهید."
          },
          "502": {
            "description": "tts_failed: موتور صدا پاسخ نداد؛ هزینه‌ای کم نشده است، دوباره تلاش کنید."
          },
          "503": {
            "description": "tts_disabled: سرویس موقتاً غیرفعال است."
          }
        }
      }
    },
    "/public/tts/info": {
      "get": {
        "operationId": "ttsInfo",
        "tags": [
          "tts"
        ],
        "summary": "صداها، قالب‌ها و تعرفهٔ TTS",
        "description": "فهرست صداها و قالب‌های در دسترس، سقف‌ها و تعرفهٔ پایه؛ بدون کلید.\n\nبرای ساخت فهرست انتخاب صدا در برنامهٔ شما یا نمایش تعرفه. مقدار `defaultVoice` صدایی است که وقتی `voice` نفرستید خوانده می‌شود.\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "limits": {
                    "maxChars": 500,
                    "demoEnabled": true,
                    "demoMaxChars": 80
                  },
                  "tariff": {
                    "perChar": "20",
                    "minRequest": "200"
                  },
                  "voices": [
                    {
                      "id": "char_officer_serious",
                      "nameFa": "آقای افشار",
                      "roleFa": "مدیر مصمم، قانون‌مدار و اداری",
                      "category": "adult",
                      "avatarEmoji": "👔"
                    }
                  ],
                  "enabled": true,
                  "formats": [
                    {
                      "id": "wav8k",
                      "ext": "wav",
                      "rate": 8000,
                      "labelFa": "WAV ۸ کیلوهرتز"
                    }
                  ],
                  "defaultVoice": "char_officer_serious"
                }
              }
            }
          }
        }
      }
    },
    "/ai/models": {
      "get": {
        "operationId": "aiModels",
        "tags": [
          "ai"
        ],
        "summary": "فهرست مدل‌های هوش مصنوعی",
        "description": "مدل‌های فعال و ضریب اعتبار هر کدام، به قالب OpenAI.\n\nهمان `GET /v1/models` در OpenAI است؛ هر مدل `id` (کد مدل برای فیلد `model` در چت)، `object` و `owned_by` دارد و ضریب اعتبار با تخفیف گروه کاربری شما محاسبه می‌شود. سقف ۶۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `ai.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "ai.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "data": [
                    {
                      "id": "gpt-fast",
                      "object": "model",
                      "owned_by": "irnoti"
                    }
                  ],
                  "object": "list"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا بدون دامنهٔ لازم."
          }
        }
      }
    },
    "/ai/balance": {
      "get": {
        "operationId": "aiBalance",
        "tags": [
          "ai"
        ],
        "summary": "موجودی اعتبار هوش مصنوعی",
        "description": "اعتبار قابل‌مصرف، اعتبار رزروشده و تخفیف شما.\n\n`balance` اعتبار آزاد، `held` اعتبار رزروشدهٔ درخواست‌های در جریان، `discountPercent` تخفیف گروه شما و `walletFallback` نشان می‌دهد وقتی اعتبار تمام شود از کیف پول (ریال) کسر شود یا نه. مقادیر عددی به‌صورت رشته برمی‌گردند.\n\nدسترسی لازم (scope): `ai.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "ai.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "held": "0",
                  "balance": "120000",
                  "walletFallback": true,
                  "discountPercent": 10
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا بدون دامنهٔ لازم."
          }
        }
      }
    },
    "/ai/chat/completions": {
      "post": {
        "operationId": "aiChat",
        "tags": [
          "ai"
        ],
        "summary": "گفتگو با مدل (Chat Completions)",
        "description": "درخواست چت سازگار با OpenAI، با پاسخ عادی یا جریانی (SSE).\n\nهر SDK سازگار با OpenAI را فقط با تغییر `base_url` به `https://api.irnoti.com/v1/ai` و کلید `irn_…` به‌کار بگیرید. با `stream: true` پاسخ به‌صورت server-sent events می‌رسد و با `data: [DONE]` پایان می‌یابد. هزینه از اعتبار هوش مصنوعی کاربر کسر می‌شود و در هدرهای `X-Credits-Charged`، `X-Credits-Balance` و `X-Wallet-Rial-Charged` و بلاک `irnoti` پاسخ آمده است. تصویر هنوز پشتیبانی نمی‌شود؛ `content` رشته یا فهرست بخش‌های `{type:\"text\"}` است. حداکثر ۲۰۰ پیام و ۴۰۰٬۰۰۰ نویسه؛ سقف ۱۲۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `ai.chat`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "ai.chat",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "کد مدل از `GET /ai/models` (حداکثر ۶۰ نویسه)."
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "description": "{role, content}"
                    },
                    "description": "پیام‌ها؛ `role` یکی از `system`، `user`، `assistant`."
                  },
                  "max_tokens": {
                    "type": "integer",
                    "description": "سقف توکن خروجی (۱ تا ۲۰۰٬۰۰۰)."
                  },
                  "temperature": {
                    "type": "number",
                    "description": "خلاقیت، ۰ تا ۲."
                  },
                  "top_p": {
                    "type": "number",
                    "description": "نمونه‌گیری هستهٔ احتمال، بیشتر از ۰ و حداکثر ۱."
                  },
                  "stop": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "تا ۴ رشتهٔ توقف."
                  },
                  "stream": {
                    "type": "boolean",
                    "description": "پاسخ جریانی SSE."
                  }
                },
                "required": [
                  "model",
                  "messages"
                ]
              },
              "example": {
                "model": "gpt-fast",
                "messages": [
                  {
                    "role": "system",
                    "content": "به فارسی کوتاه پاسخ بده."
                  },
                  {
                    "role": "user",
                    "content": "سلام!"
                  }
                ],
                "max_tokens": 200
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "chatcmpl-5521",
                  "model": "gpt-fast",
                  "usage": {
                    "total_tokens": 33,
                    "prompt_tokens": 24,
                    "completion_tokens": 9
                  },
                  "irnoti": {
                    "credits_balance": "119967",
                    "credits_charged": "33",
                    "wallet_rial_charged": "0"
                  },
                  "object": "chat.completion",
                  "choices": [
                    {
                      "index": 0,
                      "message": {
                        "role": "assistant",
                        "content": "سلام! چطور کمکتان کنم؟"
                      },
                      "finish_reason": "stop"
                    }
                  ],
                  "created": 1767000000
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر یا متن بیش از حد طولانی."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا بدون دامنهٔ لازم."
          },
          "402": {
            "description": "insufficient_credit: اعتبار هوش مصنوعی (و در صورت فعال‌بودن، کیف پول) کافی نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر است."
          }
        }
      }
    },
    "/ai/images/generations": {
      "post": {
        "operationId": "aiImages",
        "tags": [
          "ai"
        ],
        "summary": "ساخت تصویر",
        "description": "ساخت تصویر از متن، سازگار با OpenAI.\n\nتصویرها همیشه به‌صورت base64 در `data[].b64_json` برمی‌گردند (نه لینک). تا ۴ تصویر در هر درخواست. اندازه‌های مجاز: `256x256`، `512x512`، `1024x1024`، `1024x1536`، `1536x1024`، `1024x1792`، `1792x1024`؛ اگر مدل اندازه را نپذیرد خطا می‌گیرید. هزینه به اعتبار هوش مصنوعی و به‌ازای هر تصویر است. در پاسخ، هدرهای `X-Credits-Charged`، `X-Credits-Balance` و `X-Wallet-Rial-Charged` مصرف را نشان می‌دهد و بلوک `irnoti` همان مقادیر را در بدنه دارد. سقف ۳۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `ai.image`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "ai.image",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "توضیح تصویر (حداکثر ۴۰۰۰ نویسه)."
                  },
                  "model": {
                    "type": "string",
                    "description": "کد مدل (فقط اگر گروه شما اجازهٔ انتخاب دارد)."
                  },
                  "n": {
                    "type": "integer",
                    "description": "تعداد تصویر (۱ تا ۴، پیش‌فرض ۱)."
                  },
                  "size": {
                    "type": "string",
                    "description": "اندازه؛ پیش‌فرض `1024x1024`."
                  }
                },
                "required": [
                  "prompt"
                ]
              },
              "example": {
                "n": 1,
                "size": "1024x1024",
                "prompt": "گربه‌ای فضانورد روی ماه"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "data": [
                    {
                      "b64_json": "iVBORw0KGgo…"
                    }
                  ],
                  "irnoti": {
                    "model": "img-1",
                    "credits_balance": "960",
                    "credits_charged": "40",
                    "wallet_rial_charged": "0"
                  },
                  "created": 1790000000
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "insufficient_credit: اعتبار هوش مصنوعی کافی نیست."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/ai/embeddings": {
      "post": {
        "operationId": "aiEmbeddings",
        "tags": [
          "ai"
        ],
        "summary": "بردار معنایی (Embedding)",
        "description": "تبدیل متن به بردار، سازگار با OpenAI.\n\n`input` رشته یا آرایه‌ای تا ۹۶ رشته (هر کدام تا ۳۲٬۰۰۰ نویسه). بردارها همیشه عددیِ float هستند. هزینه بر اساس توکن ورودی است. در پاسخ، هدرهای `X-Credits-Charged`، `X-Credits-Balance` و `X-Wallet-Rial-Charged` مصرف را نشان می‌دهد و بلوک `irnoti` همان مقادیر را در بدنه دارد. سقف ۱۲۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `ai.embed`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "ai.embed",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "متن(ها)."
                  },
                  "model": {
                    "type": "string",
                    "description": "کد مدل."
                  },
                  "encoding_format": {
                    "type": "string",
                    "description": "فقط `float`."
                  }
                },
                "required": [
                  "input"
                ]
              },
              "example": {
                "input": [
                  "سلام دنیا"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "data": [
                    {
                      "index": 0,
                      "object": "embedding",
                      "embedding": [
                        0.012,
                        -0.034
                      ]
                    }
                  ],
                  "model": "emb-1",
                  "usage": {
                    "total_tokens": 4,
                    "prompt_tokens": 4
                  },
                  "irnoti": {
                    "credits_balance": "999",
                    "credits_charged": "1",
                    "wallet_rial_charged": "0"
                  },
                  "object": "list"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/ai/moderations": {
      "post": {
        "operationId": "aiModerations",
        "tags": [
          "ai"
        ],
        "summary": "پایش محتوا (Moderation)",
        "description": "تشخیص محتوای نامناسب، سازگار با OpenAI.\n\n`input` رشته یا آرایه‌ای تا ۳۲ رشته. نتیجه عیناً از مدل می‌آید. هزینه به‌ازای هر درخواست است. در پاسخ، هدرهای `X-Credits-Charged`، `X-Credits-Balance` و `X-Wallet-Rial-Charged` مصرف را نشان می‌دهد و بلوک `irnoti` همان مقادیر را در بدنه دارد. سقف ۱۲۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `ai.moderate`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "ai.moderate",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "متن(ها)."
                  },
                  "model": {
                    "type": "string",
                    "description": "کد مدل."
                  }
                },
                "required": [
                  "input"
                ]
              },
              "example": {
                "input": "متن نمونه"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "modr-77",
                  "model": "mod-1",
                  "irnoti": {
                    "credits_balance": "998",
                    "credits_charged": "1",
                    "wallet_rial_charged": "0"
                  },
                  "results": [
                    {
                      "flagged": false,
                      "categories": {},
                      "category_scores": {}
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/ai/audio/transcriptions": {
      "post": {
        "operationId": "aiTranscriptions",
        "tags": [
          "ai"
        ],
        "summary": "تبدیل گفتار به متن",
        "description": "رونویسی فایل صوتی، سازگار با OpenAI.\n\nدرخواست `multipart/form-data` با فیلد `file` (mp3، mp4، m4a، mpeg، mpga، wav، webm، ogg، oga، flac؛ حداکثر ۲۵ مگابایت). هزینه به‌ازای هر مگابایتِ آغازشده است. با `response_format=text` فقط متن ساده برمی‌گردد. در پاسخ، هدرهای `X-Credits-Charged`، `X-Credits-Balance` و `X-Wallet-Rial-Charged` مصرف را نشان می‌دهد و بلوک `irnoti` همان مقادیر را در بدنه دارد. سقف ۳۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `ai.stt`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "ai.stt",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "description": "فایل صوتی."
                  },
                  "model": {
                    "type": "string",
                    "description": "کد مدل."
                  },
                  "language": {
                    "type": "string",
                    "description": "کد زبان ISO مثل `fa`."
                  },
                  "prompt": {
                    "type": "string",
                    "description": "راهنمای متنی (حداکثر ۱۰۰۰ نویسه)."
                  },
                  "response_format": {
                    "type": "string",
                    "description": "`json` (پیش‌فرض) یا `text`."
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "text": "سلام، این یک آزمایش است.",
                  "irnoti": {
                    "model": "stt-1",
                    "credits_balance": "996",
                    "credits_charged": "2",
                    "wallet_rial_charged": "0"
                  },
                  "duration": 4.2,
                  "language": "fa"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/video/models": {
      "get": {
        "operationId": "videoModels",
        "tags": [
          "video"
        ],
        "summary": "فهرست مدل‌های ویدئو",
        "description": "مدل‌های ساخت ویدئو، حداکثر مدت و اعتبار هر ثانیه.\n\nبرای هر مدل: کد، نام، امکان ورودی تصویر، حداکثر ثانیه و نرخ اعتبار در هر ثانیهٔ ۷۲۰p و ۱۰۸۰p (با تخفیف گروه شما). سقف ۶۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `video.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "video.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "data": [
                    {
                      "code": "veo-fast",
                      "name": "Veo Fast",
                      "imageInput": true,
                      "maxSeconds": 8
                    }
                  ],
                  "object": "list"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا بدون دامنهٔ لازم."
          }
        }
      }
    },
    "/video/jobs": {
      "post": {
        "operationId": "videoCreate",
        "tags": [
          "video"
        ],
        "summary": "ثبت درخواست ساخت ویدئو",
        "description": "یک کار ساخت ویدئو در صف می‌گذارد و `201` برمی‌گرداند.\n\nاعتبار لازم هنگام ثبت رزرو و پس از پایان تسویه می‌شود؛ اگر کار شکست بخورد یا لغو شود رزرو آزاد می‌گردد. کلید سندباکس به پرووایدر نمی‌رسد و `403 sandbox_unsupported` می‌گیرد. تعداد کارهای هم‌زمان هر کاربر محدود است. وضعیت را با `GET /video/jobs/{id}` پیگیری کنید.\n\nدسترسی لازم (scope): `video.create`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "video.create",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "کلید یکتا (حداکثر ۱۰۰ نویسه) برای جلوگیری از ثبت دوباره."
            },
            "description": "کلید یکتا (حداکثر ۱۰۰ نویسه) برای جلوگیری از ثبت دوباره.",
            "example": "vid-1001"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "توضیح صحنه (۳ تا ۲۰۰۰ نویسه)."
                  },
                  "durationSec": {
                    "type": "integer",
                    "description": "مدت ویدئو به ثانیه (۱ تا ۶۰، حداکثر طبق مدل)."
                  },
                  "model": {
                    "type": "string",
                    "description": "کد مدل از `GET /video/models`؛ اگر نیاید استودیو انتخاب می‌کند."
                  },
                  "negativePrompt": {
                    "type": "string",
                    "description": "چیزهایی که نباید در ویدئو باشد (حداکثر ۱۰۰۰ نویسه)."
                  },
                  "imageMediaId": {
                    "type": "string",
                    "description": "شناسهٔ تصویر آپلودشده برای ساخت ویدئو از روی تصویر."
                  },
                  "aspect": {
                    "oneOf": [
                      {
                        "description": "'16:9'"
                      },
                      {
                        "description": "'9:16'"
                      },
                      {
                        "description": "'1:1'"
                      }
                    ],
                    "description": "نسبت تصویر؛ پیش‌فرض `16:9`."
                  },
                  "resolution": {
                    "oneOf": [
                      {
                        "description": "'720p'"
                      },
                      {
                        "description": "'1080p'"
                      }
                    ],
                    "description": "کیفیت؛ پیش‌فرض `720p`."
                  },
                  "seed": {
                    "type": "integer",
                    "description": "بذر تصادفی برای نتیجهٔ تکرارپذیر."
                  }
                },
                "required": [
                  "prompt",
                  "durationSec"
                ]
              },
              "example": {
                "model": "veo-fast",
                "aspect": "16:9",
                "prompt": "غروب خورشید روی دریای خزر",
                "resolution": "720p",
                "durationSec": 6
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "77",
                  "status": "queued",
                  "progress": 0
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credit: اعتبار کافی نیست."
          },
          "403": {
            "description": "sandbox_unsupported: کلید سندباکس ویدئو نمی‌سازد."
          },
          "429": {
            "description": "too_many_active: تعداد کارهای فعال از سقف بیشتر است."
          }
        }
      },
      "get": {
        "operationId": "videoList",
        "tags": [
          "video"
        ],
        "summary": "فهرست ویدئوها",
        "description": "کارهای ساخت ویدئوی شما، صفحه‌بندی‌شده.\n\nجدیدترین کارها اول. سقف ۱۲۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `video.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "video.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "شمارهٔ صفحه، پیش‌فرض ۱."
            },
            "description": "شمارهٔ صفحه، پیش‌فرض ۱.",
            "example": 1
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "اندازهٔ صفحه، پیش‌فرض ۲۰."
            },
            "description": "اندازهٔ صفحه، پیش‌فرض ۲۰.",
            "example": 20
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "items": [
                    {
                      "id": "77",
                      "status": "done",
                      "progress": 100
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا بدون دامنهٔ لازم."
          }
        }
      }
    },
    "/video/jobs/{id}": {
      "get": {
        "operationId": "videoGet",
        "tags": [
          "video"
        ],
        "summary": "وضعیت یک ویدئو",
        "description": "وضعیت و پیشرفت کار.\n\nوضعیت یکی از `queued`، `running`، `done`، `failed`، `canceled` است. بعد از `done` فایل را با `GET /video/jobs/{id}/file` بگیرید. سقف ۳۰۰ درخواست در دقیقه؛ برای پیگیری از وب‌هوک یا فاصلهٔ چند ثانیه استفاده کنید.\n\nدسترسی لازم (scope): `video.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "video.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کار."
            },
            "description": "شناسهٔ کار.",
            "example": "77"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "77",
                  "status": "running",
                  "progress": 40
                }
              }
            }
          },
          "404": {
            "description": "not_found: کار پیدا نشد."
          }
        }
      }
    },
    "/video/jobs/{id}/cancel": {
      "post": {
        "operationId": "videoCancel",
        "tags": [
          "video"
        ],
        "summary": "لغو ساخت ویدئو",
        "description": "کار در صف یا در حال اجرا را لغو و رزرو اعتبار را آزاد می‌کند.\n\nبرای کار تمام‌شده `409 job_finished` برمی‌گردد.\n\nدسترسی لازم (scope): `video.create`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "video.create",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کار."
            },
            "description": "شناسهٔ کار.",
            "example": "77"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "77",
                  "status": "canceled"
                }
              }
            }
          },
          "409": {
            "description": "job_finished: کار قبلاً تمام شده است."
          }
        }
      }
    },
    "/video/jobs/{id}/file": {
      "get": {
        "operationId": "videoFile",
        "tags": [
          "video"
        ],
        "summary": "دریافت فایل ویدئو",
        "description": "فایل ویدئوی ساخته‌شده؛ از `Range` پشتیبانی می‌کند.\n\nپاسخ خود فایل است (`Content-Disposition: attachment`) و ذخیره نمی‌شود (`no-store`). پیش از `done` خطای ۴۰۹ می‌گیرید.\n\nدسترسی لازم (scope): `video.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "video.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کار."
            },
            "description": "شناسهٔ کار.",
            "example": "77"
          },
          {
            "name": "Range",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "مثلاً `bytes=0-1048575` برای دریافت بخشی."
            },
            "description": "مثلاً `bytes=0-1048575` برای دریافت بخشی."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "404": {
            "description": "not_found: کار یا فایل پیدا نشد."
          }
        }
      }
    },
    "/verify/info": {
      "get": {
        "operationId": "verifyInfo",
        "tags": [
          "verify"
        ],
        "summary": "قیمت هر تأیید",
        "description": "بهای هر نشست تأیید به ریال.\n\nقیمت (ریال، رشته) که برای هر نشست موفق از اعتبار شما کسر می‌شود.\n\nدسترسی لازم (scope): `verify.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "verify.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "price": "1500"
                }
              }
            }
          }
        }
      }
    },
    "/verify/sessions": {
      "post": {
        "operationId": "verifyCreate",
        "tags": [
          "verify"
        ],
        "summary": "شروع نشست تأیید",
        "description": "کد یک‌بارمصرف یا پیوند تأیید را به موبایل، بات یا پوش می‌فرستد.\n\nدقیقاً یکی از `to` (موبایل) یا `bot` را بدهید. کلید سندباکس پیامک نمی‌فرستد و خود `code` را در پاسخ برمی‌گرداند تا بدون گوشی تست کنید. `mode`: `code` (کد)، `link` (پیوند) یا `both`. سقف ۳۰۰ درخواست در دقیقه. نتیجه را از `callbackUrl` (وب‌هوک) یا `GET /verify/sessions/{id}` بگیرید.\n\nدسترسی لازم (scope): `verify.send`\n\nبا کلید آزمایشی (sandbox) هم قابل‌استفاده است.",
        "x-required-scope": "verify.send",
        "x-sandbox": true,
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "string",
                    "description": "موبایل مقصد."
                  },
                  "bot": {
                    "description": "مقصد از طریق بات پیام‌رسان."
                  },
                  "lineId": {
                    "type": "string",
                    "description": "شناسهٔ خط ارسال، یا `sandbox`."
                  },
                  "push": {
                    "description": "ارسال به‌صورت پوش با بازگشت به پیامک؛ نیازمند `to`."
                  },
                  "mode": {
                    "oneOf": [
                      {
                        "description": "'code'"
                      },
                      {
                        "description": "'link'"
                      },
                      {
                        "description": "'both'"
                      }
                    ],
                    "description": "شیوهٔ تأیید."
                  },
                  "length": {
                    "type": "integer",
                    "description": "طول کد، ۴ تا ۸."
                  },
                  "ttlSec": {
                    "type": "integer",
                    "description": "اعتبار نشست به ثانیه، ۶۰ تا ۱۸۰۰."
                  },
                  "maxAttempts": {
                    "type": "integer",
                    "description": "حداکثر تلاش، ۳ تا ۱۰."
                  },
                  "redirectUrl": {
                    "type": "string",
                    "description": "آدرس بازگشت کاربر پس از تأیید."
                  },
                  "callbackUrl": {
                    "type": "string",
                    "description": "آدرس وب‌هوک نتیجه."
                  },
                  "clientRef": {
                    "type": "string",
                    "description": "شناسهٔ دلخواه شما (حداکثر ۱۰۰ نویسه)."
                  },
                  "brandName": {
                    "type": "string",
                    "description": "نام برند در صفحه و پیام."
                  },
                  "brandColor": {
                    "type": "string",
                    "description": "رنگ برند، مثل `#FF3300`."
                  }
                },
                "required": []
              },
              "example": {
                "to": "09121234567",
                "mode": "code",
                "length": 6,
                "ttlSec": 300,
                "clientRef": "login-8841"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "312",
                  "to": "0912***4567",
                  "link": "https://irnoti.com/v/vt_x9…",
                  "mode": "code",
                  "token": "vt_x9…",
                  "status": "pending",
                  "channel": "sms",
                  "expiresAt": "2026-10-27T10:05:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: هیچ‌کدام یا هر دو از `to`/`bot` داده شده‌اند."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست یا ارسال به این مقصد زیاد است."
          }
        }
      },
      "get": {
        "operationId": "verifyList",
        "tags": [
          "verify"
        ],
        "summary": "فهرست نشست‌های تأیید",
        "description": "نشست‌های اخیر با صفحه‌بندی مبتنی بر شناسه.\n\nبرای صفحهٔ بعد `before` را برابر `id` آخرین مورد بگذارید.\n\nدسترسی لازم (scope): `verify.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "verify.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "take",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "تعداد."
            },
            "description": "تعداد.",
            "example": 20
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط نشست‌های قدیمی‌تر از این شناسه."
            },
            "description": "فقط نشست‌های قدیمی‌تر از این شناسه."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "items": [
                    {
                      "id": "312",
                      "to": "0912***4567",
                      "price": "1500",
                      "status": "verified",
                      "channel": "sms",
                      "attempts": 1,
                      "clientRef": "login-8841"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/verify/sessions/{id}": {
      "get": {
        "operationId": "verifyGet",
        "tags": [
          "verify"
        ],
        "summary": "وضعیت یک نشست",
        "description": "وضعیت: `pending`، `verified`، `expired`، `locked` یا `canceled`.\n\nشامل تعداد تلاش و ارسال مجدد، زمان انقضا و زمان تأیید.\n\nدسترسی لازم (scope): `verify.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "verify.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ نشست."
            },
            "description": "شناسهٔ نشست.",
            "example": "312"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "312",
                  "status": "verified",
                  "verifiedAt": "2026-10-27T10:01:12.000Z"
                }
              }
            }
          },
          "404": {
            "description": "not_found: نشست پیدا نشد."
          }
        }
      }
    },
    "/verify/sessions/{id}/cancel": {
      "post": {
        "operationId": "verifyCancel",
        "tags": [
          "verify"
        ],
        "summary": "لغو نشست",
        "description": "نشست در انتظار را لغو می‌کند (`204`).\n\nفقط نشست `pending` قابل لغو است، وگرنه ۴۰۴.\n\nدسترسی لازم (scope): `verify.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "verify.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ نشست."
            },
            "description": "شناسهٔ نشست.",
            "example": "312"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "404": {
            "description": "not_found: نشست پیدا نشد یا دیگر در انتظار نیست."
          }
        }
      }
    },
    "/verify/stats": {
      "get": {
        "operationId": "verifyStats",
        "tags": [
          "verify"
        ],
        "summary": "آمار تأیید",
        "description": "شمار کل، موفق، لغو و قفل‌شده و نرخ موفقیت.\n\n`rate` درصد نشست‌های موفق است.\n\nدسترسی لازم (scope): `verify.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "verify.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "rate": 85,
                  "total": 200,
                  "locked": 5,
                  "canceled": 10,
                  "verified": 170
                }
              }
            }
          }
        }
      }
    },
    "/verify/{token}": {
      "get": {
        "operationId": "verifyPublicInfo",
        "tags": [
          "verify"
        ],
        "summary": "اطلاعات صفحهٔ تأیید",
        "description": "اطلاعات نمایشی یک نشست تأیید برای صفحهٔ عمومی (بدون کلید).\n\nتوکن در لینکی است که به کاربر می‌دهید. فقط داده‌های عمومی (برند، رنگ، حالت تأیید، زمان انقضا) برمی‌گردد.\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "توکن نشست."
            },
            "description": "توکن نشست.",
            "example": "vt_abc123"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "mode": "code",
                  "status": "pending",
                  "brandName": "فروشگاه نمونه",
                  "expiresAt": "2026-10-30T10:25:00.000Z",
                  "brandColor": "#FF3300"
                }
              }
            }
          },
          "404": {
            "description": "not_found: نشست پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/verify/{token}/confirm": {
      "post": {
        "operationId": "verifyPublicConfirm",
        "tags": [
          "verify"
        ],
        "summary": "تأیید نشست با کاربر",
        "description": "کد را (در حالت کدی) یا تأیید لینکی را ثبت می‌کند.\n\nبدون کلید و از صفحهٔ تأیید فراخوانی می‌شود. پس از تعداد تلاش مجاز، نشست قفل می‌شود. در پاسخ `status` و در صورت تنظیم `redirect` برمی‌گردد.\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "توکن نشست."
            },
            "description": "توکن نشست.",
            "example": "vt_abc123"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "کد ۴ تا ۸ رقمی (در حالت کدی)."
                  }
                },
                "required": []
              },
              "example": {
                "code": "123456"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "status": "verified",
                  "redirect": "https://shop.example.com/verified"
                }
              }
            }
          },
          "400": {
            "description": "invalid_code: کد اشتباه است."
          },
          "404": {
            "description": "not_found: نشست پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/verify/{token}/resend": {
      "post": {
        "operationId": "verifyPublicResend",
        "tags": [
          "verify"
        ],
        "summary": "ارسال دوبارهٔ کد",
        "description": "کد را دوباره می‌فرستد.\n\nتعداد و فاصلهٔ ارسال مجدد محدود است؛ در صورت تجاوز خطای ۴۲۹ می‌گیرید.\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "توکن نشست."
            },
            "description": "توکن نشست.",
            "example": "vt_abc123"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "status": "pending",
                  "resentAt": "2026-10-30T10:21:00.000Z"
                }
              }
            }
          },
          "404": {
            "description": "not_found: نشست پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/services/availability": {
      "get": {
        "operationId": "servicesAvailability",
        "tags": [
          "services"
        ],
        "summary": "سرویس‌های فعال",
        "description": "کدام سرویس‌های سفارشی در دسترس است.\n\nمحصولات: `regional`، `targeted`، `peyamap`، `smart`، `messenger`، `voice`، `international`.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "voice": true,
                  "regional": true
                }
              }
            }
          }
        }
      }
    },
    "/services/prices": {
      "get": {
        "operationId": "servicesPrices",
        "tags": [
          "services"
        ],
        "summary": "تعرفهٔ سرویس‌ها",
        "description": "قیمت واحد هر محصول برای گروه کاربری شما.\n\nمبالغ به ریال و رشته‌اند. نرخ مقصدهای بین‌المللی در `GET /services/international/rates` است.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "regional": "260",
                  "targeted": "300"
                }
              }
            }
          }
        }
      }
    },
    "/services/international/rates": {
      "get": {
        "operationId": "servicesIntlRates",
        "tags": [
          "services"
        ],
        "summary": "نرخ پیامک بین‌المللی",
        "description": "مقصدها و قیمت هر بخش پیامک.\n\nقبل از `POST /services/international` نرخ مقصد را از این فهرست ببینید.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "items": [
                    {
                      "code": "TR",
                      "name": "ترکیه",
                      "pricePerPart": "900"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/services/{product}/quote": {
      "post": {
        "operationId": "servicesQuote",
        "tags": [
          "services"
        ],
        "summary": "برآورد قیمت سفارش",
        "description": "بدون ثبت و کسر اعتبار، قیمت سفارش را می‌دهد.\n\nبدنه مثل ثبت سفارش همان محصول است. محصول: `regional`، `targeted`، `peyamap`، `smart`، `messenger`، `voice` یا `international`. اگر سرویس برای کاربر فعال نباشد خطای دسترسی می‌گیرید.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "product",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "نام محصول."
            },
            "description": "نام محصول.",
            "example": "regional"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "متن پیام (تا ۹۰۰ نویسه؛ صوتی تا ۳۰۰)."
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "تخفیف ویژه",
                "count": 1000,
                "province": "تهران"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "total": "260000",
                  "quantity": 1000,
                  "unitPrice": "260"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: پارامترهای محصول نامعتبر است."
          }
        }
      }
    },
    "/services/{product}": {
      "post": {
        "operationId": "servicesCreate",
        "tags": [
          "services"
        ],
        "summary": "ثبت سفارش سرویس",
        "description": "سفارش را ثبت و هزینه را از کیف پول کسر می‌کند.\n\nفیلدهای بدنه به محصول بستگی دارد: `regional` (`province`، `city?`، `count`، `text`، `scheduledAt?`)، `targeted` (فیلترهای مخاطب مثل `gender`، `ageFrom`، `ageTo`، `province`، `operator`، `job` + `count`، `text`)، `peyamap` (`operator`، `areas[]`، `text`)، `smart` / `voice` / `international` (`recipients[]` تا ۱۰٬۰۰۰ شماره + `text`) و `messenger` (`channel`، `recipients[]`، `text`). تعداد منطقه‌ای/هدفمند ۱۰۰ تا ۱٬۰۰۰٬۰۰۰. سقف ۳۰ سفارش در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "product",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "نام محصول."
            },
            "description": "نام محصول.",
            "example": "smart"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "متن پیام."
                  },
                  "count": {
                    "type": "integer",
                    "description": "تعداد مخاطب (منطقه‌ای/هدفمند)."
                  },
                  "recipients": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شماره‌ها (smart، voice، messenger، international)."
                  },
                  "scheduledAt": {
                    "type": "string",
                    "description": "زمان ارسال به‌صورت ISO 8601 (UTC)."
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "سلام",
                "recipients": [
                  "09121234567"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "61",
                  "status": "pending"
                }
              }
            }
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "403": {
            "description": "kyc_required: احراز هویت لازم است."
          }
        }
      },
      "get": {
        "operationId": "servicesList",
        "tags": [
          "services"
        ],
        "summary": "سفارش‌های یک سرویس",
        "description": "سفارش‌های شما برای یک محصول.\n\nمحصول ناشناخته ۴۰۴ می‌دهد.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "product",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "نام محصول."
            },
            "description": "نام محصول.",
            "example": "smart"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "items": [
                    {
                      "id": "61",
                      "status": "delivered"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "not_found: محصول ناشناخته."
          }
        }
      }
    },
    "/services/{product}/{id}": {
      "get": {
        "operationId": "servicesGet",
        "tags": [
          "services"
        ],
        "summary": "جزئیات سفارش",
        "description": "وضعیت یک سفارش.\n\nبرای به‌روزرسانی وضعیت از پرووایدر، `POST /services/{product}/{id}/refresh` را بزنید و برای لغو `POST /services/{product}/{id}/cancel` (دامنهٔ `sms.send`).\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "product",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "نام محصول."
            },
            "description": "نام محصول.",
            "example": "smart"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ سفارش."
            },
            "description": "شناسهٔ سفارش.",
            "example": "61"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "61",
                  "status": "delivered"
                }
              }
            }
          },
          "404": {
            "description": "not_found: سفارش پیدا نشد."
          }
        }
      }
    },
    "/services/{product}/{id}/refresh": {
      "post": {
        "operationId": "servicesRefresh",
        "tags": [
          "services"
        ],
        "summary": "به‌روزرسانی وضعیت سفارش",
        "description": "وضعیت یک سفارش را از تأمین‌کننده دوباره می‌پرسد.\n\nبرای وقتی که منتظر نتیجهٔ سفارش هستید. محصول‌ها همان مقادیر `GET /services/availability` هستند.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "product",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "نوع محصول."
            },
            "description": "نوع محصول.",
            "example": "targeted"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ سفارش."
            },
            "description": "شناسهٔ سفارش.",
            "example": "15"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "15",
                  "status": "processing"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: سفارش پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/services/{product}/{id}/cancel": {
      "post": {
        "operationId": "servicesCancel",
        "tags": [
          "services"
        ],
        "summary": "لغو سفارش",
        "description": "سفارشی را که هنوز اجرا نشده لغو و هزینه را برمی‌گرداند.\n\nفقط سفارش‌های در انتظار قابل لغو هستند.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "product",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "نوع محصول."
            },
            "description": "نوع محصول.",
            "example": "targeted"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ سفارش."
            },
            "description": "شناسهٔ سفارش.",
            "example": "15"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "15",
                  "status": "cancelled",
                  "refunded": "250000"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: سفارش پیدا نشد یا متعلق به شما نیست."
          },
          "409": {
            "description": "conflict: سفارش دیگر قابل لغو نیست."
          }
        }
      }
    },
    "/voip/price": {
      "get": {
        "operationId": "voipPrice",
        "tags": [
          "voip"
        ],
        "summary": "تعرفهٔ تماس",
        "description": "قیمت هر دقیقه تماس برای شما.\n\nمبلغ به ریال و رشته است.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "price": "1200"
                }
              }
            }
          }
        }
      }
    },
    "/voip/calls": {
      "post": {
        "operationId": "voipCall",
        "tags": [
          "voip"
        ],
        "summary": "برقراری تماس (Click-to-Call)",
        "description": "ابتدا با `from` تماس می‌گیرد و پس از پاسخ، به `to` وصل می‌کند.\n\nضبط تماس فقط با `recordConsent: true` مجاز است (سامانه به دو طرف اعلام می‌کند). سقف ۲۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "description": "شمارهٔ اول (۱۰ تا ۱۵ رقم)."
                  },
                  "to": {
                    "type": "string",
                    "description": "شمارهٔ مقصد."
                  },
                  "callerId": {
                    "type": "string",
                    "description": "شمارهٔ نمایشی از خطوط خودتان."
                  },
                  "projectId": {
                    "type": "string",
                    "description": "پروژه."
                  },
                  "record": {
                    "type": "boolean",
                    "description": "ضبط تماس."
                  },
                  "recordConsent": {
                    "type": "boolean",
                    "description": "تأیید اطلاع‌رسانی ضبط به طرفین؛ با `record` الزامی است."
                  }
                },
                "required": [
                  "from",
                  "to"
                ]
              },
              "example": {
                "to": "02112345678",
                "from": "09121234567"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "501",
                  "status": "ringing"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: `record` بدون `recordConsent`."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          }
        }
      },
      "get": {
        "operationId": "voipCalls",
        "tags": [
          "voip"
        ],
        "summary": "تاریخچهٔ تماس‌ها",
        "description": "تماس‌های ثبت‌شده، با فیلتر پروژه.\n\nگزارش‌های تجمیعی در `/voip/reports/summary` و `/voip/reports/calls` و خروجی CSV در `/voip/reports/calls.csv` است.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "projectId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط یک پروژه."
            },
            "description": "فقط یک پروژه."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "items": [
                    {
                      "id": "501",
                      "status": "answered",
                      "durationSec": 62
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/voip/otp": {
      "post": {
        "operationId": "voipOtp",
        "tags": [
          "voip"
        ],
        "summary": "کد تأیید صوتی",
        "description": "کد تأیید را با تماس تلفنی می‌خواند (`201`).\n\nمناسب کاربرانی که پیامک دریافت نمی‌کنند. سقف ۱۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "510",
                  "status": "queued"
                }
              }
            }
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          }
        }
      }
    },
    "/voip/live": {
      "get": {
        "operationId": "voipLive",
        "tags": [
          "voip"
        ],
        "summary": "تماس‌های زنده",
        "description": "تماس‌های در جریان.\n\nبرای هر تماس زنده می‌توانید `POST /voip/calls/{id}/hangup`، `/hold`، `/transfer` یا `/spy` (دامنهٔ `sms.send`) را بزنید.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "items": [
                    {
                      "id": "501",
                      "to": "021…",
                      "from": "0912…",
                      "startedAt": "2026-10-27T10:00:00.000Z"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/link-tracker/send": {
      "post": {
        "operationId": "ltSend",
        "tags": [
          "linktracker"
        ],
        "summary": "ارسال با لینک کوتاه ردیابی‌شده",
        "description": "پیامک حاوی لینک کوتاه یکتا برای هر گیرنده؛ کلیک‌ها شمارش می‌شود و می‌توانید آزمون A/B بگیرید.\n\nمتن باید جای لینک را با `{link}` نشان دهد. برای هر گیرنده یک کد ۸ نویسه‌ای ساخته می‌شود و `https://…/l/{code}` پس از ثبت کلیک به `url` هدایت می‌کند.\n\n**آزمون A/B:** تا دو نسخهٔ دیگر در `variants` بدهید. بخشی از مخاطبان (`holdoutPercent`، ۱۰ تا ۷۰) نگه داشته می‌شود؛ پس از `decideAfterMinutes` (۱۵ تا ۱۰٬۰۸۰ دقیقه) نسخه‌ای که کلیک بیشتری گرفته برای بقیه ارسال می‌شود. با `POST /link-tracker/holdouts/{id}/send-now` می‌توانید زودتر تصمیم بگیرید.\n\nنیاز به احراز هویت کامل حساب و امکان «لینک‌ساز» در گروه کاربری شما دارد. سقف ۶۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lineId": {
                    "type": "string",
                    "description": "شناسهٔ خط فرستنده."
                  },
                  "text": {
                    "type": "string",
                    "description": "متن پیام (حداکثر ۹۰۰ نویسه) با `{link}`."
                  },
                  "url": {
                    "type": "string",
                    "description": "نشانی مقصد (http/https، حداکثر ۵۰۰ نویسه)."
                  },
                  "variants": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "تا ۲ نسخهٔ دیگرِ متن برای آزمون A/B."
                  },
                  "holdoutPercent": {
                    "type": "integer",
                    "description": "درصد مخاطبانِ نگه‌داشته برای ارسال برندهٔ آزمون (۱۰ تا ۷۰)."
                  },
                  "decideAfterMinutes": {
                    "type": "integer",
                    "description": "پس از چند دقیقه برنده تعیین شود (۱۵ تا ۱۰٬۰۸۰)."
                  },
                  "to": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شماره‌های گیرنده (حداکثر ۱۰٬۰۰۰)."
                  },
                  "groupIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "گروه‌های دفترچه تلفن. حداقل یکی از `to` یا `groupIds` الزامی است."
                  }
                },
                "required": [
                  "lineId",
                  "text",
                  "url"
                ]
              },
              "example": {
                "to": [
                  "09121234567"
                ],
                "url": "https://shop.example.com/offer",
                "text": "تخفیف ویژه: {link}",
                "lineId": "1",
                "variants": [
                  "فقط امروز! {link}"
                ],
                "holdoutPercent": 30,
                "decideAfterMinutes": 120
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "count": 1,
                  "batchId": "930",
                  "holdout": 0,
                  "totalPrice": "980"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد.\nfeature_locked: امکان لینک‌ساز برای گروه کاربری شما فعال نیست یا احراز هویت کامل نشده است."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/link-tracker/holdouts": {
      "get": {
        "operationId": "ltHoldouts",
        "tags": [
          "linktracker"
        ],
        "summary": "آزمون‌های در انتظار تصمیم",
        "description": "آزمون‌های A/B که هنوز برنده‌شان تعیین نشده.\n\nبرای هر آزمون شناسه، دستهٔ مبدأ، تعداد نگه‌داشته‌شده و زمان تصمیم‌گیری خودکار برمی‌گردد.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "12",
                    "held": 150,
                    "batchId": "930",
                    "decideAt": "2026-10-30T12:00:00.000Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/link-tracker/holdouts/{id}/send-now": {
      "post": {
        "operationId": "ltHoldoutNow",
        "tags": [
          "linktracker"
        ],
        "summary": "تعیین فوری برندهٔ آزمون",
        "description": "برنده را همین حالا انتخاب و برای مخاطبان نگه‌داشته‌شده ارسال می‌کند.\n\nنسخه‌ای که تا این لحظه نرخ کلیک بیشتری دارد برنده است.\n\n**فیلدهای پاسخ:** `winner` نسخهٔ برنده (`A`، `B`، …)، `followBatchId` شناسهٔ دستهٔ ارسال دوم.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ آزمون (از `GET /link-tracker/holdouts`)."
            },
            "description": "شناسهٔ آزمون (از `GET /link-tracker/holdouts`).",
            "example": "12"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "winner": "B",
                  "followBatchId": "931"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: آزمون پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/link-tracker/campaigns": {
      "get": {
        "operationId": "ltCampaigns",
        "tags": [
          "linktracker"
        ],
        "summary": "کمپین‌های لینک‌دار",
        "description": "فهرست ارسال‌های ردیابی‌شده با تعداد لینک و کلیک.\n\nهر ردیف یک دسته (`batchId`) است؛ جزئیات هر کدام را با `GET /link-tracker/campaigns/{batchId}` ببینید.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "links": 1000,
                    "batchId": "930",
                    "createdAt": "2026-10-30T10:00:00.000Z",
                    "uniqueClicks": 214
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/link-tracker/campaigns/{batchId}": {
      "get": {
        "operationId": "ltCampaign",
        "tags": [
          "linktracker"
        ],
        "summary": "گزارش کمپین لینک‌دار",
        "description": "نرخ کلیک هر نسخه به‌همراه توزیع کشور، دستگاه و ساعت.\n\nکلیک‌های یکتا هر گیرنده یک‌بار شمرده می‌شود (ربات‌ها و پیش‌نمایش‌ها حذف می‌شوند). `ctr` درصد با یک رقم اعشار است.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دسته."
            },
            "description": "شناسهٔ دسته.",
            "example": "930"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "variants": [
                    {
                      "ctr": 17.4,
                      "links": 350,
                      "variant": "A",
                      "uniqueClicks": 61
                    },
                    {
                      "ctr": 25.1,
                      "links": 350,
                      "variant": "B",
                      "uniqueClicks": 88
                    }
                  ],
                  "countries": [
                    {
                      "key": "IR",
                      "count": 140
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: کمپین پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/number-banks": {
      "get": {
        "operationId": "nbList",
        "tags": [
          "numberbank"
        ],
        "summary": "فهرست بانک‌های شماره",
        "description": "بانک‌های شمارهٔ در دسترس برای ارسال هدفمند به مخاطبان خارج از دفترچهٔ شما.\n\nهر بانک: نام، دسته، توضیح، برچسب‌ها، تعداد شمارهٔ فعال و کارمزد هر شماره (ریال). شماره‌ها به شما نمایش داده نمی‌شود؛ فقط می‌توانید با فیلتر برای تعداد مشخصی از آن‌ها ارسال کنید.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "3",
                    "name": "مشتریان تهران",
                    "tags": [
                      "تهران"
                    ],
                    "category": "فروشگاه",
                    "available": 48210,
                    "description": null,
                    "feePerNumber": "20"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/number-banks/{id}/facets": {
      "get": {
        "operationId": "nbFacets",
        "tags": [
          "numberbank"
        ],
        "summary": "فیلترهای بانک",
        "description": "مقادیر قابل‌انتخاب (اپراتور، استان، شهر، برچسب) و شمارش هر کدام.\n\nبرای ساخت فیلتر `POST /number-banks/quote|send` استفاده می‌شود.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ بانک."
            },
            "description": "شناسهٔ بانک.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "tags": [],
                  "cities": [],
                  "operators": [
                    {
                      "key": "mci",
                      "count": 21000
                    }
                  ],
                  "provinces": [
                    {
                      "key": "تهران",
                      "count": 30100
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: بانک پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/number-banks/quote": {
      "post": {
        "operationId": "nbQuote",
        "tags": [
          "numberbank"
        ],
        "summary": "برآورد هزینهٔ ارسال از بانک",
        "description": "هزینهٔ ارسال به `count` شمارهٔ فیلترشده را بدون ارسال محاسبه می‌کند.\n\n**فیلدهای پاسخ:** `available` تعداد شمارهٔ منطبق با فیلتر، `parts` تعداد بخش پیامک، `smsPriceEach` قیمت هر پیامک، `estimatedSms` جمع پیامک‌ها، `fee` کارمزد بانک و `estimatedTotal` مجموع (همه ریال و رشته).\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bankId": {
                    "type": "string",
                    "description": "شناسهٔ بانک."
                  },
                  "count": {
                    "type": "integer",
                    "description": "تعداد شمارهٔ هدف."
                  },
                  "filters": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "`{ operator?: mci|irancell|rightel|other, province?, city?, tag? }`؛ همهٔ شروط با هم اعمال می‌شود."
                  },
                  "lineId": {
                    "type": "string",
                    "description": "خط فرستنده."
                  },
                  "text": {
                    "type": "string",
                    "description": "متن پیام (حداکثر ۱۰۰۰ نویسه)."
                  }
                },
                "required": [
                  "bankId",
                  "count",
                  "lineId",
                  "text"
                ]
              },
              "example": {
                "text": "سلام، تخفیف ویژه!",
                "count": 1000,
                "bankId": "3",
                "lineId": "1",
                "filters": {
                  "operator": "mci",
                  "province": "تهران"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "fee": "20000",
                  "parts": 1,
                  "available": 21000,
                  "estimatedSms": "980000",
                  "smsPriceEach": "980",
                  "estimatedTotal": "1000000"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: بانک پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/number-banks/send": {
      "post": {
        "operationId": "nbSend",
        "tags": [
          "numberbank"
        ],
        "summary": "ارسال به شماره‌های بانک",
        "description": "پیام را برای `count` شمارهٔ فیلترشده از بانک می‌فرستد؛ کارمزد بانک و هزینهٔ پیامک با هم کسر می‌شود.\n\nاگر ارسال پس از کسر کارمزد ردّ شود، کارمزد بازگردانده می‌شود. گیرندگان فهرست مسدودی/لغو عضویت حذف می‌شوند. نیاز به احراز هویت کامل.\n\n**فیلدهای پاسخ:** `batchId`، `count`، `smsPrice` و `fee` (ریال، رشته) و `replayed`.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، کار تکراری نمی‌سازد و نتیجهٔ قبلی را برمی‌گرداند."
            },
            "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، کار تکراری نمی‌سازد و نتیجهٔ قبلی را برمی‌گرداند.",
            "example": "nb-77"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bankId": {
                    "type": "string",
                    "description": "شناسهٔ بانک."
                  },
                  "count": {
                    "type": "integer",
                    "description": "تعداد شمارهٔ هدف."
                  },
                  "filters": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "`{ operator?: mci|irancell|rightel|other, province?, city?, tag? }`؛ همهٔ شروط با هم اعمال می‌شود."
                  },
                  "lineId": {
                    "type": "string",
                    "description": "خط فرستنده."
                  },
                  "text": {
                    "type": "string",
                    "description": "متن پیام."
                  }
                },
                "required": [
                  "bankId",
                  "count",
                  "lineId",
                  "text"
                ]
              },
              "example": {
                "text": "سلام، تخفیف ویژه!",
                "count": 1000,
                "bankId": "3",
                "lineId": "1",
                "filters": {
                  "operator": "mci"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "fee": "20000",
                  "count": 1000,
                  "batchId": "940",
                  "replayed": false,
                  "smsPrice": "980000"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: بانک پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/project-sms/send": {
      "post": {
        "operationId": "prjSend",
        "tags": [
          "project-sms"
        ],
        "summary": "ارسال پیامک پروژه",
        "description": "ارسال از بستهٔ پیامک پروژه (نه کیف پول شخصی).\n\nهمان موتور ارسال `/sms` است ولی هزینه و تاریخچه به پروژه تعلق دارد. حداکثر ۱۰۰۰ گیرنده در هر درخواست و ۱۶۰۰ نویسه متن. سقف ۶۰۰ درخواست در دقیقه. نیاز به احراز هویت کامل.\n\nدسترسی لازم (scope): `project.sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "project.sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، کار تکراری نمی‌سازد و نتیجهٔ قبلی را برمی‌گرداند."
            },
            "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، کار تکراری نمی‌سازد و نتیجهٔ قبلی را برمی‌گرداند.",
            "example": "prj-1"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "projectId": {
                    "type": "string",
                    "description": "شناسهٔ پروژه. کلید پروژه به یک پروژه بسته است و نیازی به این فیلد ندارد؛ کلید شخصی و توکن پنل باید آن را بدهند."
                  },
                  "lineId": {
                    "type": "string",
                    "description": "خط فرستنده؛ اگر نیاید، خط پیش‌فرض پروژه."
                  },
                  "to": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شماره‌های گیرنده."
                  },
                  "text": {
                    "type": "string",
                    "description": "متن پیام."
                  }
                },
                "required": [
                  "to",
                  "text"
                ]
              },
              "example": {
                "to": [
                  "09121234567"
                ],
                "text": "گزارش روزانه آماده است"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "count": 1,
                  "batchId": "77",
                  "replayed": false,
                  "totalPrice": "980"
                }
              }
            }
          },
          "400": {
            "description": "project_required: کلید شخصی بدون `projectId`."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/project-sms/pattern": {
      "post": {
        "operationId": "prjPattern",
        "tags": [
          "project-sms"
        ],
        "summary": "ارسال پترن پروژه",
        "description": "ارسال پیام الگو‌محور (مثل OTP) از بستهٔ پروژه.\n\nمانند `POST /sms/pattern`؛ `params` جایگزین متغیرهای قالب می‌شود (هر مقدار حداکثر ۵۰۰ نویسه). سقف ۱۲۰۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `project.sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "project.sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، کار تکراری نمی‌سازد و نتیجهٔ قبلی را برمی‌گرداند."
            },
            "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، کار تکراری نمی‌سازد و نتیجهٔ قبلی را برمی‌گرداند."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "projectId": {
                    "type": "string",
                    "description": "شناسهٔ پروژه. کلید پروژه به یک پروژه بسته است و نیازی به این فیلد ندارد؛ کلید شخصی و توکن پنل باید آن را بدهند."
                  },
                  "code": {
                    "type": "string",
                    "description": "کد پترن."
                  },
                  "to": {
                    "type": "string",
                    "description": "شمارهٔ گیرنده."
                  },
                  "params": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "مقدار متغیرهای قالب، مثلاً `{ \"code\": \"123456\" }`."
                  }
                },
                "required": [
                  "code",
                  "to"
                ]
              },
              "example": {
                "to": "09121234567",
                "code": "login-otp",
                "params": {
                  "code": "123456"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "count": 1,
                  "batchId": "78",
                  "replayed": false,
                  "totalPrice": "980"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: پترن پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/project-sms/quote": {
      "post": {
        "operationId": "prjQuote",
        "tags": [
          "project-sms"
        ],
        "summary": "برآورد هزینهٔ پیامک پروژه",
        "description": "هزینه و تعداد بخش‌ها را بدون ارسال حساب می‌کند.\n\nورودی مثل `POST /project-sms/send` است.\n\nدسترسی لازم (scope): `project.sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "project.sms.read",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "projectId": {
                    "type": "string",
                    "description": "شناسهٔ پروژه. کلید پروژه به یک پروژه بسته است و نیازی به این فیلد ندارد؛ کلید شخصی و توکن پنل باید آن را بدهند."
                  },
                  "lineId": {
                    "type": "string",
                    "description": "خط فرستنده."
                  },
                  "to": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شماره‌ها."
                  },
                  "text": {
                    "type": "string",
                    "description": "متن."
                  }
                },
                "required": [
                  "to",
                  "text"
                ]
              },
              "example": {
                "to": [
                  "09121234567"
                ],
                "text": "سلام"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "count": 1,
                  "parts": 1,
                  "totalPrice": "980"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/project-sms/messages": {
      "get": {
        "operationId": "prjMessages",
        "tags": [
          "project-sms"
        ],
        "summary": "پیام‌های پروژه",
        "description": "تاریخچهٔ پیامک‌های ارسالی پروژه، جدیدترین اول.\n\nساختار هر پیام مثل `GET /sms/messages` است.\n\nدسترسی لازم (scope): `project.sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "project.sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "projectId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "شناسهٔ پروژه. کلید پروژه به یک پروژه بسته است و نیازی به این فیلد ندارد؛ کلید شخصی و توکن پنل باید آن را بدهند."
            },
            "description": "شناسهٔ پروژه. کلید پروژه به یک پروژه بسته است و نیازی به این فیلد ندارد؛ کلید شخصی و توکن پنل باید آن را بدهند."
          },
          {
            "name": "take",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "تعداد (۱ تا ۲۰۰)."
            },
            "description": "تعداد (۱ تا ۲۰۰).",
            "example": "20"
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط پیام‌های با شناسهٔ کوچک‌تر."
            },
            "description": "فقط پیام‌های با شناسهٔ کوچک‌تر."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "9001",
                    "to": "09121234567",
                    "status": "delivered",
                    "totalPrice": "980"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/project-sms/usage": {
      "get": {
        "operationId": "prjUsage",
        "tags": [
          "project-sms"
        ],
        "summary": "مصرف بستهٔ پروژه",
        "description": "باقی‌ماندهٔ بسته و مصرف پروژه.\n\nمقادیر شمارشی/ریالی هستند.\n\nدسترسی لازم (scope): `project.sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "project.sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "projectId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "شناسهٔ پروژه. کلید پروژه به یک پروژه بسته است و نیازی به این فیلد ندارد؛ کلید شخصی و توکن پنل باید آن را بدهند."
            },
            "description": "شناسهٔ پروژه. کلید پروژه به یک پروژه بسته است و نیازی به این فیلد ندارد؛ کلید شخصی و توکن پنل باید آن را بدهند."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "used": 2310,
                  "package": 10000,
                  "remaining": 7690
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/botbuilder/info": {
      "get": {
        "operationId": "botInfo",
        "tags": [
          "bot"
        ],
        "summary": "اطلاعات ربات‌ساز",
        "description": "انواع ربات، تعرفه و محدودیت‌های حساب شما.\n\nبرای نمایش گزینه‌های ساخت ربات (معرفی، فروشگاهی، …)، قیمت ماهانهٔ هر نوع و مدت‌های تمدید (۱، ۳، ۶ یا ۱۲ ماه).\n\nدسترسی لازم (scope): `bot.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "bot.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "kinds": [
                    {
                      "kind": "shop",
                      "label": "فروشگاهی",
                      "monthlyFee": "300000"
                    }
                  ],
                  "termMonths": [
                    1,
                    3,
                    6,
                    12
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/botbuilder/bots": {
      "get": {
        "operationId": "botList",
        "tags": [
          "bot"
        ],
        "summary": "فهرست ربات‌ها",
        "description": "ربات‌های ساخته‌شده با ربات‌ساز.\n\nهر ربات: شناسه، کانال (`telegram`/`bale`)، نام و نام‌کاربری، وضعیت (`active`/`paused`)، نوع، تاریخ پایان اشتراک (`paidUntil`)، لینک عضویت (`joinUrl`)، لینک مستقیم و تعداد مشترکین. ربات جفت‌شده (تلگرام+بله) زیر `pair` می‌آید.\n\nدسترسی لازم (scope): `bot.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "bot.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "projectId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط رباتِ یک پروژه."
            },
            "description": "فقط رباتِ یک پروژه."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "5",
                    "kind": "shop",
                    "name": "فروشگاه من",
                    "status": "active",
                    "channel": "telegram",
                    "expired": false,
                    "joinUrl": "https://irnoti.com/b/ab12cd",
                    "username": "my_shop_bot",
                    "directUrl": "https://t.me/my_shop_bot",
                    "kindLabel": "فروشگاهی",
                    "paidUntil": "2026-12-01T00:00:00.000Z",
                    "projectId": null,
                    "subscribers": 124
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/botbuilder/bots/{id}": {
      "get": {
        "operationId": "botGet",
        "tags": [
          "bot"
        ],
        "summary": "جزئیات ربات",
        "description": "مشخصات یک ربات.\n\nهمان ساختار آیتم فهرست، به‌همراه متن خوش‌آمد و راهنما.\n\nدسترسی لازم (scope): `bot.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "bot.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ربات."
            },
            "description": "شناسهٔ ربات.",
            "example": "5"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "5",
                  "name": "فروشگاه من",
                  "status": "active",
                  "channel": "telegram",
                  "helpText": null,
                  "subscribers": 124,
                  "welcomeText": "خوش آمدید!"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ربات پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/botbuilder/bots/{id}/customers": {
      "get": {
        "operationId": "botCustomers",
        "tags": [
          "bot"
        ],
        "summary": "مشتریان ربات",
        "description": "مشتریان ثبت‌نام‌کرده (نام، تلفن، نشانی).\n\nبا `q` جست‌وجو و با `take`/`before` صفحه‌بندی می‌شود.\n\nدسترسی لازم (scope): `bot.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "bot.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ربات."
            },
            "description": "شناسهٔ ربات.",
            "example": "5"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "عبارت جست‌وجو."
            },
            "description": "عبارت جست‌وجو."
          },
          {
            "name": "take",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "تعداد."
            },
            "description": "تعداد."
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط شناسه‌های کوچک‌تر."
            },
            "description": "فقط شناسه‌های کوچک‌تر."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "71",
                    "phone": "09121234567",
                    "address": "تهران",
                    "fullName": "علی رضایی"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ربات پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/botbuilder/bots/{id}/subscribers": {
      "get": {
        "operationId": "botSubscribers",
        "tags": [
          "bot"
        ],
        "summary": "مشترکین ربات",
        "description": "کاربرانی که ربات را شروع کرده‌اند.\n\nجدیدترین اول؛ صفحه‌بندی با `take`/`before`.\n\nدسترسی لازم (scope): `bot.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "bot.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ربات."
            },
            "description": "شناسهٔ ربات.",
            "example": "5"
          },
          {
            "name": "take",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "تعداد."
            },
            "description": "تعداد."
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط شناسه‌های کوچک‌تر."
            },
            "description": "فقط شناسه‌های کوچک‌تر."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "901",
                    "ref": "ig-campaign",
                    "phone": null,
                    "chatId": "123456",
                    "status": "active",
                    "address": null,
                    "fullName": null,
                    "joinedAt": "2026-10-01T09:00:00.000Z",
                    "username": "ali",
                    "firstName": "علی"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ربات پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/botbuilder/bots/{id}/messages": {
      "get": {
        "operationId": "botMessages",
        "tags": [
          "bot"
        ],
        "summary": "پیام‌های ارسالی ربات",
        "description": "تاریخچهٔ پیام‌هایی که ربات فرستاده.\n\nهر ردیف: وضعیت (`queued`/`sent`/`failed`)، خطا و هزینه (ریال، رشته).\n\nدسترسی لازم (scope): `bot.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "bot.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ربات."
            },
            "description": "شناسهٔ ربات.",
            "example": "5"
          },
          {
            "name": "take",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "تعداد (حداکثر ۲۰۰)."
            },
            "description": "تعداد (حداکثر ۲۰۰)."
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط شناسه‌های کوچک‌تر."
            },
            "description": "فقط شناسه‌های کوچک‌تر."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "3301",
                    "kind": "text",
                    "error": null,
                    "price": "0",
                    "chatId": "123456",
                    "status": "sent",
                    "createdAt": "2026-10-30T10:00:00.000Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ربات پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/botbuilder/bots/{id}/stats": {
      "get": {
        "operationId": "botStats",
        "tags": [
          "bot"
        ],
        "summary": "آمار ارسال ربات",
        "description": "شمار پیام‌های ارسال‌شده، ناموفق و در صف.\n\nعددهای صحیح.\n\nدسترسی لازم (scope): `bot.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "bot.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ربات."
            },
            "description": "شناسهٔ ربات.",
            "example": "5"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "sent": 1200,
                  "failed": 14,
                  "queued": 0
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ربات پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/botbuilder/bots/{id}/shop/orders": {
      "get": {
        "operationId": "botShopOrders",
        "tags": [
          "bot"
        ],
        "summary": "سفارش‌های فروشگاه ربات",
        "description": "سفارش‌های ثبت‌شده در ربات فروشگاهی.\n\nوضعیت: `new`، `confirmed`، `shipped`، `done`، `canceled`. `payment` روش پرداخت را فیلتر می‌کند.\n\nدسترسی لازم (scope): `bot.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "bot.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ربات."
            },
            "description": "شناسهٔ ربات.",
            "example": "5"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فیلتر وضعیت سفارش."
            },
            "description": "فیلتر وضعیت سفارش.",
            "example": "new"
          },
          {
            "name": "payment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فیلتر روش پرداخت."
            },
            "description": "فیلتر روش پرداخت."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "18",
                    "items": [
                      {
                        "qty": 1,
                        "title": "کفش ورزشی"
                      }
                    ],
                    "total": "1250000",
                    "status": "new",
                    "createdAt": "2026-10-30T09:30:00.000Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ربات پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/botbuilder/bots/{id}/shop/stats": {
      "get": {
        "operationId": "botShopStats",
        "tags": [
          "bot"
        ],
        "summary": "آمار فروشگاه ربات",
        "description": "مجموع سفارش و فروش.\n\nمبالغ ریال و رشته‌اند.\n\nدسترسی لازم (scope): `bot.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "bot.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ربات."
            },
            "description": "شناسهٔ ربات.",
            "example": "5"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "orders": 42,
                  "pending": 3,
                  "revenue": "52000000"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ربات پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/botbuilder/bots/{id}/send": {
      "post": {
        "operationId": "botSend",
        "tags": [
          "bot"
        ],
        "summary": "ارسال پیام از ربات",
        "description": "به یک مشترک (یا همه) پیام یا رسانه می‌فرستد.\n\nارسال همیشه ناهم‌زمان و در صف است. برای یک مخاطب، `recipient` در پاسخ می‌آید. ارسال به `all` فقط برای ربات‌هایی مجاز است که اشتراک فعال دارند.\n\n**نکته:** مشترک باید قبلاً ربات را شروع کرده باشد.\n\nدسترسی لازم (scope): `bot.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "bot.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ربات."
            },
            "description": "شناسهٔ ربات.",
            "example": "5"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، کار تکراری نمی‌سازد و نتیجهٔ قبلی را برمی‌گرداند."
            },
            "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، کار تکراری نمی‌سازد و نتیجهٔ قبلی را برمی‌گرداند.",
            "example": "order-18-shipped"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "مخاطب؛ دقیقاً یکی از `chatId`، `ref` (برچسب لینک عضویت)، `phone` (شمارهٔ ثبت‌شده در ربات) یا `all: true` (همهٔ مشترکین)."
                  },
                  "message": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "`{ text?, parseMode?: HTML|Markdown, buttons?, media?: {type, url}, silent? }`؛ متن یا رسانه الزامی است (متن ≤۴۰۰۰ نویسه، کپشن ≤۱۰۰۰). دکمه‌ها آرایه‌ای از ردیف‌ها (هر ردیف ۱ تا ۴ دکمه با `url` یا `callback`)، و نشانی رسانه باید https باشد."
                  }
                },
                "required": [
                  "to",
                  "message"
                ]
              },
              "example": {
                "to": {
                  "phone": "09121234567"
                },
                "message": {
                  "text": "سفارش شما ارسال شد ✅",
                  "buttons": [
                    [
                      {
                        "url": "https://shop.example.com/track/18",
                        "text": "پیگیری"
                      }
                    ]
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "queued": 1,
                  "recipient": {
                    "ref": "ig-campaign",
                    "chatId": "123456"
                  }
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ربات یا مشترک پیدا نشد یا متعلق به شما نیست."
          },
          "409": {
            "description": "conflict: اشتراک ربات منقضی شده است."
          }
        }
      }
    },
    "/botbuilder/bots/{id}/otp": {
      "post": {
        "operationId": "botOtp",
        "tags": [
          "bot"
        ],
        "summary": "ارسال کد تأیید از ربات",
        "description": "کدی عددی می‌سازد، برای مشترک می‌فرستد و خودِ کد را برمی‌گرداند.\n\nبرای تأیید ورود از طریق ربات به‌جای پیامک. `length` بین ۴ تا ۸ و `template` متنی با `{code}`. کد را شما باید با ورودی کاربر مقایسه کنید؛ اعتبار پیش‌فرض چند دقیقه است (`expiresInSec`).\n\nدسترسی لازم (scope): `bot.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "bot.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ربات."
            },
            "description": "شناسهٔ ربات.",
            "example": "5"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، کار تکراری نمی‌سازد و نتیجهٔ قبلی را برمی‌گرداند."
            },
            "description": "کلید یکتا (حداکثر ۱۰۰ نویسه). ارسال دوباره با همان کلید، کار تکراری نمی‌سازد و نتیجهٔ قبلی را برمی‌گرداند."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "مخاطب؛ دقیقاً یکی از `chatId`، `ref` (برچسب لینک عضویت)، `phone` (شمارهٔ ثبت‌شده در ربات) یا `all: true` (همهٔ مشترکین)."
                  },
                  "length": {
                    "type": "integer",
                    "description": "تعداد ارقام (۴ تا ۸)."
                  },
                  "template": {
                    "type": "string",
                    "description": "متن پیام شامل `{code}`."
                  }
                },
                "required": [
                  "to"
                ]
              },
              "example": {
                "to": {
                  "phone": "09121234567"
                },
                "length": 6
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "code": "482910",
                  "queued": 1,
                  "recipient": {
                    "ref": null,
                    "chatId": "123456"
                  },
                  "expiresInSec": 300
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ربات یا مشترک پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps": {
      "get": {
        "operationId": "pushApps",
        "tags": [
          "push"
        ],
        "summary": "فهرست اپ‌های پوش",
        "description": "اپ‌های SDK پوش حساب یا پروژه.\n\nاپ یک اعتبارنامهٔ بروکر است؛ برای هر اپ کلید عمومی (`publicKey`) برای قرار دادن در SDK برمی‌گردد.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "projectId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط اپ‌های یک پروژه."
            },
            "description": "فقط اپ‌های یک پروژه."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "8",
                    "name": "اپ فروشگاه",
                    "devices": 1840,
                    "createdAt": "2026-09-01T08:00:00.000Z",
                    "platforms": [
                      "android",
                      "ios",
                      "web"
                    ],
                    "publicKey": "pk_live_…"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "pushAppCreate",
        "tags": [
          "push"
        ],
        "summary": "ساخت اپ پوش",
        "description": "اپ می‌سازد و کلید عمومی SDK را برمی‌گرداند.\n\nفایل حساب سرویس Firebase (`serviceAccount`) را به‌صورت شیء JSON یا متن بدهید؛ رمزنگاری‌شده ذخیره می‌شود و هرگز بازگردانده نمی‌شود. فقط مالک حساب. سقف ۲۰ اپ در ساعت.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام اپ (۱ تا ۸۰ نویسه)."
                  },
                  "serviceAccount": {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": true
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "فایل حساب سرویس Firebase."
                  },
                  "projectId": {
                    "type": "string",
                    "description": "پروژهٔ سازمانی."
                  },
                  "description": {
                    "type": "string",
                    "description": "توضیح (≤۲۵۵)."
                  },
                  "logo": {
                    "type": "string",
                    "description": "نشانی لوگو (http/https)."
                  },
                  "platforms": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "زیرمجموعهٔ `android`، `ios`، `web`."
                  }
                },
                "required": [
                  "name",
                  "serviceAccount"
                ]
              },
              "example": {
                "name": "اپ فروشگاه",
                "platforms": [
                  "android",
                  "ios"
                ],
                "serviceAccount": {
                  "type": "service_account",
                  "project_id": "my-app"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "8",
                  "name": "اپ فروشگاه",
                  "publicKey": "pk_live_…"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/sdk-apps/{id}": {
      "get": {
        "operationId": "pushAppGet",
        "tags": [
          "push"
        ],
        "summary": "جزئیات اپ پوش",
        "description": "مشخصات یک اپ.\n\nشامل پلتفرم‌ها، وضعیت اعتبارنامهٔ FCM، APNs و وب‌پوش.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "8",
                  "name": "اپ فروشگاه",
                  "platforms": [
                    "android",
                    "ios",
                    "web"
                  ],
                  "publicKey": "pk_live_…"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "patch": {
        "operationId": "pushAppUpdate",
        "tags": [
          "push"
        ],
        "summary": "ویرایش اپ پوش",
        "description": "نام، توضیح، لوگو یا پلتفرم‌ها را تغییر می‌دهد.\n\nفقط مالک؛ حداقل یک فیلد.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام."
                  },
                  "description": {
                    "type": "string",
                    "description": "توضیح یا `null`."
                  },
                  "logo": {
                    "type": "string",
                    "description": "لوگو یا `null`."
                  },
                  "platforms": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "پلتفرم‌ها."
                  }
                },
                "required": []
              },
              "example": {
                "name": "اپ فروشگاه نسخهٔ ۲"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "8",
                  "name": "اپ فروشگاه نسخهٔ ۲"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "pushAppDelete",
        "tags": [
          "push"
        ],
        "summary": "حذف اپ پوش",
        "description": "اپ و دستگاه‌هایش را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴)؛ برگشت‌پذیر نیست. فقط مالک.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/credential": {
      "put": {
        "operationId": "pushAppCredential",
        "tags": [
          "push"
        ],
        "summary": "جایگزینی اعتبارنامهٔ Firebase",
        "description": "حساب سرویس Firebase را عوض می‌کند.\n\nفقط مالک؛ سقف ۱۰ بار در ساعت.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "serviceAccount": {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": true
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "فایل حساب سرویس."
                  }
                },
                "required": [
                  "serviceAccount"
                ]
              },
              "example": {
                "serviceAccount": {
                  "type": "service_account",
                  "project_id": "my-app"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "8",
                  "credential": "updated"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/sdk-apps/{id}/rotate-key": {
      "post": {
        "operationId": "pushAppRotate",
        "tags": [
          "push"
        ],
        "summary": "چرخش کلید عمومی",
        "description": "کلید عمومی جدید می‌سازد.\n\nکلید قبلی از همان لحظه کار نمی‌کند؛ SDK اپ باید با کلید جدید منتشر شود. فقط مالک؛ سقف ۱۰ بار در ساعت.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "8",
                  "publicKey": "pk_live_new…"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/sdk-apps/{id}/move": {
      "post": {
        "operationId": "pushAppMove",
        "tags": [
          "push"
        ],
        "summary": "انتقال اپ به پروژه",
        "description": "اپ را به یک پروژهٔ سازمانی می‌برد.\n\nفقط مالک.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "projectId": {
                    "type": "string",
                    "description": "پروژهٔ مقصد."
                  }
                },
                "required": [
                  "projectId"
                ]
              },
              "example": {
                "projectId": "4"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "8",
                  "projectId": "4"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ یا پروژه پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/devices": {
      "get": {
        "operationId": "pushDevices",
        "tags": [
          "push"
        ],
        "summary": "دستگاه‌های اپ",
        "description": "دستگاه‌های ثبت‌شده با فیلتر و صفحه‌بندی.\n\n`status`: `active`، `inactive` یا `unregistered`. `linked=true` فقط دستگاه‌های وصل‌شده به مخاطب دفترچه. `q` در شناسهٔ بیرونی و موبایل/نام مخاطب جست‌وجو می‌کند.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "صفحه (پیش‌فرض ۱)."
            },
            "description": "صفحه (پیش‌فرض ۱)."
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "اندازه (۱ تا ۱۰۰، پیش‌فرض ۲۵)."
            },
            "description": "اندازه (۱ تا ۱۰۰، پیش‌فرض ۲۵).",
            "example": "2"
          },
          {
            "name": "externalId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کاربر در سامانهٔ شما."
            },
            "description": "شناسهٔ کاربر در سامانهٔ شما."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "وضعیت دستگاه."
            },
            "description": "وضعیت دستگاه.",
            "example": "active"
          },
          {
            "name": "linked",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "`true` یا `false`."
            },
            "description": "`true` یا `false`."
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "جست‌وجو."
            },
            "description": "جست‌وجو."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "items": [
                    {
                      "id": "dev_301",
                      "status": "active",
                      "platform": "android",
                      "externalId": "user-77",
                      "lastSeenAt": "2026-10-30T09:00:00.000Z"
                    }
                  ],
                  "total": 1840
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/devices/{deviceId}": {
      "get": {
        "operationId": "pushDevice",
        "tags": [
          "push"
        ],
        "summary": "جزئیات دستگاه",
        "description": "مشخصات، برچسب‌ها، مخاطب وصل‌شده و آخرین رویدادهای یک دستگاه.\n\nمکان تقریبی (حدود ۱ کیلومتر) و رویدادهای گزارش‌شدهٔ اپ در صورت وجود می‌آید.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "deviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دستگاه (`dev_…` یا عدد)."
            },
            "description": "شناسهٔ دستگاه (`dev_…` یا عدد).",
            "example": "dev_301"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "dev_301",
                  "tags": {
                    "plan": "pro"
                  },
                  "contact": null,
                  "platform": "android",
                  "externalId": "user-77"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: دستگاه پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "pushDeviceDelete",
        "tags": [
          "push"
        ],
        "summary": "حذف دستگاه",
        "description": "دستگاه را از اپ حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴). فقط مالک.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "deviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دستگاه (`dev_…` یا عدد)."
            },
            "description": "شناسهٔ دستگاه (`dev_…` یا عدد).",
            "example": "dev_301"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: دستگاه پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/contacts": {
      "get": {
        "operationId": "pushContactLookup",
        "tags": [
          "push"
        ],
        "summary": "جست‌وجوی مخاطب برای اتصال",
        "description": "مخاطبان دفترچهٔ مالک را بر اساس موبایل/ایمیل/نام می‌یابد.\n\nبرای وصل کردن دستگاه به یک مخاطب موجود. سقف ۱۲۰ در دقیقه.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "عبارت جست‌وجو (≤۱۰۰)."
            },
            "description": "عبارت جست‌وجو (≤۱۰۰).",
            "example": "0912"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "801",
                    "name": "علی",
                    "mobile": "09121234567"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/sdk-apps/{id}/devices/{deviceId}/contact": {
      "put": {
        "operationId": "pushDeviceLink",
        "tags": [
          "push"
        ],
        "summary": "اتصال دستگاه به مخاطب",
        "description": "دستگاه را به یک مخاطب موجود یا جدید وصل می‌کند.\n\nبا آن، همان شخص با پیامک و ربات هم قابل دسترسی می‌شود. یا `contactId` بدهید یا `contact` (موبایل، نام، نام خانوادگی، شرکت، ایمیل، شهر، یادداشت، تولد شمسی).\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "deviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دستگاه (`dev_…` یا عدد)."
            },
            "description": "شناسهٔ دستگاه (`dev_…` یا عدد).",
            "example": "dev_301"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contactId": {
                    "type": "string",
                    "description": "شناسهٔ مخاطب موجود."
                  },
                  "contact": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "مشخصات مخاطب جدید/به‌روزشده."
                  }
                },
                "required": []
              },
              "example": {
                "contact": {
                  "name": "علی",
                  "mobile": "09121234567"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "deviceId": "dev_301",
                  "contactId": "801"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: دستگاه پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      },
      "delete": {
        "operationId": "pushDeviceUnlink",
        "tags": [
          "push"
        ],
        "summary": "جدا کردن دستگاه از مخاطب",
        "description": "ارتباط دستگاه با مخاطب را برمی‌دارد.\n\nپاسخ بدون بدنه (۲۰۴). مخاطب حذف نمی‌شود.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "deviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ دستگاه (`dev_…` یا عدد)."
            },
            "description": "شناسهٔ دستگاه (`dev_…` یا عدد).",
            "example": "dev_301"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: دستگاه پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/send": {
      "post": {
        "operationId": "pushSend",
        "tags": [
          "push"
        ],
        "summary": "ارسال پوش",
        "description": "پوش را به همهٔ دستگاه‌ها، یک موضوع، شناسه‌ها، موبایل‌ها، گروه دفترچه یا یک بخش‌بندی می‌فرستد.\n\nدقیقاً با یکی از حالت‌های `target` مخاطب را مشخص کنید:\n- `all: true` همهٔ دستگاه‌ها\n- `topic`\n- `externalIds` یا `deviceIds` (تا ۱۰۰۰)\n- `phones` (موبایل‌هایی که کاربر در اپ معرفی کرده)\n- `groupId` گروه دفترچه\n- `segment` ترکیب شرط‌ها: `platform`، `locale`، `appVersion`، `tags`، `activeWithinDays`، `identified`، `country`، `city`، `near {lat, lon, radiusKm}`، `performed` (رویداد گزارش‌شده)\n\n**امکانات:** زمان‌بندی (`sendAt`، حداکثر ۳۰ روز)، ساعت محلی هر دستگاه (`sendLocal.time`)، ساعت سکوت (`quietHours`)، آزمون A/B (`variants` با سهم درصدی) و پیامک جایگزین برای دستگاه‌های ناموفق (`smsFallback.text`).\n\n**پیام:** `title`، `body`، `image`، `url`/`deepLink`، `data` و … طبق ساختار پیام SDK. سقف ۶۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "محتوای پوش (عنوان، متن، تصویر، لینک، داده)."
                  },
                  "target": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "مخاطب (بالا)."
                  },
                  "sendAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "ارسال بعداً (حداکثر ۳۰ روز)."
                  },
                  "sendLocal": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "`{ time: \"HH:MM\" }` ارسال با ساعت محلی هر دستگاه؛ همراه `sendAt` نمی‌آید."
                  },
                  "quietHours": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "`{ from, to }` (HH:MM) بازهٔ سکوت؛ ممکن است از نیمه‌شب بگذرد."
                  },
                  "variants": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "description": "تا ۳ نسخه: `{ message, percent }`؛ جمع درصدها ≤۹۹."
                  },
                  "smsFallback": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "`{ text }` پیامک جایگزین (فقط اپ شخصی)."
                  }
                },
                "required": [
                  "message",
                  "target"
                ]
              },
              "example": {
                "target": {
                  "segment": {
                    "platform": "android",
                    "activeWithinDays": 30
                  }
                },
                "message": {
                  "url": "https://shop.example.com/offer",
                  "body": "تا فردا ۳۰٪ تخفیف",
                  "title": "تخفیف ویژه"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "status": "queued",
                  "targeted": 1320,
                  "messageId": "msg_901",
                  "messageIds": [
                    "msg_901"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/sdk-apps/{id}/messages/{messageId}/cancel": {
      "post": {
        "operationId": "pushMessageCancel",
        "tags": [
          "push"
        ],
        "summary": "لغو پوش زمان‌بندی‌شده",
        "description": "پوشی را که هنوز ارسال نشده لغو می‌کند.\n\nپوش‌های در حال ارسال یا تمام‌شده قابل لغو نیستند.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ پیام."
            },
            "description": "شناسهٔ پیام.",
            "example": "msg_901"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "status": "cancelled",
                  "messageId": "msg_901"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: پیام پیدا نشد یا متعلق به شما نیست."
          },
          "409": {
            "description": "conflict: پیام دیگر قابل لغو نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/messages": {
      "get": {
        "operationId": "pushMessages",
        "tags": [
          "push"
        ],
        "summary": "پوش‌های ارسالی",
        "description": "تاریخچهٔ پوش‌ها با وضعیت و شمارنده‌ها.\n\nصفحه‌بندی با `page`/`pageSize`.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "صفحه."
            },
            "description": "صفحه."
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "اندازه (۱ تا ۱۰۰)."
            },
            "description": "اندازه (۱ تا ۱۰۰)."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "items": [
                    {
                      "id": "msg_901",
                      "opened": 210,
                      "status": "sent",
                      "targeted": 1320,
                      "createdAt": "2026-10-30T10:00:00.000Z",
                      "delivered": 1280
                    }
                  ],
                  "total": 1
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/messages/{messageId}/stats": {
      "get": {
        "operationId": "pushMessageStats",
        "tags": [
          "push"
        ],
        "summary": "آمار یک پوش",
        "description": "تحویل، باز شدن و کلیک و ریز هر نسخهٔ A/B.\n\nاعداد تجمیعی؛ برای آزمون A/B به‌ازای هر نسخه جدا.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ پیام."
            },
            "description": "شناسهٔ پیام.",
            "example": "msg_901"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "sent": 1320,
                  "opened": 210,
                  "clicked": 95,
                  "variants": [],
                  "delivered": 1280
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: پیام پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/messages/export.csv": {
      "get": {
        "operationId": "pushMessagesCsv",
        "tags": [
          "push"
        ],
        "summary": "خروجی CSV پوش‌ها",
        "description": "همهٔ پوش‌های اپ را به‌صورت فایل CSV می‌دهد.\n\nپاسخ `text/csv` و ضمیمه با نام `push-messages.csv` است. سقف ۱۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/sdk-apps/{id}/analytics": {
      "get": {
        "operationId": "pushAnalytics",
        "tags": [
          "push"
        ],
        "summary": "تحلیل اپ",
        "description": "شمار دستگاه فعال، ارسال، تحویل و باز شدن در بازهٔ روزهای اخیر.\n\n`days` از ۱ تا ۳۶۶ (پیش‌فرض ۳۰).\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "تعداد روز."
            },
            "description": "تعداد روز.",
            "example": "30"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "sent": 15000,
                  "opened": 2100,
                  "devices": 1840,
                  "delivered": 14600,
                  "activeDevices": 1250
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/insights": {
      "get": {
        "operationId": "pushInsights",
        "tags": [
          "push"
        ],
        "summary": "بینش رفتار کاربران",
        "description": "ترکیب پلتفرم، کشور، نسخه و رویدادهای پرتکرار اپ.\n\n`days` از ۱ تا ۳۶۶.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "تعداد روز."
            },
            "description": "تعداد روز.",
            "example": "30"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "countries": [
                    {
                      "key": "IR",
                      "count": 1700
                    }
                  ],
                  "platforms": [
                    {
                      "key": "android",
                      "count": 1100
                    }
                  ],
                  "topEvents": []
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/transports": {
      "get": {
        "operationId": "pushTransports",
        "tags": [
          "push"
        ],
        "summary": "وضعیت کانال‌های ارسال",
        "description": "کدام کانال‌ها (FCM، APNs مستقیم، وب‌پوش) تنظیم شده‌اند.\n\nاسرار هرگز برنمی‌گردند؛ فقط بخش عمومی (شناسهٔ کلید، کلید عمومی VAPID).\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "fcm": {
                    "configured": true
                  },
                  "apns": {
                    "configured": false
                  },
                  "webpush": {
                    "publicKey": "BN…",
                    "configured": true
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/apns": {
      "put": {
        "operationId": "pushApnsSet",
        "tags": [
          "push"
        ],
        "summary": "تنظیم APNs مستقیم",
        "description": "کلید APNs اپل را برای ارسال مستقیم به iOS ثبت می‌کند.\n\nفایل `.p8` رمزنگاری‌شده ذخیره می‌شود. فقط مالک؛ سقف ۱۰ بار در ساعت.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "keyId": {
                    "type": "string",
                    "description": "شناسهٔ کلید (۱۰ نویسهٔ بزرگ/رقم)."
                  },
                  "teamId": {
                    "type": "string",
                    "description": "شناسهٔ تیم (۱۰ نویسه)."
                  },
                  "bundleId": {
                    "type": "string",
                    "description": "شناسهٔ بسته."
                  },
                  "key": {
                    "type": "string",
                    "description": "محتوای فایل `.p8`."
                  },
                  "sandbox": {
                    "type": "boolean",
                    "description": "محیط آزمایشی اپل."
                  }
                },
                "required": [
                  "keyId",
                  "teamId",
                  "bundleId",
                  "key"
                ]
              },
              "example": {
                "key": "-----BEGIN PRIVATE KEY-----…",
                "keyId": "ABCDE12345",
                "teamId": "TEAM123456",
                "bundleId": "com.example.shop"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "keyId": "ABCDE12345",
                  "configured": true
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      },
      "delete": {
        "operationId": "pushApnsDelete",
        "tags": [
          "push"
        ],
        "summary": "حذف APNs",
        "description": "تنظیمات APNs را پاک می‌کند.\n\nپاسخ بدون بدنه (۲۰۴). فقط مالک.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/webpush": {
      "post": {
        "operationId": "pushWebpushSet",
        "tags": [
          "push"
        ],
        "summary": "فعال‌سازی وب‌پوش",
        "description": "کلید VAPID می‌سازد (یا می‌چرخاند) و کلید عمومی را برمی‌گرداند.\n\n`subject` باید `mailto:` یا `https://` باشد. با `rotate: true` کلید جدید جایگزین می‌شود و مشترکین باید دوباره مشترک شوند. فقط مالک؛ سقف ۱۰ بار در ساعت.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subject": {
                    "type": "string",
                    "description": "مثل `mailto:admin@example.com`."
                  },
                  "rotate": {
                    "type": "boolean",
                    "description": "ساخت کلید تازه."
                  }
                },
                "required": [
                  "subject"
                ]
              },
              "example": {
                "subject": "mailto:admin@example.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "publicKey": "BN…",
                  "configured": true
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      },
      "delete": {
        "operationId": "pushWebpushDelete",
        "tags": [
          "push"
        ],
        "summary": "حذف وب‌پوش",
        "description": "کلیدهای VAPID را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴). فقط مالک.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/automations": {
      "get": {
        "operationId": "pushAutoList",
        "tags": [
          "push"
        ],
        "summary": "اتوماسیون‌های پوش",
        "description": "پوش‌های رویدادمحور اپ.\n\nهر اتوماسیون با دیدن رویداد (مثلاً «سبد رهاشده») بعد از تأخیر پوش می‌فرستد.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "3",
                    "name": "سبد رهاشده",
                    "status": "active",
                    "delaySeconds": 3600,
                    "triggerEvent": "cart_abandoned"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "post": {
        "operationId": "pushAutoCreate",
        "tags": [
          "push"
        ],
        "summary": "ساخت اتوماسیون پوش",
        "description": "یک پوش رویدادمحور تعریف می‌کند.\n\nاجراها با همان فرایند ارسال عادی می‌روند (بررسی پلن، رسید، تحلیل).\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام (≤۸۰)."
                  },
                  "triggerEvent": {
                    "type": "string",
                    "description": "رویدادی که اپ گزارش می‌دهد و اجرا را آغاز می‌کند."
                  },
                  "cancelOnEvent": {
                    "type": "string",
                    "description": "رویدادی که اجرای در انتظار را لغو می‌کند (مثلاً خرید)."
                  },
                  "delaySeconds": {
                    "type": "integer",
                    "description": "تأخیر تا ارسال."
                  },
                  "capHours": {
                    "type": "integer",
                    "description": "حداقل فاصلهٔ دو ارسال برای یک دستگاه (ساعت، حداکثر ۲۱۶۰)."
                  },
                  "message": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "محتوای پوش."
                  }
                },
                "required": [
                  "name",
                  "triggerEvent",
                  "message"
                ]
              },
              "example": {
                "name": "سبد رهاشده",
                "message": {
                  "body": "خرید را کامل کنید",
                  "title": "سبدتان منتظر است"
                },
                "capHours": 24,
                "delaySeconds": 3600,
                "triggerEvent": "cart_abandoned",
                "cancelOnEvent": "purchase"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "3",
                  "status": "active"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/sdk-apps/{id}/automations/{aid}": {
      "patch": {
        "operationId": "pushAutoUpdate",
        "tags": [
          "push"
        ],
        "summary": "ویرایش اتوماسیون",
        "description": "فیلدهای اتوماسیون یا وضعیت (`active`/`paused`) را تغییر می‌دهد.\n\nحداقل یک فیلد.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "aid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اتوماسیون."
            },
            "description": "شناسهٔ اتوماسیون.",
            "example": "3"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "description": "`active` یا `paused`."
                  },
                  "delaySeconds": {
                    "type": "integer",
                    "description": "تأخیر."
                  },
                  "message": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "محتوای جدید."
                  }
                },
                "required": []
              },
              "example": {
                "status": "paused"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "3",
                  "status": "paused"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اتوماسیون پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "pushAutoDelete",
        "tags": [
          "push"
        ],
        "summary": "حذف اتوماسیون",
        "description": "اتوماسیون را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "aid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اتوماسیون."
            },
            "description": "شناسهٔ اتوماسیون.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اتوماسیون پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/automations/{aid}/runs": {
      "get": {
        "operationId": "pushAutoRuns",
        "tags": [
          "push"
        ],
        "summary": "اجراهای اتوماسیون",
        "description": "اجراهای اخیر (در انتظار، ارسال‌شده، لغوشده).\n\nبرای عیب‌یابی.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "aid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اتوماسیون."
            },
            "description": "شناسهٔ اتوماسیون.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "77",
                    "dueAt": "2026-10-30T11:00:00.000Z",
                    "status": "sent",
                    "deviceId": "dev_301"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اتوماسیون پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/forms": {
      "get": {
        "operationId": "pushForms",
        "tags": [
          "push"
        ],
        "summary": "فرم‌های اپ",
        "description": "فرم‌های ثبت‌نام/نظرسنجی که در اپ یا وب نمایش داده می‌شود.\n\nثبت فرم، مخاطب را در گروهی از دفترچه می‌گذارد.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "4",
                    "name": "ثبت‌نام خبرنامه",
                    "title": "عضو شوید",
                    "status": "active"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "post": {
        "operationId": "pushFormCreate",
        "tags": [
          "push"
        ],
        "summary": "ساخت فرم",
        "description": "فرم با فیلدهای دلخواه می‌سازد.\n\n`fields` فهرست فیلد (نوع، برچسب، الزامی بودن). `consentText` تیک رضایت اجباری می‌گذارد. اگر تأیید پیامکی شمارهٔ موبایل لازم است، `verifyLineId` خطی را بدهید که کدها را می‌فرستد و هزینه‌اش را می‌پردازد.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام داخلی (≤۸۰)."
                  },
                  "title": {
                    "type": "string",
                    "description": "عنوان نمایشی (≤۱۲۰)."
                  },
                  "description": {
                    "type": "string",
                    "description": "توضیح (≤۵۰۰)."
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "description": "فیلدهای فرم."
                  },
                  "groupName": {
                    "type": "string",
                    "description": "گروه دفترچه برای ثبت‌ها."
                  },
                  "consentText": {
                    "type": "string",
                    "description": "متن رضایت (≤۳۰۰)."
                  },
                  "submitText": {
                    "type": "string",
                    "description": "متن دکمه."
                  },
                  "successMessage": {
                    "type": "string",
                    "description": "پیام موفقیت."
                  },
                  "verifyLineId": {
                    "type": "string",
                    "description": "خط ارسال کد تأیید موبایل."
                  }
                },
                "required": [
                  "name",
                  "title"
                ]
              },
              "example": {
                "name": "ثبت‌نام خبرنامه",
                "title": "عضو خبرنامه شوید",
                "fields": [
                  {
                    "key": "mobile",
                    "type": "mobile",
                    "label": "موبایل",
                    "required": true
                  }
                ],
                "consentText": "با دریافت پیام موافقم"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "4",
                  "name": "ثبت‌نام خبرنامه",
                  "status": "active"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/sdk-apps/{id}/forms/{fid}": {
      "patch": {
        "operationId": "pushFormUpdate",
        "tags": [
          "push"
        ],
        "summary": "ویرایش فرم",
        "description": "فیلدهای فرم را تغییر می‌دهد.\n\nهر فیلد ساخت قابل ویرایش است.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "fid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ فرم."
            },
            "description": "شناسهٔ فرم.",
            "example": "4"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "عنوان."
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "description": "فیلدها."
                  },
                  "status": {
                    "type": "string",
                    "description": "وضعیت."
                  }
                },
                "required": []
              },
              "example": {
                "title": "عضو شوید"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "4",
                  "title": "عضو شوید"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: فرم پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "pushFormDelete",
        "tags": [
          "push"
        ],
        "summary": "حذف فرم",
        "description": "فرم را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴). مخاطبان ثبت‌شده می‌مانند.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "fid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ فرم."
            },
            "description": "شناسهٔ فرم.",
            "example": "4"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: فرم پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/forms/{fid}/stats": {
      "get": {
        "operationId": "pushFormStats",
        "tags": [
          "push"
        ],
        "summary": "آمار فرم",
        "description": "نمایش، ثبت و نرخ تبدیل فرم.\n\n`days` از ۱ تا ۳۶۶.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "fid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ فرم."
            },
            "description": "شناسهٔ فرم.",
            "example": "4"
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "تعداد روز."
            },
            "description": "تعداد روز.",
            "example": "30"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "views": 900,
                  "conversion": 15.6,
                  "submissions": 140
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: فرم پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/feeds": {
      "get": {
        "operationId": "pushFeeds",
        "tags": [
          "push"
        ],
        "summary": "فیدهای خودکار",
        "description": "فیدهای RSS/Atom که با انتشار مطلب جدید پوش می‌فرستند.\n\nبازهٔ بررسی ۱۵ تا ۱۴۴۰ دقیقه.\n\nدسترسی لازم (scope): `broker.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "2",
                    "url": "https://blog.example.com/feed",
                    "name": "وبلاگ",
                    "status": "active",
                    "intervalMinutes": 60
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: اپ پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "post": {
        "operationId": "pushFeedCreate",
        "tags": [
          "push"
        ],
        "summary": "ساخت فید",
        "description": "یک فید را به اپ وصل می‌کند.\n\nدر هر بررسی حداکثر `maxPerRun` (۱ تا ۵) مطلب جدید پوش می‌شود. سقف ۲۰ فید در ساعت.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام."
                  },
                  "url": {
                    "type": "string",
                    "description": "نشانی فید (۸ تا ۵۰۰ نویسه)."
                  },
                  "intervalMinutes": {
                    "type": "integer",
                    "description": "بازهٔ بررسی (۱۵ تا ۱۴۴۰، پیش‌فرض ۶۰)."
                  },
                  "maxPerRun": {
                    "type": "integer",
                    "description": "سقف مطلب در هر بررسی (۱ تا ۵، پیش‌فرض ۳)."
                  },
                  "target": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "مخاطب پوش؛ پیش‌فرض `{ all: true }`."
                  }
                },
                "required": [
                  "name",
                  "url"
                ]
              },
              "example": {
                "url": "https://blog.example.com/feed",
                "name": "وبلاگ",
                "intervalMinutes": 60
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "2",
                  "status": "active"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/sdk-apps/{id}/feeds/{fid}": {
      "patch": {
        "operationId": "pushFeedUpdate",
        "tags": [
          "push"
        ],
        "summary": "ویرایش فید",
        "description": "تنظیمات یا وضعیت فید را تغییر می‌دهد.\n\nسقف ۳۰ بار در ساعت.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "fid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ فید."
            },
            "description": "شناسهٔ فید.",
            "example": "2"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "intervalMinutes": {
                    "type": "integer",
                    "description": "بازهٔ بررسی."
                  },
                  "status": {
                    "type": "string",
                    "description": "`active` یا `paused`."
                  }
                },
                "required": []
              },
              "example": {
                "status": "paused"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "2",
                  "status": "paused"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: فید پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      },
      "delete": {
        "operationId": "pushFeedDelete",
        "tags": [
          "push"
        ],
        "summary": "حذف فید",
        "description": "فید را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "fid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ فید."
            },
            "description": "شناسهٔ فید.",
            "example": "2"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: فید پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/sdk-apps/{id}/feeds/{fid}/check": {
      "post": {
        "operationId": "pushFeedCheck",
        "tags": [
          "push"
        ],
        "summary": "بررسی فوری فید",
        "description": "فید را همین حالا می‌خواند و مطالب جدید را پوش می‌کند.\n\nسقف ۱۰ بار در دقیقه.\n\nدسترسی لازم (scope): `broker.write`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "broker.write",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ اپ."
            },
            "description": "شناسهٔ اپ.",
            "example": "8"
          },
          {
            "name": "fid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ فید."
            },
            "description": "شناسهٔ فید.",
            "example": "2"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "sent": 2,
                  "found": 2
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: فید پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/routes": {
      "get": {
        "operationId": "voipRoutes",
        "tags": [
          "voip-routing"
        ],
        "summary": "مسیر تماس شماره‌ها",
        "description": "مسیر تماس ورودیِ شماره‌های شما.\n\nبرای هر شمارهٔ خریداری‌شده، پیکربندی مسیر (زنگ‌خوردن گوشی، IVR، شرط زمانی …) و فعال بودنش. همهٔ مسیرهای VoIP با دامنهٔ `sms.read` (خواندن) و `sms.send` (تغییر) کار می‌کنند و نیاز به امکان VoIP در گروه کاربری دارند. کلید پروژه به این مسیرها دسترسی ندارد.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "config": {
                      "to": [
                        "09121234567"
                      ],
                      "type": "forward"
                    },
                    "number": "02112345678",
                    "enabled": true,
                    "numberId": "9"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voip/routes/{numberId}": {
      "put": {
        "operationId": "voipRoutePut",
        "tags": [
          "voip-routing"
        ],
        "summary": "تنظیم مسیر یک شماره",
        "description": "مسیر تماس ورودی یک شماره را ذخیره می‌کند.\n\n`config` توصیف مسیر است (مقصد مستقیم، گروه زنگ، IVR یا شرط زمانی). اگر ضبط تماس در مسیر هست باید `recordConsent: true` بدهید؛ یعنی هر دو طرف از ضبط مطلع می‌شوند.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "numberId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ شمارهٔ خریداری‌شده."
            },
            "description": "شناسهٔ شمارهٔ خریداری‌شده.",
            "example": "9"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "config": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "پیکربندی مسیر."
                  },
                  "recordConsent": {
                    "type": "boolean",
                    "description": "تأیید اعلام ضبط به طرفین."
                  },
                  "enabled": {
                    "type": "boolean",
                    "description": "فعال/غیرفعال."
                  }
                },
                "required": [
                  "config"
                ]
              },
              "example": {
                "config": {
                  "to": [
                    "09121234567"
                  ],
                  "type": "forward"
                },
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "enabled": true,
                  "numberId": "9"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: شماره پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "voipRouteDelete",
        "tags": [
          "voip-routing"
        ],
        "summary": "حذف مسیر شماره",
        "description": "مسیر شماره را برمی‌دارد.\n\nپاسخ بدون بدنه (۲۰۴). شماره همچنان مال شماست ولی تماس ورودی پاسخ داده نمی‌شود.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "numberId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ شماره."
            },
            "description": "شناسهٔ شماره.",
            "example": "9"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: شماره پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/routes/{numberId}/preview": {
      "get": {
        "operationId": "voipRoutePreview",
        "tags": [
          "voip-routing"
        ],
        "summary": "پیش‌نمایش مسیر در یک زمان",
        "description": "نشان می‌دهد در زمان داده‌شده تماس به کجا می‌رود.\n\nبرای بررسی شرط‌های زمانی و تعطیلات. `at` را به ISO 8601 بدهید؛ پیش‌فرض همین حالا.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "numberId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ شماره."
            },
            "description": "شناسهٔ شماره.",
            "example": "9"
          },
          {
            "name": "at",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "زمان فرضی."
            },
            "description": "زمان فرضی.",
            "example": "2026-11-01T20:00:00Z"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "reason": "خارج از ساعت کاری",
                  "destination": {
                    "type": "voicemail"
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: شماره پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/groups": {
      "get": {
        "operationId": "voipGroups",
        "tags": [
          "voip-routing"
        ],
        "summary": "گروه‌های زنگ",
        "description": "گروه‌هایی که تماس را بین چند نفر پخش می‌کنند.\n\nاعضا شمارهٔ تلفن یا یکی از سافت‌فون‌های خودتان هستند.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "4",
                    "name": "پشتیبانی",
                    "members": [
                      "09121234567",
                      "sip:2"
                    ],
                    "strategy": "ring_all",
                    "ringTimeoutSec": 25
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "voipGroupCreate",
        "tags": [
          "voip-routing"
        ],
        "summary": "ساخت گروه زنگ",
        "description": "گروه زنگ جدید.\n\nسپس در مسیر شماره یا IVR به آن ارجاع بدهید.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام گروه (≤۸۰)."
                  },
                  "strategy": {
                    "type": "string",
                    "description": "روش زنگ؛ پیش‌فرض `ring_all` (همه هم‌زمان)."
                  },
                  "members": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شماره‌ها یا `sip:<شناسه حساب>` (۱ تا ۲۰ عضو)."
                  },
                  "ringTimeoutSec": {
                    "type": "integer",
                    "description": "مهلت زنگ (۵ تا ۱۲۰ ثانیه، پیش‌فرض ۲۵)."
                  }
                },
                "required": [
                  "name",
                  "members"
                ]
              },
              "example": {
                "name": "پشتیبانی",
                "members": [
                  "09121234567",
                  "sip:2"
                ],
                "ringTimeoutSec": 25
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "4",
                  "name": "پشتیبانی"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voip/groups/{id}": {
      "put": {
        "operationId": "voipGroupUpdate",
        "tags": [
          "voip-routing"
        ],
        "summary": "ویرایش گروه زنگ",
        "description": "گروه را به‌طور کامل بازنویسی می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ گروه."
            },
            "description": "شناسهٔ گروه.",
            "example": "4"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام گروه (≤۸۰)."
                  },
                  "strategy": {
                    "type": "string",
                    "description": "روش زنگ؛ پیش‌فرض `ring_all` (همه هم‌زمان)."
                  },
                  "members": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شماره‌ها یا `sip:<شناسه حساب>` (۱ تا ۲۰ عضو)."
                  },
                  "ringTimeoutSec": {
                    "type": "integer",
                    "description": "مهلت زنگ (۵ تا ۱۲۰ ثانیه، پیش‌فرض ۲۵)."
                  }
                },
                "required": [
                  "name",
                  "members"
                ]
              },
              "example": {
                "name": "پشتیبانی",
                "members": [
                  "09121234567"
                ],
                "ringTimeoutSec": 30
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: گروه پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "voipGroupDelete",
        "tags": [
          "voip-routing"
        ],
        "summary": "حذف گروه زنگ",
        "description": "گروه را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴). اگر مسیری به آن ارجاع دارد باید اول اصلاح شود.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ گروه."
            },
            "description": "شناسهٔ گروه.",
            "example": "4"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: گروه پیدا نشد یا متعلق به شما نیست."
          },
          "409": {
            "description": "conflict: گروه در مسیر یا IVR استفاده می‌شود."
          }
        }
      }
    },
    "/voip/ivrs": {
      "get": {
        "operationId": "voipIvrs",
        "tags": [
          "voip-routing"
        ],
        "summary": "منوهای صوتی (IVR)",
        "description": "منوهای تعاملی ساخته‌شده.\n\nهر IVR یک درخت از پیام و گزینه‌هاست.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "6",
                    "name": "منوی اصلی"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "voipIvrCreate",
        "tags": [
          "voip-routing"
        ],
        "summary": "ساخت IVR",
        "description": "منوی صوتی جدید.\n\nبرای طراحی دیداری از بوم (`/voip/flows`) هم می‌توانید استفاده کنید.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام (≤۸۰)."
                  },
                  "tree": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "درخت منو: پیام خوش‌آمد، گزینه‌ها (کلید ۰ تا ۹) و مقصد هر کدام."
                  }
                },
                "required": [
                  "name",
                  "tree"
                ]
              },
              "example": {
                "name": "منوی اصلی",
                "tree": {
                  "prompt": {
                    "text": "برای فروش یک و برای پشتیبانی دو را بزنید",
                    "type": "tts"
                  },
                  "options": {
                    "1": {
                      "to": [
                        "09121234567"
                      ],
                      "type": "forward"
                    },
                    "2": {
                      "id": "4",
                      "type": "group"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "6",
                  "name": "منوی اصلی"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voip/ivrs/{id}": {
      "put": {
        "operationId": "voipIvrUpdate",
        "tags": [
          "voip-routing"
        ],
        "summary": "ویرایش IVR",
        "description": "IVR را بازنویسی می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ IVR."
            },
            "description": "شناسهٔ IVR.",
            "example": "6"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام (≤۸۰)."
                  },
                  "tree": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "درخت منو: پیام خوش‌آمد، گزینه‌ها (کلید ۰ تا ۹) و مقصد هر کدام."
                  }
                },
                "required": [
                  "name",
                  "tree"
                ]
              },
              "example": {
                "name": "منوی اصلی",
                "tree": {
                  "prompt": {
                    "text": "برای فروش یک و برای پشتیبانی دو را بزنید",
                    "type": "tts"
                  },
                  "options": {
                    "1": {
                      "to": [
                        "09121234567"
                      ],
                      "type": "forward"
                    },
                    "2": {
                      "id": "4",
                      "type": "group"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: IVR پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "voipIvrDelete",
        "tags": [
          "voip-routing"
        ],
        "summary": "حذف IVR",
        "description": "IVR را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ IVR."
            },
            "description": "شناسهٔ IVR.",
            "example": "6"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: IVR پیدا نشد یا متعلق به شما نیست."
          },
          "409": {
            "description": "conflict: IVR در مسیر استفاده می‌شود."
          }
        }
      }
    },
    "/voip/time-conditions": {
      "get": {
        "operationId": "voipTcList",
        "tags": [
          "voip-routing"
        ],
        "summary": "شرط‌های زمانی",
        "description": "قاعده‌هایی که مقصد تماس را بر اساس ساعت و تعطیلات عوض می‌کنند.\n\nتا ۵۰ شرط.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "2",
                    "name": "ساعت اداری"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "voipTcCreate",
        "tags": [
          "voip-routing"
        ],
        "summary": "ساخت شرط زمانی",
        "description": "شرط زمانی جدید.\n\nداخل ساعات `matchDest` و خارج از آن (یا در تعطیلات) `elseDest` اجرا می‌شود.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام (≤۸۰)."
                  },
                  "hours": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "ساعات کاری هفتگی برای هر روز."
                  },
                  "holidays": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "description": "تعطیلات (تاریخ)."
                  },
                  "matchDest": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "مقصد در ساعات کاری."
                  },
                  "elseDest": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "مقصد خارج از ساعات یا در تعطیلات."
                  }
                },
                "required": [
                  "name",
                  "hours",
                  "matchDest",
                  "elseDest"
                ]
              },
              "example": {
                "name": "ساعت اداری",
                "hours": {
                  "sat": [
                    [
                      "08:00",
                      "17:00"
                    ]
                  ]
                },
                "elseDest": {
                  "type": "voicemail"
                },
                "holidays": [],
                "matchDest": {
                  "id": "4",
                  "type": "group"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "2",
                  "name": "ساعت اداری"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voip/time-conditions/{id}": {
      "put": {
        "operationId": "voipTcUpdate",
        "tags": [
          "voip-routing"
        ],
        "summary": "ویرایش شرط زمانی",
        "description": "شرط را بازنویسی می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ شرط."
            },
            "description": "شناسهٔ شرط.",
            "example": "2"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام (≤۸۰)."
                  },
                  "hours": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "ساعات کاری هفتگی برای هر روز."
                  },
                  "holidays": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "description": "تعطیلات (تاریخ)."
                  },
                  "matchDest": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "مقصد در ساعات کاری."
                  },
                  "elseDest": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "مقصد خارج از ساعات یا در تعطیلات."
                  }
                },
                "required": [
                  "name",
                  "hours",
                  "matchDest",
                  "elseDest"
                ]
              },
              "example": {
                "name": "ساعت اداری",
                "hours": {
                  "sat": [
                    [
                      "08:00",
                      "17:00"
                    ]
                  ]
                },
                "elseDest": {
                  "type": "voicemail"
                },
                "holidays": [],
                "matchDest": {
                  "id": "4",
                  "type": "group"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: شرط پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "voipTcDelete",
        "tags": [
          "voip-routing"
        ],
        "summary": "حذف شرط زمانی",
        "description": "شرط را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ شرط."
            },
            "description": "شناسهٔ شرط.",
            "example": "2"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: شرط پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/extensions": {
      "get": {
        "operationId": "voipExtList",
        "tags": [
          "voip-routing"
        ],
        "summary": "شماره‌های داخلی",
        "description": "داخلی‌های مرکز تلفن (تا ۱۰۰ عدد).\n\nمخاطب می‌تواند داخلی را در IVR یا تأیید صوتی انتخاب کند.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "4",
                    "name": "فروش",
                    "number": "101"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "voipExtCreate",
        "tags": [
          "voip-routing"
        ],
        "summary": "ساخت داخلی",
        "description": "داخلی جدید.\n\nشمارهٔ داخلی در حساب شما یکتاست.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "number": {
                    "type": "string",
                    "description": "شمارهٔ داخلی (۲ تا ۸ رقم)."
                  },
                  "name": {
                    "type": "string",
                    "description": "نام (≤۸۰)."
                  },
                  "sipAccountId": {
                    "type": "string",
                    "description": "سافت‌فونی که زنگ می‌خورد."
                  },
                  "forwardTo": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شماره‌هایی که هم‌زمان زنگ می‌خورند (حداکثر ۵)."
                  },
                  "ringTimeoutSec": {
                    "type": "integer",
                    "description": "مهلت زنگ (۵ تا ۱۲۰)."
                  }
                },
                "required": [
                  "number",
                  "name"
                ]
              },
              "example": {
                "name": "فروش",
                "number": "101",
                "forwardTo": [
                  "09121234567"
                ],
                "sipAccountId": "2",
                "ringTimeoutSec": 25
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "4",
                  "number": "101"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "409": {
            "description": "conflict: این شمارهٔ داخلی قبلاً وجود دارد."
          }
        }
      }
    },
    "/voip/extensions/{id}": {
      "put": {
        "operationId": "voipExtUpdate",
        "tags": [
          "voip-routing"
        ],
        "summary": "ویرایش داخلی",
        "description": "داخلی را بازنویسی می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ داخلی."
            },
            "description": "شناسهٔ داخلی.",
            "example": "4"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "number": {
                    "type": "string",
                    "description": "شمارهٔ داخلی (۲ تا ۸ رقم)."
                  },
                  "name": {
                    "type": "string",
                    "description": "نام (≤۸۰)."
                  },
                  "sipAccountId": {
                    "type": "string",
                    "description": "سافت‌فونی که زنگ می‌خورد."
                  },
                  "forwardTo": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شماره‌هایی که هم‌زمان زنگ می‌خورند (حداکثر ۵)."
                  },
                  "ringTimeoutSec": {
                    "type": "integer",
                    "description": "مهلت زنگ (۵ تا ۱۲۰)."
                  }
                },
                "required": [
                  "number",
                  "name"
                ]
              },
              "example": {
                "name": "فروش",
                "number": "101",
                "forwardTo": [
                  "09121234567"
                ],
                "sipAccountId": "2",
                "ringTimeoutSec": 25
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: داخلی پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "voipExtDelete",
        "tags": [
          "voip-routing"
        ],
        "summary": "حذف داخلی",
        "description": "داخلی را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ داخلی."
            },
            "description": "شناسهٔ داخلی.",
            "example": "4"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: داخلی پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/sip-accounts": {
      "get": {
        "operationId": "voipSipList",
        "tags": [
          "voip-sip"
        ],
        "summary": "حساب‌های SIP",
        "description": "سافت‌فون‌های شما (موبایل، دسکتاپ، وب‌رتی‌سی).\n\nهر حساب با نام‌کاربری و (اختیاری) شمارهٔ داخلی. رمز هرگز برنمی‌گردد.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "2",
                    "label": "میز فروش",
                    "username": "u1234",
                    "extension": "101",
                    "registered": true
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "voipSipCreate",
        "tags": [
          "voip-sip"
        ],
        "summary": "ساخت حساب SIP",
        "description": "حساب سافت‌فون جدید و رمز آن را (فقط همین یک بار) می‌دهد.\n\nرمز را ذخیره کنید؛ بعداً فقط با `credentials` یا `rotate` می‌توان رمز تازه گرفت. سقف ۱۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "description": "برچسب (≤۸۰)."
                  },
                  "extension": {
                    "type": "string",
                    "description": "داخلی (۲ تا ۸ رقم)."
                  }
                },
                "required": [
                  "label"
                ]
              },
              "example": {
                "label": "میز فروش",
                "extension": "101"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "2",
                  "domain": "sip.irnoti.com",
                  "password": "S3cr3t…",
                  "username": "u1234"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/sip-accounts/{id}": {
      "patch": {
        "operationId": "voipSipUpdate",
        "tags": [
          "voip-sip"
        ],
        "summary": "تغییر داخلیِ حساب",
        "description": "شمارهٔ داخلی حساب را عوض یا پاک (`null`) می‌کند.\n\nسقف ۳۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ حساب."
            },
            "description": "شناسهٔ حساب.",
            "example": "4"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "extension": {
                    "type": "string",
                    "description": "داخلی جدید یا `null`."
                  }
                },
                "required": [
                  "extension"
                ]
              },
              "example": {
                "extension": "102"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "4",
                  "extension": "102"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: حساب پیدا نشد یا متعلق به شما نیست."
          },
          "409": {
            "description": "conflict: داخلی تکراری است."
          }
        }
      },
      "delete": {
        "operationId": "voipSipDelete",
        "tags": [
          "voip-sip"
        ],
        "summary": "حذف حساب SIP",
        "description": "حساب را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ حساب."
            },
            "description": "شناسهٔ حساب.",
            "example": "4"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: حساب پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/sip-accounts/{id}/config": {
      "get": {
        "operationId": "voipSipConfig",
        "tags": [
          "voip-sip"
        ],
        "summary": "تنظیمات اتصال سافت‌فون",
        "description": "سرور، پورت، پروتکل و نشانی WebRTC برای وارد کردن در سافت‌فون.\n\nبدون رمز؛ برای رمز از `credentials` استفاده کنید.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ حساب."
            },
            "description": "شناسهٔ حساب.",
            "example": "4"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "wss": "wss://sip.irnoti.com/ws",
                  "port": 5061,
                  "server": "sip.irnoti.com",
                  "username": "u1234",
                  "transport": "tls"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: حساب پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/sip-accounts/{id}/credentials": {
      "post": {
        "operationId": "voipSipCredentials",
        "tags": [
          "voip-sip"
        ],
        "summary": "دریافت اطلاعات ورود",
        "description": "اعتبارنامهٔ ورود حساب را نشان می‌دهد.\n\nهر فراخوانی ثبت می‌شود. سقف ۳۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ حساب."
            },
            "description": "شناسهٔ حساب.",
            "example": "4"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "password": "S3cr3t…",
                  "username": "u1234"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: حساب پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/sip-accounts/{id}/sync": {
      "post": {
        "operationId": "voipSipSync",
        "tags": [
          "voip-sip"
        ],
        "summary": "همگام‌سازی با مرکز تلفن",
        "description": "حساب را دوباره روی سرور تلفن اعمال می‌کند.\n\nاگر سافت‌فون ثبت‌نام نمی‌شود بعد از تغییرات امتحان کنید. سقف ۲۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ حساب."
            },
            "description": "شناسهٔ حساب.",
            "example": "4"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "synced": true
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: حساب پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/sip-accounts/{id}/rotate": {
      "post": {
        "operationId": "voipSipRotate",
        "tags": [
          "voip-sip"
        ],
        "summary": "چرخش رمز",
        "description": "رمز تازه می‌سازد؛ رمز قبلی بی‌اعتبار می‌شود.\n\nسافت‌فون‌های متصل باید دوباره وارد شوند.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ حساب."
            },
            "description": "شناسهٔ حساب.",
            "example": "4"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "password": "N3wS3cr3t…",
                  "username": "u1234"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: حساب پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/calls/{id}/hangup": {
      "post": {
        "operationId": "voipHangup",
        "tags": [
          "voip-live"
        ],
        "summary": "قطع تماس",
        "description": "تماس در جریان را قطع می‌کند.\n\nپاسخ بدون بدنه (۲۰۴). شناسه را از `GET /voip/live` بگیرید.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ تماس."
            },
            "description": "شناسهٔ تماس.",
            "example": "120"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: تماس پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/calls/{id}/hold": {
      "post": {
        "operationId": "voipHold",
        "tags": [
          "voip-live"
        ],
        "summary": "نگه‌داشتن تماس",
        "description": "تماس را روی انتظار می‌گذارد یا برمی‌دارد.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ تماس."
            },
            "description": "شناسهٔ تماس.",
            "example": "120"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "on": {
                    "type": "boolean",
                    "description": "`true` (پیش‌فرض) نگه‌داشتن، `false` ادامه."
                  }
                },
                "required": []
              },
              "example": {
                "on": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: تماس پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/calls/{id}/transfer": {
      "post": {
        "operationId": "voipTransfer",
        "tags": [
          "voip-live"
        ],
        "summary": "انتقال تماس",
        "description": "تماس را به شماره یا داخلی دیگری منتقل می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ تماس."
            },
            "description": "شناسهٔ تماس.",
            "example": "120"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "string",
                    "description": "مقصد (شماره یا داخلی)."
                  }
                },
                "required": [
                  "to"
                ]
              },
              "example": {
                "to": "102"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: تماس پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/calls/{id}/spy": {
      "post": {
        "operationId": "voipSpy",
        "tags": [
          "voip-live"
        ],
        "summary": "شنود سرپرست",
        "description": "یک سرپرست را به تماس وصل می‌کند.\n\n`mode`: `listen` فقط گوش دادن، `whisper` صحبت فقط با کارمند، `barge` ورود به مکالمه. ثبت می‌شود. سقف ۱۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ تماس."
            },
            "description": "شناسهٔ تماس.",
            "example": "120"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "supervisor": {
                    "type": "string",
                    "description": "شمارهٔ سرپرست."
                  },
                  "mode": {
                    "type": "string",
                    "description": "`listen` (پیش‌فرض)، `whisper` یا `barge`."
                  }
                },
                "required": [
                  "supervisor"
                ]
              },
              "example": {
                "mode": "listen",
                "supervisor": "09121234567"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "ok": true
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: تماس پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/conferences": {
      "get": {
        "operationId": "voipConfList",
        "tags": [
          "voip-live"
        ],
        "summary": "کنفرانس‌ها",
        "description": "کنفرانس‌های فعال و اخیر.\n\nبرای هر کدام شرکت‌کنندگان فعلی برمی‌گردد.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "3",
                    "name": "جلسه هفتگی",
                    "status": "active",
                    "participants": 3
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "voipConfCreate",
        "tags": [
          "voip-live"
        ],
        "summary": "ساخت کنفرانس",
        "description": "اتاق کنفرانس می‌سازد و به شرکت‌کنندگان زنگ می‌زند.\n\nتا ۲۰ شرکت‌کننده. هزینه طبق تعرفهٔ تماس هر شرکت‌کننده. سقف ۱۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام."
                  },
                  "participants": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شماره‌ها (حداکثر ۲۰)."
                  },
                  "callerId": {
                    "type": "string",
                    "description": "شمارهٔ نمایشی."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "جلسه هفتگی",
                "participants": [
                  "09121234567",
                  "09351234567"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "3",
                  "name": "جلسه هفتگی",
                  "status": "active"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/conferences/{id}/participants": {
      "post": {
        "operationId": "voipConfAdd",
        "tags": [
          "voip-live"
        ],
        "summary": "افزودن شرکت‌کننده",
        "description": "به کنفرانس شخص دیگری را دعوت می‌کند.\n\nسقف ۳۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کنفرانس."
            },
            "description": "شناسهٔ کنفرانس.",
            "example": "3"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "number": {
                    "type": "string",
                    "description": "شماره."
                  },
                  "callerId": {
                    "type": "string",
                    "description": "شمارهٔ نمایشی."
                  }
                },
                "required": [
                  "number"
                ]
              },
              "example": {
                "number": "09351234567"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "ok": true
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: کنفرانس پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/conferences/{id}/end": {
      "post": {
        "operationId": "voipConfEnd",
        "tags": [
          "voip-live"
        ],
        "summary": "پایان کنفرانس",
        "description": "کنفرانس را می‌بندد و همه را قطع می‌کند.\n\nپاسخ شامل خلاصهٔ مدت.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کنفرانس."
            },
            "description": "شناسهٔ کنفرانس.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "3",
                  "status": "ended"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: کنفرانس پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/campaigns": {
      "get": {
        "operationId": "voipCampList",
        "tags": [
          "voip-campaign"
        ],
        "summary": "کمپین‌های تماس",
        "description": "کمپین‌های پخش پیام و نظرسنجی تلفنی.\n\nوضعیت: پیش‌نویس، در حال اجرا، متوقف، تمام‌شده، لغوشده.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "5",
                    "kind": "broadcast",
                    "name": "یادآوری قسط",
                    "status": "running"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "voipCampCreate",
        "tags": [
          "voip-campaign"
        ],
        "summary": "ساخت کمپین تماس",
        "description": "کمپین می‌سازد؛ با `start` شروع می‌شود.\n\nبرای نظرسنجی باید حداقل یک گزینه تعریف شود. سقف ۱۰ در دقیقه. هزینه هنگام شروع رزرو می‌شود.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام (≤۱۲۰)."
                  },
                  "kind": {
                    "type": "string",
                    "description": "`broadcast` (پخش پیام) یا `survey` (نظرسنجی با کلید)."
                  },
                  "script": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "متن گفتار یا فایل صوتی؛ برای نظرسنجی گزینه‌ها (`options`: کلید ← برچسب)."
                  },
                  "numbers": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شماره‌ها."
                  },
                  "contactGroupId": {
                    "type": "string",
                    "description": "گروه دفترچه. یکی از `numbers` یا `contactGroupId` الزامی است."
                  },
                  "callerId": {
                    "type": "string",
                    "description": "شمارهٔ نمایشی."
                  },
                  "window": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "بازهٔ مجاز تماس (ساعت روز)."
                  },
                  "concurrency": {
                    "type": "integer",
                    "description": "تماس هم‌زمان (پیش‌فرض ۳)."
                  },
                  "cps": {
                    "type": "integer",
                    "description": "تماس در ثانیه (پیش‌فرض ۱)."
                  },
                  "maxAttempts": {
                    "type": "integer",
                    "description": "تعداد تلاش (پیش‌فرض ۲)."
                  },
                  "retryDelayMin": {
                    "type": "integer",
                    "description": "فاصلهٔ تلاش دوباره (دقیقه، پیش‌فرض ۳۰)."
                  }
                },
                "required": [
                  "name",
                  "kind",
                  "script"
                ]
              },
              "example": {
                "kind": "survey",
                "name": "نظرسنجی رضایت",
                "script": {
                  "text": "برای رضایت یک و برای نارضایتی دو را بزنید",
                  "options": {
                    "1": "راضی",
                    "2": "ناراضی"
                  }
                },
                "numbers": [
                  "09121234567"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "5",
                  "status": "draft"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/campaigns/{id}": {
      "get": {
        "operationId": "voipCampGet",
        "tags": [
          "voip-campaign"
        ],
        "summary": "جزئیات کمپین",
        "description": "پیشرفت و شمارنده‌های کمپین.\n\nپاسخ، تعداد هدف‌ها بر اساس وضعیت (`pending`، `dialing`، `answered`، `noanswer`، `failed`، `skipped`) را هم دارد.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کمپین."
            },
            "description": "شناسهٔ کمپین.",
            "example": "5"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "5",
                  "name": "نظرسنجی رضایت",
                  "counts": {
                    "pending": 10,
                    "answered": 32,
                    "noanswer": 5
                  },
                  "status": "running"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: کمپین پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/campaigns/{id}/targets": {
      "get": {
        "operationId": "voipCampTargets",
        "tags": [
          "voip-campaign"
        ],
        "summary": "مخاطبان کمپین",
        "description": "وضعیت تماس با هر شماره.\n\nبا `status` فیلتر و با `before` صفحه‌بندی می‌شود.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کمپین."
            },
            "description": "شناسهٔ کمپین.",
            "example": "5"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "وضعیت هدف."
            },
            "description": "وضعیت هدف."
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط شناسه‌های کوچک‌تر."
            },
            "description": "فقط شناسه‌های کوچک‌تر."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "801",
                    "dtmf": "1",
                    "number": "09121234567",
                    "status": "answered",
                    "attempts": 1
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: کمپین پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/campaigns/{id}/results": {
      "get": {
        "operationId": "voipCampResults",
        "tags": [
          "voip-campaign"
        ],
        "summary": "نتایج کمپین",
        "description": "خلاصهٔ نتایج و توزیع پاسخ‌های نظرسنجی.\n\nبرای هر گزینه تعداد انتخاب برمی‌گردد.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کمپین."
            },
            "description": "شناسهٔ کمپین.",
            "example": "5"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "cost": "640000",
                  "options": {
                    "1": 20,
                    "2": 12
                  },
                  "answered": 32
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: کمپین پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/campaigns/{id}/start": {
      "post": {
        "operationId": "voipCampStart",
        "tags": [
          "voip-campaign"
        ],
        "summary": "شروع کمپین",
        "description": "کمپین را شروع می‌کند و هزینه را رزرو می‌کند.\n\nوضعیت جدید کمپین برمی‌گردد.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کمپین."
            },
            "description": "شناسهٔ کمپین.",
            "example": "5"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "5",
                  "status": "running"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: کمپین پیدا نشد یا متعلق به شما نیست."
          },
          "409": {
            "description": "conflict: وضعیت کمپین این کار را اجازه نمی‌دهد."
          }
        }
      }
    },
    "/voip/campaigns/{id}/pause": {
      "post": {
        "operationId": "voipCampPause",
        "tags": [
          "voip-campaign"
        ],
        "summary": "توقف کمپین",
        "description": "تماس‌های جدید را متوقف می‌کند.\n\nوضعیت جدید کمپین برمی‌گردد.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کمپین."
            },
            "description": "شناسهٔ کمپین.",
            "example": "5"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "5",
                  "status": "paused"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: کمپین پیدا نشد یا متعلق به شما نیست."
          },
          "409": {
            "description": "conflict: وضعیت کمپین این کار را اجازه نمی‌دهد."
          }
        }
      }
    },
    "/voip/campaigns/{id}/cancel": {
      "post": {
        "operationId": "voipCampCancel",
        "tags": [
          "voip-campaign"
        ],
        "summary": "لغو کمپین",
        "description": "کمپین را پایان می‌دهد و هزینهٔ باقی‌مانده را برمی‌گرداند.\n\nوضعیت جدید کمپین برمی‌گردد.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کمپین."
            },
            "description": "شناسهٔ کمپین.",
            "example": "5"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "5",
                  "status": "cancelled"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: کمپین پیدا نشد یا متعلق به شما نیست."
          },
          "409": {
            "description": "conflict: وضعیت کمپین این کار را اجازه نمی‌دهد."
          }
        }
      }
    },
    "/voice-confirm": {
      "post": {
        "operationId": "voiceConfirmCreate",
        "tags": [
          "voip-campaign"
        ],
        "summary": "تأیید تلفنی",
        "description": "به مخاطب زنگ می‌زند تا کدی را تایپ یا گزینه‌ای را انتخاب کند.\n\nمناسب تأیید پرداخت، سفارش یا هویت. نتیجه را با `GET /voice-confirm/{id}` بگیرید. سقف ۲۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "string",
                    "description": "شمارهٔ مخاطب."
                  },
                  "mode": {
                    "type": "string",
                    "description": "`code` (کاربر کد را تایپ کند) یا `choice` (انتخاب با کلید)."
                  },
                  "prompt": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "پیام ابتدایی: متن گفتار یا فایل صوتی."
                  },
                  "code": {
                    "type": "string",
                    "description": "حالت `code`: ارقام (۳ تا ۸) که کاربر باید وارد کند."
                  },
                  "options": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "حالت `choice`: کلید ← برچسب (۲ تا ۹ گزینه)."
                  },
                  "transfers": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "حالت `choice`: کلید ← داخلی برای وصل شدن."
                  }
                },
                "required": [
                  "to",
                  "mode",
                  "prompt"
                ]
              },
              "example": {
                "to": "09121234567",
                "mode": "choice",
                "prompt": {
                  "text": "سفارش شما را تأیید می‌کنید؟ یک برای بله و دو برای خیر"
                },
                "options": {
                  "1": "بله",
                  "2": "خیر"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "17",
                  "status": "calling"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      },
      "get": {
        "operationId": "voiceConfirmList",
        "tags": [
          "voip-campaign"
        ],
        "summary": "فهرست تأییدهای تلفنی",
        "description": "تأییدهای اخیر و وضعیتشان.\n\nوضعیت: `calling`، `confirmed`، `rejected`، `no_answer`، `failed`.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "17",
                    "to": "09121234567",
                    "answer": "1",
                    "status": "confirmed"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voice-confirm/{id}": {
      "get": {
        "operationId": "voiceConfirmGet",
        "tags": [
          "voip-campaign"
        ],
        "summary": "نتیجهٔ تأیید تلفنی",
        "description": "وضعیت و پاسخ مخاطب.\n\nدر حالت `code` نتیجه فقط تأیید یا رد است، نه کد وارد‌شده.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ تأیید."
            },
            "description": "شناسهٔ تأیید.",
            "example": "17"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "17",
                  "answer": "1",
                  "status": "confirmed"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: تأیید پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/otp-voices": {
      "get": {
        "operationId": "voipOtpVoices",
        "tags": [
          "voip-campaign"
        ],
        "summary": "صداهای کد تأیید صوتی",
        "description": "فهرست صداهای آمادهٔ OTP صوتی.\n\nمقدار `code` را در فیلد `voice` مسیر `POST /voip/otp` بدهید؛ بدون آن صدای پیش‌فرض استفاده می‌شود.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "code": "fa-female",
                    "nameFa": "فارسی - خانم",
                    "isDefault": true,
                    "description": null
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voip/recordings": {
      "get": {
        "operationId": "voipRecList",
        "tags": [
          "voip-records"
        ],
        "summary": "ضبط‌ها و پیام‌های صوتی",
        "description": "ضبط مکالمه‌ها و صندوق پیام صوتی.\n\n`kind=call|voicemail`، `unheard=1` فقط نشنیده‌ها، `search` در شماره و متن رونویسی.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "`call` یا `voicemail`."
            },
            "description": "`call` یا `voicemail`.",
            "example": "voicemail"
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "عبارت (۲ تا ۱۰۰ نویسه)."
            },
            "description": "عبارت (۲ تا ۱۰۰ نویسه)."
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط شناسه‌های کوچک‌تر."
            },
            "description": "فقط شناسه‌های کوچک‌تر."
          },
          {
            "name": "unheard",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "`1` یا `true`."
            },
            "description": "`1` یا `true`.",
            "example": "1"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "33",
                    "from": "09121234567",
                    "kind": "voicemail",
                    "heard": false,
                    "createdAt": "2026-10-30T09:12:00.000Z",
                    "transcript": null,
                    "durationSec": 24
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voip/recordings/{id}": {
      "get": {
        "operationId": "voipRecGet",
        "tags": [
          "voip-records"
        ],
        "summary": "جزئیات ضبط",
        "description": "مشخصات یک ضبط یا پیام صوتی.\n\nفایل صوتی با لینک موقت (`link`) دریافت می‌شود.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ضبط."
            },
            "description": "شناسهٔ ضبط.",
            "example": "33"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "33",
                  "kind": "voicemail",
                  "transcript": null,
                  "durationSec": 24
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ضبط پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "voipRecDelete",
        "tags": [
          "voip-records"
        ],
        "summary": "حذف ضبط",
        "description": "ضبط را برای همیشه حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ضبط."
            },
            "description": "شناسهٔ ضبط.",
            "example": "33"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ضبط پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/recordings/{id}/link": {
      "post": {
        "operationId": "voipRecLink",
        "tags": [
          "voip-records"
        ],
        "summary": "لینک موقت شنیدن",
        "description": "نشانی کوتاه‌مدت و بدون کلید برای پخش فایل.\n\nلینک پس از `expiresAt` منقضی می‌شود؛ آن را برای کاربر نهایی بسازید، نه ذخیره دائمی.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ضبط."
            },
            "description": "شناسهٔ ضبط.",
            "example": "33"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "url": "/api/v1/public/voip-recordings/tok_abc",
                  "expiresAt": "2026-10-30T10:30:00.000Z"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ضبط پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/recordings/{id}/transcribe": {
      "post": {
        "operationId": "voipRecTranscribe",
        "tags": [
          "voip-records"
        ],
        "summary": "رونویسی ضبط",
        "description": "ضبط را به متن تبدیل می‌کند.\n\nهزینه از اعتبار هوش مصنوعی کسر می‌شود. سقف ۲۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ ضبط."
            },
            "description": "شناسهٔ ضبط.",
            "example": "33"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "33",
                  "transcript": "سلام، لطفاً با من تماس بگیرید."
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: ضبط پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/reports/summary": {
      "get": {
        "operationId": "voipRepSummary",
        "tags": [
          "voip-reports"
        ],
        "summary": "خلاصهٔ تماس‌ها",
        "description": "شمار و مدت تماس‌ها در بازه.\n\nتفکیک بر اساس جهت و وضعیت و جمع هزینه.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "آغاز بازه."
            },
            "description": "آغاز بازه.",
            "example": "2026-10-01T00:00:00Z"
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "پایان بازه."
            },
            "description": "پایان بازه.",
            "example": "2026-10-30T00:00:00Z"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "cost": "4200000",
                  "total": 540,
                  "failed": 40,
                  "missed": 90,
                  "answered": 410,
                  "totalSeconds": 61200
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voip/reports/calls": {
      "get": {
        "operationId": "voipRepCalls",
        "tags": [
          "voip-reports"
        ],
        "summary": "گزارش تماس‌ها",
        "description": "جزئیات هر تماس (CDR) با فیلتر.\n\nبرای صفحه‌بندی از `before` استفاده کنید.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "آغاز بازه."
            },
            "description": "آغاز بازه.",
            "example": "2026-10-01T00:00:00Z"
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "پایان بازه."
            },
            "description": "پایان بازه.",
            "example": "2026-10-30T00:00:00Z"
          },
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "`in`، `out` یا `int`."
            },
            "description": "`in`، `out` یا `int`."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "`ringing`، `answered`، `missed` یا `failed`."
            },
            "description": "`ringing`، `answered`، `missed` یا `failed`."
          },
          {
            "name": "cause",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "علت قطع."
            },
            "description": "علت قطع."
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "منطقه."
            },
            "description": "منطقه."
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "بخشی از شماره."
            },
            "description": "بخشی از شماره."
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "فقط شناسه‌های کوچک‌تر."
            },
            "description": "فقط شناسه‌های کوچک‌تر."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "120",
                    "to": "09121234567",
                    "from": "02112345678",
                    "price": "1240",
                    "status": "answered",
                    "direction": "out",
                    "startedAt": "2026-10-29T10:00:00.000Z",
                    "durationSec": 62
                  }
                ]
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voip/reports/calls.csv": {
      "get": {
        "operationId": "voipRepCsv",
        "tags": [
          "voip-reports"
        ],
        "summary": "خروجی CSV تماس‌ها",
        "description": "همان گزارش تماس‌ها به‌صورت فایل CSV.\n\nپاسخ `text/csv` و ضمیمه با نام `calls.csv` است. سقف ۱۰ درخواست در دقیقه.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "آغاز بازه."
            },
            "description": "آغاز بازه.",
            "example": "2026-10-01T00:00:00Z"
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "پایان بازه."
            },
            "description": "پایان بازه.",
            "example": "2026-10-30T00:00:00Z"
          },
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "`in`، `out` یا `int`."
            },
            "description": "`in`، `out` یا `int`."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "`ringing`، `answered`، `missed` یا `failed`."
            },
            "description": "`ringing`، `answered`، `missed` یا `failed`."
          },
          {
            "name": "cause",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "علت قطع."
            },
            "description": "علت قطع."
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "منطقه."
            },
            "description": "منطقه."
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "بخشی از شماره."
            },
            "description": "بخشی از شماره."
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/blocklist": {
      "get": {
        "operationId": "voipBlockList",
        "tags": [
          "voip-reports"
        ],
        "summary": "فهرست مسدودی",
        "description": "شماره‌هایی که تماسشان رد می‌شود.\n\nشامل مسدودی‌های حساب شما و مسدودی سراسری.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "9",
                    "number": "09120000000",
                    "reason": "مزاحم"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "voipBlockAdd",
        "tags": [
          "voip-reports"
        ],
        "summary": "مسدود کردن شماره",
        "description": "شماره را به فهرست مسدودی اضافه می‌کند.\n\nتماس ورودی از آن شماره رد می‌شود و از تماس خروجی به آن جلوگیری می‌شود.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "number": {
                    "type": "string",
                    "description": "شماره (۵ تا ۲۰ رقم)."
                  },
                  "reason": {
                    "type": "string",
                    "description": "دلیل (≤۱۲۰)."
                  }
                },
                "required": [
                  "number"
                ]
              },
              "example": {
                "number": "09120000000",
                "reason": "مزاحم"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "9",
                  "number": "09120000000"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voip/blocklist/{id}": {
      "delete": {
        "operationId": "voipBlockRemove",
        "tags": [
          "voip-reports"
        ],
        "summary": "رفع مسدودی",
        "description": "شماره را از فهرست مسدودی بیرون می‌آورد.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ مسدودی."
            },
            "description": "شناسهٔ مسدودی.",
            "example": "9"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: مورد پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/pricing": {
      "get": {
        "operationId": "voipPricingMine",
        "tags": [
          "voip-reports"
        ],
        "summary": "تعرفهٔ VoIP حساب من",
        "description": "طرح، قیمت ماهانهٔ سرور و وضعیت پرداخت VoIP شما.\n\nمبالغ ریال و رشته‌اند. برای نرخ هر دقیقه تماس از `GET /voip/price` استفاده کنید.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "plan": "standard",
                  "status": "active",
                  "paidUntil": "2026-11-30T00:00:00.000Z",
                  "monthlyFee": "1500000"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voip/flows": {
      "get": {
        "operationId": "voipFlowList",
        "tags": [
          "voip-flow"
        ],
        "summary": "بوم‌های مسیر تماس",
        "description": "بوم ذخیره‌شدهٔ هر شماره و وضعیت انتشارش.\n\nهر شماره حداکثر یک بوم دارد؛ پیش‌نویس و نسخهٔ منتشرشده جدا هستند.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "name": "مسیر فروش",
                    "numberId": "9",
                    "published": true,
                    "updatedAt": "2026-10-28T08:00:00.000Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voip/flows/{numberId}": {
      "get": {
        "operationId": "voipFlowGet",
        "tags": [
          "voip-flow"
        ],
        "summary": "بوم یک شماره",
        "description": "نمودار ذخیره‌شده و وضعیت.\n\nشامل `graph` پیش‌نویس.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "numberId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ شماره."
            },
            "description": "شناسهٔ شماره.",
            "example": "9"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "name": "مسیر فروش",
                  "graph": {
                    "edges": [],
                    "nodes": []
                  },
                  "numberId": "9",
                  "published": true
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: بوم پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "put": {
        "operationId": "voipFlowSave",
        "tags": [
          "voip-flow"
        ],
        "summary": "ذخیرهٔ پیش‌نویس بوم",
        "description": "نمودار را ذخیره می‌کند (منتشر نمی‌کند).\n\nاعتبارسنجی ساختاری انجام می‌شود و خطاها با شناسهٔ گره برمی‌گردند. سقف ۱۲۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "numberId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ شماره."
            },
            "description": "شناسهٔ شماره.",
            "example": "9"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "graph": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "نمودار بوم: `nodes` و `edges` (ساختار در راهنمای «بوم تماس»)."
                  },
                  "name": {
                    "type": "string",
                    "description": "نام (≤۸۰)."
                  },
                  "recordConsent": {
                    "type": "boolean",
                    "description": "تأیید اعلام ضبط (اگر گره ضبط دارد)."
                  }
                },
                "required": [
                  "graph"
                ]
              },
              "example": {
                "name": "مسیر فروش",
                "graph": {
                  "edges": [],
                  "nodes": []
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "saved": true,
                  "numberId": "9"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      },
      "delete": {
        "operationId": "voipFlowDelete",
        "tags": [
          "voip-flow"
        ],
        "summary": "حذف بوم",
        "description": "بوم و نسخهٔ منتشرشده را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "numberId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ شماره."
            },
            "description": "شناسهٔ شماره.",
            "example": "9"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: بوم پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/flows/{numberId}/publish": {
      "post": {
        "operationId": "voipFlowPublish",
        "tags": [
          "voip-flow"
        ],
        "summary": "انتشار بوم",
        "description": "نمودار را به مسیر زندهٔ شماره کامپایل می‌کند.\n\nاگر خطای اعتبارسنجی باشد منتشر نمی‌شود. سقف ۲۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "numberId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ شماره."
            },
            "description": "شناسهٔ شماره.",
            "example": "9"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recordConsent": {
                    "type": "boolean",
                    "description": "تأیید اعلام ضبط."
                  }
                },
                "required": []
              },
              "example": {
                "recordConsent": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "numberId": "9",
                  "published": true
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: بوم پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/flows/{numberId}/unpublish": {
      "post": {
        "operationId": "voipFlowUnpublish",
        "tags": [
          "voip-flow"
        ],
        "summary": "لغو انتشار",
        "description": "مسیر زنده را برمی‌دارد و پیش‌نویس می‌ماند.\n\nتماس‌های ورودی طبق تنظیم قبلی شماره پاسخ داده می‌شوند.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "numberId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ شماره."
            },
            "description": "شناسهٔ شماره.",
            "example": "9"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "numberId": "9",
                  "published": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: بوم پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/flows/{numberId}/import": {
      "post": {
        "operationId": "voipFlowImport",
        "tags": [
          "voip-flow"
        ],
        "summary": "درون‌ریزی مسیر موجود به بوم",
        "description": "مسیر فعلی شماره را به نمودار تبدیل می‌کند.\n\nبرای شروع ویرایش دیداری از تنظیمات قدیمی. سقف ۲۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "numberId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ شماره."
            },
            "description": "شناسهٔ شماره.",
            "example": "9"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "graph": {
                    "edges": [],
                    "nodes": []
                  },
                  "numberId": "9"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: شماره پیدا نشد یا متعلق به شما نیست."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/flows/{numberId}/simulate": {
      "post": {
        "operationId": "voipFlowSimulate",
        "tags": [
          "voip-flow"
        ],
        "summary": "شبیه‌سازی تماس روی بوم",
        "description": "مسیر یک تماس فرضی را روی نمودار دنبال می‌کند.\n\nبدون ایجاد تماس واقعی. `keys` کلیدهای فشرده‌شده، `unanswered` گره‌هایی که پاسخ نمی‌دهند و `at` زمان فرضی (برای شرط زمانی). سقف ۱۲۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "numberId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ شماره."
            },
            "description": "شناسهٔ شماره.",
            "example": "9"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "graph": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "نمودار آزمایشی؛ بدون آن، پیش‌نویس ذخیره‌شده."
                  },
                  "at": {
                    "type": "string",
                    "format": "date-time",
                    "description": "زمان فرضی."
                  },
                  "keys": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "کلیدهای فشرده‌شده به ترتیب."
                  },
                  "unanswered": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "شناسهٔ گره‌های بی‌پاسخ."
                  }
                },
                "required": []
              },
              "example": {
                "at": "2026-11-01T09:00:00Z",
                "keys": [
                  "1"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "steps": [
                    {
                      "node": "start"
                    },
                    {
                      "key": "1",
                      "node": "menu"
                    },
                    {
                      "node": "ring-group"
                    }
                  ],
                  "outcome": "answered"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/flows/check": {
      "post": {
        "operationId": "voipFlowCheck",
        "tags": [
          "voip-flow"
        ],
        "summary": "اعتبارسنجی نمودار",
        "description": "نمودار را بدون ذخیره بررسی می‌کند.\n\nخطاها و هشدارها با شناسهٔ گره. سقف ۱۲۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "graph": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "نمودار بوم: `nodes` و `edges` (ساختار در راهنمای «بوم تماس»)."
                  },
                  "numberId": {
                    "type": "string",
                    "description": "شماره (برای بررسی منابع آن)."
                  }
                },
                "required": [
                  "graph"
                ]
              },
              "example": {
                "graph": {
                  "edges": [],
                  "nodes": []
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "ok": true,
                  "errors": [],
                  "warnings": []
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/flows/layout": {
      "post": {
        "operationId": "voipFlowLayout",
        "tags": [
          "voip-flow"
        ],
        "summary": "چیدمان خودکار نمودار",
        "description": "مختصات گره‌ها را مرتب می‌کند.\n\nفقط موقعیت گره‌ها عوض می‌شود. سقف ۶۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "graph": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "نمودار بوم: `nodes` و `edges` (ساختار در راهنمای «بوم تماس»)."
                  }
                },
                "required": [
                  "graph"
                ]
              },
              "example": {
                "graph": {
                  "edges": [],
                  "nodes": []
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "graph": {
                    "edges": [],
                    "nodes": []
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/flows/ai/draft": {
      "post": {
        "operationId": "voipFlowAi",
        "tags": [
          "voip-flow"
        ],
        "summary": "پیش‌نویس هوشمند بوم",
        "description": "از روی توضیح فارسی یک نمودار پیشنهاد می‌دهد.\n\nمثلاً «ساعت اداری به پشتیبانی وصل شود، بعد از آن پیام صوتی». هزینه از اعتبار هوش مصنوعی؛ سقف ساعتی دارد.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "توضیح مسیر (۵ تا چند هزار نویسه)."
                  },
                  "graph": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "نمودار فعلی برای اصلاح."
                  }
                },
                "required": [
                  "prompt"
                ]
              },
              "example": {
                "prompt": "ساعت ۸ تا ۱۷ به پشتیبانی وصل شود، در غیر این صورت پیام صوتی"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "graph": {
                    "edges": [],
                    "nodes": []
                  },
                  "notes": []
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "402": {
            "description": "insufficient_balance: اعتبار کافی نیست."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/notify/secrets": {
      "get": {
        "operationId": "voipSecretList",
        "tags": [
          "voip-notify"
        ],
        "summary": "رمزهای امضای وب‌هوک",
        "description": "رمزهایی که با آن‌ها اعلان‌های وب‌هوک تماس امضا می‌شود.\n\nمقدار رمز برنمی‌گردد.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "3",
                    "name": "CRM",
                    "createdAt": "2026-10-01T08:00:00.000Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "voipSecretCreate",
        "tags": [
          "voip-notify"
        ],
        "summary": "ساخت رمز امضا",
        "description": "رمز جدید می‌سازد و فقط همین یک بار نمایش می‌دهد.\n\nاگر `value` ندهید خودکار ساخته می‌شود (۱۶ تا ۲۰۰ نویسه). سقف ۲۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "نام (≤۶۰)."
                  },
                  "value": {
                    "type": "string",
                    "description": "مقدار دلخواه."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "CRM"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "3",
                  "name": "CRM",
                  "value": "whsec_…"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/notify/secrets/{id}": {
      "delete": {
        "operationId": "voipSecretDelete",
        "tags": [
          "voip-notify"
        ],
        "summary": "حذف رمز امضا",
        "description": "رمز را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴). اعلان‌هایی که از آن استفاده می‌کردند دیگر امضا نمی‌شوند.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ رمز."
            },
            "description": "شناسهٔ رمز.",
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: رمز پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    },
    "/voip/notify/jobs": {
      "get": {
        "operationId": "voipNotifyJobs",
        "tags": [
          "voip-notify"
        ],
        "summary": "اعلان‌های اخیر",
        "description": "آخرین اعلان‌های ارسال‌شده (وب‌هوک، پیامک، ایمیل) برای تماس‌ها.\n\nهر اعلان یک کار ذخیره‌شده است (برای هر تماس و مرحله یک‌بار) که تا چند بار تلاش می‌شود. تماس هرگز منتظر آن نمی‌ماند.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "41",
                    "status": "sent",
                    "channel": "webhook",
                    "attempts": 1,
                    "createdAt": "2026-10-30T09:00:00.000Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      }
    },
    "/voip/dial-actions": {
      "get": {
        "operationId": "voipDaList",
        "tags": [
          "voip-notify"
        ],
        "summary": "کدهای شماره‌گیری",
        "description": "کدهایی که با شماره‌گیری روی سافت‌فون یک اعلان را فعال می‌کنند.\n\nمثلاً شماره‌گیری `*77` در حین تماس، وضعیت را به CRM می‌فرستد.\n\nدسترسی لازم (scope): `sms.read`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.read",
        "x-sandbox": false,
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": [
                  {
                    "id": "5",
                    "code": "*77",
                    "name": "اعلان به CRM",
                    "enabled": true
                  }
                ]
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          }
        }
      },
      "post": {
        "operationId": "voipDaCreate",
        "tags": [
          "voip-notify"
        ],
        "summary": "ساخت کد شماره‌گیری",
        "description": "کد و اعلان جدید.\n\nسقف ۲۰ در دقیقه.\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "کد شماره‌گیری (مثلاً `*77`)."
                  },
                  "name": {
                    "type": "string",
                    "description": "نام (≤۸۰)."
                  },
                  "notify": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "تعریف اعلان: کانال (`webhook`، `sms` یا `email`) و مقصد."
                  },
                  "enabled": {
                    "type": "boolean",
                    "description": "فعال (پیش‌فرض true)."
                  }
                },
                "required": [
                  "code",
                  "name",
                  "notify"
                ]
              },
              "example": {
                "code": "*77",
                "name": "اعلان به CRM",
                "notify": {
                  "url": "https://crm.example.com/hook",
                  "channel": "webhook",
                  "secretId": "3"
                },
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "id": "5",
                  "code": "*77"
                }
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "409": {
            "description": "conflict: این کد قبلاً تعریف شده است."
          },
          "429": {
            "description": "rate_limited: تعداد درخواست از سقف مجاز بیشتر شد؛ پس از زمان `Retry-After` دوباره تلاش کنید."
          }
        }
      }
    },
    "/voip/dial-actions/{id}": {
      "put": {
        "operationId": "voipDaUpdate",
        "tags": [
          "voip-notify"
        ],
        "summary": "ویرایش کد شماره‌گیری",
        "description": "تعریف را بازنویسی می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کد."
            },
            "description": "شناسهٔ کد.",
            "example": "5"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "کد شماره‌گیری (مثلاً `*77`)."
                  },
                  "name": {
                    "type": "string",
                    "description": "نام (≤۸۰)."
                  },
                  "notify": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "تعریف اعلان: کانال (`webhook`، `sms` یا `email`) و مقصد."
                  },
                  "enabled": {
                    "type": "boolean",
                    "description": "فعال (پیش‌فرض true)."
                  }
                },
                "required": [
                  "code",
                  "name",
                  "notify"
                ]
              },
              "example": {
                "code": "*77",
                "name": "اعلان به CRM",
                "notify": {
                  "url": "https://crm.example.com/hook",
                  "channel": "webhook",
                  "secretId": "3"
                },
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "400": {
            "description": "validation_error: ورودی نامعتبر است (جزئیات در پاسخ)."
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: کد پیدا نشد یا متعلق به شما نیست."
          }
        }
      },
      "delete": {
        "operationId": "voipDaDelete",
        "tags": [
          "voip-notify"
        ],
        "summary": "حذف کد شماره‌گیری",
        "description": "کد را حذف می‌کند.\n\nپاسخ بدون بدنه (۲۰۴).\n\nدسترسی لازم (scope): `sms.send`\n\nبا کلید آزمایشی (sandbox) در دسترس نیست.",
        "x-required-scope": "sms.send",
        "x-sandbox": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "شناسهٔ کد."
            },
            "description": "شناسهٔ کد.",
            "example": "5"
          }
        ],
        "responses": {
          "200": {
            "description": "موفق",
            "content": {
              "application/json": {
                "schema": {},
                "example": {}
              }
            }
          },
          "401": {
            "description": "unauthorized: کلید API نامعتبر یا منقضی است."
          },
          "403": {
            "description": "insufficient_scope: کلید API دامنهٔ دسترسی لازم را ندارد."
          },
          "404": {
            "description": "not_found: کد پیدا نشد یا متعلق به شما نیست."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "کلید دسترسی (irn_live_… یا irn_test_…). scopeهای موجود: ai.chat، ai.embed، ai.image، ai.moderate، ai.read، ai.stt، bot.read، bot.send، broker.read، broker.request، broker.write، email.manage، email.read، email.send، phonebook.read، phonebook.write، project.sms.read، project.sms.send، sms.read، sms.send، tts.say، verify.read، verify.send، video.create، video.read، wallet.read"
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ]
}