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/hin

Request Parameters

Important: This endpoint requires application/json Content-Type. Images must be sent as Base64 strings.

ParameterInRequiredDescription
x-api-keyHeaderRequiredYour unique API key generated from the dashboard.
Content-TypeHeaderRequiredMust be set to application/json.
imgBody (JSON)RequiredThe Base64 encoded string of the hull image.
  • Supports standard Data URI (e.g., data:image/jpeg;base64,...)
  • Supports raw Base64 strings
  • Max file size: 4.5MB
  • Formats: JPG, PNG, WebP

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.

FieldTypeDescription
hin_numberString | nullThe 15-character Hull Identification Number. Auto-formats with a hyphen (e.g., US-...).
is_validBooleanTrue if the HIN passes ISO 10087 format rules and prohibited character checks.
validation_errorString | nullProvides specific error details if validation fails (e.g., "Contains prohibited characters (I, O, Q)").
confidenceStringRecognition confidence ("High", "Medium", "Low", or "Medium (Validation Failed)").
parsedObject | nullStructured breakdown of the HIN. Will be populated if the base format is valid.
parsed.country_codeString2-character country of origin code (e.g., 'US', 'CN').
parsed.manufacturer_codeString3-character Manufacturer Identification Code (MIC).
parsed.serial_numberString5-character hull serial number.
parsed.production_monthStringFull month name mapped from standard letter codes A-L (e.g., 'February').
parsed.production_year_shortStringSingle digit representing the production year ending.
parsed.model_yearStringFull 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)

JSON EXAMPLE
{
  "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

CodeError CodeDescription
200SUCCESSRecognition success
400INVALID_REQUEST_FORMATInvalid payload or corrupted Base64. Ensure the image string has no whitespace, newlines, or illegal characters.
402INSUFFICIENT_CREDITSAccount balance too low
413FILE_TOO_LARGEDecoded image exceeds 4.5MB
415INVALID_CONTENT_TYPENot using application/json
422CONTENT_POLICY_VIOLATIONAI safety/policy block
503SYSTEM_BUSYAPI Rate limit reached