> ## Documentation Index
> Fetch the complete documentation index at: https://docs.didit.me/llms.txt
> Use this file to discover all available pages before exploring further.

# التحقق من الهاتف: تحديث الدول ومسارات API

> ضبط مفاتيح الدول للرسائل القصيرة والاتصال الصوتي وواتساب والتحقق الصامت، وتحديث مسارات SMS لعدة دول بطلب واحد في Didit.

واجهة Phone API من Didit تُعدّل القنوات والمسار والهدف لعدة دول في طلب واحد. تنطبق مفاتيح التبديل `sms` و`voice` و`whatsapp` و`silent` على التسليم في الدولة بأكملها.

يتحقق Didit من كل إدخال في `closed_channels` عند الإرسال الأولي وعند كل خطوة احتياطية. يحظر الإدخالُ القناةَ الخاصةَ به عندما يطابق `signals.device_platform` منصةً مدرجة (`web` أو `ios` أو `android`). ويطابق كلٌّ من `ipados` و`tvos` القيمة `ios`.

أغفل `platforms` أو مرّر `[]` لحظر القناة لكل عملية إرسال. إدراج المنصات الثلاث كلها يحظر القناة أيضاً لكل عملية إرسال، بما في ذلك الإرسال الذي لا يتضمن `signals.device_platform`. تنطبق قائمة من منصة واحدة أو منصتين فقط عندما يطابق الإرسال إحداها. أرسل قائمة `closed_channels` فارغة لإزالة إغلاقات القنوات الخاصة بالدولة.

تُرجع الاستجابة الحقل `updated` فقط، وهو عدد إدخالات الدول في طلبك، بما فيها الإدخالات التي طابقت ما هو محفوظ مسبقاً. تُرجع [إعدادات الهاتف](https://docs.didit.me/ar/standalone-apis/phone-settings-retrieve.md) الإعدادات الافتراضية على مستوى تطبيقك، لا القنوات أو المسارات الخاصة بكل دولة. يُرجع رمز الدولة غير المعروف الخطأ `400 invalid_country`. وتُرجع القناة أو المنصة غير المدعومة في `closed_channels` الخطأ `400 invalid_setting`.

يحتاج مفتاح API المقيّد إلى صلاحية الكتابة على `applications`. ويتلقى المفتاح الذي لا يملك هذا النطاق الرمز `403`.


## OpenAPI

````yaml ar/openapi-25.json PATCH /v3/phone/countries/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: Identity verification API. Authenticate with x-api-key header.
servers:
  - url: https://verification.didit.me
security: []
tags:
  - name: Bank Data
    description: >-
      Bank Link, connections, accounts, balances, transactions, institutions and
      coverage. One-time reads of real banks are open to live applications.
      Ongoing access with real banks is not open yet for live applications: it
      is available for sandbox applications with the Didit Test Bank, and opens
      country by country. Nothing is charged in sandbox. A call made with an API
      key needs a key that can reach Bank data: a full-access key can, and a
      scoped key needs `bank-data` in its scopes (read for reads, write for
      operations that change something). A scoped key without it is refused, and
      the call answers `403 bank_data_access_denied`. The account check is the
      exception: it needs write access to sessions, or full access, and not the
      Bank data scope. Raw bank data (accounts, balances, transactions and the
      change feed) also refuses a request that carries no API key.


      Every refusal under `/v3/bank/` except the account check's has the same
      JSON body (`code`, `message`, `request_id`, `field`, `next_action`,
      `retry_after`). A path that is not an operation, an id that is not a UUID
      or an unknown sub-resource answers `404 not_found` for every method, and
      any unexpected error answers `500 internal_error` with a `request_id`.
      Where Bank data is not available, every operation answers the platform's
      standard `404`, exactly as an unknown route does.
paths:
  /v3/phone/countries/:
    patch:
      tags:
        - Phone
      summary: Switch countries and routes in bulk
      description: >-
        Update channel settings for multiple countries, the SMS route (`Route A`
        or `Route B`) and the routing objective (`price`, `balanced` or
        `conversion`). The `sms`, `voice`, `whatsapp` and `silent` switches
        apply to delivery for the whole country. Didit checks each
        `closed_channels` entry on the initial send and every fallback hop. The
        entry blocks its channel when `signals.device_platform` matches a listed
        platform (`web`, `ios`, or `android`). Both `ipados` and `tvos` match
        `ios`. Omit `platforms` or pass `[]` to block the channel for every
        send. Listing all three platforms also blocks the channel for every
        send, including a send that omits `signals.device_platform`. A list of
        one or two platforms applies only when the send matches one of them. A
        restricted API key needs write access to `applications`.
      operationId: patchPhoneCountries
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PhoneCountriesUpdateRequest'
            example:
              countries:
                - country: TJ
                  sms: false
                  objective: conversion
                  closed_channels:
                    - channel: sms
                      platforms:
                        - web
      responses:
        '200':
          description: >-
            The country settings were saved. `updated` counts the country
            entries in the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneCountriesUpdateResponse'
              example:
                updated: 1
        '400':
          description: >-
            An unknown country code returns `invalid_country`. An unsupported
            channel or platform in `closed_channels` returns `invalid_setting`.
        '401':
          description: The API key is invalid, revoked or expired.
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    type: string
              example:
                detail: Authentication credentials were not provided or are invalid.
        '403':
          description: The API key lacks write access to `applications`.
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    type: string
              example:
                detail: This API key has no write access to application settings.
        '429':
          $ref: '#/components/responses/RateLimitedWrite'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: |-
            curl -X PATCH 'https://verification.didit.me/v3/phone/countries/' \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{
                "countries": [
                  {
                    "country": "TJ",
                    "sms": false,
                    "objective": "conversion",
                    "closed_channels": [
                      {
                        "channel": "sms",
                        "platforms": [
                          "web"
                        ]
                      }
                    ]
                  }
                ]
              }'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        Optional retry-safety key you choose for one operation, up to 255
        characters (a UUID works). A request repeated with the same key,
        endpoint, query and body is answered with the first response, same
        status and same body, and runs and bills nothing a second time. The same
        key with another endpoint, query or body returns `409`
        `idempotency_key_reused`, and while the first request is still running,
        `409` `idempotency_key_in_progress` with `Retry-After`. A failed request
        (any `4xx` or `5xx`) is not stored, so you can send it again with the
        same key. Keys belong to your application, whether you call with an API
        key or an access token. See [Retries and
        idempotency](/integration/api-errors#retries-and-idempotency).
      schema:
        type: string
        minLength: 1
        maxLength: 255
  schemas:
    PhoneCountriesUpdateRequest:
      type: object
      properties:
        countries:
          type: array
          items:
            $ref: '#/components/schemas/PhoneCountryUpdate'
          description: The countries to change.
          minItems: 1
      description: Countries and routes to switch in bulk.
      required:
        - countries
      example:
        countries:
          - country: TJ
            sms: false
            objective: conversion
            closed_channels:
              - channel: sms
                platforms:
                  - web
    PhoneCountriesUpdateResponse:
      type: object
      required:
        - updated
      properties:
        updated:
          type: integer
          description: >-
            How many country entries the request carried, whether or not an
            entry changed a saved value.
          example: 1
      description: How many country entries the request carried.
    PhoneCountryUpdate:
      type: object
      properties:
        country:
          type: string
          description: ISO country code.
          example: TJ
        sms:
          type: boolean
          description: SMS on or off for the country.
          example: false
        voice:
          type: boolean
          description: Voice on or off.
        whatsapp:
          type: boolean
          description: WhatsApp on or off.
        silent:
          type: boolean
          description: Silent verification on or off.
        route:
          type: string
          description: Route A or Route B for SMS.
          enum:
            - Route A
            - Route B
        objective:
          type: string
          description: >-
            What routing optimises in the country: price, balanced (default) or
            conversion.
          enum:
            - price
            - balanced
            - conversion
          example: conversion
        closed_channels:
          type: array
          items:
            $ref: '#/components/schemas/PhoneCountryClosedChannel'
          description: >-
            Didit checks each `closed_channels` entry on the initial send and
            every fallback hop. The entry blocks its channel when
            `signals.device_platform` matches a listed platform (`web`, `ios`,
            or `android`). Both `ipados` and `tvos` match `ios`. Omit
            `platforms` or pass `[]` to block the channel for every send.
            Listing all three platforms also blocks the channel for every send,
            including a send that omits `signals.device_platform`. A list of one
            or two platforms applies only when the send matches one of them.
            Send an empty `closed_channels` list to remove the country's channel
            closures.
      required:
        - country
    RateLimitBudgetError:
      type: object
      description: >-
        Returned only for a rate-limit middleware budget refusal. Other 429
        errors, including idempotency conflicts and endpoint-specific caps, do
        not promise these metadata fields.
      required:
        - detail
        - reference
        - limit
        - remaining
        - reset
        - window_seconds
      properties:
        detail:
          type: string
          description: Existing human-readable budget refusal message.
        reference:
          type: string
          pattern: ^RL-[0-9a-f]{32}$
          description: >-
            Opaque support reference: RL- followed by 32 lowercase UUID
            hexadecimal characters.
        limit:
          type: integer
          description: Budget for the exceeded scope; equals X-RateLimit-Limit.
        remaining:
          type: integer
          minimum: 0
          description: Remaining budget, clamped to zero; equals X-RateLimit-Remaining.
        reset:
          type: integer
          format: int64
          description: Window reset time in Unix seconds; equals X-RateLimit-Reset.
        window_seconds:
          type: integer
          description: >-
            Fixed-window duration in seconds, not the remaining wait. Honor
            Retry-After before retrying.
      example:
        detail: >-
          Write request rate limit exceeded. You can make up to 300 requests per
          minute.
        reference: RL-00000000000040008000000000000001
        limit: 300
        remaining: 0
        reset: 1794358860
        window_seconds: 60
    PhoneCountryClosedChannel:
      type: object
      properties:
        channel:
          type: string
          description: Channel to block for this country.
          enum:
            - silent
            - sms
            - whatsapp
            - telegram
            - voice
            - rcs
            - viber
            - zalo
            - email
            - push
            - totp
            - passkey
          example: sms
        platforms:
          type: array
          items:
            type: string
            description: Device platform.
            enum:
              - web
              - ios
              - android
          description: >-
            Didit checks each `closed_channels` entry on the initial send and
            every fallback hop. The entry blocks its channel when
            `signals.device_platform` matches a listed platform (`web`, `ios`,
            or `android`). Both `ipados` and `tvos` match `ios`. Omit
            `platforms` or pass `[]` to block the channel for every send.
            Listing all three platforms also blocks the channel for every send,
            including a send that omits `signals.device_platform`. A list of one
            or two platforms applies only when the send matches one of them.
          example:
            - web
      required:
        - channel
  responses:
    RateLimitedWrite:
      description: >-
        The shared write limit of 300 requests per minute per API key was
        exceeded. Honor `Retry-After` before retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitBudgetError'
          example:
            detail: >-
              Write request rate limit exceeded. You can make up to 300 requests
              per minute.
            reference: RL-00000000000040008000000000000001
            limit: 300
            remaining: 0
            reset: 1794358860
            window_seconds: 60
      headers:
        Retry-After:
          $ref: '#/components/headers/BudgetRetryAfter'
        X-RateLimit-Scope:
          $ref: '#/components/headers/BudgetXRateLimitScope'
        X-RateLimit-Limit:
          $ref: '#/components/headers/BudgetXRateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/BudgetXRateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/BudgetXRateLimitReset'
  headers:
    BudgetRetryAfter:
      description: >-
        Seconds to wait, rounded up to the next window. Present on middleware
        budget refusals.
      schema:
        type: integer
    BudgetXRateLimitScope:
      description: >-
        The scope whose budget was exceeded. Present on middleware budget
        refusals.
      schema:
        type: string
    BudgetXRateLimitLimit:
      description: >-
        Budget for the exceeded scope; equals body limit. Present on middleware
        budget refusals.
      schema:
        type: integer
    BudgetXRateLimitRemaining:
      description: >-
        Remaining budget, clamped to zero; equals body remaining. Present on
        middleware budget refusals.
      schema:
        type: integer
    BudgetXRateLimitReset:
      description: >-
        Reset time in Unix seconds; equals body reset. Present on middleware
        budget refusals.
      schema:
        type: integer
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your application's API key, from Developers -> API keys in the Business
        Console. The primary key has full access. A named key can be scoped:
        none, read or write per resource, limited to some workflows or to
        approved sessions, to a list of IP addresses, and to an expiry date. 401
        means the key is wrong, revoked or expired; 403 means no key was sent,
        the key has no access to this resource or action, or the request came
        from an address outside its IP list; 404 on a session route means the
        session is outside the key's workflows or statuses. A key without media
        access receives image, video and PDF URLs as null, and a key without
        sessions write receives session links and tokens as null. See
        https://docs.didit.me/console/api-keys.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.