OCR
Extract text from license plates and VIN images.
This page shows how to use the VehiCore OCR APIs to extract text from vehicle images — license plates and VINs. All endpoints use multipart/form-data and the X-API-Key header.
Plate OCR
Extract license plate text from an image.
POST /api/ocr/{type} with type = plate or vin. For license plates use /api/ocr/plate.
Request
Headers
| Field | Type | Required | Description |
|---|---|---|---|
X-API-Key | string | Yes | Your API key. |
Body (multipart/form-data)
| Field | Type | Required | Description |
|---|---|---|---|
image | file | Yes | Image file (JPG, PNG, etc.). |
userLanguage | string | No | Language code (e.g. en). Default: en. |
Example request
curl -X POST "https://vehicore-api.dev-stage.fyi/api/ocr/plate" \
-H "X-API-Key: YOUR_API_KEY" \
-F "image=@/path/to/plate.jpg" \
-F "userLanguage=en"import fs from 'node:fs';
const formData = new FormData();
const buf = fs.readFileSync('/path/to/plate.jpg');
formData.append('image', new Blob([buf], { type: 'image/jpeg' }), 'plate.jpg');
formData.append('userLanguage', 'en');
const response = await fetch('https://vehicore-api.dev-stage.fyi/api/ocr/plate', {
method: 'POST',
headers: { 'X-API-Key': process.env.VEHICORE_API_KEY },
body: formData,
});
const data = await response.json();import os
import requests
url = "https://vehicore-api.dev-stage.fyi/api/ocr/plate"
headers = {"X-API-Key": os.environ["VEHICORE_API_KEY"]}
files = {"image": open("/path/to/plate.jpg", "rb")}
data = {"userLanguage": "en"}
response = requests.post(url, headers=headers, files=files, data=data)
print(response.json())import okhttp3.*;
import java.io.File;
RequestBody body = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "plate.jpg",
RequestBody.create(new File("/path/to/plate.jpg"), MediaType.parse("image/jpeg")))
.addFormDataPart("userLanguage", "en")
.build();
Request request = new Request.Builder()
.url("https://vehicore-api.dev-stage.fyi/api/ocr/plate")
.header("X-API-Key", System.getenv("VEHICORE_API_KEY"))
.post(body)
.build();
OkHttpClient client = new OkHttpClient();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}body := &bytes.Buffer{}
w := multipart.NewWriter(body)
f, _ := os.Open("/path/to/plate.jpg")
part, _ := w.CreateFormFile("image", "plate.jpg")
io.Copy(part, f)
f.Close()
w.WriteField("userLanguage", "en")
w.Close()
req, _ := http.NewRequest("POST", "https://vehicore-api.dev-stage.fyi/api/ocr/plate", body)
req.Header.Set("X-API-Key", os.Getenv("VEHICORE_API_KEY"))
req.Header.Set("Content-Type", w.FormDataContentType())
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
io.Copy(os.Stdout, resp.Body)Response
On success the API returns { "result": "extracted text" }. See Swagger for the full schema.
Possible errors
All error responses use the shape { "message": "Human-readable text", "code": "OPTIONAL_CODE" }. See Error responses for details.
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Bad Request — invalid or missing image, unsupported format, or other validation failure. |
| 401 | UNAUTHORIZED | Unauthorized — missing or invalid X-API-Key. |
| 402 | INSUFFICIENT_CREDITS | Payment Required — insufficient credits for this product. Purchase more from the Billing page. |
| 500 | — | Internal Server Error — unexpected server error; retry later. |
VIN OCR
Extract VIN (Vehicle Identification Number) from an image.
POST /api/ocr/vin (same path as Plate OCR with type = vin).
Request
Headers
| Field | Type | Required | Description |
|---|---|---|---|
X-API-Key | string | Yes | Your API key. |
Body (multipart/form-data)
| Field | Type | Required | Description |
|---|---|---|---|
image | file | Yes | Image containing the VIN. |
userLanguage | string | No | Language code (e.g. en). |
Example request
curl -X POST "https://vehicore-api.dev-stage.fyi/api/ocr/vin" \
-H "X-API-Key: YOUR_API_KEY" \
-F "image=@/path/to/vin.jpg" \
-F "userLanguage=en"import fs from 'node:fs';
const formData = new FormData();
const buf = fs.readFileSync('/path/to/vin.jpg');
formData.append('image', new Blob([buf], { type: 'image/jpeg' }), 'vin.jpg');
formData.append('userLanguage', 'en');
const response = await fetch('https://vehicore-api.dev-stage.fyi/api/ocr/vin', {
method: 'POST',
headers: { 'X-API-Key': process.env.VEHICORE_API_KEY },
body: formData,
});
const data = await response.json();import os
import requests
url = "https://vehicore-api.dev-stage.fyi/api/ocr/vin"
headers = {"X-API-Key": os.environ["VEHICORE_API_KEY"]}
files = {"image": open("/path/to/vin.jpg", "rb")}
data = {"userLanguage": "en"}
response = requests.post(url, headers=headers, files=files, data=data)
print(response.json())RequestBody body = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "vin.jpg",
RequestBody.create(new File("/path/to/vin.jpg"), MediaType.parse("image/jpeg")))
.addFormDataPart("userLanguage", "en")
.build();
Request request = new Request.Builder()
.url("https://vehicore-api.dev-stage.fyi/api/ocr/vin")
.header("X-API-Key", System.getenv("VEHICORE_API_KEY"))
.post(body)
.build();
try (Response response = new OkHttpClient().newCall(request).execute()) {
System.out.println(response.body().string());
}body := &bytes.Buffer{}
w := multipart.NewWriter(body)
f, _ := os.Open("/path/to/vin.jpg")
part, _ := w.CreateFormFile("image", "vin.jpg")
io.Copy(part, f)
f.Close()
w.WriteField("userLanguage", "en")
w.Close()
req, _ := http.NewRequest("POST", "https://vehicore-api.dev-stage.fyi/api/ocr/vin", body)
req.Header.Set("X-API-Key", os.Getenv("VEHICORE_API_KEY"))
req.Header.Set("Content-Type", w.FormDataContentType())
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
io.Copy(os.Stdout, resp.Body)Response
On success the API returns { "result": "extracted VIN or text" }. See Swagger for the full schema.
Possible errors
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Bad Request — invalid or missing image, or other validation failure. |
| 401 | UNAUTHORIZED | Unauthorized — missing or invalid X-API-Key. |
| 402 | INSUFFICIENT_CREDITS | Payment Required — insufficient credits. Purchase more from Billing. |
| 500 | — | Internal Server Error — unexpected server error; retry later. |