Container OCR API ISO 6346 Shipping Container Number Extraction
Streamline your logistics and port operations with our Container OCR API. We provide highly accurate extraction of the standard 11-character ISO 6346 shipping container numbers from images. The engine automatically parses the owner code (BIC), equipment category, serial number, and check digit, performing strict mathematical validation to ensure absolute data reliability for your Terminal Operating Systems (TOS) or yard management workflows.
- Port Automation
- Freight Tracking
- Yard Management
Endpoint
POSThttps://api.structocr.com/v1/containerRequest Parameters
Important: This endpoint requires application/json Content-Type. Images must be sent as Base64 strings.
| Parameter | In | Required | Description |
|---|---|---|---|
| x-api-key | Header | Required | Your unique API key generated from the dashboard. |
| Content-Type | Header | Required | Must be set to application/json. |
| img | Body (JSON) | Required | The Base64 encoded string of the shipping container image.
|
Response Schema
The following fields are extracted into the data object. The engine automatically separates the standard ISO 6346 components.
| Field | Description |
|---|---|
| container_number | The full 11-character ISO 6346 container identification sequence. |
| is_valid | Boolean indicating if the check digit math validates correctly against the ISO 6346 standard algorithm. |
| confidence | The confidence level of the recognition (High, Medium, Low). |
| parsed.owner_code | The 3-letter Owner Code (BIC code) identifying the principal operator. |
| parsed.category | The 1-letter Equipment Category Identifier (typically 'U' for freight containers, 'J', or 'Z'). |
| parsed.serial_number | The 6-digit Serial Number assigned by the owner. |
| parsed.check_digit | The 1-digit Check Digit used to validate the entire container number. |
Code Examples
Request Implementation
curl -X POST https://api.structocr.com/v1/container \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"img": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."
}'Success Response (200 OK)
{
"success": true,
"data": {
"container_number": "ZCSU8921655",
"is_valid": true,
"confidence": "High",
"parsed": {
"owner_code": "ZCS",
"category": "U",
"serial_number": "892165",
"check_digit": "5"
}
}
}Error Responses
400 Bad Request - Invalid Input
Returned when JSON is invalid or image data is missing/corrupt.
{
"status": 400,
"code": "INVALID_REQUEST_FORMAT",
// or "INVALID_JSON", "INVALID_BASE64_FORMAT"
"message":"The image data in 'img' field is malformed. Please check for illegal characters (spaces, newlines) or incorrect Base64 encoding."
}402 Payment Required - Insufficient Credits
{
"status": 402,
"code": "INSUFFICIENT_CREDITS",
"message": "Your account balance is insufficient to complete this operation."
}413 Payload Too Large
The Base64 decoded image size exceeds 4.5MB.
{
"error": "FILE_TOO_LARGE"
}415 Unsupported Media Type
{
"error": "INVALID_CONTENT_TYPE_USE_JSON"
}422 Unprocessable Entity - Policy Violation
{
"status": 422,
"code": "CONTENT_POLICY_VIOLATION",
"message": "The document content could not be processed due to safety policies."
}500 Internal Server Error
{
"status": 500,
"code": "PROCESSING_ERROR",
"message": "An internal error occurred while processing the document..."
}503 Service Unavailable - System Busy
{
"status": 503,
"code": "SYSTEM_BUSY",
"message": "StructOCR is currently processing a high volume of requests..."
}Status Code Definitions
| Code | Error Code | Description |
|---|---|---|
| 200 | SUCCESS | Recognition success |
| 400 | INVALID_REQUEST_FORMAT | Invalid payload or corrupted Base64. Ensure the image string has no whitespace, newlines, or illegal characters. |
| 402 | INSUFFICIENT_CREDITS | Account balance too low |
| 413 | FILE_TOO_LARGE | Decoded image exceeds 4.5MB |
| 415 | INVALID_CONTENT_TYPE | Not using application/json |
| 422 | CONTENT_POLICY_VIOLATION | AI safety/policy block |
| 503 | SYSTEM_BUSY | API Rate limit reached |