openapi: 3.0.3
info:
  title: API انتقال داخلی نوبیتکس
  version: "1.0.0"
  description: |
    با انتقال داخلی می‌توانید رمزارز را از کیف‌پول اسپات خود به کیف‌پول اسپات کاربر دیگری در نوبیتکس منتقل کنید. این انتقال خارج از شبکه بلاک‌چین انجام می‌شود.

    برای دریافت، ابتدا [دریافت انتقال داخلی](/internal_transfer/set-internal-transfer-settings) را فعال کنید و شناسه عمومی خود را به فرستنده بدهید.

    ### مراحل ارسال
    1. [فهرست ارزها و کارمزدها](/internal_transfer/list-internal-transfer-currencies) را ببینید.
    2. [درخواست انتقال](/internal_transfer/request-internal-transfer) را با شناسه عمومی گیرنده ثبت کنید و شناسه پیگیری را نگه دارید.
    3. برای انجام انتقال، آن را با کد شناسایی دوعاملی [تأیید کنید](/internal_transfer/confirm-internal-transfer). تا پیش از تأیید می‌توانید آن را [لغو کنید](/internal_transfer/cancel-internal-transfer).

    [بررسی مقصد](/internal_transfer/resolve-internal-transfer-target) اختیاری است. با آن می‌توانید پیش از ثبت، شناسه گیرنده را تأیید کنید، اما برای ثبت درخواست لازم نیست.

    کارمزد از مبلغ دریافتی گیرنده کم می‌شود. با شناسه پیگیری می‌توانید [وضعیت و جزئیات ارسال](/internal_transfer/get-internal-transfer-withdraw) یا [جزئیات دریافت](/internal_transfer/get-internal-transfer-deposit) را ببینید.

    برای استفاده از این APIها به توکن کاربر یا [کلید API با دسترسی لازم](/api_key/api-key-guide) نیاز دارید.

servers:
  - url: https://apiv2.nobitex.ir
  - url: https://testnetapiv2.nobitex.ir

tags:
  - name: انتقال داخلی
    description: انتقال آنی موجودی اسپات بین کاربران نوبیتکس

security:
  - TokenAuth: []
  - KeyAuth: []
    SignatureAuth: []
    TimestampAuth: []

paths:
  /users/wallets/internal-transfer-options:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    post:
      operationId: listInternalTransferCurrencies
      tags:
        - انتقال داخلی
      summary: فهرست ارزهای انتقال داخلی
      description: |
        پیش از ثبت انتقال، فهرست ارزهای قابل‌انتقال، حداقل و حداکثر مبلغ، کارمزد و تعداد رقم اعشار مجاز را از این API بگیرید. اگر انتقال داخلی برای شما در دسترس نباشد، فهرست خالی است.

        - محدودیت درخواست: ۳۰ بار در دقیقه
        - دسترسی لازم برای کلید API: `READ`
      responses:
        "200":
          description: فهرست ارزهای قابل انتقال برای این کاربر
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InternalTransferCurrenciesResponse"
              examples:
                success:
                  summary: ارز فعال
                  value:
                    status: ok
                    currencies:
                      btc:
                        min: "0.001"
                        max: "10"
                        fee: "0.0001"
                        max_decimals: 6
                unavailable:
                  summary: انتقال داخلی برای کاربر فعال نیست
                  value:
                    status: ok
                    currencies: {}
        "429":
          $ref: "#/components/responses/RateLimitExceeded"

  /users/wallets/internal-transfer-settings:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    post:
      operationId: setInternalTransferSettings
      tags:
        - انتقال داخلی
      summary: فعال‌سازی و تنظیم دریافت انتقال داخلی
      description: |
        برای دریافت انتقال داخلی یا تغییر تنظیم نمایش نام، این API را فراخوانی کنید. پاسخ، شناسه عمومی شما را برمی‌گرداند. می‌توانید این شناسه را با فرستنده به اشتراک بگذارید.

        هنگام تغییر تنظیمات، اگر می‌خواهید نمایش نام فعال بماند آن را دوباره بفرستید. گزینه ارسال‌نشده غیرفعال می‌شود.

        - محدودیت درخواست: ۱۰ بار در ساعت
        - دسترسی لازم برای کلید API: `DEPOSIT`
        - پذیرش توافق‌نامه اسپات الزامی است.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InternalTransferSettingsRequest"
            examples:
              show_name:
                summary: نمایش نام
                value:
                  show_full_name: true
              hide_name:
                summary: مخفی کردن نام
                value:
                  show_full_name: false
      responses:
        "200":
          description: تنظیم ذخیره شد، یا انتقال داخلی برای این حساب در دسترس نیست
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/InternalTransferSettingsResponse"
                  - $ref: "#/components/schemas/InternalTransferSettingsUnavailableResponse"
              examples:
                success:
                  summary: ذخیره موفق
                  value:
                    status: ok
                    internalTransferConfigs:
                      publicId: "0123456789"
                      showFullName: true
                feature_unavailable:
                  summary: انتقال داخلی برای کاربر فعال نیست
                  value:
                    status: failed
                    code: FeatureUnavailable
                    message: Feature is not available.
        "400":
          description: توافق‌نامه پذیرفته نشده، یا مقدار نامعتبر است
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InternalTransferSettingsErrorResponse"
              examples:
                disclaimer:
                  summary: توافق‌نامه اسپات پذیرفته نشده
                  value:
                    status: failed
                    code: UnAcceptedDisclaimerError
                    message: User does not accepted a disclaimer.
                invalid_bool:
                  summary: مقدار نامعتبر
                  value:
                    status: failed
                    code: ParseError
                    message: 'Invalid boolean value: "1"'
        "429":
          $ref: "#/components/responses/RateLimitExceeded"

  /v2/users/wallets/internal-transfer/resolve-target:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    post:
      operationId: resolveInternalTransferTarget
      tags:
        - انتقال داخلی
      summary: بررسی اختیاری مقصد انتقال داخلی
      description: |
        این API اختیاری است. با آن می‌توانید پیش از [ثبت درخواست](/internal_transfer/request-internal-transfer) شناسه عمومی گیرنده را بررسی کنید و، اگر نمایش نام فعال باشد، نام او را ببینید. فراخوانی آن برای ثبت درخواست لازم نیست و همان شناسه را می‌توانید مستقیم در ثبت درخواست بفرستید.

        اگر مقصد پیدا نشد یا امکان دریافت ندارد، پاسخ `404` با کد `TargetNotFound` برمی‌گردد. شناسه را بررسی کنید یا از گیرنده شناسه عمومی‌اش را بخواهید.

        - محدودیت درخواست: ۳۰ بار در ساعت
        - دسترسی لازم برای کلید API: `WITHDRAW`
        - پذیرش توافق‌نامه اسپات و دسترسی به انتقال داخلی و برداشت الزامی است.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ResolveInternalTransferTargetRequest"
            example:
              target_query: "0123456789"
      responses:
        "200":
          description: مقصد پیدا شد
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ResolveInternalTransferTargetResponse"
              examples:
                by_public_id:
                  summary: مقصد با شناسه عمومی
                  value:
                    status: ok
                    target:
                      name: Ali Ahmadi
                      publicId: "0123456789"
        "400":
          description: اطلاعات مقصد وارد نشده، قابلیت در دسترس نیست یا توافق‌نامه پذیرفته نشده است
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ResolveInternalTransferTargetBadRequestResponse"
              examples:
                missing_query:
                  summary: نبودن target_query
                  value:
                    status: failed
                    code: ParseError
                    message: target_query is required.
                feature_unavailable:
                  summary: انتقال داخلی برای فرستنده فعال نیست
                  value:
                    status: failed
                    code: FeatureUnavailable
                    message: Feature is not available.
        "404":
          description: مقصدی با این شناسه پیدا نشد یا امکان دریافت ندارد
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ResolveInternalTransferTargetNotFoundResponse"
              example:
                status: failed
                code: TargetNotFound
                message: No target found!.
        "429":
          $ref: "#/components/responses/RateLimitExceeded"

  /v2/users/wallets/internal-transfer/request:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    post:
      operationId: requestInternalTransfer
      tags:
        - انتقال داخلی
      summary: ثبت درخواست انتقال داخلی
      description: |
        برای شروع انتقال، ارز، مبلغ و شناسه عمومی گیرنده را بفرستید. شناسه پیگیری را برای [تأیید](/internal_transfer/confirm-internal-transfer) یا [لغو](/internal_transfer/cancel-internal-transfer) نگه دارید. ثبت درخواست موجودی را جابه‌جا نمی‌کند. [بررسی مقصد](/internal_transfer/resolve-internal-transfer-target) پیش از این مرحله اختیاری است.

        ثبت درخواست این شرایط را به ترتیب بررسی می‌کند:

        1. کیف‌پول اسپات این ارز وجود داشته باشد.
        2. ورود با دستگاه جدید تا حدود یک ساعت برداشت را محدود می‌کند.
        3. ارز در [فهرست ارزها](/internal_transfer/list-internal-transfer-currencies) باشد.
        4. مبلغ مثبت باشد و موجودی کیف‌پول اسپات برای آن کافی باشد.
        5. سقف و محدودیت برداشت حساب برقرار باشد. سقف برداشت را در [محدودیت‌های کاربر](/user_data/دریافت-محدودیت-های-کاربر) ببینید.
        6. شناسایی دوعاملی فعال باشد. کد آن در مرحله تأیید لازم است.
        7. مبلغ از حداقل و کارمزد کمتر نباشد، از سقف همان ارز بیشتر نباشد و تعداد رقم اعشار مجاز را رعایت کند.

        - محدودیت درخواست: ۳۰ بار در ساعت
        - دسترسی لازم برای کلید API: `WITHDRAW`
        - پذیرش توافق‌نامه اسپات الزامی است.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RequestInternalTransferBody"
            examples:
              with_description:
                summary: انتقال بیت‌کوین با توضیح
                value:
                  currency: btc
                  amount: "0.01"
                  target_query: "0123456789"
                  description: invoice 42
              without_description:
                summary: انتقال بدون توضیح
                value:
                  currency: btc
                  amount: "0.01"
                  target_query: "0123456789"
      responses:
        "200":
          description: درخواست ثبت شد و منتظر تأیید است
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RequestInternalTransferResponse"
              example:
                status: ok
                trackingId: a1b2c3d4
                target:
                  name: Ali Ahmadi
                  publicId: "0123456789"
                createdAt: "2026-11-21T12:00:00+03:30"
                description: invoice 42
        "400":
          description: ورودی نامعتبر است یا شرایط برداشت برقرار نیست
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RequestInternalTransferBadRequestResponse"
              examples:
                missing_amount:
                  summary: مبلغ ارسال نشده یا نامعتبر است
                  value:
                    status: failed
                    code: ParseError
                    message: amount is required.
                amount_too_low:
                  summary: مبلغ از حداقل یا کارمزد کمتر است
                  value:
                    status: failed
                    code: AmountTooLow
                    message: msgAmountTooLow
                insufficient_balance:
                  summary: موجودی کافی نیست
                  value:
                    status: failed
                    code: InsufficientBalance
                    message: Insufficient Balance
        "404":
          description: کیف‌پول اسپات این ارز وجود ندارد، یا مقصد پیدا نشد
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RequestInternalTransferNotFoundResponse"
              examples:
                wallet_not_found:
                  summary: کیف‌پول اسپات این ارز وجود ندارد
                  value:
                    status: failed
                    code: WalletNotFound
                    message: No spot wallet with this currency for your user
                target_not_found:
                  summary: مقصد پیدا نشد یا امکان دریافت ندارد
                  value:
                    status: failed
                    code: TargetNotFound
                    message: No target found!.
        "429":
          $ref: "#/components/responses/RateLimitExceeded"

  /v2/users/wallets/internal-transfer/confirm:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    post:
      operationId: confirmInternalTransfer
      tags:
        - انتقال داخلی
      summary: تأیید انتقال داخلی
      description: |
        برای انجام انتقال، شناسه پیگیری را در بدنه درخواست و کد معتبر شناسایی دوعاملی را در هدر `X-TOTP` بفرستید. پس از تأیید، مبلغ از موجودی شما کم می‌شود و گیرنده مبلغ پس از کسر کارمزد را دریافت می‌کند. فقط درخواست در انتظار تأیید (`new`) قابل تأیید است.

        اگر کد دوعاملی پذیرفته نشد (`Invalid2FA`)، دوباره با کد معتبر درخواست دهید. اگر مقصد دیگر امکان دریافت ندارد (`TargetNotFound`)، درخواست در انتظار تأیید می‌ماند و می‌توانید آن را لغو کنید. محدودیت‌های [ثبت درخواست](/internal_transfer/request-internal-transfer) در این مرحله هم اعمال می‌شوند.

        - محدودیت درخواست: ۳۰ بار در ساعت
        - دسترسی لازم برای کلید API: `WITHDRAW`
        - پذیرش توافق‌نامه اسپات الزامی است.
      parameters:
        - $ref: "#/components/parameters/InternalTransferTotp"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InternalTransferTrackingRequest"
            example:
              tracking_id: a1b2c3d4
      responses:
        "200":
          description: انتقال انجام شد
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InternalTransferStatusResponse"
              example:
                status: ok
        "400":
          description: درخواست قابل تأیید نیست یا کد دوعاملی نادرست است
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConfirmInternalTransferBadRequestResponse"
              examples:
                invalid_transfer:
                  summary: انتقال وجود ندارد یا قبلاً پردازش شده
                  value:
                    status: failed
                    code: InvalidTransfer
                    message: The internal_transfer does not exists or already processed.
                invalid_2fa:
                  summary: کد دوعاملی نادرست است
                  value:
                    status: failed
                    code: Invalid2FA
                    message: msgInvalid2FA
                insufficient_balance:
                  summary: موجودی کافی نیست
                  value:
                    status: failed
                    code: InsufficientBalance
                    message: Insufficient Balance
        "404":
          description: مقصد دیگر امکان دریافت این انتقال را ندارد
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConfirmInternalTransferNotFoundResponse"
              example:
                status: failed
                code: TargetNotFound
                message: No target found!.
        "500":
          description: انتقال انجام نشد
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConfirmInternalTransferServerErrorResponse"
              examples:
                wallet_creation_failed:
                  summary: آماده‌سازی دریافت انتقال ناموفق بود
                  value:
                    status: failed
                    code: WalletCreationFailed
                    message: Creating wallet for the target failed!
                deposit_creation_failed:
                  summary: واریز به گیرنده ناموفق بود
                  value:
                    status: failed
                    code: DepositCreationFailed
                    message: Creating deposit transaction failed!
        "429":
          $ref: "#/components/responses/RateLimitExceeded"

  /v2/users/wallets/internal-transfer/cancel:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    put:
      operationId: cancelInternalTransfer
      tags:
        - انتقال داخلی
      summary: لغو انتقال داخلی
      description: |
        اگر از ارسال منصرف شدید، شناسه پیگیری درخواست را بفرستید تا انتقال لغو شود. پس از لغو، موجودی جابه‌جا نمی‌شود. انتقال تأییدشده قابل لغو نیست و برای درخواست غیرقابل لغو ممکن است کد `InvalidTransfer` برگردد.

        - محدودیت درخواست: ۳۰ بار در ساعت
        - دسترسی لازم برای کلید API: `WITHDRAW`
        - پذیرش توافق‌نامه اسپات و دسترسی به انتقال داخلی و برداشت الزامی است.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InternalTransferTrackingRequest"
            example:
              tracking_id: a1b2c3d4
      responses:
        "200":
          description: انتقال لغو شد
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InternalTransferStatusResponse"
              example:
                status: ok
        "400":
          description: درخواست قابل لغو نیست
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CancelInternalTransferErrorResponse"
              examples:
                invalid_transfer:
                  summary: انتقال وجود ندارد یا دیگر قابل لغو نیست
                  value:
                    status: failed
                    code: InvalidTransfer
                    message: The internal_transfer does not exists or already processed.
                unsuccessful:
                  summary: لغو انجام نشد
                  value:
                    status: failed
                    code: UnsuccessfulCancellation
                    message: Cannot cancel the request.
                feature_unavailable:
                  summary: انتقال داخلی برای فرستنده فعال نیست
                  value:
                    status: failed
                    code: FeatureUnavailable
                    message: Feature is not available.
        "429":
          $ref: "#/components/responses/RateLimitExceeded"

  /v2/users/wallets/internal-transfer/withdraws/{tracking_id}:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
      - $ref: "#/components/parameters/InternalTransferTrackingId"
    get:
      operationId: getInternalTransferWithdraw
      tags:
        - انتقال داخلی
      summary: جزئیات انتقال از دید فرستنده
      description: |
        اگر فرستنده هستید، با شناسه پیگیری مبلغ درخواستی و وضعیت انتقال را ببینید: در انتظار تأیید (`new`)، انجام‌شده (`done`) یا لغوشده (`canceled`). اگر انتقالی با این شناسه برای شما پیدا نشود، پاسخ `404` با کد `TransferNotFound` برمی‌گردد.

        - محدودیت درخواست: ۶۰ بار در دقیقه
        - دسترسی لازم برای کلید API: `READ`
        - انتقال داخلی و برداشت باید برای شما در دسترس باشند.
      responses:
        "200":
          description: جزئیات انتقال
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InternalTransferWithdrawDetailResponse"
              examples:
                done:
                  summary: انتقال انجام‌شده
                  value:
                    status: ok
                    transfer:
                      trackingId: a1b2c3d4
                      status: done
                      currency: btc
                      amount: "0.003"
                      amountInRial: "3000000"
                      target:
                        name: Ali Ahmadi
                        publicId: "0123456789"
                        depositEnabled: true
                      createdAt: "2026-11-21T12:00:00+03:30"
                      confirmedAt: "2026-11-21T12:01:00+03:30"
                      canceledAt: null
                      description: invoice 42
                pending:
                  summary: انتقال در انتظار تأیید
                  value:
                    status: ok
                    transfer:
                      trackingId: a1b2c3d4
                      status: new
                      currency: btc
                      amount: "0.003"
                      amountInRial: "3000000"
                      target:
                        name: null
                        publicId: "0123456789"
                        depositEnabled: false
                      createdAt: "2026-11-21T12:00:00+03:30"
                      confirmedAt: null
                      canceledAt: null
                      description: ""
        "400":
          description: انتقال داخلی برای کاربر فعال نیست
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InternalTransferLookupBadRequestResponse"
              example:
                status: failed
                code: FeatureUnavailable
                message: Feature is not available.
        "404":
          description: انتقالی با این شناسه برای این کاربر نیست
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InternalTransferLookupNotFoundResponse"
              example:
                status: failed
                code: TransferNotFound
                message: No internal transfer found for this tracking id.
        "429":
          $ref: "#/components/responses/RateLimitExceeded"

  /v2/users/wallets/internal-transfer/deposits/{tracking_id}:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
      - $ref: "#/components/parameters/InternalTransferTrackingId"
    get:
      operationId: getInternalTransferDeposit
      tags:
        - انتقال داخلی
      summary: جزئیات انتقال از دید گیرنده
      description: |
        اگر گیرنده هستید، پس از انجام انتقال با شناسه پیگیری جزئیات دریافت، از جمله مبلغ پس از کسر کارمزد و اطلاعات قابل نمایش فرستنده را ببینید. اگر انتقال هنوز انجام نشده یا با این شناسه برای شما پیدا نشود، پاسخ `404` با کد `TransferNotFound` برمی‌گردد.

        - محدودیت درخواست: ۶۰ بار در دقیقه
        - دسترسی لازم برای کلید API: `READ`
        - انتقال داخلی و واریز باید برای شما در دسترس باشند.
      responses:
        "200":
          description: جزئیات واریز داخلی
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InternalTransferDepositDetailResponse"
              example:
                status: ok
                transfer:
                  trackingId: a1b2c3d4
                  currency: btc
                  amount: "0.0029"
                  amountInRial: "3000000"
                  source:
                    name: Ali Ahmadi
                    publicId: "0123456789"
                  confirmedAt: "2026-11-21T12:01:00+03:30"
        "400":
          description: دریافت انتقال داخلی برای کاربر فعال نیست
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InternalTransferLookupBadRequestResponse"
              example:
                status: failed
                code: FeatureUnavailable
                message: Feature is not available.
        "404":
          description: واریز انجام‌شده‌ای با این شناسه برای این کاربر نیست
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InternalTransferLookupNotFoundResponse"
              example:
                status: failed
                code: TransferNotFound
                message: No internal transfer found for this tracking id.
        "429":
          $ref: "#/components/responses/RateLimitExceeded"

components:
  parameters:
    TraderBotUserAgent:
      name: User-Agent
      in: header
      required: false
      description: |
        برای شناسایی بات، این هدر را در همه درخواست‌های HTTP بات با الگوی
        `TraderBot/<name-and-version>` ارسال کنید. استفاده از این هدر برای بات‌ها توصیه می‌شود.
      schema:
        type: string
      example: TraderBot/MyBot-1.0.0

    InternalTransferTotp:
      name: X-TOTP
      in: header
      required: true
      description: کد شناسایی دوعاملی (`TOTP`) فرستنده.
      schema:
        type: string
        example: "123456"

    InternalTransferTrackingId:
      name: tracking_id
      in: path
      required: true
      description: |
        شناسه پیگیری انتقال که هنگام ثبت درخواست دریافت می‌کنید.
      schema:
        type: string
        example: a1b2c3d4

  securitySchemes:
    TokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: |
        توکن احراز هویت به فرمت `Token <token>`.
        مثال: `Authorization: Token abc123`
    KeyAuth:
      type: apiKey
      in: header
      name: Nobitex-Key
      description: کلید عمومی API Key.
    SignatureAuth:
      type: apiKey
      in: header
      name: Nobitex-Signature
      description: امضای درخواست. روش ساخت امضا در [راهنمای کلید API](/api_key/api-key-guide) آمده است.
    TimestampAuth:
      type: apiKey
      in: header
      name: Nobitex-Timestamp
      description: زمان ثبت درخواست طبق [راهنمای کلید API](/api_key/api-key-guide).

  responses:
    RateLimitExceeded:
      description: تعداد درخواست از حد مجاز گذشته است
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/InternalTransferRateLimitResponse"
          example:
            status: failed
            code: TooManyRequests
            message: تعداد درخواست شما بیش از حد معمول تشخیص داده شده. لطفا کمی صبر نمایید.
            backOff: 60
            limit: 30

  schemas:
    InternalTransferFailedStatus:
      type: object
      description: |
        پاسخ خطا. برای نمایش به کاربر از `code` استفاده کنید. `message` فقط برای اشکال‌یابی است.
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum: [failed]
          example: failed
        message:
          type: string
          description: توضیح خام سرور برای اشکال‌یابی.
          example: Feature is not available.

    InternalTransferSettingsUnavailableResponse:
      allOf:
        - $ref: "#/components/schemas/InternalTransferFailedStatus"
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              description: |
                کد خطا در پاسخ `200`.

                | کد | توضیح |
                |---|---|
                | `FeatureUnavailable` | انتقال داخلی برای این حساب در دسترس نیست. با پشتیبانی ارتباط بگیرید. |
              example: FeatureUnavailable

    InternalTransferSettingsErrorResponse:
      allOf:
        - $ref: "#/components/schemas/InternalTransferFailedStatus"
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              description: |
                کد خطای `400`. هر ردیف معنی کد و کار لازم را می‌گوید.

                | کد | توضیح |
                |---|---|
                | `ParseError` | مقدار نامعتبر است. `show_full_name` را `true` یا `false` بفرستید. |
                | `UnAcceptedDisclaimerError` | توافق‌نامه اسپات پذیرفته نشده. آن را بپذیرید و دوباره درخواست دهید. |
              example: ParseError

    ResolveInternalTransferTargetBadRequestResponse:
      allOf:
        - $ref: "#/components/schemas/InternalTransferFailedStatus"
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              description: |
                کد خطای `400`. هر ردیف معنی کد و کار لازم را می‌گوید.

                | کد | توضیح |
                |---|---|
                | `ParseError` | شناسه مقصد نیست یا نامعتبر است. `target_query` را بفرستید. |
                | `FeatureUnavailable` | انتقال داخلی برای این حساب در دسترس نیست. با پشتیبانی ارتباط بگیرید. |
                | `UnAcceptedDisclaimerError` | توافق‌نامه اسپات پذیرفته نشده. آن را بپذیرید و دوباره درخواست دهید. |
              example: ParseError

    ResolveInternalTransferTargetNotFoundResponse:
      allOf:
        - $ref: "#/components/schemas/InternalTransferFailedStatus"
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              description: |
                کد خطای `404`.

                | کد | توضیح |
                |---|---|
                | `TargetNotFound` | مقصد پیدا نشد یا نمی‌تواند انتقال بگیرد. شناسه را بررسی کنید. |
              example: TargetNotFound

    RequestInternalTransferBadRequestResponse:
      allOf:
        - $ref: "#/components/schemas/InternalTransferFailedStatus"
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              description: |
                کد خطای `400`. هر ردیف معنی کد و کار لازم را می‌گوید.

                | کد | توضیح |
                |---|---|
                | `ParseError` | فرمت amount وارد شده نادرست است. |
                | `TargetQueryRequired` | شناسه مقصد در ثبت درخواست نیست. `target_query` را بفرستید. |
                | `FeatureUnavailable` | انتقال داخلی برای این حساب در دسترس نیست. با پشتیبانی ارتباط بگیرید. |
                | `UnAcceptedDisclaimerError` | توافق‌نامه اسپات پذیرفته نشده. آن را بپذیرید و دوباره درخواست دهید. |
                | `PleaseEnable2FA` | شناسایی دوعاملی فعال نیست. آن را فعال کنید. |
                | `InvalidAmount` | رقم اعشار مبلغ بیش از حد مجاز است. رقم اعشار را کم کنید. |
                | `AmountTooLow` | مبلغ از حداقل یا کارمزد کمتر است. مبلغ را بیشتر کنید. |
                | `AmountTooHigh` | مبلغ از سقف همان ارز بیشتر است. مبلغ را کم کنید. |
                | `InvalidCurrency` | این ارز پشتیبانی نمی‌شود. آن را از فهرست ارزها انتخاب کنید. |
                | `TargetNotSupportCurrency` | مقصد این ارز را نمی‌پذیرد. ارز دیگری بفرستید. |
                | `InsufficientBalance` | موجودی اسپات کافی نیست. موجودی را زیاد یا مبلغ را کم کنید. |
                | `WithdrawAmountLimitation` | مبلغ از سقف برداشت حساب بیشتر است. سقف را در [محدودیت‌های کاربر](/user_data/دریافت-محدودیت-های-کاربر) ببینید. |
                | `WithdrawLimitReached` | درخواست‌های باز برداشت به سقف رسیده. آن‌ها را تکمیل یا لغو کنید. |
                | `WithdrawUnavailable` | برداشت این حساب محدود است. دلیل را در [محدودیت‌های حساب](/user_data/get-user-restrictions) ببینید. |
                | `WithdrawUnavailableNewDevice` | ورود با دستگاه جدید برداشت را محدود کرده است. یک ساعت صبر کنید. |
              example: AmountTooLow

    RequestInternalTransferNotFoundResponse:
      allOf:
        - $ref: "#/components/schemas/InternalTransferFailedStatus"
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              description: |
                کد خطای `404`.

                | کد | توضیح |
                |---|---|
                | `WalletNotFound` | کیف‌پول اسپات این ارز پیدا نشد. ابتدا در این ارز موجودی داشته باشید. |
                | `TargetNotFound` | مقصد پیدا نشد یا نمی‌تواند انتقال بگیرد. شناسه را بررسی کنید. |
              example: WalletNotFound

    ConfirmInternalTransferBadRequestResponse:
      allOf:
        - $ref: "#/components/schemas/InternalTransferFailedStatus"
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              description: |
                کد خطای `400`. هر ردیف معنی کد و کار لازم را می‌گوید.

                | کد | توضیح |
                |---|---|
                | `TrackingIdRequired` | شناسه پیگیری ارسال نشده یا نامعتبر است. `tracking_id` ثبت درخواست را بفرستید. |
                | `InvalidTransfer` | انتقال پیدا نشد یا دیگر `new` نیست. فقط درخواست در انتظار تأیید قابل تأیید است. |
                | `FeatureUnavailable` | انتقال داخلی برای این حساب در دسترس نیست. با پشتیبانی ارتباط بگیرید. |
                | `UnAcceptedDisclaimerError` | توافق‌نامه اسپات پذیرفته نشده. آن را بپذیرید و دوباره درخواست دهید. |
                | `PleaseEnable2FA` | شناسایی دوعاملی فعال نیست. آن را فعال کنید. |
                | `Invalid2FA` | کد هدر `X-TOTP` ارسال نشده یا نادرست است. با کد معتبر تأیید کنید. |
                | `InvalidCurrency` | این ارز پشتیبانی نمی‌شود. آن را از فهرست ارزها انتخاب کنید. |
                | `TargetNotSupportCurrency` | مقصد این ارز را نمی‌پذیرد. ارز دیگری بفرستید. |
                | `InsufficientBalance` | موجودی اسپات کافی نیست. موجودی را زیاد یا مبلغ را کم کنید. |
                | `WithdrawAmountLimitation` | مبلغ از سقف برداشت حساب بیشتر است. سقف را در [محدودیت‌های کاربر](/user_data/دریافت-محدودیت-های-کاربر) ببینید. |
                | `WithdrawLimitReached` | درخواست‌های باز برداشت به سقف رسیده. آن‌ها را تکمیل یا لغو کنید. |
                | `WithdrawUnavailable` | برداشت این حساب محدود است. دلیل را در [محدودیت‌های حساب](/user_data/get-user-restrictions) ببینید. |
                | `WithdrawUnavailableNewDevice` | ورود با دستگاه جدید برداشت را محدود کرده. یک ساعت صبر کنید. |
              example: Invalid2FA

    ConfirmInternalTransferNotFoundResponse:
      allOf:
        - $ref: "#/components/schemas/InternalTransferFailedStatus"
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              description: |
                کد خطای `404`.

                | کد | توضیح |
                |---|---|
                | `TargetNotFound` | مقصد دیگر نمی‌تواند این انتقال را بگیرد. درخواست در انتظار تأیید می‌ماند و می‌توانید آن را لغو کنید. |
              example: TargetNotFound

    ConfirmInternalTransferServerErrorResponse:
      allOf:
        - $ref: "#/components/schemas/InternalTransferFailedStatus"
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              description: |
                کد خطای `500`.

                | کد | توضیح |
                |---|---|
                | `WalletCreationFailed` | آماده‌سازی دریافت ناموفق بود. کمی بعد دوباره تأیید کنید. |
                | `DepositCreationFailed` | واریز به گیرنده ناموفق بود. کمی بعد دوباره تأیید کنید. |
              example: DepositCreationFailed

    CancelInternalTransferErrorResponse:
      allOf:
        - $ref: "#/components/schemas/InternalTransferFailedStatus"
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              description: |
                کد خطا. هر ردیف معنی کد و کار لازم را می‌گوید.

                | کد | توضیح |
                |---|---|
                | `TrackingIdRequired` | شناسه پیگیری ارسال نشده یا نامعتبر است. `tracking_id` ثبت درخواست را بفرستید. |
                | `InvalidTransfer` | انتقال پیدا نشد یا دیگر `new` نیست. فقط درخواست در انتظار تأیید قابل لغو است. |
                | `UnsuccessfulCancellation` | لغو انجام نشد. وضعیت را ببینید و دوباره تلاش کنید. |
                | `FeatureUnavailable` | انتقال داخلی برای این حساب در دسترس نیست. با پشتیبانی ارتباط بگیرید. |
                | `UnAcceptedDisclaimerError` | توافق‌نامه اسپات پذیرفته نشده. آن را بپذیرید و دوباره درخواست دهید. |
              example: InvalidTransfer

    InternalTransferLookupBadRequestResponse:
      allOf:
        - $ref: "#/components/schemas/InternalTransferFailedStatus"
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              description: |
                کد خطای `400`.

                | کد | توضیح |
                |---|---|
                | `FeatureUnavailable` | انتقال داخلی برای این حساب در دسترس نیست. با پشتیبانی ارتباط بگیرید. |
              example: FeatureUnavailable

    InternalTransferLookupNotFoundResponse:
      allOf:
        - $ref: "#/components/schemas/InternalTransferFailedStatus"
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              description: |
                کد خطای `404`.

                | کد | توضیح |
                |---|---|
                | `TransferNotFound` | این شناسه برای شما نیست. شناسه پیگیری را بررسی کنید. |
              example: TransferNotFound

    InternalTransferRateLimitResponse:
      type: object
      required:
        - status
        - code
        - message
      properties:
        status:
          type: string
          enum: [failed]
          example: failed
        code:
          type: string
          enum: [TooManyRequests]
          description: تعداد درخواست از حد مجاز گذشته است. به اندازه `backOff` صبر کنید و دوباره تلاش کنید.
          example: TooManyRequests
        message:
          type: string
          example: تعداد درخواست شما بیش از حد معمول تشخیص داده شده. لطفا کمی صبر نمایید.
        backOff:
          type: integer
          description: مدت انتظار پیشنهادی، به ثانیه
          example: 60
        limit:
          type: integer
          nullable: true
          description: حداکثر تعداد درخواست مجاز در بازه اعلام‌شده
          example: 30

    InternalTransferStatusResponse:
      type: object
      required:
        - status
      properties:
        status:
          type: string
          enum: [ok]
          example: ok

    InternalTransferCurrencyConfig:
      type: object
      required:
        - min
        - max
        - fee
        - max_decimals
      properties:
        min:
          type: string
          description: حداقل مبلغ تنظیم‌شده برای این ارز
          example: "0.001"
        max:
          type: string
          nullable: true
          description: حداکثر مبلغ. `null` یعنی سقفی تعریف نشده است.
          example: "10"
        fee:
          type: string
          description: |
            کارمزد انتقال به واحد خودِ ارز. از مبلغی که گیرنده دریافت می‌کند کم می‌شود.
          example: "0.0001"
        max_decimals:
          type: integer
          description: بیشترین تعداد رقم اعشار مجاز برای مبلغ
          example: 6

    InternalTransferCurrenciesResponse:
      type: object
      required:
        - status
        - currencies
      properties:
        status:
          type: string
          enum: [ok]
          example: ok
        currencies:
          type: object
          description: |
            فهرست ارزهای قابل‌انتقال و شرایط هر ارز. اگر امکان انتقال ندارید، فهرست خالی است.
          additionalProperties:
            $ref: "#/components/schemas/InternalTransferCurrencyConfig"
          example:
            btc:
              min: "0.001"
              max: "10"
              fee: "0.0001"
              max_decimals: 6

    InternalTransferSettingsRequest:
      type: object
      properties:
        show_full_name:
          type: boolean
          description: اجازه نمایش نام کامل به فرستنده. گزینه ارسال‌نشده غیرفعال می‌شود.
          example: true

    InternalTransferSettings:
      type: object
      required:
        - publicId
        - showFullName
      properties:
        publicId:
          type: string
          description: |
            شناسه عمومی ۱۰ رقمی کاربر برای دریافت انتقال داخلی.
            فرستنده همین مقدار را در [ثبت درخواست](/internal_transfer/request-internal-transfer) می‌فرستد.
          example: "0123456789"
        showFullName:
          type: boolean
          description: آیا نام کامل این کاربر به فرستنده نشان داده می‌شود
          example: true

    InternalTransferSettingsResponse:
      type: object
      required:
        - status
        - internalTransferConfigs
      properties:
        status:
          type: string
          enum: [ok]
          example: ok
        internalTransferConfigs:
          $ref: "#/components/schemas/InternalTransferSettings"

    InternalTransferTarget:
      type: object
      required:
        - name
        - publicId
      properties:
        name:
          type: string
          nullable: true
          description: |
            نام کامل کاربر، در صورت فعال بودن نمایش نام.
          example: Ali Ahmadi
        publicId:
          type: string
          nullable: true
          description: |
            شناسه عمومی ۱۰ رقمی. مقدار خود کاربر از [فعال‌سازی دریافت](/internal_transfer/set-internal-transfer-settings) به دست می‌آید.
          example: "0123456789"

    ResolveInternalTransferTargetRequest:
      type: object
      required:
        - target_query
      properties:
        target_query:
          type: string
          description: |
            شناسه عمومی مقصد.
            این شناسه از [فعال‌سازی دریافت](/internal_transfer/set-internal-transfer-settings) خود گیرنده به دست می‌آید.
          example: "0123456789"

    ResolveInternalTransferTargetResponse:
      type: object
      required:
        - status
        - target
      properties:
        status:
          type: string
          enum: [ok]
          example: ok
        target:
          $ref: "#/components/schemas/InternalTransferTarget"

    RequestInternalTransferBody:
      type: object
      required:
        - currency
        - amount
        - target_query
      properties:
        currency:
          type: string
          description: |
            نماد ارز، همان کلید [فهرست ارزها](/internal_transfer/list-internal-transfer-currencies).
            نمونه `btc`
          example: btc
        amount:
          type: string
          description: مبلغ انتقال به واحد همان ارز. باید مثبت باشد و محدودیت‌های [فهرست ارزها](/internal_transfer/list-internal-transfer-currencies) را رعایت کند.
          example: "0.01"
        target_query:
          type: string
          description: |
            شناسه عمومی مقصد.
            این شناسه از [فعال‌سازی دریافت](/internal_transfer/set-internal-transfer-settings) خود گیرنده به دست می‌آید. در صورت تمایل می‌توانید آن را ابتدا با [بررسی مقصد](/internal_transfer/resolve-internal-transfer-target) تأیید کنید؛ این کار برای ثبت درخواست لازم نیست.
          example: "0123456789"
        description:
          type: string
          maxLength: 1000
          description: توضیح اختیاری فرستنده، حداکثر ۱۰۰۰ کاراکتر.
          example: invoice 42

    RequestInternalTransferResponse:
      type: object
      required:
        - status
        - trackingId
        - target
        - createdAt
        - description
      properties:
        status:
          type: string
          enum: [ok]
          example: ok
        trackingId:
          type: string
          description: |
            شناسه پیگیری هشت‌حرفی. برای [تأیید](/internal_transfer/confirm-internal-transfer)،
            [لغو](/internal_transfer/cancel-internal-transfer)،
            [جزئیات فرستنده](/internal_transfer/get-internal-transfer-withdraw) و
            [جزئیات گیرنده](/internal_transfer/get-internal-transfer-deposit) استفاده می‌شود.
          example: a1b2c3d4
        target:
          $ref: "#/components/schemas/InternalTransferTarget"
        createdAt:
          type: string
          format: date-time
          description: زمان ثبت درخواست
          example: "2026-11-21T12:00:00+03:30"
        description:
          type: string
          description: توضیحی که فرستنده هنگام ثبت وارد کرده است.
          example: invoice 42

    InternalTransferTrackingRequest:
      type: object
      required:
        - tracking_id
      properties:
        tracking_id:
          type: string
          description: |
            شناسه پیگیری دریافتی از [ثبت درخواست](/internal_transfer/request-internal-transfer).
            حروف بزرگ و کوچک پذیرفته می‌شود.
          example: a1b2c3d4

    InternalTransferTargetWithDepositStatus:
      allOf:
        - $ref: "#/components/schemas/InternalTransferTarget"
        - type: object
          required:
            - depositEnabled
          properties:
            depositEnabled:
              type: boolean
              description: آیا گیرنده در حال حاضر امکان دریافت انتقال داخلی دارد
              example: true

    InternalTransferWithdraw:
      type: object
      required:
        - trackingId
        - status
        - currency
        - amount
        - amountInRial
        - target
        - createdAt
        - confirmedAt
        - canceledAt
        - description
      properties:
        trackingId:
          type: string
          description: شناسه پیگیری انتقال
          example: a1b2c3d4
        status:
          type: string
          description: وضعیت انتقال
          enum: [new, done, canceled]
          example: done
        currency:
          type: string
          description: نماد ارز. فهرست نمادها را از [تنظیمات سیستم](/options/get-system-options) ببینید.
          example: btc
        amount:
          type: string
          description: مبلغ درخواستی، پیش از کسر کارمزد
          example: "0.003"
        amountInRial:
          type: string
          description: معادل ریالی مبلغ درخواستی در زمان ثبت
          example: "3000000"
        target:
          $ref: "#/components/schemas/InternalTransferTargetWithDepositStatus"
        createdAt:
          type: string
          format: date-time
          example: "2026-11-21T12:00:00+03:30"
        confirmedAt:
          type: string
          format: date-time
          nullable: true
          description: زمان تأیید. تا پیش از تأیید `null` است.
          example: "2026-11-21T12:01:00+03:30"
        canceledAt:
          type: string
          format: date-time
          nullable: true
          description: زمان لغو. اگر لغو نشده باشد `null` است.
          example: null
        description:
          type: string
          nullable: true
          description: توضیح ثبت‌شده توسط فرستنده
          example: invoice 42

    InternalTransferWithdrawDetailResponse:
      type: object
      required:
        - status
        - transfer
      properties:
        status:
          type: string
          enum: [ok]
          example: ok
        transfer:
          $ref: "#/components/schemas/InternalTransferWithdraw"

    InternalTransferDeposit:
      type: object
      required:
        - trackingId
        - currency
        - amount
        - amountInRial
        - source
        - confirmedAt
      properties:
        trackingId:
          type: string
          example: a1b2c3d4
        currency:
          type: string
          description: نماد ارز. فهرست نمادها را از [تنظیمات سیستم](/options/get-system-options) ببینید.
          example: btc
        amount:
          type: string
          description: مبلغ واریزشده به گیرنده، پس از کسر کارمزد
          example: "0.0029"
        amountInRial:
          type: string
          description: معادل ریالی مبلغ درخواستی فرستنده در زمان ثبت
          example: "3000000"
        source:
          $ref: "#/components/schemas/InternalTransferTarget"
        confirmedAt:
          type: string
          format: date-time
          nullable: true
          description: زمان تأیید انتقال
          example: "2026-11-21T12:01:00+03:30"

    InternalTransferDepositDetailResponse:
      type: object
      required:
        - status
        - transfer
      properties:
        status:
          type: string
          enum: [ok]
          example: ok
        transfer:
          $ref: "#/components/schemas/InternalTransferDeposit"
