USDOT OCR API Reference
Welcome to the USDOT OCR API! Use it to read USDOT identifiers from images of trucks.
Cloud and On-premises share the same inference engine and the same parameters. They differ in the endpoint, in authentication, in some default values, and in the format of the JSON response. See Parameters and Response.
USDOT OCR Cloud API​
Authentication​
All API calls must include an Authorization header containing the API Token in the format below:
Authorization: Token YOUR_API_TOKEN
For the commands below, make sure to replace YOUR_API_TOKEN with your API Token. For example, Authorization: Token abcdef123456xxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Get your token from your USDOT account page. Never commit this value to source control.
Read USDOT Identifier from an Image​
HTTP Request​
POST https://usdot.parkpow.com/api/v1/predict/
POST Parameters​
See Parameters for the full description. Only image is required.
- Shell
- Python
# Download a test picture
curl -o usdot.jpg https://app.platerecognizer.com/static/usdot_demo.jpg
# Upload to the API
curl -H "Authorization: Token YOUR_API_TOKEN" \
-F "[email protected]" \
https://usdot.parkpow.com/api/v1/predict/
# Upload with optional parameters
curl -H "Authorization: Token YOUR_API_TOKEN" \
-F "[email protected]" \
-F "camera_id=my-camera-1" \
-F 'config={"text_rule":"strict","text_formats":["USDOT[0-9]{7}"]}' \
https://usdot.parkpow.com/api/v1/predict/
import requests
from pprint import pprint
# Download a test picture
# curl -o /tmp/usdot.jpg https://app.platerecognizer.com/static/usdot_demo.jpg
with open("/tmp/usdot.jpg", "rb") as fp:
response = requests.post(
"https://usdot.parkpow.com/api/v1/predict/",
files=dict(image=fp),
data=dict(camera_id="my-camera-1"),
headers={"Authorization": "Token YOUR_API_TOKEN"},
)
pprint(response.json())
Webhooks are only supported on On-premises. When you use the Cloud API, read the results from the response of the call.
Usage Statistics​
Get the API usage of the current month.
HTTP Request​
GET https://usdot.parkpow.com/api/v1/statistics/
curl -H "Authorization: Token YOUR_API_TOKEN" https://usdot.parkpow.com/api/v1/statistics/
JSON Response​
| Field | Description |
|---|---|
lookup_limit | Total API usage limit for a month |
lookup_usage | Number of API calls made during the current period |
resets_on | Date and time when the usage counter resets |
USDOT OCR On-premises API​
Authentication​
The On-premises API does not require an Authorization header. The container is licensed during installation. See Install, Upgrade.
In all examples below replace localhost with the IP address of the machine running the docker container, if not the same one.
Read USDOT Identifier from an Image​
HTTP Request​
POST http://localhost:8001/predict/
POST Parameters​
See Parameters for the full description. Only image is required.
# Download a test picture
curl -o usdot.jpg https://app.platerecognizer.com/static/usdot_demo.jpg
# Upload to the API
curl -F '[email protected]' http://localhost:8001/predict/
# Upload with optional parameters
curl -F '[email protected]' \
-F 'camera_id=1' \
-F 'timestamp=2023-01-01T12:00:00' \
-F 'min_detection_score=0.2' \
-F 'min_ocr_score=0.6' \
http://localhost:8001/predict/
On-premises can also send each result to a webhook.
SDK Information​
Returns the SDK version, the number of recognitions made, and the configured webhooks.
HTTP Request​
GET http://localhost:8001/info/
curl http://localhost:8001/info/
Parameters​
These parameters are accepted by the Cloud and the On-premises predict endpoint.
| Parameter | Required | Description |
|---|---|---|
image | Yes | Image file to analyze. Must start with the @ symbol in curl. For example, image=@/tmp/usdot.jpg. |
min_detection_score | No | Skip detected regions of text with a score below this value (between 0 and 1). Default: 0.1 On-premises, 0.42 Cloud. Overrides threshold_d in config. |
min_ocr_score | No | Skip OCR readings with a score below this value (between 0 and 1). Default: 0.2 On-premises, 0.15 Cloud. Overrides threshold_o in config. |
camera_id | No | Unique key to identify the source of the image when you have multiple sources. Returned in the response if passed. Does not influence the recognition. |
timestamp | No | Time the image was taken, to differentiate between images. Defaults to the current time in ISO format. Returned in the response. Does not influence the recognition. |
config | No | JSON dictionary to adjust the engine. See config. |
config​
Pass the config parameter as a JSON dictionary to adjust the engine configuration. Accepted values:
-
{"text_formats":["..."]}: List of regular expressions that the readings are matched against. For example, if you know the output is generallyUSDOTfollowed by 7 digits, you would use{"text_formats":["USDOT[0-9]{7}"]}. More information about the format. -
{"text_rule":"strict"}: Only accept the readings that match one of the templates in"text_formats". For example, with the template above, the valueUSDOT05573is discarded. There are no default USDOT templates, sostricthas no effect unless you also send"text_formats". -
{"text_rule":"normal"}(default): The templates in"text_formats"are used to prefer the readings that match them, but if no reading matches, the engine returns what it read instead of discarding it. -
{"threshold_d":0.1}: Same asmin_detection_score. If both are sent,min_detection_scorewins. -
{"threshold_o":0.2}: Same asmin_ocr_score. If both are sent,min_ocr_scorewins.
You can combine several values in one dictionary:
curl -F '[email protected]' \
-F 'config={"text_rule":"strict","text_formats":["USDOT[0-9]{7}"],"threshold_o":0.1}' \
http://localhost:8001/predict/
New in version 0.1.6.
Response​
Cloud and On-premises return different JSON formats. Select your deployment below.
- Cloud
- On-premises
{
"original_width": 280,
"original_height": 280,
"results": [
{
"texts": [{ "value": "USDOT0557341Z", "score": 0.99888915 }],
"object": {
"score": 0.7782135009765625,
"label": "usdot",
"value": {
"xmin": 0.2525801956653595,
"xmax": 0.7522493004798889,
"ymin": 0.3767074644565582,
"ymax": 0.49078893661499023
}
}
}
],
"processing_time": 2110.444,
"timestamp": "2025-09-13T17:35:56.030478+00:00",
"camera_id": "my-camera-1"
}
| Field | Description |
|---|---|
original_width | Width of the image in pixels |
original_height | Height of the image in pixels |
results | List of detected USDOT readings |
results[].texts | Texts read by the OCR engine for the detected region |
results[].texts[].value | Text read from the image |
results[].texts[].score | OCR confidence score, between 0 and 1 |
results[].object.label | Type of text detected, always usdot |
results[].object.score | Detection confidence score, between 0 and 1 |
results[].object.value | Bounding box of the text: xmin, ymin, xmax and ymax, as a fraction of the image width and height |
processing_time | Time taken by the processing engine, in milliseconds |
timestamp | Timestamp of the request, in ISO format |
camera_id | ID as passed in the request. Only present if sent |
{
"timestamp": "2025-09-13T17:35:56.030478+00:00",
"camera_id": "my-camera-1",
"results": [
{
"box": [0.3767, 0.2526, 0.4908, 0.7522],
"score": 0.778,
"label": "usdot",
"rotation": 0,
"texts": [{ "value": "USDOT0557341", "score": 0.999 }],
"height": 280,
"width": 280
}
],
"original_width": 280,
"original_height": 280,
"usage": { "calls": 120, "max_calls": 2500 },
"processing_time": 2110.444
}
| Field | Description |
|---|---|
timestamp | Value of the timestamp parameter, or the time of the request if it was not sent |
camera_id | ID as passed in the request, or null if it was not sent |
results | List of detected USDOT readings |
results[].box | Bounding box of the text as [ymin, xmin, ymax, xmax], as a fraction of the image height and width |
results[].score | Detection confidence score, between 0 and 1 |
results[].label | Type of text detected, always usdot |
results[].rotation | Orientation of the text in degrees: 0 for horizontal text, 90 for vertical text |
results[].texts | Texts read by the OCR engine for the detected region |
results[].texts[].value | Text read from the image |
results[].texts[].score | OCR confidence score, between 0 and 1 |
results[].height | Height of the image in pixels |
results[].width | Width of the image in pixels |
original_width | Width of the image in pixels |
original_height | Height of the image in pixels |
usage | License usage: calls is the number of recognitions in the current period, max_calls is the license limit |
processing_time | Time taken by the processing engine, in milliseconds |
Webhook payload
On-premises webhooks send the response above inside a data field, together with a hook field that identifies the webhook:
{
"hook": {
"target": "https://webhook.site/6db201cf-ac3f-4cf7-8b63-2b10700bc2e1",
"id": 1,
"event": "image.done"
},
"data": {
"timestamp": "2025-09-13T17:35:56.030478+00:00",
"camera_id": "my-camera-1",
"results": [
{
"box": [0.3767, 0.2526, 0.4908, 0.7522],
"score": 0.778,
"label": "usdot",
"rotation": 0,
"texts": [{ "value": "USDOT0557341", "score": 0.999 }],
"height": 280,
"width": 280
}
],
"original_width": 280,
"original_height": 280,
"usage": { "calls": 120, "max_calls": 2500 },
"processing_time": 2110.444
}
}