API Documentation — Railway Consignment Note

Railway Consignment Note API Reference

Parse railway consignment notes with CIM and SMGS format support. Multi-language OCR optimized for the China-Laos-Thailand corridor with 40+ field extraction.

Introduction

The Railway Consignment Note (RCN) API extracts structured data from CIM and SMGS rail consignment notes using advanced OCR and machine learning. Purpose-built for the China-Laos-Thailand (CLT) corridor and ASEAN cross-border rail freight, the API handles the complexity of multi-format, multi-language railway documentation with enterprise-grade accuracy.

The API supports both CIM (Convention concerning International Carriage by Rail, used across Europe) and SMGS (Agreement on International Goods Transport by Rail, used across Russia, CIS states, and China) consignment note formats. Multi-language OCR capabilities cover Chinese (Simplified and Traditional), Thai, English, Russian, and Lao scripts simultaneously within a single document.

Key capabilities include automatic format detection (CIM vs SMGS), Mohan/Boten border crossing data extraction, wagon and container tracking, customs declaration parsing, HS code identification, and seal number verification. The API returns 40+ structured fields with per-field confidence scores, enabling seamless integration with freight management, customs clearance, and logistics tracking systems.

Supported file formats: PDF, JPEG, PNG, TIFF (max 20 MB per file). Average processing time: 1.2-2.8 seconds depending on document complexity and number of languages detected.

Base URL https://api.kabytech.com

Authentication

All API requests must include a valid API key in the Authorization header using the Bearer token scheme. API keys are scoped to your organization and can be created, rotated, and revoked from the dashboard.

Authorization: Bearer YOUR_API_KEY

Obtain your API key from dashboard.kabytech.comSettings → API Keys. Each key can be assigned granular permissions (read, write, batch) and rate limit tiers. We recommend creating separate keys for development and production environments.

Security best practices:

Quick Start

Parse a railway consignment note in seconds. Upload a CIM or SMGS document and receive structured JSON with 40+ extracted fields, confidence scores, and processing metadata.

curl -X POST https://api.kabytech.com/v1/rcn/parse \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "file=@/path/to/consignment-note.pdf" \
  -F "language=zh" \
  -F "format_hint=smgs"

The API automatically detects whether the document is CIM or SMGS format. For optimal accuracy on multi-language documents (e.g., Chinese-English or Russian-English), pass the primary language as the language parameter. The OCR engine will still detect and extract text in secondary languages.

Example response for a Kunming-Vientiane-Laem Chabang auto parts shipment:

{
  "id": "job_rcn_8f3a2b1c9d4e",
  "status": "completed",
  "document_type": "rcn",
  "format_detected": "smgs",
  "data": {
    "consignment_number": "RCNKBT2026005678",
    "format": "smgs",
    "date_of_consignment": "2026-03-15",
    "sender": {
      "name": "Kunming Precision Auto Parts Co., Ltd.",
      "address": "88 Dianchi Road, Xishan District, Kunming, Yunnan 650228",
      "country": "CN",
      "contact_phone": "+86-871-6812-3456"
    },
    "recipient": {
      "name": "Laem Chabang Auto Distribution Co., Ltd.",
      "address": "456 Port Road, Si Racha, Chonburi 20230, Thailand",
      "country": "TH",
      "contact_phone": "+66-38-491-2345"
    },
    "station_from": {
      "name": "Kunming South",
      "code": "KMS",
      "country": "CN"
    },
    "station_to": {
      "name": "Laem Chabang",
      "code": "LCB",
      "country": "TH"
    },
    "route_via": ["Yuxi", "Mohan", "Boten", "Luang Prabang", "Vientiane", "Nong Khai", "Laem Chabang"],
    "wagon_number": "KZ4-5678901",
    "wagon_type": "covered",
    "container_numbers": ["KBTU2234567", "KBTU2234568"],
    "goods_description": "Automotive brake assemblies and suspension components, new, in cartons",
    "hs_code": "8708.30",
    "gross_weight": "24800 kg",
    "net_weight": "23200 kg",
    "number_of_packages": 480,
    "customs_declaration_number": "CD-2026-KM-001234",
    "seal_numbers": ["KBTS-20260315-001", "KBTS-20260315-002", "CN-CUSTOMS-887654"],
    "border_crossing": {
      "primary": { "checkpoint": "Mohan", "country_from": "CN", "country_to": "LA" },
      "secondary": { "checkpoint": "Nong Khai", "country_from": "LA", "country_to": "TH" }
    },
    "estimated_arrival": "2026-03-18T14:00:00+07:00",
    "freight_charges": { "currency": "CNY", "amount": 45600.00, "terms": "prepaid" },
    "special_declarations": "Fragile - Handle with care. Keep dry.",
    "document_language": "zh",
    "ocr_languages_detected": ["zh", "en"]
  },
  "confidence": 0.96,
  "field_confidences": {
    "consignment_number": 0.99,
    "sender.name": 0.97,
    "goods_description": 0.94,
    "hs_code": 0.95,
    "seal_numbers": 0.92
  },
  "processing_time_ms": 2140,
  "pages_processed": 3
}

POST /v1/rcn/parse

POST /v1/rcn/parse

Upload a railway consignment note (CIM or SMGS format) for parsing. The API accepts PDF, JPEG, PNG, and TIFF files up to 20 MB. Multi-page documents are fully supported — the parser correlates data across all pages to build a complete extraction.

For documents containing multiple languages (common in CLT corridor shipments), the OCR engine automatically detects and processes all present scripts. Passing the language parameter as the primary language improves extraction accuracy for ambiguous characters.

Request Parameters

filefileRequired. The consignment note file to parse. Accepted formats: PDF, JPEG, PNG, TIFF. Maximum size: 20 MB.
languagestringPrimary language hint for OCR. Values: zh (Chinese), en (English), th (Thai), lo (Lao), ru (Russian). Default: auto (detect).
format_hintstringConsignment note format hint. Values: cim, smgs, auto. Default: auto.
webhook_urlstringURL to receive a POST callback when parsing completes. Must be HTTPS.
prioritystringProcessing priority. Values: normal, high. High priority costs 2x credits. Default: normal.
include_raw_ocrbooleanInclude raw OCR text in the response. Useful for debugging. Default: false.
extract_sealsbooleanEnable seal number detection from images. Requires additional processing. Default: true.
validate_routebooleanValidate station codes and route feasibility against the CLT rail network database. Default: true.

Response Fields

idstringUnique job identifier. Use this to retrieve results later via GET.
statusstringJob status: completed, processing, or failed.
document_typestringAlways rcn for railway consignment notes.
format_detectedstringDetected format: cim or smgs.
dataobjectExtracted fields object. See Field Reference for complete schema.
confidencenumberOverall extraction confidence (0.0 to 1.0).
field_confidencesobjectPer-field confidence scores.
processing_time_msintegerTotal processing time in milliseconds.
pages_processedintegerNumber of pages analyzed.

GET /v1/rcn/{id}

GET /v1/rcn/{id}

Retrieve the parsed results for a previously submitted railway consignment note by its job ID. This endpoint is especially useful when the initial parse request returned a "processing" status, indicating the document is still being analyzed.

Results are retained for 30 days after parsing. After this period, the job ID expires and a 404 error is returned.

Path Parameters

idstringRequired. The job ID returned from the parse endpoint (e.g., job_rcn_8f3a2b1c9d4e).

Query Parameters

include_rawbooleanInclude the raw OCR text output alongside structured data. Default: false.
fieldsstringComma-separated list of fields to return. Returns all fields if omitted. Example: consignment_number,sender,goods_description.
curl https://api.kabytech.com/v1/rcn/job_rcn_8f3a2b1c9d4e \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -G -d "include_raw=false" -d "fields=consignment_number,sender,station_from,station_to,route_via"
{
  "id": "job_rcn_8f3a2b1c9d4e",
  "status": "completed",
  "document_type": "rcn",
  "format_detected": "smgs",
  "data": {
    "consignment_number": "RCNKBT2026005678",
    "sender": {
      "name": "Kunming Precision Auto Parts Co., Ltd.",
      "address": "88 Dianchi Road, Xishan District, Kunming, Yunnan 650228",
      "country": "CN"
    },
    "station_from": { "name": "Kunming South", "code": "KMS", "country": "CN" },
    "station_to": { "name": "Laem Chabang", "code": "LCB", "country": "TH" },
    "route_via": ["Yuxi", "Mohan", "Boten", "Luang Prabang", "Vientiane", "Nong Khai", "Laem Chabang"]
  },
  "confidence": 0.96,
  "processing_time_ms": 2140
}

POST /v1/rcn/batch

POST /v1/rcn/batch

Submit up to 50 railway consignment notes for batch processing. Batch parsing is ideal for processing daily manifests, customs declaration packages, or historical document digitization. Each file is processed independently and results are aggregated.

Batch jobs always run asynchronously. Use the returned batch_id to poll for results or provide a webhook_url to receive a callback when all documents are complete.

Request Parameters

files[]file[]Required. Array of document files. Maximum 50 files, 20 MB each. Total batch size limit: 500 MB.
languagestringDefault language hint for all files. Individual files auto-detect if not specified. Default: auto.
format_hintstringDefault format hint: cim, smgs, or auto. Default: auto.
webhook_urlstringURL to receive a POST callback when the entire batch completes.
parallelintegerNumber of concurrent workers (1-10). Higher values process faster but cost more. Default: 3.
curl -X POST https://api.kabytech.com/v1/rcn/batch \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "files[]=@consignment-001.pdf" \
  -F "files[]=@consignment-002.pdf" \
  -F "files[]=@consignment-003.pdf" \
  -F "language=zh" \
  -F "format_hint=smgs" \
  -F "webhook_url=https://your-server.com/webhooks/rcn-batch"
{
  "batch_id": "batch_rcn_7k2m9x4p",
  "status": "processing",
  "total_files": 3,
  "completed": 0,
  "failed": 0,
  "estimated_completion_seconds": 12,
  "results_url": "https://api.kabytech.com/v1/rcn/batch/batch_rcn_7k2m9x4p"
}

GET /v1/status

GET /v1/status

Health check endpoint for the RCN parsing service. Returns current operational status, API version, and queue depth. This endpoint does not require authentication and can be used for monitoring and uptime checks.

curl https://api.kabytech.com/v1/status
{
  "service": "rcn-parser",
  "status": "operational",
  "version": "2.4.1",
  "queue_depth": 7,
  "avg_processing_time_ms": 2050,
  "supported_formats": ["cim", "smgs"],
  "ocr_languages": ["zh", "en", "th", "lo", "ru"],
  "uptime_percent": 99.97,
  "last_incident": "2026-02-10T03:22:00Z"
}

RCN Sections Reference

Railway consignment notes (both CIM and SMGS formats) are organized into standardized sections. The API maps extracted data to these logical sections, making it easy to access specific parts of the document. Each section contains related fields grouped by their function in the consignment note.

Header Section

Core identification fields at the top of the consignment note.

consignment_numberstringUnique consignment note number. Format varies by issuing railway.
formatstringDocument format: cim (CIM/COTIF) or smgs (SMGS/OSJD).
date_of_consignmentstringDate the consignment was accepted by the railway (ISO 8601).
contract_numberstringTransport contract number, if applicable.
reference_numberstringSender's internal reference number.

Sender / Recipient Section

Parties involved in the consignment. Both CIM and SMGS formats capture sender (consignor) and recipient (consignee) details, though field positions differ between formats.

sender.namestringFull legal name of the sender / consignor.
sender.addressstringSender's full address including postal code.
sender.countrystringISO 3166-1 alpha-2 country code (e.g., CN, TH).
sender.contact_phonestringSender's contact phone number.
recipient.namestringFull legal name of the recipient / consignee.
recipient.addressstringRecipient's full address including postal code.
recipient.countrystringISO 3166-1 alpha-2 country code.
recipient.contact_phonestringRecipient's contact phone number.

Route Section

Origin and destination stations, intermediate routing, and border crossing points. The CLT corridor typically routes through Mohan (China) / Boten (Laos) and Nong Khai (Thailand) / Thanaleng (Laos) border crossings.

station_fromobjectOrigin station with name, code, and country fields.
station_toobjectDestination station with name, code, and country fields.
route_viastring[]Ordered list of intermediate stations and border crossings.
border_crossingobjectPrimary and secondary border crossing points with checkpoint names and country pairs.
transit_countriesstring[]List of countries transited (ISO 3166-1 alpha-2 codes).
estimated_arrivalstringEstimated arrival at destination (ISO 8601 datetime).
route_distance_kmnumberTotal route distance in kilometers (when available on document).

Wagon Details Section

Information about the railway wagon(s) and containers used for transport.

wagon_numberstringUnique wagon identification number (UIC or railway-specific format).
wagon_typestringWagon type: covered, open, flat, tank, refrigerated, container.
container_numbersstring[]ISO 6346 container identification numbers, if containerized.
wagon_capacity_tonnesnumberMaximum carrying capacity of the wagon in tonnes.
wagon_tare_weightstringEmpty weight of the wagon.

Goods and Weight Section

Description of goods, quantities, and weight measurements.

goods_descriptionstringFull description of goods being transported.
hs_codestringHarmonized System commodity code (6-10 digits).
gross_weightstringTotal gross weight including packaging (kg).
net_weightstringNet weight of goods excluding packaging (kg).
number_of_packagesintegerTotal number of packages / loading units.
packaging_typestringType of packaging (cartons, pallets, drums, bags, etc.).
dangerous_goods_classstringUN dangerous goods class, if applicable (e.g., 3 for flammable liquids).
special_declarationsstringSpecial handling instructions or declarations.

Customs Section

Customs and border clearance data extracted from the consignment note.

customs_declaration_numberstringCustoms declaration reference number.
customs_valueobjectDeclared customs value with amount and currency fields.
export_license_numberstringExport license reference, if required for the commodity.
import_permit_numberstringImport permit reference at destination country.
phytosanitary_certificatestringPhytosanitary or health certificate number for agricultural goods.

Seals Section

Seal numbers applied to wagons and containers for security verification. The API extracts seal numbers from both printed text and photographed seal images.

seal_numbersstring[]All seal identification numbers found on the document.
seal_typestringType of seal: customs, shipper, carrier, veterinary.
seal_verifiedbooleanWhether seal numbers match known customs seal registries (when validate_route is enabled).

Response Field Reference

Complete reference of all 40+ fields extracted from railway consignment notes. Each field includes a confidence score (0.0 to 1.0) available in the field_confidences object. Fields not present on the source document are returned as null.

consignment_numberstringUnique railway consignment note number.
formatstringDocument format: cim or smgs.
date_of_consignmentstringConsignment acceptance date (ISO 8601).
contract_numberstringTransport contract reference.
reference_numberstringSender's internal reference.
senderobjectSender/consignor with name, address, country, contact_phone.
recipientobjectRecipient/consignee with name, address, country, contact_phone.
station_fromobjectOrigin station with name, code, country.
station_toobjectDestination station with name, code, country.
route_viastring[]Ordered intermediate stations and border crossings.
border_crossingobjectBorder crossing details with primary and secondary checkpoint objects.
transit_countriesstring[]Countries transited (ISO 3166-1 alpha-2).
estimated_arrivalstringEstimated arrival datetime (ISO 8601).
route_distance_kmnumberTotal route distance in kilometers.
wagon_numberstringWagon identification number.
wagon_typestringType of wagon used for transport.
container_numbersstring[]ISO 6346 container IDs.
wagon_capacity_tonnesnumberWagon maximum carrying capacity.
wagon_tare_weightstringWagon empty weight.
goods_descriptionstringFull goods description.
hs_codestringHarmonized System code.
gross_weightstringGross weight including packaging.
net_weightstringNet weight excluding packaging.
number_of_packagesintegerTotal package count.
packaging_typestringPackaging type description.
dangerous_goods_classstringUN dangerous goods classification.
special_declarationsstringSpecial handling instructions.
customs_declaration_numberstringCustoms declaration reference.
customs_valueobjectDeclared value with amount and currency.
export_license_numberstringExport license reference.
import_permit_numberstringImport permit reference.
phytosanitary_certificatestringHealth/phytosanitary certificate number.
seal_numbersstring[]All seal identification numbers.
seal_typestringType of seal applied.
seal_verifiedbooleanWhether seals are verified against registries.
freight_chargesobjectFreight cost with currency, amount, terms.
payment_methodstringPayment method: prepaid, collect, third_party.
document_languagestringPrimary document language detected.
ocr_languages_detectedstring[]All languages detected by OCR.
issuing_railwaystringName of the issuing railway company.
date_of_issuestringDocument issue date (ISO 8601).

Error Codes

The API returns standard HTTP status codes along with a JSON error body containing a machine-readable code and a human-readable message. Use the code field for programmatic error handling.

400INVALID_FILE_TYPEThe uploaded file is not a supported format (PDF, JPEG, PNG, TIFF).
400FILE_TOO_LARGEFile exceeds the 20 MB size limit.
400INVALID_FORMAT_HINTThe format_hint parameter must be cim, smgs, or auto.
401UNAUTHORIZEDMissing or invalid API key in the Authorization header.
403FORBIDDENAPI key does not have permission for this operation.
404JOB_NOT_FOUNDThe specified job ID does not exist or has expired (30-day retention).
409DUPLICATE_SUBMISSIONThis exact file has already been submitted within the last 5 minutes. Use the existing job ID.
422UNPROCESSABLE_DOCUMENTThe document could not be parsed. It may be corrupted, blank, or not a railway consignment note.
422LOW_QUALITY_IMAGEImage resolution is too low for reliable OCR (minimum 150 DPI recommended).
429RATE_LIMITEDRequest rate exceeds your plan's limits. Retry after the Retry-After header interval.
500INTERNAL_ERRORAn unexpected server error occurred. Contact support if this persists.
503SERVICE_UNAVAILABLEThe RCN parser is temporarily unavailable due to maintenance or high load.

Rate Limits

Rate limits are applied per API key and vary by plan tier. Limits are enforced using a sliding window algorithm. The API returns rate limit headers with every response:

Free10 req/min100 documents/month. Single file processing only (no batch). Community support.
Starter60 req/min2,000 documents/month. Batch processing up to 10 files. Email support.
Professional300 req/min20,000 documents/month. Batch up to 50 files. Priority support with 4-hour SLA.
EnterpriseCustomUnlimited documents. Dedicated infrastructure. 24/7 support with 1-hour SLA. Custom SLA.

Official SDKs

KabyTech provides official SDKs for popular languages to simplify integration with the RCN API. All SDKs handle authentication, retries, file uploads, and response parsing automatically.

# Python
pip install kabytech
from kabytech import KabyTech
client = KabyTech(api_key="YOUR_API_KEY")
result = client.rcn.parse("consignment-note.pdf", language="zh", format_hint="smgs")
print(result.data.consignment_number)
print(result.data.sender.name)
print(result.data.route_via)
// Node.js
npm install @kabytech/sdk
const { KabyTech } = require("@kabytech/sdk");
const client = new KabyTech({ apiKey: "YOUR_API_KEY" });
const result = await client.rcn.parse("consignment-note.pdf", {
  language: "zh",
  formatHint: "smgs",
  validateRoute: true
});
console.log(result.data.consignmentNumber);
console.log(result.data.sender.name);
console.log(result.data.borderCrossing.primary.checkpoint);

Additional SDKs available: Go (go get github.com/kabytech/kabytech-go), Java (Maven Central: com.kabytech:kabytech-sdk), PHP (composer require kabytech/sdk). Full SDK documentation is available at docs.kabytech.com/sdks.

Ready to integrate?

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