كل الموارد

الحساب

الحساب والأقسام والمستخدمون والأدوار وجهات الاتصال للرسائل، عبر واجهة REST.

عنوان الأساسhttps://api.ping.nml.sa/v110 عمليات

الانتقال إلى عملية

الأخطاء المشتركة

تُرجع عمليات هذه الصفحة هذه الأخطاء بصيغة واحدة، وتذكر كل عملية الأخطاء التي تُرجعها.

  • 400The request is invalid (code: invalid_request), with field errors.
  • 401The API key is missing, unknown, expired or revoked (code: unauthorized).
  • 403The API key lacks the scope this operation needs (code: forbidden).
  • 404No such resource in this account, or outside the key's data scope (code: not_found).
  • 409The resource is not in a state that allows this (code: conflict), or the idempotency key is in use.
  • 429The key's rate limit is reached (code: rate_limited). Retry after the Retry-After header's seconds.

قائمة جهات الاتصال للرسائل.

GET/v1/contacts

Phone numbers that receive WhatsApp and SMS messages, with language and WhatsApp opt-in.

النطاقaccounts:read

المعاملات

  • limitinteger الاستعلام

    Items per page, 1 to 200 (default 50).

  • cursorstring الاستعلام

    The next_cursor of the previous page.

الاستجابة 200

  • dataobject[]
    حقول data
    • idstring

      مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

    • phonestring

      Telephone number in E.164 (any country)

      مثال:+966551234567

    • user_idstring | null

      مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

    • languagestring

      أحد:aren

    • whatsapp_opt_inboolean

      مثال:true

    • created_atstring (date-time)

      مثال:2026-09-02T09:25:00Z

  • next_cursorstring | null

    مثال:eyJpZCI6InZlaF83S3EyIn0

الأخطاء

400401403404429

مثال الطلب
curl "https://api.ping.nml.sa/v1/contacts" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 200
{
  "data": [
    {
      "id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
      "phone": "+966551234567",
      "user_id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
      "language": "ar",
      "whatsapp_opt_in": true,
      "created_at": "2026-09-02T09:25:00Z"
    }
  ],
  "next_cursor": "eyJpZCI6InZlaF83S3EyIn0"
}

إنشاء جهة اتصال للرسائل أو تحديثها.

POST/v1/contacts

Keyed by phone number: an existing contact with the same number is updated and answers 200, a new one 201.

النطاقaccounts:write يقبل Idempotency-Key

المعاملات

  • Idempotency-Keystring الترويسة

    A unique key per create request. A retry with the same key within 24 hours returns the first result instead of creating again.

محتوى الطلب

  • phonestring مطلوب

    E.164, or a Saudi number as typed.

    مثال:0501234567

  • user_idstring | null

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • languagestring

    أحد:aren

الاستجابة 200

  • idstring

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • phonestring

    Telephone number in E.164 (any country)

    مثال:+966551234567

  • user_idstring | null

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • languagestring

    أحد:aren

  • whatsapp_opt_inboolean

    مثال:true

  • created_atstring (date-time)

    مثال:2026-09-02T09:25:00Z

الاستجابة 201

  • idstring

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • phonestring

    Telephone number in E.164 (any country)

    مثال:+966551234567

  • user_idstring | null

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • languagestring

    أحد:aren

  • whatsapp_opt_inboolean

    مثال:true

  • created_atstring (date-time)

    مثال:2026-09-02T09:25:00Z

الأخطاء

400401403404409429

مثال الطلب
curl -X POST "https://api.ping.nml.sa/v1/contacts" \
  -H "Authorization: Bearer $PING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone": "0501234567", "user_id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f"}'
مثال الاستجابة · 200
{
  "id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
  "phone": "+966551234567",
  "user_id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
  "language": "ar",
  "whatsapp_opt_in": true,
  "created_at": "2026-09-02T09:25:00Z"
}
مثال الاستجابة · 201
{
  "id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
  "phone": "+966551234567",
  "user_id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
  "language": "ar",
  "whatsapp_opt_in": true,
  "created_at": "2026-09-02T09:25:00Z"
}

حذف جهة اتصال للرسائل.

DELETE/v1/contacts/{contactId}

The number stops receiving the account's messages: the contact is removed and kept in the account's removed contacts with its opt-in and opt-out as they were (listRemovedContacts), and contact.changed is published with the opt-in withdrawn, so messaging records the number's opt-out. A user's verified phone is removed with its contact; the user verifies it again to be reached on WhatsApp.

النطاقaccounts:write يقبل Idempotency-Key

المعاملات

  • contactIdstring المسار مطلوب

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • Idempotency-Keystring الترويسة

    A unique key per create request. A retry with the same key within 24 hours returns the first result instead of creating again.

الاستجابة 200

  • idstring

    The contact's id as it was.

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • phonestring

    Telephone number in E.164 (any country)

    مثال:+966551234567

  • user_idstring | null

    مثال:null

  • languagestring

    أحد:aren

  • whatsapp_opt_inboolean

    Whether it had opted in when removed.

    مثال:true

  • opt_in_howstring | null

    أحد:whatsappformcallcontractnull

  • opt_in_atstring | null (date-time)

    مثال:2026-09-02T09:25:00Z

  • opt_out_atstring | null (date-time)

    مثال:null

  • created_atstring (date-time)

    مثال:2026-09-02T09:25:00Z

  • removed_atstring (date-time)

    مثال:2026-11-30T10:00:00Z

  • removed_bystring

    Who removed it, as the gateways name the caller: user:<id>, user:apikey/<id> or agent:<name>.

    مثال:user:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

الأخطاء

400401403404409429

مثال الطلب
curl -X DELETE "https://api.ping.nml.sa/v1/contacts/0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 200
{
  "id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
  "phone": "+966551234567",
  "user_id": null,
  "language": "ar",
  "whatsapp_opt_in": true,
  "opt_in_how": "form",
  "opt_in_at": "2026-09-02T09:25:00Z",
  "opt_out_at": null,
  "created_at": "2026-09-02T09:25:00Z",
  "removed_at": "2026-11-30T10:00:00Z",
  "removed_by": "user:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f"
}

بيانات الحساب.

GET/v1/customers/{customerId}

The account the API key belongs to. Any other customer id answers 404.

النطاقaccounts:read

المعاملات

  • customerIdstring المسار مطلوب

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

الاستجابة 200

  • idstring

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • name_arstring

    مثال:شركة النقل المتحدة

  • name_enstring

    مثال:United Transport Co.

  • cr_numberstring | null

    Commercial Registration number.

  • unified_numberstring | null

    The Unified National Number (700) replacing the CR number under the 2025 Commercial Register Law.

  • vat_numberstring | null
  • vat_statusstring | null

    From the ZATCA documents sent with the CR: a VAT certificate (registered), a registration notice (not subject), or only the general registration certificate (not registered for VAT); null when none was sent.

    أحد:registerednot_subjectnot_registerednull

  • tinstring | null

    ZATCA's distinctive number (TIN), from its document.

  • registrationobject | null

    The commercial registration the identity was filled from, as the Ministry of Commerce's registry answered for the certificate's QR.

  • statusstring

    مثال:active

  • expires_atstring | null (date)

    When the subscription ends unless renewed.

    مثال:2027-08-31

  • tga_licence_numberstring | null

    The Transport General Authority licence for transport activity.

    مثال:TGA-1043398

  • tga_licence_expires_onstring | null (date)

    مثال:2027-03-14

  • national_addressobject | null
  • operating_weekstring[]

    Sunday first: what each day of the week is.

    مثال:["full","full","full","full","full","closed","closed"]

  • operating_hoursobject

    The working hours of a full day, a short day and a day in Ramadan, Asia/Riyadh.

    حقول operating_hours
    • fullobject
      حقول full
      • fromstring

        مثال:08:00

      • tostring

        مثال:17:00

    • shortobject
      حقول short
      • fromstring

        مثال:08:00

      • tostring

        مثال:17:00

    • ramadanobject
      حقول ramadan
      • fromstring

        مثال:08:00

      • tostring

        مثال:17:00

  • created_atstring (date-time)

    مثال:2026-09-01T08:00:00Z

الأخطاء

400401403404429

مثال الطلب
curl "https://api.ping.nml.sa/v1/customers/0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 200
{
  "id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
  "name_ar": "شركة النقل المتحدة",
  "name_en": "United Transport Co.",
  "cr_number": "1010010000",
  "unified_number": "7001369813",
  "vat_number": "300000000000003",
  "vat_status": "registered",
  "tin": "3001234567",
  "registration": {
    "cr_number": "1010010000",
    "national_number": "7001369813",
    "status_id": 0,
    "status_ar": "string",
    "status_en": "string",
    "active": false,
    "entity_type_ar": "string",
    "entity_type_en": "string",
    "company_form_ar": "string",
    "company_form_en": "string",
    "name_ar": "string",
    "name_en": "string",
    "capital_sar": 0,
    "is_main": false,
    "main_cr_number": "1010010000",
    "main_national_number": "7001369813",
    "in_liquidation": false,
    "has_ecommerce": false,
    "issued_on": "string",
    "issued_on_hijri": "string",
    "confirm_on": "string",
    "confirm_on_hijri": "string",
    "modified_on": "string",
    "modified_on_hijri": "string",
    "deleted_on": "string",
    "owner": {
      "name_ar": "string",
      "name_en": "string",
      "id_type_en": "string",
      "id_number": "string"
    },
    "national_address": {
      "short_address": "RAGI2929",
      "building_number": "2929",
      "street_ar": "Rayhanah Bint Zaid",
      "street_en": "Rayhanah Bint Zaid",
      "district_ar": "Riyadh",
      "district_en": "Riyadh",
      "city_ar": "Riyadh",
      "city_en": "Riyadh",
      "postal_code": "13337",
      "additional_number": "8118"
    },
    "unit_number": "string",
    "contact": {
      "phone": "+966551234567",
      "mobile": "+966551234567",
      "email": "string",
      "website": "string"
    },
    "activities": [
      {
        "code": "string",
        "description_ar": "string",
        "description_en": "string"
      }
    ],
    "managers": [
      {
        "name_ar": "string",
        "name_en": "string",
        "manager_type_en": "string",
        "nationality_en": "string",
        "id_type_en": "string",
        "id_number": "string",
        "licensed": false
      }
    ],
    "read_at": "string"
  },
  "status": "active",
  "expires_at": "2027-08-31",
  "tga_licence_number": "TGA-1043398",
  "tga_licence_expires_on": "2027-03-14",
  "national_address": {
    "short_address": "RAGI2929",
    "building_number": "2929",
    "street_ar": "Rayhanah Bint Zaid",
    "street_en": "Rayhanah Bint Zaid",
    "district_ar": "Riyadh",
    "district_en": "Riyadh",
    "city_ar": "Riyadh",
    "city_en": "Riyadh",
    "postal_code": "13337",
    "additional_number": "8118"
  },
  "operating_week": [
    "full",
    "full",
    "full",
    "full",
    "full",
    "closed",
    "closed"
  ],
  "operating_hours": {
    "full": {
      "from": "08:00",
      "to": "17:00"
    },
    "short": {
      "from": "08:00",
      "to": "17:00"
    },
    "ramadan": {
      "from": "08:00",
      "to": "17:00"
    }
  },
  "created_at": "2026-09-01T08:00:00Z"
}

قائمة الأقسام.

GET/v1/departments

The account's departments, each with its parent, so the tree can be rebuilt. Ordered by creation.

النطاقaccounts:read

المعاملات

  • limitinteger الاستعلام

    Items per page, 1 to 200 (default 50).

  • cursorstring الاستعلام

    The next_cursor of the previous page.

الاستجابة 200

  • dataobject[]
    حقول data
    • idstring

      مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

    • namestring

      مثال:Riyadh distribution

    • parent_idstring | null

      The parent department; null at the top of the tree.

      مثال:null

    • cost_centrestring | null

      The code the department's costs are booked to.

      مثال:CC-410

    • created_atstring (date-time)

      مثال:2026-09-02T09:15:00Z

  • next_cursorstring | null

    مثال:eyJpZCI6InZlaF83S3EyIn0

الأخطاء

400401403404429

مثال الطلب
curl "https://api.ping.nml.sa/v1/departments" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 200
{
  "data": [
    {
      "id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
      "name": "Riyadh distribution",
      "parent_id": null,
      "cost_centre": "CC-410",
      "created_at": "2026-09-02T09:15:00Z"
    }
  ],
  "next_cursor": "eyJpZCI6InZlaF83S3EyIn0"
}

إنشاء قسم.

POST/v1/departments

A department at the top of the tree, or under parent_id.

النطاقaccounts:write يقبل Idempotency-Key

المعاملات

  • Idempotency-Keystring الترويسة

    A unique key per create request. A retry with the same key within 24 hours returns the first result instead of creating again.

محتوى الطلب

  • namestring مطلوب

    مثال:Riyadh distribution

  • parent_idstring | null

    مثال:null

الاستجابة 201

  • idstring

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • namestring

    مثال:Riyadh distribution

  • parent_idstring | null

    The parent department; null at the top of the tree.

    مثال:null

  • cost_centrestring | null

    The code the department's costs are booked to.

    مثال:CC-410

  • created_atstring (date-time)

    مثال:2026-09-02T09:15:00Z

الأخطاء

400401403404429

مثال الطلب
curl -X POST "https://api.ping.nml.sa/v1/departments" \
  -H "Authorization: Bearer $PING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Riyadh distribution", "parent_id": null}'
مثال الاستجابة · 201
{
  "id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
  "name": "Riyadh distribution",
  "parent_id": null,
  "cost_centre": "CC-410",
  "created_at": "2026-09-02T09:15:00Z"
}

قائمة جهات الاتصال المحذوفة.

GET/v1/removed-contacts

Contacts deleted from the account, newest first, each with its opt-in and opt-out as they stood when it was removed, and who removed it.

النطاقaccounts:read

المعاملات

  • limitinteger الاستعلام

    Items per page, 1 to 200 (default 50).

  • cursorstring الاستعلام

    The next_cursor of the previous page.

الاستجابة 200

  • dataobject[]
    حقول data
    • idstring

      The contact's id as it was.

      مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

    • phonestring

      Telephone number in E.164 (any country)

      مثال:+966551234567

    • user_idstring | null

      مثال:null

    • languagestring

      أحد:aren

    • whatsapp_opt_inboolean

      Whether it had opted in when removed.

      مثال:true

    • opt_in_howstring | null

      أحد:whatsappformcallcontractnull

    • opt_in_atstring | null (date-time)

      مثال:2026-09-02T09:25:00Z

    • opt_out_atstring | null (date-time)

      مثال:null

    • created_atstring (date-time)

      مثال:2026-09-02T09:25:00Z

    • removed_atstring (date-time)

      مثال:2026-11-30T10:00:00Z

    • removed_bystring

      Who removed it, as the gateways name the caller: user:<id>, user:apikey/<id> or agent:<name>.

      مثال:user:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • next_cursorstring | null

    مثال:eyJpZCI6InZlaF83S3EyIn0

الأخطاء

400401403429

مثال الطلب
curl "https://api.ping.nml.sa/v1/removed-contacts" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 200
{
  "data": [
    {
      "id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
      "phone": "+966551234567",
      "user_id": null,
      "language": "ar",
      "whatsapp_opt_in": true,
      "opt_in_how": "form",
      "opt_in_at": "2026-09-02T09:25:00Z",
      "opt_out_at": null,
      "created_at": "2026-09-02T09:25:00Z",
      "removed_at": "2026-11-30T10:00:00Z",
      "removed_by": "user:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f"
    }
  ],
  "next_cursor": "eyJpZCI6InZlaF83S3EyIn0"
}

قائمة المستخدمين.

GET/v1/users

The account's users with their role, data scope and language. Ordered by creation.

النطاقaccounts:read

المعاملات

  • limitinteger الاستعلام

    Items per page, 1 to 200 (default 50).

  • cursorstring الاستعلام

    The next_cursor of the previous page.

  • deactivatedboolean الاستعلام

    true: the deactivated users instead of the active ones.

الاستجابة 200

  • dataobject[]
    حقول data
    • idstring

      مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

    • namestring | null

      مثال:Fahad Al-Harbi

    • emailstring | null
    • phonestring | null

      E.164.

    • languagestring

      أحد:aren

    • rolestring

      أحد:ownermanagerviewerdriver

    • data_scopestring

      What the user sees: the whole account, a department and its sub-departments, one department, or a custom selection.

      أحد:customerdepartment_treedepartmentcustom

    • department_idstring | null

      مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

    • dutiesstring[]

      The work the user handles; scheduled reports send each duty's exceptions to its holders.

      مثال:["dispatch"]

    • created_atstring (date-time)

      مثال:2026-09-02T09:20:00Z

    • deactivated_atstring | null (date-time)

      When the user left the account; null while active.

      مثال:null

  • next_cursorstring | null

    مثال:eyJpZCI6InZlaF83S3EyIn0

الأخطاء

400401403404429

مثال الطلب
curl "https://api.ping.nml.sa/v1/users" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 200
{
  "data": [
    {
      "id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
      "name": "Fahad Al-Harbi",
      "email": "fahad@example.com",
      "phone": "+966551234567",
      "language": "ar",
      "role": "manager",
      "data_scope": "department_tree",
      "department_id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
      "duties": [
        "dispatch"
      ],
      "created_at": "2026-09-02T09:20:00Z",
      "deactivated_at": null
    }
  ],
  "next_cursor": "eyJpZCI6InZlaF83S3EyIn0"
}

دعوة مستخدم.

POST/v1/users

Adds a user to the account with a role and data scope. The invitation is sent to the email or phone given.

النطاقaccounts:write يقبل Idempotency-Key

المعاملات

  • Idempotency-Keystring الترويسة

    A unique key per create request. A retry with the same key within 24 hours returns the first result instead of creating again.

محتوى الطلب

  • namestring

    مثال:Fahad Al-Harbi

  • emailstring (email)

    مثال:fahad@example.com

  • phonestring

    E.164, or a Saudi number as typed.

    مثال:+966501234567

  • languagestring

    أحد:aren

  • rolestring مطلوب

    أحد:ownermanagerviewerdriver

  • data_scopestring

    أحد:customerdepartment_treedepartment

  • department_idstring | null

    Required unless data_scope is customer.

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • dutiesstring[]

    The work the user handles.

    مثال:["dispatch"]

الاستجابة 201

  • idstring

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • namestring | null

    مثال:Fahad Al-Harbi

  • emailstring | null
  • phonestring | null

    E.164.

  • languagestring

    أحد:aren

  • rolestring

    أحد:ownermanagerviewerdriver

  • data_scopestring

    What the user sees: the whole account, a department and its sub-departments, one department, or a custom selection.

    أحد:customerdepartment_treedepartmentcustom

  • department_idstring | null

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • dutiesstring[]

    The work the user handles; scheduled reports send each duty's exceptions to its holders.

    مثال:["dispatch"]

  • created_atstring (date-time)

    مثال:2026-09-02T09:20:00Z

  • deactivated_atstring | null (date-time)

    When the user left the account; null while active.

    مثال:null

الأخطاء

400401403404409429

مثال الطلب
curl -X POST "https://api.ping.nml.sa/v1/users" \
  -H "Authorization: Bearer $PING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Fahad Al-Harbi", "email": "fahad@example.com", "phone": "+966501234567", "role": "manager", "department_id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f", "duties": ["dispatch"]}'
مثال الاستجابة · 201
{
  "id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
  "name": "Fahad Al-Harbi",
  "email": "fahad@example.com",
  "phone": "+966551234567",
  "language": "ar",
  "role": "manager",
  "data_scope": "department_tree",
  "department_id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
  "duties": [
    "dispatch"
  ],
  "created_at": "2026-09-02T09:20:00Z",
  "deactivated_at": null
}

تغيير دور المستخدم ونطاق بياناته.

PATCH/v1/users/{userId}/role

The account always keeps at least one owner: demoting the last owner answers 409.

النطاقaccounts:write

المعاملات

  • userIdstring المسار مطلوب

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e70

محتوى الطلب

  • rolestring مطلوب

    أحد:ownermanagerviewerdriver

  • data_scopestring

    أحد:customerdepartment_treedepartment

  • department_idstring | null

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

الاستجابة 200

  • idstring

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • namestring | null

    مثال:Fahad Al-Harbi

  • emailstring | null
  • phonestring | null

    E.164.

  • languagestring

    أحد:aren

  • rolestring

    أحد:ownermanagerviewerdriver

  • data_scopestring

    What the user sees: the whole account, a department and its sub-departments, one department, or a custom selection.

    أحد:customerdepartment_treedepartmentcustom

  • department_idstring | null

    مثال:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f

  • dutiesstring[]

    The work the user handles; scheduled reports send each duty's exceptions to its holders.

    مثال:["dispatch"]

  • created_atstring (date-time)

    مثال:2026-09-02T09:20:00Z

  • deactivated_atstring | null (date-time)

    When the user left the account; null while active.

    مثال:null

الأخطاء

400401403404409429

مثال الطلب
curl -X PATCH "https://api.ping.nml.sa/v1/users/0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e70/role" \
  -H "Authorization: Bearer $PING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"role": "viewer", "data_scope": "department", "department_id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f"}'
مثال الاستجابة · 200
{
  "id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
  "name": "Fahad Al-Harbi",
  "email": "fahad@example.com",
  "phone": "+966551234567",
  "language": "ar",
  "role": "manager",
  "data_scope": "department_tree",
  "department_id": "0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f",
  "duties": [
    "dispatch"
  ],
  "created_at": "2026-09-02T09:20:00Z",
  "deactivated_at": null
}