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
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.
- Shell
- Python
# 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/
import requests
from pprint import pprint
# Download a test picture
# curl -o /tmp/container.jpg https://app.platerecognizer.com/static/container_demo.jpg
with open("/tmp/container.jpg", "rb") as fp:
response = requests.post(
"https://container-api.parkpow.com/api/v1/predict/",
files=dict(image=fp),
data=dict(camera_id="my-camera-1", config='{"text_rule": "normal"}'),
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://container-api.parkpow.com/api/v1/statistics/
curl -H "Authorization: Token YOUR_API_TOKEN" https://container-api.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 |
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.
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.
| Parameter | Required | Description |
|---|---|---|
image | Yes | Image file to analyze. Must start with the @ symbol in curl. For example, image=@/tmp/container.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.25 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. 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. |
postprocessing | No | Cloud 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 value43001061is 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 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":"normal","threshold_d":0.05,"threshold_o":0.05}' \
http://localhost:8001/predict/
New in version 0.7.0.
text_rule: strict vs normal​
| Behavior | strict (default) | normal |
|---|---|---|
| Readings that do not match the template for the label (Serial Number, Size and Type Codes, Owner Code and Category Identifier) | Discarded | Kept, only when no reading matches the template |
| Readings that match the template | Kept | Preferred over those that do not match |
| ISO 6346 check digit between Owner Code and Serial Number | Used to select the valid pair | Not 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
1to5or a letter fromAtoNorP. The second is0,2, a digit from4to9, or one ofC,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,UorZ, for exampleMSKU.
Response​
Cloud and On-premises return different JSON formats. Select your deployment below.
- Cloud
- On-premises
{
"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"
}
| Field | Description |
|---|---|
original_width | Width of the image in pixels |
original_height | Height of the image in pixels |
results | List of detected texts |
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: Serial Number, Size and Type Codes or Owner Code and Category Identifier |
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": "2024-10-15T07:58:03.692615Z",
"camera_id": "my-camera-1",
"results": [
{
"box": [0.1683, 0.6135, 0.2497, 0.8984],
"score": 0.908,
"label": "Serial Number",
"rotation": 0,
"texts": [{ "value": "2179839", "score": 1.0 }],
"height": 496,
"width": 496
},
{
"box": [0.2656, 0.6177, 0.3382, 0.7459],
"score": 0.875,
"label": "Size and Type Codes",
"rotation": 0,
"texts": [{ "value": "22G1", "score": 1.0 }],
"height": 496,
"width": 496
},
{
"box": [0.1608, 0.4006, 0.2423, 0.5466],
"score": 0.857,
"label": "Owner Code and Category Identifier",
"rotation": 0,
"texts": [{ "value": "TGHU", "score": 1.0 }],
"height": 496,
"width": 496
}
],
"original_width": 496,
"original_height": 496,
"usage": { "calls": 120, "max_calls": 2500 },
"processing_time": 144.538
}
| 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 texts |
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: Serial Number, Size and Type Codes or Owner Code and Category Identifier |
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": "2024-10-15T07:58:03.692615Z",
"camera_id": "my-camera-1",
"results": [
{
"box": [0.1683, 0.6135, 0.2497, 0.8984],
"score": 0.908,
"label": "Serial Number",
"rotation": 0,
"texts": [{ "value": "2179839", "score": 1.0 }],
"height": 496,
"width": 496
}
],
"original_width": 496,
"original_height": 496,
"usage": { "calls": 120, "max_calls": 2500 },
"processing_time": 144.538
}
}