Skip to main content

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

danger

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.

# 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/
note

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​

FieldDescription
lookup_limitTotal API usage limit for a month
lookup_usageNumber of API calls made during the current period
resets_onDate 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.

note

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.

ParameterRequiredDescription
imageYesImage file to analyze. Must start with the @ symbol in curl. For example, image=@/tmp/usdot.jpg.
min_detection_scoreNoSkip 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_scoreNoSkip 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_idNoUnique key to identify the source of the image when you have multiple sources. Returned in the response if passed. Does not influence the recognition.
timestampNoTime 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.
configNoJSON 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 generally USDOT followed 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 value USDOT05573 is discarded. There are no default USDOT templates, so strict has 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 as min_detection_score. If both are sent, min_detection_score wins.

  • {"threshold_o":0.2}: Same as min_ocr_score. If both are sent, min_ocr_score wins.

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.

{
"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"
}
FieldDescription
original_widthWidth of the image in pixels
original_heightHeight of the image in pixels
resultsList of detected USDOT readings
results[].textsTexts read by the OCR engine for the detected region
results[].texts[].valueText read from the image
results[].texts[].scoreOCR confidence score, between 0 and 1
results[].object.labelType of text detected, always usdot
results[].object.scoreDetection confidence score, between 0 and 1
results[].object.valueBounding box of the text: xmin, ymin, xmax and ymax, as a fraction of the image width and height
processing_timeTime taken by the processing engine, in milliseconds
timestampTimestamp of the request, in ISO format
camera_idID as passed in the request. Only present if sent