REST API

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 dasar API

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

Tambahkan nama fungsi ke URL ini. Contoh:

  • 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.

Lingkungan UAT (pengujian).

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

Cara mendapatkan kunci 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.

Contoh permintaan penawaran 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".

Otentikasi

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.

Titik akhir

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)

Kolom permintaan

LapanganDeskripsi
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.

Contoh permintaan

{
  "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
  }'

Contoh tanggapan

{
  "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

LapanganDeskripsi
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

Kolom permintaan

LapanganDeskripsi
api_tokenOptional if Authorization: Bearer tnx_... is set. No other body fields required.

Contoh permintaan

{
  "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();

Contoh tanggapan

{
  "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

LapanganDeskripsi
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)

Kolom permintaan

LapanganDeskripsi
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

Contoh permintaan

{
  "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.

Minta muatan
{
  "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.

Minta muatan
{
  "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.

Minta muatan
{
  "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.

Minta muatan
{
  "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.

Minta muatan
{
  "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).

Minta muatan
{
  "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

Kolom permintaan

LapanganDeskripsi
trackingNumberTNX reference or supported carrier/ref number
refreshOptional boolean to force a fresh pull

Contoh permintaan

{
  "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 Pengambilan oleh Mitra

Akun mitra dapat mengirimkan permintaan penjemputan di Thailand dan mengelola alamat penjemputan yang disimpan melalui pengirimanCrud. Ini terpisah dari CRUD pengiriman internasional dan memerlukan partner client_type.

  • URL dasar yang sama: POST https://app.thainexus.co.th/functions/shipmentCrud
  • Tindakannya meliputi verifikasi_akun, daftar_tujuan, biaya_kutipan, buat, daftar, dapatkan, batalkan, dan dapatkan_pelacakan.
  • Tetapkan api_scope pickup atau alamat untuk daftar dan dapatkan rute panggilan ke penangan pickup.

Minta akses API Pelacakan

API Pelacakan bukan layanan mandiri. Kirimkan formulir ini dan kami akan membalasnya dalam satu hari kerja dengan kredensial atau pertanyaan lanjutan. Tidak ada lingkungan UAT untuk melacak peristiwa; akses hanya untuk produksi setelah disetujui.

Pertanyaan Umum Pengembang

Apakah API Thai Nexus ada dalam paket berbayar?
Kutipan, daftar layanan pengiriman, dan CRUD pengiriman menggunakan token akun klien gratis dari Pengaturan Profil di aplikasi klien. Tidak ada biaya per panggilan untuk integrasi toko standar dalam penggunaan wajar. Akses API pelacakan diberikan setelah formulir pendaftaran ditinjau. Penggunaan API Pelacakan bervolume tinggi harus diungkapkan pada formulir.
Di mana saya bisa mendapatkan token API Thai Nexus?
Masuk ke aplikasi klien, buka Pengaturan Profil, dan buat atau salin token produksi tnx_ Anda. Integrasi WooCommerce, Shopify dan BigCommerce menggunakan token yang sama. Kunci UAT menggunakan awalan uat_tnx_ dan dikeluarkan berdasarkan permintaan; mereka tidak tersedia di Pengaturan Profil. Jangan pernah menyematkan token dalam kode frontend publik.
Apa yang dimaksud dengan lingkungan API UAT Thai Nexus?
UAT berjalan di uat-dev.thainexus.co.th untuk penawaran, layanan pengiriman, dan pengiriman CRUD sebelum Anda ditayangkan. Minta kunci API UAT dari Thai Nexus; itu bukan layanan mandiri. Tidak ada UAT untuk melacak peristiwa; pelacakan tetap hanya produksi setelah persetujuan API Pelacakan.
Apa perbedaan antara API Pelacakan Thai Nexus dan pelacakan publik?
Siapa pun dapat melacak nomor TNX di tracking.thainexus.co.th tanpa otentikasi. Tracking API mengembalikan peristiwa JSON terstruktur untuk sistem dan memerlukan registrasi. Tidak ada UAT untuk pelacakan. Batasan tarif berlaku; HTTP 429 berarti mundur dan coba lagi.
Berapa batas kecepatan API Thai Nexus?
Pelacakan publik dan titik akhir API Pelacakan dibatasi tarifnya per IP dan token. Respons HTTP 429 berarti menunggu dan coba lagi dengan backoff. Jajak pendapat bervolume tinggi harus diganti dengan interval atau webhook yang wajar jika tersedia. Ungkapkan volume yang diharapkan pada formulir pendaftaran API Pelacakan.
API apa yang ditawarkan Thai Nexus untuk pengiriman?
Kutipan, daftar layanan pengiriman, CRUD pengiriman, dan titik akhir API Pelacakan. Token produksi berasal dari Pengaturan Profil di aplikasi klien (awalan tnx_). Kunci UAT dikeluarkan berdasarkan permintaan penawaran dan pengujian pengiriman. Jalur lengkap dan contoh ada di halaman pengembang.
Apakah Thai Nexus terintegrasi dengan Shopify?
Ya melalui integrasi Shopify yang dipublikasikan menggunakan token API klien Anda untuk tarif checkout langsung dan pembuatan pengiriman. Instal dari halaman integrasi. Token yang sama seperti WooCommerce dan BigCommerce. API Pelacakan adalah pendaftaran terpisah.
Apakah Thai Nexus terintegrasi dengan WooCommerce?
Ya. Plugin WooCommerce menggunakan token tnx_ yang sama dari Pengaturan Profil. Konfigurasikan alamat asal sebagai gudang Hua Hin atau Bangkok Anda. Kutipan harga memanggil titik akhir kutipan yang didokumentasikan di halaman pengembang.
Bagaimana cara kerja otentikasi API Thai Nexus?
Token pembawa dengan awalan tnx_ dari Pengaturan Profil setelah login klien. Jangan pernah menyematkan token di JavaScript frontend publik. Segera putar token yang disusupi. UAT menggunakan kunci uat_tnx_ yang dikeluarkan secara manual, bukan dari Pengaturan Profil.
Apa URL dasar API Thai Nexus?
URL basis produksi didokumentasikan di halaman pengembang dan cocok dengan host yang digunakan oleh panggilan API aplikasi klien. Tambahkan nama fungsi seperti apiQuote atau shipCrud. Host UAT terpisah di uat-dev.thainexus.co.th untuk pengujian pra-siaran langsung.
Bagaimana cara menampilkan tarif pengiriman langsung saat checkout dari Thailand?
Hubungi titik akhir penawaran dari backend toko Anda dengan berat, dimensi, dan negara tujuan. Integrasi Thai Nexus Shopify, WooCommerce dan BigCommerce membungkus panggilan yang sama. Tarif hanya bersifat indikatif sampai isinya dikonfirmasi; kutipan yang mengikat mungkin memerlukan tinjauan manual pada barang yang dibatasi.
Siapa yang menyediakan API pengiriman dari Thailand?
Thai Nexus Point Co., Ltd. mengekspos titik akhir REST untuk penawaran harga, pengiriman, dan pelacakan. Pendaftaran/NPWP 0775567004498. API asli operator (DHL, FedEx) adalah kontrak terpisah; Thai Nexus mengabstraksi pemesanan multi-operator di belakang satu token.