VIN OCR

Seamlessly automate vehicle verification with our enterprise-grade VIN OCR API. We provide high-precision extraction for 17-character Vehicle Identification Numbers from windshields, door jamb stickers, and metal plates. The engine features built-in ISO 3779 logic to automatically correct common OCR errors (e.g., converting 'I' to '1', 'Q' to '0') and ensure data validity for your insurance or fleet management workflows.


Endpoint

POSThttps://api.structocr.com/v1/vin

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 vehicle image (windshield, sticker, etc).
  • 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 following fields are extracted into the data object. The engine automatically normalizes characters (e.g. upper-case).

FieldDescription
vinThe 17-character Vehicle Identification Number (ISO 3779 corrected).
confidenceThe confidence level of the recognition (High, Medium, Low).
carrier_typeThe detected location of the VIN (e.g., 'windshield', 'sticker_label', 'metal_plate').

Code Examples

Request Implementation

curl -X POST https://api.structocr.com/v1/vin \
  -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": {
    "vin": "1M8GDM9A6KP042788",
    "confidence": "High",
    "carrier_type": "windshield"
  }
}

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

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