واجهات برمجة التطبيقات (API) من نوع REST

API documentation

View endpoint documentation for quotation, shipping services, and shipment CRUD. Production APIs use a personal token from Profile Settings. A separate UAT host is available for integration testing. Tracking API access requires a short registration form and has no UAT environment.

عنوان URL الأساسي لواجهة برمجة التطبيقات (API)

Production base URL: https://app.thainexus.co.th/functions

أضف اسم الدالة إلى عنوان URL هذا. أمثلة:

  • POSThttps://app.thainexus.co.th/functions/apiQuote
  • POSThttps://app.thainexus.co.th/functions/shipmentCrud
  • POSThttps://app.thainexus.co.th/functions/apiShippingServices

Interactive live tests live in the client app. Get your production token from Profile Settings.

بيئة UAT (الاختبار)

Use the UAT host to build and verify integrations before switching to production. Request and response shapes match production for quotation, shipping services, and shipment CRUD. Tracking events and the Tracking API are production-only; there is no UAT for tracking.

UAT base URL: https://uat-dev.thainexus.co.th/functions

Same function paths as production (apiQuote, apiShippingServices, shipmentCrud). Example:

  • POSThttps://uat-dev.thainexus.co.th/functions/apiQuote
  • POSThttps://uat-dev.thainexus.co.th/functions/shipmentCrud
  • POSThttps://uat-dev.thainexus.co.th/functions/apiShippingServices

كيفية الحصول على مفتاح API لـ UAT

  1. 01

    Request a UAT API key

    UAT keys are not self-serve. Email contact@thainexus.co.th (or contact your Thai Nexus account manager) and ask for a UAT API key. Keys use the format uat_tnx_... and only work on the UAT host.

  2. 02

    Call the UAT base URL

    Send the same paths as production, but against https://uat-dev.thainexus.co.th/functions. Do not use a production tnx_... token on UAT, and do not use a uat_tnx_... token on production.

  3. 03

    Authenticate UAT requests

    Send Authorization: Bearer uat_tnx_... or include api_token in the JSON body. shipmentCrud always expects api_token in the body.

مثال على طلب عرض أسعار لاختبار القبول المستخدم (UAT)

curl -X POST https://uat-dev.thainexus.co.th/functions/apiQuote \
  -H "Content-Type: application/json" \
  -d '{
    "api_token": "uat_tnx_XXXXXXXX_XXXXXXXX_XXXXXXXX",
    "country": "US",
    "actual_weight_kg": 2.5,
    "length_cm": 30,
    "width_cm": 20,
    "height_cm": 15,
    "is_document": false
  }'
  • Supported on UAT: apiQuote, apiShippingServices, and shipmentCrud.
  • shipmentCrud on UAT is a sandbox. Creates, updates, and deletes stay on UAT and do not write to production shipments.
  • There is no UAT for tracking events or the Tracking API. Use public tracking or request production Tracking API access below.
  • When your integration is ready, switch the base URL to production and use your Profile Settings tnx_... token.

Need a key? Email contact@thainexus.co.th with subject "UAT API key request".

المصادقة

Steps below are for production (tnx_...). For UAT keys, see UAT (test) environment.

  1. 01

    Create a free client account

    Register at https://app.thainexus.co.th/register, verify your email, and sign in.

  2. 02

    Generate an API token

    Open Profile Settings in the client app and generate a token (format tnx_...). Keep it secret. Store integrations (WooCommerce, Shopify, BigCommerce) use the same token.

  3. 03

    Authenticate requests

    Send Authorization: Bearer tnx_... or include api_token in the JSON body. All shipmentCrud endpoints pass api_token in the request body.

نقاط النهاية

Quotation API

POST /apiQuote

Full endpoint: https://app.thainexus.co.th/functions/apiQuote

Returns shipping quotes from all active couriers for a given package. Rates come from our live pricing engine. Destination TH and THAILAND are accepted. Unlike the public shipping calculator, this API does not suppress domestic Thailand quotes.

Auth: Pass api_token in the request body (from Profile Settings)

حقول الطلب

الميدانالوصف
api_tokenstring - Your API token
countrystring - ISO code (US, GB, TH, JP) or full name (UNITED STATES, THAILAND). TH is not suppressed.
actual_weight_kgnumber - Actual weight in kg
length_cmnumber - Package length in cm
width_cmnumber - Package width in cm
height_cmnumber - Package height in cm
is_documentboolean - Optional (default false). If true, returns only document-type quotes. If false, excludes document quotes.

مثال على الطلب

{
  "api_token": "tnx_XXXXXXXX_XXXXXXXX_XXXXXXXX_XXXXXXXX",
  "country": "US",
  "actual_weight_kg": 2.5,
  "length_cm": 30,
  "width_cm": 20,
  "height_cm": 15,
  "is_document": false
}

cURL example

curl -X POST https://app.thainexus.co.th/functions/apiQuote \
  -H "Content-Type: application/json" \
  -d '{
    "api_token": "tnx_XXXXXXXX_XXXXXXXX_XXXXXXXX_XXXXXXXX",
    "country": "US",
    "actual_weight_kg": 2.5,
    "length_cm": 30,
    "width_cm": 20,
    "height_cm": 15,
    "is_document": false
  }'

مثال على الرد

{
  "success": true,
  "country": "US",
  "package": {
    "actual_weight_kg": 2.5,
    "length_cm": 30,
    "width_cm": 20,
    "height_cm": 15
  },
  "quotes_count": 3,
  "quotes": [
    {
      "courier_name": "flex_dap",
      "display_name": "Flex DAP",
      "delivery_type": "pickup",
      "estimated_days": "5-10",
      "final_price_thb": 1250,
      "currency": "THB",
      "chargeable_weight_kg": 2.5,
      "weight_used": "actual",
      "volumetric_weight_kg": 1.8,
      "is_oversize": false
    }
  ]
}

Response fields

الميدانالوصف
courier_nameInternal courier ID
display_nameHuman-readable name
final_price_thbTotal price in THB
estimated_daysDelivery estimate (e.g. "5-10")
chargeable_weight_kgWeight used for pricing
weight_used"actual" or "volumetric"
  • Unlike the public calculator, domestic Thailand quotes are not suppressed.
  • Live testing is available in the client app under Integrations / API documentation.
  • For pre-production testing, call the same path on https://uat-dev.thainexus.co.th/functions with a uat_tnx_... key (contact us for a UAT key).

Service List API

POST /apiShippingServices

Full endpoint: https://app.thainexus.co.th/functions/apiShippingServices

Returns all active shipping services with their name, logo, and ID. Uses the same personal API token from Profile Settings (the tnx_... token) as apiQuote and other client APIs.

Auth: Bearer token recommended, or api_token in the request body

حقول الطلب

الميدانالوصف
api_tokenOptional if Authorization: Bearer tnx_... is set. No other body fields required.

مثال على الطلب

{
  "api_token": "tnx_xxxxxxxxxxxxxxxxxxxx"
}

cURL example

curl --location 'https://app.thainexus.co.th/functions/apiShippingServices' \
  --header 'Authorization: Bearer tnx_xxxxxxxxxxxxxxxxxxxx'

fetch example

const response = await fetch(
  "https://app.thainexus.co.th/functions/apiShippingServices",
  {
    method: "GET",
    headers: {
      "Authorization": "Bearer tnx_xxxxxxxxxxxxxxxxxxxx"
    }
  }
);
const data = await response.json();

مثال على الرد

{
  "success": true,
  "cached": false,
  "cache_expires_at": "2026-06-12T10:00:00.000Z",
  "total": 10,
  "data": [
    {
      "id": "swift_dap",
      "service_name": "Thai Nexus Express Swift DAP",
      "logo": "https://..."
    }
  ]
}

Response fields

الميدانالوصف
idstring - Unique service identifier (e.g. swift_dap)
service_namestring - Full display name
logostring | null - URL to the service logo image
cachedboolean - Whether this response was reused
cache_expires_atISO datetime - When this response expires
  • Use service IDs when creating shipments from your store integration.
  • UAT: same path on https://uat-dev.thainexus.co.th/functions with a uat_tnx_... key.

Shipment CRUD API

POST /shipmentCrud

Full endpoint: https://app.thainexus.co.th/functions/shipmentCrud

All endpoints use the shipmentCrud backend function. Pass the action field to select the operation. Soft-delete is used - records remain in the database for audit but are excluded from standard queries.

Auth: Pass your api_token in the request body (get it from Profile Settings)

حقول الطلب

الميدانالوصف
api_tokenYour personal API token
actioncreate | update | get | list | delete | restore
request_numberRequired for get / update / delete / restore
dataObject with shipment fields (create / update)
page / limit / statusOptional list filters
reasonOptional delete reason

مثال على الطلب

{
  "api_token": "tnx_YOUR_TOKEN",
  "action": "create",
  "data": {
    "shipper_address": {
      "name": "John Doe",
      "phone": "+66812345678",
      "address_line1": "123 Sukhumvit",
      "city": "Bangkok",
      "country": "TH"
    },
    "consignee_address": {
      "name": "Jane Smith",
      "phone": "+12025551234",
      "address_line1": "456 Main St",
      "city": "New York",
      "state": "NY",
      "postal_code": "10001",
      "country": "US"
    },
    "actual_weight_kg": 2.5,
    "length_cm": 30,
    "width_cm": 20,
    "height_cm": 15,
    "shipment_type": "parcel",
    "shipment_description": "Electronics"
  }
}

Actions

Create shipment
action: create

Create a new shipment request with origin/destination/dimensions. Volumetric weight is auto-calculated from dimensions. Status defaults to pending.

طلب الحمولة
{
  "api_token": "tnx_YOUR_TOKEN",
  "action": "create",
  "data": {
    "shipper_address": {
      "name": "John Doe",
      "phone": "+66812345678",
      "address_line1": "123 Sukhumvit",
      "city": "Bangkok",
      "country": "TH"
    },
    "consignee_address": {
      "name": "Jane Smith",
      "phone": "+12025551234",
      "address_line1": "456 Main St",
      "city": "New York",
      "state": "NY",
      "postal_code": "10001",
      "country": "US"
    },
    "actual_weight_kg": 2.5,
    "length_cm": 30,
    "width_cm": 20,
    "height_cm": 15,
    "shipment_type": "parcel",
    "shipment_description": "Electronics"
  }
}
Response
{
  "success": true,
  "action": "create",
  "data": {
    "id": "abc123",
    "request_number": "SR-X9K2F7",
    "status": "pending",
    "volumetric_weight_kg": 1.8,
    "submitted_date": "2026-04-24T10:00:00Z"
  }
}
Update shipment
action: update

Update a shipment's details. Blocked for shipped/completed shipments. Updates are blocked when status is: in_transit, delivered, confiscated, returned, lost. Staff can bypass this restriction.

طلب الحمولة
{
  "api_token": "tnx_YOUR_TOKEN",
  "action": "update",
  "request_number": "SR-X9K2F7",
  "data": {
    "actual_weight_kg": 3.0,
    "shipment_description": "Updated description"
  }
}
Response
{
  "success": true,
  "action": "update",
  "data": {
    "id": "abc123",
    "request_number": "SR-X9K2F7",
    "updated_fields": ["actual_weight_kg", "shipment_description", "volumetric_weight_kg"]
  }
}
Get shipment
action: get

Get a single shipment by ID or request number.

طلب الحمولة
{
  "api_token": "tnx_YOUR_TOKEN",
  "action": "get",
  "request_number": "SR-X9K2F7"
}
Response
{
  "success": true,
  "action": "get",
  "data": { /* full ShipmentRequest entity */ }
}
List shipments
action: list

Paginated list of shipments for the authenticated user. Staff can list all shipments or filter by client_email. Soft-deleted records are excluded.

طلب الحمولة
{
  "api_token": "tnx_YOUR_TOKEN",
  "action": "list",
  "page": 1,
  "limit": 20,
  "status": "pending"
}
Response
{
  "success": true,
  "action": "list",
  "data": [ /* summary shipment objects */ ],
  "pagination": { "page": 1, "limit": 20, "total": 45, "total_pages": 3 }
}
Delete shipment
action: delete

Soft-delete a shipment. Record remains for audit. Sets is_deleted=true with timestamp. Active/shipped shipments cannot be deleted by clients.

طلب الحمولة
{
  "api_token": "tnx_YOUR_TOKEN",
  "action": "delete",
  "request_number": "SR-X9K2F7",
  "reason": "Created by mistake"
}
Response
{
  "success": true,
  "action": "delete",
  "data": {
    "id": "abc123",
    "request_number": "SR-X9K2F7",
    "deleted_at": "2026-04-24T10:30:00Z"
  }
}
Restore shipment
action: restore

Restore a soft-deleted shipment (staff only).

طلب الحمولة
{
  "api_token": "tnx_YOUR_TOKEN",
  "action": "restore",
  "request_number": "SR-X9K2F7"
}
Response
{
  "success": true,
  "action": "restore",
  "data": { "id": "abc123", "request_number": "SR-X9K2F7" }
}
  • Volumetric weight is auto-calculated from dimensions. Status defaults to pending on create.
  • Updates are blocked when status is in_transit, delivered, confiscated, returned, or lost (staff can bypass).
  • Soft-delete sets is_deleted=true with timestamp. Active/shipped shipments cannot be deleted by clients.
  • Restore is staff only.
  • Staff can list all shipments or filter by client_email. Soft-deleted records are excluded from list.
  • UAT: same actions on https://uat-dev.thainexus.co.th/functions/shipmentCrud with a uat_tnx_... key. UAT shipment data is sandbox-only and does not affect production.

Tracking API

POST /Tracking API (registration required)

Programmatic access to Thai Nexus Express tracking events for TNX references and linked carrier updates. Access is provisioned after you submit the registration form on this page. There is no UAT environment for tracking events.

Auth: Issued after registration approval

حقول الطلب

الميدانالوصف
trackingNumberTNX reference or supported carrier/ref number
refreshOptional boolean to force a fresh pull

مثال على الطلب

{
  "trackingNumber": "TNX1783820599067POM",
  "refresh": true
}
  • Public browser tracking stays on tracking.thainexus.co.th without an API key.
  • API access is for platforms, marketplaces, and internal tools that need structured event data.
  • Rate limits apply; 429 responses mean you should back off and retry.
  • No UAT for tracking events. Test against production tracking only after access is approved.

واجهة برمجة تطبيقات (API) لاستلام الشركاء

يمكن لحسابات الشركاء تقديم طلبات الاستلام في تايلاند وإدارة عناوين الاستلام المحفوظة من خلال عمليات CRUD الخاصة بالشحنات. ويُعد هذا الأمر منفصلاً عن عمليات CRUD الخاصة بالشحنات الدولية، ويتطلب أن يكون client_type هو «partner».

  • عنوان URL الأساسي نفسه: POST https://app.thainexus.co.th/functions/shipmentCrud
  • تشمل الإجراءات: verify_account، وlist_destinations، وquote_fee، وcreate، وlist، وget، وcancel، وget_tracking.
  • اضبط نطاق api_scope على «نقطة الاستلام» أو «العنوان» في عمليات الاستدعاء من نوع list و get، بحيث يتم توجيه هذه الاستدعاءات إلى معالجات نقطة الاستلام.

طلب الوصول إلى واجهة برمجة تطبيقات (API) لتتبع الطلبات

واجهة برمجة التطبيقات (API) الخاصة بالتتبع ليست متاحة للخدمة الذاتية. يرجى إرسال هذا النموذج وسنرد عليك في غضون يوم عمل واحد بتزويدك ببيانات الاعتماد أو بطرح أسئلة متابعة. لا توجد بيئة اختبار المستخدم (UAT) لأحداث التتبع؛ ويقتصر الوصول بعد الموافقة على بيئة الإنتاج فقط.

الأسئلة الشائعة للمطورين

هل واجهة برمجة التطبيقات (API) الخاصة بـ Thai Nexus متوفرة ضمن خطة مدفوعة؟
تستخدم خدمات عرض الأسعار وقائمة خدمات الشحن وعمليات إنشاء وقراءة وقراءة وتعديل وحذف (CRUD) للشحنات رمز حساب عميل مجاني من «إعدادات الملف الشخصي» في تطبيق العميل. لا توجد رسوم لكل استدعاء بالنسبة لعمليات التكامل القياسية مع المتاجر في حدود الاستخدام العادل. يُمنح حق الوصول إلى واجهة برمجة تطبيقات التتبع (Tracking API) بعد مراجعة نموذج التسجيل. يجب الإفصاح في النموذج عن الاستخدام المكثف لواجهة برمجة تطبيقات التتبع (Tracking API).
من أين أحصل على رمز API الخاص بـ Thai Nexus؟
سجّل الدخول إلى تطبيق العميل، وافتح «إعدادات الملف الشخصي»، ثم قم بإنشاء رمز tnx_ الخاص بالإنتاج أو نسخه. تستخدم عمليات التكامل WooCommerce وShopify وBigCommerce نفس الرمز. أما مفاتيح UAT فتستخدم البادئة uat_tnx_ ويتم إصدارها عند الطلب؛ وهي غير متوفرة في «إعدادات الملف الشخصي». لا تقم أبدًا بتضمين الرموز في كود الواجهة الأمامية العامة.
ما هي بيئة واجهة برمجة التطبيقات (API) الخاصة بـ Thai Nexus UAT؟
يتم تشغيل اختبار القبول المستخدم (UAT) على uat-dev.thainexus.co.th لأغراض إعداد عروض الأسعار وخدمات الشحن وعمليات إنشاء وقراءة وقراءة وتعديل وحذف (CRUD) للشحنات قبل بدء التشغيل الفعلي. يرجى طلب مفتاح API الخاص بـ UAT من Thai Nexus؛ حيث لا يمكن الحصول عليه ذاتيًا. لا يتوفر اختبار UAT لأحداث التتبع؛ ويظل التتبع مقتصرًا على بيئة الإنتاج فقط بعد الموافقة على واجهة برمجة تطبيقات التتبع (Tracking API).
ما الفرق بين واجهة برمجة تطبيقات التتبع Thai Nexus والتتبع العام؟
يمكن لأي شخص تتبع رقم TNX على الموقع tracking.thainexus.co.th دون الحاجة إلى المصادقة. أما واجهة برمجة التطبيقات (API) الخاصة بالتتبع، فهي تُرجع أحداثًا بتنسيق JSON منظم للأنظمة وتتطلب التسجيل. ولا يوجد اختبار قبول المستخدم (UAT) لخدمة التتبع. وتُطبق حدود معدل الاستخدام؛ حيث تعني رسالة HTTP «429» التراجع ومحاولة إعادة الإرسال.
ما هي حدود الاستخدام الخاصة بواجهة برمجة التطبيقات (API) لـ Thai Nexus؟
يخضع التتبع العام ونقاط نهاية واجهة برمجة تطبيقات التتبع (Tracking API) لقيود على معدل الاستخدام لكل عنوان IP ورمز مميز. تشير استجابات HTTP 429 إلى ضرورة الانتظار وإعادة المحاولة مع التراجع التدريجي. ينبغي استبدال عمليات الاستقصاء ذات الحجم الكبير بفترات زمنية معقولة أو باستخدام «webhooks» (الخطافات الويب) عند توفرها. يرجى الإفصاح عن الحجم المتوقع في نموذج تسجيل واجهة برمجة تطبيقات التتبع (Tracking API).
هل يتكامل Thai Nexus مع Shopify؟
نعم، من خلال تكامل Shopify المنشور باستخدام رمز API الخاص بك كعميل للحصول على أسعار الدفع الفورية وإنشاء عمليات الشحن. قم بالتثبيت من صفحة التكاملات. الرمز هو نفسه المستخدم في WooCommerce وBigCommerce. أما واجهة برمجة تطبيقات التتبع (API) فتتطلب تسجيلًا منفصلاً.
هل يتكامل Thai Nexus مع WooCommerce؟
نعم. يستخدم المكون الإضافي WooCommerce نفس الرمز tnx_ الموجود في «إعدادات الملف الشخصي». قم بتعيين عنوان المنشأ ليكون مستودعك في هوا هين أو بانكوك. وتستدعي عروض الأسعار نقطة نهاية عرض الأسعار الموثقة في صفحة المطورين.
كيف يمكنني عرض أسعار الشحن المباشرة عند إتمام عملية الدفع من تايلاند؟
قم باستدعاء نقطة نهاية الاستشعار من النظام الخلفي لمتجرك مع تضمين الوزن والأبعاد وبلد المقصد. تعمل عمليات التكامل Thai Nexus وShopify وWooCommerce وBigCommerce على تجميع نفس الاستدعاء. تعتبر الأسعار إرشادية إلى حين تأكيد المحتويات؛ وقد تتطلب عروض الأسعار الملزمة مراجعة يدوية في حالة البضائع الخاضعة للقيود.
من الذي يوفر واجهة برمجة تطبيقات (API) للشحن من تايلاند؟
توفر شركة Thai Nexus Point Co., Ltd. نقاط نهاية REST الخاصة بالعروض السعرية والشحنات والتتبع. رقم التسجيل/الرقم الضريبي: 0775567004498. أما واجهات برمجة التطبيقات (API) الخاصة بشركات النقل (DHL، FedEx) فهي تخضع لعقود منفصلة؛ بينما تقوم Thai Nexus بتوحيد عمليات الحجز عبر شركات نقل متعددة تحت رمز واحد.