API Documentation — Delivery Order

Delivery Order API Reference

Comprehensive documentation for the KabyTech D/O Intelligence REST API. Parse Delivery Order documents (PDF, image, or scanned copies) and receive structured JSON with 25+ fields extracted — including release authorization, container validation, and terminal-specific data for all major Thai ports.

Introduction

The KabyTech Delivery Order (D/O) Intelligence API lets you parse Delivery Order documents (PDF, image, or scanned copies) and receive structured JSON with 25+ fields extracted. The API is designed for Thai port and terminal operations, supporting cargo release authorization at Laem Chabang (THLCH), Bangkok Port (THBKK), and Map Ta Phut (THMTP).

Delivery Orders authorize the release of cargo from port terminals to the consignee or their agent. The API automatically matches each D/O against its originating AWB or B/L reference, validates container numbers per ISO 6346, and tracks release authorization status in real time.

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/do/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 Delivery Order parsed in under 5 minutes. This example uses the Python SDK to upload a scanned D/O and receive structured release authorization data.

Python — Quick Start
from kabytech import KabyTechClient
 
# Initialize client with your API key
client = KabyTechClient(api_key="kby_live_a1b2c3d4...")
 
# Parse a Delivery Order document (PDF, PNG, JPG, or scanned copy)
result = client.do.parse(
    file="./delivery-orders/DO-LCB-2026-0042.pdf",
    options={
        "include_confidence": True,
        "validate_iso6346": True,
        "match_reference": True
    }
)
 
# Access parsed D/O data
print(f"D/O Number: {result.do_number}")
print(f"Terminal: {result.terminal} — Berth: {result.berth}")
print(f"Container: {result.container_number} (ISO 6346 valid: {result.container_valid})")
print(f"Release Authorized: {result.release_authorized}")
print(f"Pickup Deadline: {result.pickup_deadline}")
print(f"Confidence: {result.confidence}%")
 
# Access party information
print(f"Issuer: {result.issuer.name}")
print(f"Consignee: {result.consignee.name}")
 
# Check for validation warnings
if result.validation_errors:
    for err in result.validation_errors:
        print(f"Warning: {err.field} — {err.message}")

POST /v1/do/parse

Parse a single Delivery Order document and return structured data. Accepts PDF, PNG, JPG, TIFF images, or scanned copies. Returns 25+ fields including release authorization status, container validation, and reference matching against the originating AWB or B/L.

POST /v1/do/parse

Parses a Delivery Order document and extracts all structured fields. Container numbers are validated per ISO 6346 (check digit verification). The D/O is automatically matched against its originating AWB or B/L reference when available. Average processing time is 1.0–1.5 seconds per document.

Request Body (JSON)

ParameterTypeDescription
document RequiredstringBase64-encoded document content (PDF, PNG, JPG, TIFF)
format RequiredstringDocument format: pdf, png, jpg, tiff
include_confidence OptionalbooleanInclude per-field confidence scores (default: true)
validate_iso6346 OptionalbooleanValidate container numbers per ISO 6346 check digit (default: true)
match_reference OptionalbooleanMatch D/O against originating AWB or B/L in your account (default: true)
webhook_url OptionalstringURL to receive a POST callback when processing completes

Example Request (cURL)

cURL — Parse D/O
curl -X POST https://api.kabytech.co.th/v1/do/parse \
  -H "X-API-Key: kby_live_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{
    "document": "JVBERi0xLjQKMS...",
    "format": "pdf",
    "validate_iso6346": true,
    "match_reference": true
  }'

Response (200 OK)

JSON Response — 200 OK · 1.12s
{
  "id": "do_7k2m9f3n1p4q",
  "do_number": "DO-LCB-2026-0042",
  "issuer": {
    "name": "EVERGREEN MARINE (THAILAND) CO LTD",
    "address": "135 LAEM CHABANG PORT RD, CHONBURI 20230"
  },
  "consignee": {
    "name": "SIAM CARGO LOGISTICS CO LTD",
    "address": "88 BANGNA-TRAD RD, BANGKOK 10260",
    "tax_id": "0105548012345"
  },
  "cargo_agent": {
    "name": "THAI SHIPPING AGENCY CO LTD",
    "iata_code": "TH-0042"
  },
  "vessel_or_flight": "EVER GIVEN / 0125E",
  "bl_or_awb_reference": "EGLV123456789012",
  "container_number": "EGHU1234567",
  "container_iso6346_valid": true,
  "cargo_description": "1,200 CARTONS CANNED PINEAPPLE SLICES, HS 2008.20",
  "packages": 1200,
  "gross_weight": "18,400 kg",
  "measurement": "42.5 CBM",
  "terminal": "Laem Chabang Terminal A",
  "terminal_code": "THLCH-A",
  "berth": "A3",
  "release_type": "full",
  "release_authorized": true,
  "release_authorized_at": "2026-03-26T14:30:00+07:00",
  "pickup_deadline": "2026-03-31T17:00:00+07:00",
  "customs_reference": "TH-IMP-2026-LCB-004521",
  "free_time_expiry": "2026-04-02T00:00:00+07:00",
  "storage_charges": {
    "currency": "THB",
    "daily_rate": 850.00,
    "accrued": 0.00
  },
  "confidence": 96.8,
  "processing_ms": 1120,
  "validation_errors": [],
  "created_at": "2026-03-26T09:15:32Z"
}

GET /v1/do/{id}

Retrieve a previously parsed Delivery Order 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 documents. The release authorization status is refreshed on each retrieval.

GET /v1/do/{id}

Returns the full parsed result for a specific Delivery Order. The {id} is the unique identifier returned by the /do/parse endpoint (e.g., do_7k2m9f3n1p4q). Returns the same response schema as the parse endpoint with updated release status.

Path Parameters

ParameterTypeDescription
id RequiredstringThe unique D/O result ID (e.g., do_7k2m9f3n1p4q)

Query Parameters

ParameterTypeDescription
include_raw OptionalbooleanInclude raw OCR text in the response (default: false)
refresh_status OptionalbooleanRe-check release authorization status from terminal (default: false)
cURL — Get D/O by ID
curl https://api.kabytech.co.th/v1/do/do_7k2m9f3n1p4q \
  -H "X-API-Key: kby_live_a1b2c3d4..."

POST /v1/do/batch

Submit multiple Delivery Order documents for batch processing. The API accepts up to 50 documents per batch request and processes them asynchronously. Ideal for processing daily port release batches or bulk digitization of historical D/O records.

POST /v1/do/batch

Submits a batch of D/O documents for asynchronous processing. Returns immediately with a batch ID and individual document IDs. Each document is processed independently — one failure won't affect the others. Container validation and reference matching are applied to each document.

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_iso6346 OptionalbooleanValidate all container numbers per ISO 6346 (default: true)
Python — Batch Processing
from kabytech import KabyTechClient
import glob
 
client = KabyTechClient(api_key="kby_live_a1b2c3d4...")
 
# Collect all D/O PDFs from a directory
files = glob.glob("./daily-release-orders/*.pdf")
 
# Submit batch (max 50 per request)
batch = client.do.batch(
    files=files,
    webhook_url="https://your-app.com/webhooks/kabytech",
    priority="high"
)
 
print(f"Batch ID: {batch.batch_id}")
print(f"Documents submitted: {batch.total_documents}")
 
# Poll for results
results = batch.wait() # Blocks until complete
for r in results:
    print(f"{r.do_number}: {r.terminal} | Release: {r.release_authorized} | Container: {r.container_number}")

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. Use this to monitor your quota or verify connectivity before submitting batch jobs.

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

D/O Sections Reference

The KabyTech API parses all standard Delivery Order sections. Below are the primary sections returned in the response for every parsed D/O document. Each section groups related fields for easy integration with terminal management systems (TOS) and customs workflows.

#SectionKeyDescription
1HeaderheaderD/O number, issue date, document type (original/copy), issuing terminal
2PartiespartiesIssuer (shipping line/agent), consignee, cargo agent, notify party
3ReferencereferenceAWB or B/L number matching, booking reference, vessel/voyage or flight
4ContainercontainerContainer number (ISO 6346 validated), size/type, seal number, tare weight
5Cargo DetailscargoGoods description, HS codes, packages count, gross weight, measurement (CBM)
6Terminal & ReleasereleaseTerminal name/code, berth, release type (full/partial), authorization status & timestamp
7CustomscustomsCustoms declaration reference, import permit number, duty payment status
8ChargeschargesFree time expiry, storage charges (daily rate, accrued), demurrage, handling fees

Each section is returned as a nested object within the response. Fields that could not be extracted are returned as null with a confidence score of 0. Use include_confidence: true to get per-field scores.

Response Field Reference

Every API response includes these top-level fields alongside the section objects. All 25+ fields are extracted with individual confidence scores.

do_number string The unique Delivery Order number (e.g., "DO-LCB-2026-0042")
issuer object Issuing party — shipping line or freight agent. Contains name, address, and code.
consignee object Consignee details. Contains name, address, and tax_id.
cargo_agent object Cargo agent or freight forwarder handling the release. Contains name and iata_code.
vessel_or_flight string Vessel name and voyage number, or flight number for air cargo D/Os.
bl_or_awb_reference string Originating Bill of Lading or Air Waybill number. Auto-matched when match_reference is enabled.
container_number string Container identification number, validated per ISO 6346 with check digit verification.
container_iso6346_valid boolean Whether the container number passes ISO 6346 check digit validation.
cargo_description string Full goods description including commodity and HS code references.
packages integer Total number of packages in the delivery order.
gross_weight string Total gross weight with unit (e.g., "18,400 kg").
measurement string Cargo measurement in cubic meters (CBM).
terminal string Port terminal name (e.g., "Laem Chabang Terminal A").
terminal_code string Terminal UN/LOCODE with sub-terminal (e.g., "THLCH-A").
berth string Berth number at the terminal.
release_type string Release type: full (complete release) or partial (split delivery).
release_authorized boolean Whether cargo release has been authorized by the terminal.
release_authorized_at string ISO 8601 timestamp of release authorization (null if pending).
pickup_deadline string Deadline for cargo pickup (ISO 8601). After this, storage charges apply.
customs_reference string Thai Customs import declaration reference number.
free_time_expiry string Free storage time expiry at the terminal (ISO 8601).
storage_charges object Storage charges breakdown: currency, daily_rate, accrued.
confidence float Overall extraction confidence as a percentage (0–100). Scores above 95% indicate high reliability.
processing_ms integer Processing time in milliseconds. Average: 1,000–1,500ms for single documents.
validation_errors array Array of validation warnings. Each has field, message, and severity properties.
id string Unique result identifier for retrieval via GET /do/{id}. Prefixed with "do_".
created_at string ISO 8601 timestamp of when the document was processed (UTC).

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, or tiff.
400invalid_containerContainer number failed ISO 6346 check digit validation.
401invalid_api_keyAPI key is missing, invalid, or expired.
403plan_limit_exceededMonthly request quota exceeded. Upgrade your plan or wait for reset.
404do_not_foundNo parsed result found for the given ID. Results expire after 90 days.
422parse_failedDocument was read but no D/O data could be extracted. Verify document content.
429rate_limitedToo many requests. Respect the rate limits for your plan tier.
500internal_errorUnexpected server error. Retry the request. If persistent, contact support.
503service_unavailableAPI is temporarily unavailable for maintenance. Typically under 5 minutes.
Error Response Example — 401
{
  "error": "invalid_api_key",
  "message": "The API key provided is invalid or has been revoked.",
  "code": 401
}

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.

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.do.parse({
  file: './delivery-order.pdf',
  validateIso6346: true,
  matchReference: true
});
 
console.log(result.doNumber); // "DO-LCB-2026-0042"
console.log(result.containerNumber); // "EGHU1234567"
console.log(result.releaseAuthorized); // true
console.log(result.terminal); // "Laem Chabang Terminal A"

Need help integrating?

Our integration team can help you connect the KabyTech D/O API to your Terminal Operating System (TOS), CargoWise, or customs management platform.

Contact Support About Us

Ready to integrate?

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