Skip to main content

Shipping Container Images API Reference

Welcome to the Shipping Container Images API! Use it to read shipping container identifiers from images.

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.

Shipping Container Images 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 Shipping Container account. Never commit this value to source control.

Read Container Information from an Image​

HTTP Request​

POST https://container-api.parkpow.com/api/v1/predict/

POST Parameters​

See Parameters for the full description. Only image is required.

# Download a test picture
curl -o container.jpg https://app.platerecognizer.com/static/container_demo.jpg

# Upload to the API
curl -H "Authorization: Token YOUR_API_TOKEN" \
-F "[email protected]" \
https://container-api.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":"normal"}' \
https://container-api.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://container-api.parkpow.com/api/v1/statistics/

curl -H "Authorization: Token YOUR_API_TOKEN" https://container-api.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

Shipping Container Images 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.

Previously available Swagger UI is no longer supported.

Read Container Information 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 container.jpg https://app.platerecognizer.com/static/container_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/container.jpg.
min_detection_scoreNoSkip detected regions of text with a score below this value (between 0 and 1). Default: 0.1 On-premises, 0.25 Cloud. Overrides threshold_d in config.
min_ocr_scoreNoSkip OCR readings with a score below this value (between 0 and 1). Default: 0.2. 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.
postprocessingNoCloud only. Deprecated, use config instead. Accepted values are strict (default) and none.

config​

Pass the config parameter as a JSON dictionary to adjust the engine configuration. Accepted values:

  • {"text_rule":"strict"} (default): Only accept the results that exactly match the default templates for each label, or the templates specified in "text_formats". For example, the Serial Number label requires exactly 7 digits, so the 8-digit value 43001061 is discarded. The engine also checks the Owner Code and Serial Number pair against the ISO 6346 check digit, and prefers the pair that is valid.

  • {"text_rule":"normal"}: Turns off strict matching. The templates are still used to prefer the readings that match them, but if no reading matches, the engine returns what it read instead of discarding it. The ISO 6346 check digit is not enforced. Use this to see the raw readings, for example when you suspect a valid text is being discarded. See text_rule.

  • {"text_formats":["..."]}: List of regular expressions. They replace the default templates for every label. For example, if you know the output is generally 3 digits and 2 letters, you would use {"text_formats":["[0-9][0-9][0-9][A-Z][A-Z]"]}. More information about the format. With "text_rule":"normal" the engine may not follow the format when the predictions are too different. If you want to exactly match the regexp, you should also use "text_rule":"strict".

  • {"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":"normal","threshold_d":0.05,"threshold_o":0.05}' \
http://localhost:8001/predict/

New in version 0.7.0.

text_rule: strict vs normal​

Behaviorstrict (default)normal
Readings that do not match the template for the label (Serial Number, Size and Type Codes, Owner Code and Category Identifier)DiscardedKept, only when no reading matches the template
Readings that match the templateKeptPreferred over those that do not match
ISO 6346 check digit between Owner Code and Serial NumberUsed to select the valid pairNot used

Default templates per label:

  • Serial Number: exactly 7 digits (6 digits plus the check digit).
  • Size and Type Codes: 4 characters. The first is a digit from 1 to 5 or a letter from A to N or P. The second is 0, 2, a digit from 4 to 9, or one of C, D, E, F, L, M, N, P, R, S, T, U. The last two are any letter or digit. For example, 22G1.
  • Owner Code and Category Identifier: 3 letters followed by J, U or Z, for example MSKU.

Response​

Cloud and On-premises return different JSON formats. Select your deployment below.

{
"original_width": 496,
"original_height": 496,
"results": [
{
"texts": [{ "value": "22G1", "score": 0.99982607 }],
"object": {
"score": 0.8951634168624878,
"label": "Size and Type Codes",
"value": {
"xmin": 0.6187261343002319,
"xmax": 0.7464326620101929,
"ymin": 0.2681463360786438,
"ymax": 0.3363390564918518
}
}
},
{
"texts": [{ "value": "TGHU", "score": 0.99987996 }],
"object": {
"score": 0.8807715177536011,
"label": "Owner Code and Category Identifier",
"value": {
"xmin": 0.39994415640830994,
"xmax": 0.5456485152244568,
"ymin": 0.16643111407756805,
"ymax": 0.23566366732120514
}
}
},
{
"texts": [{ "value": "2179839", "score": 0.99922401 }],
"object": {
"score": 0.8622628450393677,
"label": "Serial Number",
"value": {
"xmin": 0.6109504699707031,
"xmax": 0.904198944568634,
"ymin": 0.1689700484275818,
"ymax": 0.24608176946640015
}
}
}
],
"processing_time": 157.188,
"timestamp": "2026-04-07T07:28:21.981530+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 texts
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: Serial Number, Size and Type Codes or Owner Code and Category Identifier
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