الحساب
الحساب والأقسام والمستخدمون والأدوار وجهات الاتصال للرسائل، عبر واجهة 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-1a2b3c4d5e6fphonestringTelephone number in E.164 (any country)
مثال:
+966551234567user_idstring | nullمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6flanguagestringأحد:
arenwhatsapp_opt_inbooleanمثال:
truecreated_atstring (date-time)مثال:
2026-09-02T09:25:00Z
next_cursorstring | nullمثال:
eyJpZCI6InZlaF83S3EyIn0
الأخطاء
curl "https://api.ping.nml.sa/v1/contacts" \
-H "Authorization: Bearer $PING_API_KEY"{
"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.
مثال:
0501234567user_idstring | nullمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6flanguagestringأحد:
aren
الاستجابة 200
idstringمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6fphonestringTelephone number in E.164 (any country)
مثال:
+966551234567user_idstring | nullمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6flanguagestringأحد:
arenwhatsapp_opt_inbooleanمثال:
truecreated_atstring (date-time)مثال:
2026-09-02T09:25:00Z
الاستجابة 201
idstringمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6fphonestringTelephone number in E.164 (any country)
مثال:
+966551234567user_idstring | nullمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6flanguagestringأحد:
arenwhatsapp_opt_inbooleanمثال:
truecreated_atstring (date-time)مثال:
2026-09-02T09:25:00Z
الأخطاء
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"}'{
"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"
}{
"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-1a2b3c4d5e6fIdempotency-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
idstringThe contact's id as it was.
مثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6fphonestringTelephone number in E.164 (any country)
مثال:
+966551234567user_idstring | nullمثال:
nulllanguagestringأحد:
arenwhatsapp_opt_inbooleanWhether it had opted in when removed.
مثال:
trueopt_in_howstring | nullأحد:
whatsappformcallcontractnullopt_in_atstring | null (date-time)مثال:
2026-09-02T09:25:00Zopt_out_atstring | null (date-time)مثال:
nullcreated_atstring (date-time)مثال:
2026-09-02T09:25:00Zremoved_atstring (date-time)مثال:
2026-11-30T10:00:00Zremoved_bystringWho removed it, as the gateways name the caller: user:<id>, user:apikey/<id> or agent:<name>.
مثال:
user:0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f
الأخطاء
curl -X DELETE "https://api.ping.nml.sa/v1/contacts/0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f" \
-H "Authorization: Bearer $PING_API_KEY"{
"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-1a2b3c4d5e6fname_arstringمثال:
شركة النقل المتحدةname_enstringمثال:
United Transport Co.cr_numberstring | nullCommercial Registration number.
unified_numberstring | nullThe Unified National Number (700) replacing the CR number under the 2025 Commercial Register Law.
vat_numberstring | nullvat_statusstring | nullFrom 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_registerednulltinstring | nullZATCA's distinctive number (TIN), from its document.
registrationobject | nullThe commercial registration the identity was filled from, as the Ministry of Commerce's registry answered for the certificate's QR.
statusstringمثال:
activeexpires_atstring | null (date)When the subscription ends unless renewed.
مثال:
2027-08-31tga_licence_numberstring | nullThe Transport General Authority licence for transport activity.
مثال:
TGA-1043398tga_licence_expires_onstring | null (date)مثال:
2027-03-14national_addressobject | nulloperating_weekstring[]Sunday first: what each day of the week is.
مثال:
["full","full","full","full","full","closed","closed"]operating_hoursobjectThe working hours of a full day, a short day and a day in Ramadan, Asia/Riyadh.
حقول operating_hours
fullobjectحقول full
fromstringمثال:
08:00tostringمثال:
17:00
shortobjectحقول short
fromstringمثال:
08:00tostringمثال:
17:00
ramadanobjectحقول ramadan
fromstringمثال:
08:00tostringمثال:
17:00
created_atstring (date-time)مثال:
2026-09-01T08:00:00Z
الأخطاء
curl "https://api.ping.nml.sa/v1/customers/0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f" \
-H "Authorization: Bearer $PING_API_KEY"{
"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-1a2b3c4d5e6fnamestringمثال:
Riyadh distributionparent_idstring | nullThe parent department; null at the top of the tree.
مثال:
nullcost_centrestring | nullThe code the department's costs are booked to.
مثال:
CC-410created_atstring (date-time)مثال:
2026-09-02T09:15:00Z
next_cursorstring | nullمثال:
eyJpZCI6InZlaF83S3EyIn0
الأخطاء
curl "https://api.ping.nml.sa/v1/departments" \
-H "Authorization: Bearer $PING_API_KEY"{
"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 distributionparent_idstring | nullمثال:
null
الاستجابة 201
idstringمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6fnamestringمثال:
Riyadh distributionparent_idstring | nullThe parent department; null at the top of the tree.
مثال:
nullcost_centrestring | nullThe code the department's costs are booked to.
مثال:
CC-410created_atstring (date-time)مثال:
2026-09-02T09:15:00Z
الأخطاء
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}'{
"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
idstringThe contact's id as it was.
مثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6fphonestringTelephone number in E.164 (any country)
مثال:
+966551234567user_idstring | nullمثال:
nulllanguagestringأحد:
arenwhatsapp_opt_inbooleanWhether it had opted in when removed.
مثال:
trueopt_in_howstring | nullأحد:
whatsappformcallcontractnullopt_in_atstring | null (date-time)مثال:
2026-09-02T09:25:00Zopt_out_atstring | null (date-time)مثال:
nullcreated_atstring (date-time)مثال:
2026-09-02T09:25:00Zremoved_atstring (date-time)مثال:
2026-11-30T10:00:00Zremoved_bystringWho 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
الأخطاء
curl "https://api.ping.nml.sa/v1/removed-contacts" \
-H "Authorization: Bearer $PING_API_KEY"{
"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-1a2b3c4d5e6fnamestring | nullمثال:
Fahad Al-Harbiemailstring | nullphonestring | nullE.164.
languagestringأحد:
arenrolestringأحد:
ownermanagerviewerdriverdata_scopestringWhat the user sees: the whole account, a department and its sub-departments, one department, or a custom selection.
أحد:
customerdepartment_treedepartmentcustomdepartment_idstring | nullمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6fdutiesstring[]The work the user handles; scheduled reports send each duty's exceptions to its holders.
مثال:
["dispatch"]created_atstring (date-time)مثال:
2026-09-02T09:20:00Zdeactivated_atstring | null (date-time)When the user left the account; null while active.
مثال:
null
next_cursorstring | nullمثال:
eyJpZCI6InZlaF83S3EyIn0
الأخطاء
curl "https://api.ping.nml.sa/v1/users" \
-H "Authorization: Bearer $PING_API_KEY"{
"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-Harbiemailstring (email)مثال:
fahad@example.comphonestringE.164, or a Saudi number as typed.
مثال:
+966501234567languagestringأحد:
arenrolestringمطلوبأحد:
ownermanagerviewerdriverdata_scopestringأحد:
customerdepartment_treedepartmentdepartment_idstring | nullRequired unless data_scope is customer.
مثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6fdutiesstring[]The work the user handles.
مثال:
["dispatch"]
الاستجابة 201
idstringمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6fnamestring | nullمثال:
Fahad Al-Harbiemailstring | nullphonestring | nullE.164.
languagestringأحد:
arenrolestringأحد:
ownermanagerviewerdriverdata_scopestringWhat the user sees: the whole account, a department and its sub-departments, one department, or a custom selection.
أحد:
customerdepartment_treedepartmentcustomdepartment_idstring | nullمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6fdutiesstring[]The work the user handles; scheduled reports send each duty's exceptions to its holders.
مثال:
["dispatch"]created_atstring (date-time)مثال:
2026-09-02T09:20:00Zdeactivated_atstring | null (date-time)When the user left the account; null while active.
مثال:
null
الأخطاء
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"]}'{
"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مطلوبأحد:
ownermanagerviewerdriverdata_scopestringأحد:
customerdepartment_treedepartmentdepartment_idstring | nullمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6f
الاستجابة 200
idstringمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6fnamestring | nullمثال:
Fahad Al-Harbiemailstring | nullphonestring | nullE.164.
languagestringأحد:
arenrolestringأحد:
ownermanagerviewerdriverdata_scopestringWhat the user sees: the whole account, a department and its sub-departments, one department, or a custom selection.
أحد:
customerdepartment_treedepartmentcustomdepartment_idstring | nullمثال:
0196f1c2-7a3b-7c4d-8e5f-1a2b3c4d5e6fdutiesstring[]The work the user handles; scheduled reports send each duty's exceptions to its holders.
مثال:
["dispatch"]created_atstring (date-time)مثال:
2026-09-02T09:20:00Zdeactivated_atstring | null (date-time)When the user left the account; null while active.
مثال:
null
الأخطاء
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"}'{
"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
}