API Documentation — Cargo Manifest

Cargo Manifest API Reference

Comprehensive documentation for the KabyTech MFT Intelligence REST API. Parse cargo manifest documents (PDF, image, or EDI messages) and receive structured JSON with 50+ fields extracted — including multi-shipment compilation, DG cargo auto-flagging, NSW pre-filing to Thai Customs, and HS code pre-validation.

Introduction

The KabyTech Freight Manifest (MFT) Intelligence API lets you parse and compile freight manifests for Thai Customs National Single Window (NSW) filing. The API accepts PDF, image, or EDI formats and returns structured JSON with 50+ fields extracted, including a detailed per-shipment items[] array.

The API supports air manifests (FHL/FWB message formats), sea manifests (cargo declarations), and multimodal manifests. It auto-flags dangerous goods (DG) cargo per IMDG and ICAO classification codes, pre-validates HS codes against the Thai Customs tariff schedule, and provides direct EDI submission to the Thai Customs Department via NSW integration.

All API requests are made over HTTPS. Responses are returned in JSON format. The API follows RESTful conventions and uses standard HTTP status codes.

Base URL

Base https://api.kabytech.co.th/v1

All endpoints described in this documentation are relative to this base URL. For example, the parse endpoint is available at https://api.kabytech.co.th/v1/mft/parse.

Authentication

All API requests require authentication via an API key. Include your API key in the X-API-Key header with every request. You can obtain your API key from the KabyTech Dashboard after creating an account.

Authentication Header
X-API-Key: kby_live_a1b2c3d4e5f6g7h8i9j0...

API keys are prefixed with kby_live_ for production and kby_test_ for sandbox. Test keys process documents but return synthetic data — they're free to use during development.

HeaderValueRequired
X-API-KeyYour API key (kby_live_... or kby_test_...)Required
Content-Typeapplication/json or multipart/form-dataRequired
Acceptapplication/jsonOptional

Quick Start

Get your first Freight Manifest parsed in under 5 minutes. This example uses the Python SDK to upload a manifest document and receive structured data with DG flagging and HS validation.

Python — Quick Start
from kabytech import KabyTechClient
 
# Initialize client with your API key
client = KabyTechClient(api_key="kby_live_a1b2c3d4...")
 
# Parse a Freight Manifest (PDF, PNG, JPG, or EDI format)
result = client.mft.parse(
    file="./manifests/TG676-BKK-NRT-manifest.pdf",
    options={
        "include_confidence": True,
        "validate_hs": True,
        "flag_dg": True,
        "nsw_submit": False
    }
)
 
# Access parsed manifest data
print(f"Manifest: {result.manifest_number}")
print(f"Type: {result.manifest_type}") # air, sea, or multimodal
print(f"Carrier: {result.carrier} ({result.carrier_code})")
print(f"Flight: {result.voyage_or_flight}")
print(f"Total AWBs: {result.total_bills}")
print(f"DG Cargo: {result.dangerous_goods_flag}")
print(f"NSW Status: {result.nsw_filing_status}")
 
# Iterate through manifest items
for item in result.items:
    print(f" AWB {item.bl_or_awb_number}: {item.packages} pkg, {item.weight}")
    if item.dg_class:
        print(f" !! DG Class {item.dg_class}, UN{item.dg_un_number}")
    if not item.hs_validated:
        print(f" !! HS code {item.hs_code} failed validation")

POST /v1/mft/parse

Parse a single Freight Manifest document and return structured data. Accepts PDF, PNG, JPG, TIFF images, or raw EDI messages (FHL, FWB, CUSCAR). Returns 50+ fields including a detailed items[] array with per-shipment breakdowns, DG auto-flagging per IMDG/ICAO codes, and HS pre-validation against the Thai Customs tariff.

POST /v1/mft/parse

Parses a Freight Manifest document and extracts all structured fields. Dangerous goods are automatically classified per IMDG (sea) and ICAO TI (air) codes. HS codes across all items are pre-validated against the Thai Customs tariff schedule. Average processing time is 2.0–4.5 seconds depending on item count.

Request Body (JSON)

ParameterTypeDescription
document RequiredstringBase64-encoded document content (PDF, PNG, JPG, TIFF) or raw EDI text
format RequiredstringDocument format: pdf, png, jpg, tiff, edi, or text
manifest_type OptionalstringHint: air, sea, or multimodal. Auto-detected if omitted.
include_confidence OptionalbooleanInclude per-field confidence scores (default: true)
validate_hs OptionalbooleanPre-validate HS codes against Thai Customs tariff (default: true)
flag_dg OptionalbooleanAuto-flag dangerous goods per IMDG/ICAO codes (default: true)
nsw_submit OptionalbooleanAutomatically submit to Thai Customs NSW after parsing (default: false)
webhook_url OptionalstringURL to receive a POST callback when processing completes

Example Request (cURL)

cURL — Parse Manifest
curl -X POST https://api.kabytech.co.th/v1/mft/parse \
  -H "X-API-Key: kby_live_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{
    "document": "JVBERi0xLjQKMS...",
    "format": "pdf",
    "validate_hs": true,
    "flag_dg": true,
    "nsw_submit": false
  }'

Response (200 OK)

JSON Response — 200 OK · 3.21s
{
  "id": "mft_9p4q7k2m3f1n",
  "manifest_number": "MFT-TG676-BKK-NRT-20260326",
  "manifest_type": "air",
  "carrier": "THAI AIRWAYS INTERNATIONAL",
  "carrier_code": "TG",
  "voyage_or_flight": "TG676",
  "port_of_loading": { "name": "Suvarnabhumi", "code": "THBKK" },
  "port_of_discharge": { "name": "Narita", "code": "JPNRT" },
  "arrival_date": "2026-03-27T06:45:00+09:00",
  "total_bills": 12,
  "total_packages": 847,
  "total_gross_weight": "14,280 kg",
  "dangerous_goods_flag": true,
  "nsw_filing_status": "pending",
  "nsw_reference": null,
  "items": [
    {
      "bl_or_awb_number": "217-98761234",
      "shipper": "SIAM EXPORT CO LTD",
      "consignee": "TOKYO TRADING CORP",
      "packages": 120,
      "weight": "2,400 kg",
      "goods_description": "ELECTRONIC COMPONENTS, HS 8542.31",
      "hs_code": "8542.31",
      "hs_validated": true,
      "dg_class": null,
      "dg_un_number": null,
      "origin_country": "TH",
      "customs_value": 285000.00,
      "currency": "USD"
    },
    {
      "bl_or_awb_number": "217-98765678",
      "shipper": "BANGKOK CHEMICAL INDUSTRIES CO LTD",
      "consignee": "OSAKA INDUSTRIAL MATERIALS KK",
      "packages": 8,
      "weight": "640 kg",
      "goods_description": "RESIN SOLUTION, FLAMMABLE, HS 3506.91",
      "hs_code": "3506.91",
      "hs_validated": true,
      "dg_class": "3",
      "dg_un_number": "UN3268",
      "origin_country": "TH",
      "customs_value": 42500.00,
      "currency": "USD"
    },
    // ... 10 more items
  ],
  "confidence": 95.4,
  "processing_ms": 3210,
  "validation_errors": [],
  "created_at": "2026-03-26T09:15:32Z"
}

GET /v1/mft/{id}

Retrieve a previously parsed Freight Manifest result by its unique ID. Results are stored for 90 days. Use this endpoint to fetch results asynchronously when using webhooks, or to re-access previously parsed manifests. The NSW filing status is refreshed on each retrieval.

GET /v1/mft/{id}

Returns the full parsed result for a specific Freight Manifest. The {id} is the unique identifier returned by the /mft/parse endpoint (e.g., mft_9p4q7k2m3f1n). Returns the same response schema as the parse endpoint with updated NSW filing status.

Path Parameters

ParameterTypeDescription
id RequiredstringThe unique manifest result ID (e.g., mft_9p4q7k2m3f1n)

Query Parameters

ParameterTypeDescription
include_raw OptionalbooleanInclude raw OCR text or EDI source in the response (default: false)
refresh_nsw OptionalbooleanRe-check NSW filing status from Thai Customs (default: false)
items_offset OptionalintegerPagination offset for items[] array (default: 0)
items_limit OptionalintegerMax items to return per page (default: 100, max: 500)
cURL — Get Manifest by ID
curl https://api.kabytech.co.th/v1/mft/mft_9p4q7k2m3f1n \
  -H "X-API-Key: kby_live_a1b2c3d4..." \
  -G -d "refresh_nsw=true"

POST /v1/mft/batch

Submit multiple Freight Manifest documents for batch processing. The API accepts up to 50 documents per batch request and processes them asynchronously. Ideal for processing daily flight/vessel manifests or bulk pre-filing with Thai Customs NSW.

POST /v1/mft/batch

Submits a batch of manifest documents for asynchronous processing. Returns immediately with a batch ID and individual document IDs. Each manifest is processed independently — one failure won't affect the others. DG flagging and HS validation are applied to every item across all manifests.

Request Body

ParameterTypeDescription
documents RequiredarrayArray of document objects (max 50). Each object has document and format fields.
webhook_url OptionalstringURL to receive a POST callback when the entire batch is complete
priority Optionalstringnormal (default) or high (Professional/Enterprise plans only)
validate_hs OptionalbooleanPre-validate HS codes across all items (default: true)
flag_dg OptionalbooleanAuto-flag dangerous goods per IMDG/ICAO (default: true)
nsw_submit OptionalbooleanAuto-submit each manifest to NSW after parsing (default: false)
Python — Batch Processing
from kabytech import KabyTechClient
import glob
 
client = KabyTechClient(api_key="kby_live_a1b2c3d4...")
 
# Collect all manifest PDFs from a directory
files = glob.glob("./daily-manifests/*.pdf")
 
# Submit batch with NSW auto-submission
batch = client.mft.batch(
    files=files,
    webhook_url="https://your-app.com/webhooks/kabytech",
    priority="high",
    nsw_submit=True
)
 
print(f"Batch ID: {batch.batch_id}")
print(f"Manifests submitted: {batch.total_documents}")
 
# Poll for results
results = batch.wait() # Blocks until complete
for r in results:
    dg_count = sum(1 for i in r.items if i.dg_class)
    print(f"{r.manifest_number}: {r.total_bills} bills, {dg_count} DG | NSW: {r.nsw_filing_status}")

GET /v1/status

Check the API health and your account usage. Returns current API status, your plan details, and remaining request quota for the current billing period.

GET /v1/status

Returns API health status, your account plan information, and current usage statistics. Also reports NSW gateway connectivity status for manifest filing.

JSON Response — GET /status
{
  "status": "operational",
  "version": "v1.8.2",
  "plan": "professional",
  "nsw_gateway": "connected",
  "usage": {
    "period": "2026-03",
    "requests_used": 4283,
    "requests_limit": 10000,
    "batch_remaining": 5717
  }
}

MFT Sections Reference

The KabyTech API parses all standard Freight Manifest sections. Below are the primary sections returned in the response for every parsed manifest. Each section groups related fields for integration with customs filing systems, airline cargo systems (CHAMP, IBS), or freight management platforms.

#SectionKeyDescription
1HeaderheaderManifest number, type (air/sea/multimodal), carrier name and code
2Voyage/FlightvoyageFlight number or voyage, ETD/ETA, aircraft or vessel type
3Port DetailsportsPort of loading (UN/LOCODE), port of discharge, transshipment ports
4Cargo SummarysummaryTotal bills, total packages, total gross weight, total volume
5Item-Level Detailsitems[]Per-shipment breakdown: AWB/B/L, shipper, consignee, goods, weight, HS code
6DG Flaggingdg_summaryDangerous goods overview: IMDG classes (sea), ICAO TI codes (air), UN numbers, counts
7HS Validationhs_validationPer-item HS code validation results against Thai Customs tariff schedule
8NSW Filing StatusnswThai Customs NSW submission status, reference number, filing timestamp, errors
9Charges SummarychargesHandling fees, customs processing charges, carrier surcharges

The items[] array is the core of the manifest response. Each item represents a single shipment (AWB or B/L) within the manifest. Items include individual DG classification and HS validation results. Use items_offset and items_limit on the GET endpoint to paginate large manifests.

Response Field Reference

Every API response includes these top-level fields alongside the section objects. The items[] array contains per-shipment details with 50+ total fields across the response.

Top-Level Fields

manifest_number string The unique manifest identifier (e.g., "MFT-TG676-BKK-NRT-20260326")
manifest_type string Manifest type: air, sea, or multimodal
carrier string Full carrier name (e.g., "THAI AIRWAYS INTERNATIONAL")
carrier_code string IATA airline code or SCAC carrier code (e.g., "TG")
voyage_or_flight string Flight number (air) or voyage number (sea)
port_of_loading object Loading port with name and code (UN/LOCODE)
port_of_discharge object Discharge port with name and code (UN/LOCODE)
arrival_date string Estimated arrival date/time (ISO 8601 with timezone)
total_bills integer Total number of AWBs or B/Ls in the manifest
total_packages integer Sum of all packages across all shipments
total_gross_weight string Total gross weight with unit (e.g., "14,280 kg")
dangerous_goods_flag boolean True if any item in the manifest contains dangerous goods
nsw_filing_status string Thai Customs NSW status: pending, submitted, accepted, rejected
nsw_reference string NSW filing reference number (null until submitted)
confidence float Overall extraction confidence as a percentage (0–100). Scores above 95% indicate high reliability.
processing_ms integer Processing time in milliseconds. Average: 2,000–4,500ms depending on item count.
validation_errors array Array of validation warnings (HS failures, DG classification issues). Each has field, message, severity.
id string Unique result identifier for retrieval via GET /mft/{id}. Prefixed with "mft_".
created_at string ISO 8601 timestamp of when the document was processed (UTC).

Item-Level Fields (items[])

bl_or_awb_number string Individual AWB or B/L number for this shipment
shipper string Shipper/exporter name
consignee string Consignee/importer name
packages integer Number of packages in this shipment
weight string Gross weight of this shipment with unit
goods_description string Full goods description including commodity type
hs_code string HS tariff code extracted from the goods description
hs_validated boolean Whether the HS code passed Thai Customs tariff validation
dg_class string Dangerous goods class per IMDG (sea) or ICAO TI (air). Null if not DG.
dg_un_number string UN number for dangerous goods (e.g., "UN3268"). Null if not DG.
origin_country string Country of origin (ISO 3166-1 alpha-2 code)
customs_value number Declared customs value for this shipment
currency string Currency code for customs_value (ISO 4217, e.g., "USD", "THB")

Error Codes

The API uses standard HTTP status codes. All error responses include a JSON body with error, message, and code fields.

StatusCodeDescription
400invalid_documentThe document could not be read. Check encoding and format parameter.
400unsupported_formatDocument format not supported. Use pdf, png, jpg, tiff, edi, or text.
400invalid_ediEDI message format is malformed or incomplete. Check FHL/FWB/CUSCAR syntax.
401invalid_api_keyAPI key is missing, invalid, or expired.
403plan_limit_exceededMonthly request quota exceeded. Upgrade your plan or wait for reset.
403nsw_not_enabledNSW direct submission requires Professional or Enterprise plan.
404mft_not_foundNo parsed result found for the given ID. Results expire after 90 days.
422parse_failedDocument was read but no manifest data could be extracted. Verify document content.
422hs_validation_failedOne or more HS codes could not be validated. Check validation_errors for details.
429rate_limitedToo many requests. Respect the rate limits for your plan tier.
500internal_errorUnexpected server error. Retry the request. If persistent, contact support.
502nsw_gateway_errorThai Customs NSW gateway is unreachable. Manifest is parsed; NSW submission queued.
503service_unavailableAPI is temporarily unavailable for maintenance. Typically under 5 minutes.
Error Response Example — 422
{
  "error": "hs_validation_failed",
  "message": "2 of 12 items have invalid HS codes. See validation_errors for details.",
  "code": 422,
  "validation_errors": [
    { "item_index": 4, "field": "hs_code", "value": "9999.99", "message": "HS code not found in Thai Customs tariff" },
    { "item_index": 9, "field": "hs_code", "value": "8542.999", "message": "Invalid HS code format (expected 4-10 digits)" }
  ]
}

Rate Limits

Rate limits vary by plan tier. All limits are applied per API key on a per-minute and per-month basis. Rate limit headers are included in every response. Manifest parsing counts as one request per document regardless of item count.

60

requests/min
Starter Plan

300

requests/min
Professional Plan

1,000

requests/min
Enterprise Plan

Response HeaderDescription
X-RateLimit-LimitMaximum requests per minute for your plan
X-RateLimit-RemainingRemaining requests in the current minute window
X-RateLimit-ResetUnix timestamp when the rate limit window resets

Official SDKs

We provide official SDKs for the most popular languages in the Thai logistics tech ecosystem. All SDKs are open source and available on GitHub.

🐍

Python

Python 3.8+

pip install kabytech

Node.js

Node 16+

npm i @kabytech/sdk
🔮

PHP

PHP 8.0+

composer require kabytech/sdk

Java

Java 11+

co.th.kabytech:sdk:1.4.0
Node.js — Quick Example
const { KabyTech } = require('@kabytech/sdk');
 
const client = new KabyTech({ apiKey: 'kby_live_a1b2c3d4...' });
 
const result = await client.mft.parse({
  file: './manifest.pdf',
  validateHs: true,
  flagDg: true,
  nswSubmit: false
});
 
console.log(result.manifestNumber); // "MFT-TG676-BKK-NRT-20260326"
console.log(result.totalBills); // 12
console.log(result.dangerousGoodsFlag); // true
console.log(result.nswFilingStatus); // "pending"
 
// Iterate items
for (const item of result.items) {
  console.log(`${item.blOrAwbNumber}: ${item.weight}`);
  if (item.dgClass) console.log(` DG: Class ${item.dgClass}, ${item.dgUnNumber}`);
}

Need help integrating?

Our integration team can help you connect the KabyTech Manifest API to CHAMP Cargosystems, IBS iCargo, Thai Customs NSW, or your custom freight management platform.

Contact Support About Us

Ready to integrate?

Start your free 30-day trial with 50 API calls. No credit card required.