HIN OCR API
Automate marine vessel verification with our specialized HIN OCR API. We provide high-precision extraction for 15-character Hull Identification Numbers from low-contrast transom engravings, fiberglass embossments, and metal plates. The engine features built-in ISO 10087 strict format validation, prohibited character checks (I, O, Q), and a dynamic sliding-window algorithm to accurately resolve 20th and 21st-century model years.
Endpoint
POSThttps://api.structocr.com/v1/hinRequest 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 hull image.
|
Response Schema
The extracted and validated data is returned in the data object. The API automatically parses ISO 10087 structures and calculates full production years.
| Field | Type | Description |
|---|---|---|
| hin_number | String | null | The 15-character Hull Identification Number. Auto-formats with a hyphen (e.g., US-...). |
| is_valid | Boolean | True if the HIN passes ISO 10087 format rules and prohibited character checks. |
| validation_error | String | null | Provides specific error details if validation fails (e.g., "Contains prohibited characters (I, O, Q)"). |
| confidence | String | Recognition confidence ("High", "Medium", "Low", or "Medium (Validation Failed)"). |
| parsed | Object | null | Structured breakdown of the HIN. Will be populated if the base format is valid. |
| parsed.country_code | String | 2-character country of origin code (e.g., 'US', 'CN'). |
| parsed.manufacturer_code | String | 3-character Manufacturer Identification Code (MIC). |
| parsed.serial_number | String | 5-character hull serial number. |
| parsed.production_month | String | Full month name mapped from standard letter codes A-L (e.g., 'February'). |
| parsed.production_year_short | String | Single digit representing the production year ending. |
| parsed.model_year | String | Full 4-digit model year resolved dynamically (e.g., '1999', '2024'). |
Code Examples
Request Implementation
curl -X POST https://api.structocr.com/v1/hin \
-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": {
"hin_number": "US-TNPD7474B899",
"is_valid": true,
"validation_error": null,
"confidence": "High",
"parsed": {
"country_code": "US",
"manufacturer_code": "TNP",
"serial_number": "D7474",
"production_month": "February",
"production_year_short": "8",
"model_year": "1999"
}
}
}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": "HIN OCR is currently busy. Please try again."
}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 |