TrailerID API Reference
Welcome to the Plate Recognizer TrailerID API! Our API allows you to seamlessly extract trailer identification numbers from images with high accuracy and efficiency.
For comprehensive guidelines on utilizing TrailerID Cloud, please refer to our detailed documentation here.
We offer support for multiple programming languages. Scroll down to explore code examples in various languages for easy integration.
TrailerID Cloud API​
Authentication​
TrailerID Cloud is only available to registered users. Sign up for a Free Trial and get an API Token. It has to be included in all API calls. The HTTP headers must contain:
Authorization: Token YOUR_API_TOKEN
For the commands below, make sure to replace YOUR_API_TOKEN
with your API Token. For example, Authorization: Token 3a0effff73919f898b69ac65a32dc12347769564
.
Get your token from, here.
Read Number Plates from an Image​
HTTP Request​
POST https://api.platerecognizer.com/v1/trailerid-reader/
The CORS
policy of this endpoint allows requests from all origins.
POST Parameters​
Parameter | Required | Description |
---|---|---|
upload | Yes | The file to be uploaded. The parameter can either be the file bytes (using Content-Type multipart/form-data) OR a base64 encoded image. This parameter becomes optional if upload_url parameter is present. |
upload_url | No | The url of file to be uploaded. This parameter is to be used as an alternative to upload parameter. |
camera_id | No | Unique camera identifier. |
timestamp | No | ISO 8601 timestamp. For example, 2019-08-19T13:11:25. The timestamp has to be in UTC. |
- Shell
- Ruby
- Python
- JavaScript
#On Linux
curl -F "upload=@/your-image.jpg" \
-H "Authorization: Token YOUR_API_TOKEN" \
https://api.platerecognizer.com/v1/trailerid-reader/
#Calling the API with an image URL.
curl -X POST -F upload_url="https://www.demo.com/static/your-image.jpg" -H "Authorization: Token YOUR_API_TOKEN" https://api.platerecognizer.com/v1/trailerid-reader
#On Windows
curl -F "upload=@your-image.jpg" ^
-H "Authorization: Token YOUR_API_TOKEN" ^
https://api.platerecognizer.com/v1/trailerid-reader/
#gem install multipart-post
require 'net/http/post/multipart'
url = URI.parse('https://api.platerecognizer.com/v1/trailerid-reader/')
path = '/path/to/your-image.jpg'
File.open(path) do |jpg|
req = Net::HTTP::Post::Multipart.new url.path,
"upload" => UploadIO.new(jpg, "image/jpeg", path)
req['Authorization'] = 'Token YOUR_API_TOKEN'
res = Net::HTTP.start(url.host, url.port, use_ssl: true) do |http|
http.request(req)
end
end
import requests
from pprint import pprint
with open('/path/to/your-image.jpg', 'rb') as fp:
response = requests.post(
'https://api.platerecognizer.com/v1/trailerid-reader/',
files=dict(upload=fp),
headers={'Authorization': 'Token YOUR_API_TOKEN'})
#For files field, if needed, use imencode method of cv2 library to encode an image and producing a compressed representation that can be easier stored, transmitted, or processed.
#import cv2
#success, image_jpg = cv2.imencode('.jpg', fp)
#files=dict(upload=image_jpg.tostring())
pprint(response.json())
# With OpenCV
import cv2
success, image_jpg = cv2.imencode('.jpg', image)
files={'upload':image_jpg.tostring()}
response = requests.post(
'https://api.platerecognizer.com/v1/trailerid-reader/',
headers={'Authorization': 'Token YOUR_API_TOKEN'})
// Using Node-RED?
// Check https://github.com/parkpow/node-red-contrib-plate-recognizer
const fetch = require("node-fetch");
const FormData = require("form-data");
const fs = require("fs");
let image_path = "/path/to/your-image.jpg";
let body = new FormData();
body.append("upload", fs.createReadStream(image_path));
// Or body.append('upload', base64Image);
fetch("https://api.platerecognizer.com/v1/trailerid-reader/", {
method: "POST",
headers: {
Authorization: "Token YOUR_API_TOKEN",
},
body: body,
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch((err) => {
console.log(err);
});
Response​
{
"processing_time": 128.758,
"results": [
{
"identifier": {
"type": "text",
"box": {
"xmin": 100,
"ymin": 200,
"xmax": 650,
"ymax": 400
},
"props": {
"code": [
{
"value": "12345"
}
],
"orientation": [
{
"value": "horizontal"
}
]
}
}
}
],
"filename": "image.jpg",
"version": 1,
"camera_id": null,
"timestamp": "2025-03-22T13:26:01.683008Z"
}
Attribute | Description |
---|---|
results/identifier/box | Trailer's identifier bounding box. |
results/identifier/code | Text of the trailer's identifier |
results/identifier/orientation | The orientation of the trailer's identifier. One of vertical, horizontal. |