CRADالمطوّرون
العربية

Change a customer phone

Move mapping after new phone proof

قبل الاستخدام الفعلي — افحص القدرات المنشورة والصلاحيات وجاهزية ربطك.

تحقّق من القدرات المنشورة وصلاحيات المفتاح وجاهزية النشاط في بيئتك. أمثلة HTTP مسجّلة من اختبارات معزولة؛ وصفها local-unreleased لا يعني أن API غير عامل ولا يُثبت جاهزية ربطك. في مسار العميل يُتحقق من الهاتف بقالب واتساب أعدّه النشاط؛ SMS غير مدعوم. التسجيل بواسطة مسؤول مخوّل عملية منفصلة دون رمز.

POST/v1/integration/customers/{customerId}/phone-change

Behavior

Moves this integration mapping to the profile for the newly verified phone. Historical appointments keep their original accepted identity; this operation does not move their ownership or grant access to them through the new phone.

Authentication

IntegrationCredential OR ManagementCredential

Credential rules

Use the same server-only wbm_ API key as business management, with explicitly approved integration scopes; legacy wbi_ integration-only keys remain supported. No Origin request header. GET /v1/integration returns the integration-scoped view of the same credential/site/integration. Customer phone proof is still required for self-service.

One server-only owner-issued wbm_ API key can carry both management and integration permissions. Additional permissions require an explicit owner-issued grant. GET /v1/management returns the management discovery view, which may be empty for a booking-only key. For credentials with appointments:read, this discovery view omits whatsapp-templates:read, whatsapp-templates:write, whatsapp-profile:read and whatsapp-profile:write to preserve calendar-client compatibility. Discover these grants through GET /v1/management/messaging-capabilities. Template/profile command authorization still uses the stored grants. Server-only owner-issued Management authority with explicit application permissions. Calling this API does not expand a credential's grants. contacts:read/write/block/sync/fields:read/fields:write are separate approvals for canonical business contacts; fields also require current typed owner grants. contacts:record remains contact recording/recovery only. These grants create no customer phone proof, booking authority, messaging consent or automatic synchronization. Hours/blocks retain their independent resource grants. booking-policy:read/write separately delegate whole-business booking settings, without schedule/provider grants; write requires read. They preserve existing appointments and create no duration-rewrite authority. Provider duration policy additionally requires explicit provider-booking-policy:read/write and exact current providerIds; booking-duration:rewrite is separately approved and does not itself grant policy read/write. Service catalogue requires explicit services:read/write, independent of provider/calendar/schedule resources; write requires read. These operations do not expand an existing credential's grants. Public presentation and reviewed service selection require explicit website-content:read/write; write requires read, independently from services:* and provider resources. Existing provider metadata/activity/assignment additionally requires providers:read/write and a nonempty explicit current providerIds grant; write requires read. This grants no provider creation, deletion, login, invitation or schedule authority. WhatsApp template/profile management requires separate whatsapp-templates:read, whatsapp-templates:write, whatsapp-profile:read and whatsapp-profile:write application scopes. Write requires its matching read scope. These grants require explicit owner approval; Meta OAuth permissions remain separate.

Required application permissions

customers:write

The newSessionToken must prove the new phone for the same site and integration. A server-supplied phone or account ID cannot replace that proof.

Request

Idempotency and recovery

Keep the original operation UUID, customer ID, original If-Match version and intended new phone. Replay still requires current proof. If newSessionToken expires, explicitly verify that same new phone again in this site/integration and replace only the proof token. A different target phone is a different command, not a retry. Historical appointments do not move with the mapping.

  • customerIdpath · stringRequired
    Format and constraints
    customerId schema
    {
      "type": "string",
      "format": "uuid"
    }
  • Idempotency-Keyheader · stringRequired

    Persist and reuse the original UUID with the same customerId, original If-Match version and verified new phone. A refreshed newSessionToken for that same phone is allowed and is required after the previous proof expires; a different new phone conflicts with the original operation.

    Format and constraints
    Idempotency-Key schema
    {
      "type": "string",
      "format": "uuid"
    }
  • If-Matchheader · stringRequired

    Exact strong quoted version returned by the relevant resource; never weak or *. Customer: "1". Schedule: "b1"/"b1:p2". Block: "v1".

    Format and constraints
    If-Match schema
    {
      "type": "string",
      "pattern": "^\"[1-9][0-9]*\"$"
    }

Request body · required

application/json

  • newSessionTokenstringRequired

    Current phone proof for the new phone at the same site and integration. Proof is checked even on replay. A fresh token proving that same phone can replace an expired token without changing the operation UUID or original If-Match version.

    pattern: "^wbs_[a-f0-9]{64}$"

  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "newSessionToken": {
      "type": "string",
      "pattern": "^wbs_[a-f0-9]{64}$",
      "description": "Current phone proof for the new phone at the same site and integration. Proof is checked even on replay. A fresh token proving that same phone can replace an expired token without changing the operation UUID or original If-Match version."
    }
  },
  "required": [
    "newSessionToken"
  ]
}

Successful responses

200 · CustomerResult

Accepted mapping projection and replay status. A replay may carry the historical accepted projection; GET the customer before a new edit. Historical appointments keep their original identity.

ETag · Strong quoted version of the returned customer projection. An exact replay may return the historical accepted projection; GET the customer before using a current version for another edit.
ETag schema
{
  "type": "string",
  "pattern": "^\"[1-9][0-9]*\"$"
}

application/json · CustomerResult

  • customerobject; allOf (unspecified)Required

    All of these schema rules apply together.

    View nested fields
    • customerIdstring · uuidRequired
    • externalCustomerIdanyOf (string | null)Required

      At least one of these variants must match.

      View nested fields
      • anyOf 1stringSchema branch
      • anyOf 2nullSchema branch
    • statusstringRequired

      Allowed values: ["active","detached"]

    • versionintegerRequired

      minimum: 1

    • displayNameanyOf (string | null)Optional

      At least one of these variants must match.

      View nested fields
      • anyOf 1stringSchema branch
      • anyOf 2nullSchema branch
    • languageanyOf (string | null)Optional

      At least one of these variants must match.

      View nested fields
      • anyOf 1stringSchema branch

        Allowed values: ["he","ar","en"]

      • anyOf 2nullSchema branch
    • phonestringOptional

      pattern: "^\\+[1-9][0-9]{7,14}$"

    • fieldSourcesobjectOptional
      View nested fields
      • additionalPropertiesobjectSchema rule
        View branch fields and rules
        • sourcestringRequired
        • versionintegerRequired
        • updated_atstring · date-timeRequired
        • additionalPropertiesno value allowedSchema rule
    • identityAssurancestringOptional

      owner_reviewed means an owner-approved administrative or historical contact record, never customer authentication or phone proof.

      Allowed values: ["customer_verified","owner_reviewed"]

    • displayNameUnavailableReasonstringOptional

      Present only when the active displayName is unavailable (null). Canonical CRAD text is preserved, not truncated or cleared. Do not echo null as a source-field deletion.

      Allowed values: ["not_set","blank","too_long","unsupported_characters"]

    • allOf 1unspecifiedSchema branch
      View branch fields and rules
      • ifunspecifiedSchema rule
        View branch fields and rules
        • displayNameUnavailableReasonunspecifiedCondition predicate

          Presence constraint in this rule; evaluate its enclosing condition or negation. The field’s type may be defined elsewhere.

      • thenobjectSchema rule
        View branch fields and rules
        • statusstringOptional in this branch

          Value: "active"

        • displayNamenullRequired in this branch
    • additionalPropertiesno value allowedSchema rule
  • replayedbooleanRequired
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "customer": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "customerId",
        "externalCustomerId",
        "status",
        "version"
      ],
      "properties": {
        "customerId": {
          "type": "string",
          "format": "uuid"
        },
        "externalCustomerId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "enum": [
            "active",
            "detached"
          ]
        },
        "version": {
          "type": "integer",
          "minimum": 1
        },
        "displayName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "language": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "he",
                "ar",
                "en"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "phone": {
          "type": "string",
          "pattern": "^\\+[1-9][0-9]{7,14}$"
        },
        "fieldSources": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "source": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              },
              "updated_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "source",
              "version",
              "updated_at"
            ]
          }
        },
        "identityAssurance": {
          "enum": [
            "customer_verified",
            "owner_reviewed"
          ],
          "description": "owner_reviewed means an owner-approved administrative or historical contact record, never customer authentication or phone proof."
        },
        "displayNameUnavailableReason": {
          "enum": [
            "not_set",
            "blank",
            "too_long",
            "unsupported_characters"
          ],
          "description": "Present only when the active displayName is unavailable (null). Canonical CRAD text is preserved, not truncated or cleared. Do not echo null as a source-field deletion."
        }
      },
      "allOf": [
        {
          "if": {
            "required": [
              "displayNameUnavailableReason"
            ]
          },
          "then": {
            "required": [
              "displayName"
            ],
            "properties": {
              "status": {
                "const": "active"
              },
              "displayName": {
                "type": "null"
              }
            }
          }
        }
      ]
    },
    "replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "customer",
    "replayed"
  ]
}

Errors and recovery

Input validation

  • 413REQUEST_TOO_LARGE

    The JSON request body exceeds 8,192 bytes.

  • 415JSON_REQUIRED

    Send Content-Type: application/json.

Error responses declared in the contract (10)

The preview contract shares generic error definitions across operations. This list is not an exhaustive list of runtime errors.

401 · Structured error.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
403 · Structured error.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
404 · Structured error.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
409 · Structured error.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
410 · Structured error.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
412 · Structured error.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
422 · Structured error.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
428 · Structured error.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
429 · Rate limit; honor Retry-After.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
503 · Outcome may be unknown. Keep operation key and reconcile.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}