Transportation & Cargo API Reference

API URL: http(s)://<your-host>/transport/[type]

Where [type] is the type of code to read in the uploaded images:

TypeParameter Value
European wagon and locomotive codes used across Europe to identify individual rail vehicleseu-rail
American wagon and locomotive codes used across the American continent to identify individual rail vehiclesam-rail
Identification codes used on trucks (ACCR, US DOT, Chassis)truck
ISO codes for containers and identification of intermodal loading units (ILU)iso

To use the API, make an HTTP POST request the endpoint found above.

See below for the required and optional parameters and possible responses.

/{type+}

POST

Description

The content type of the POST request must be in 'multipart/form-data' format, and its size in bytes must not exceed the value specified in the CarmenWorkerMaxFileSize environment variable.

See below for the required and optional parameters and possible responses.

Parameters
NameLocated inDescriptionRequiredSchema
x-disable-checksum-checkheaderThe codes the engine can recognize contain a checksum digit which can be used to check the validity of the digits read. A matching checksum indicates a high probability of the recognition result being correct. The Transportation & Cargo API verifies the checksum by default and discards any results where the check fails. By sending true as the value of this header, you can disable this check and receive all codes the engine recognized - even those known to be incorrect.Nostring
x-disable-iso-codeheaderDisables searching for and reading the last 4 digits of the ISO container code. NOTE: This parameter is only used when using the iso code type, when searching for other code types, it has no effect.Nostring
x-enable-full-us-accr-codeheaderEnables full US ACCR code recognition. NOTE: This parameter is only used when using the accr_usa code type, when searching for other code types, it has no effect.Nostring
x-enable-wide-range-analysisheaderIf you cannot guarantee that the uploaded image meets all the required parameters (see the Input Images tab on the How To Use page), you can turn on the wide-range analysis by setting this header's value to true. Attention! The duration of the analysis may increase several times.Nostring
x-disable-image-resizingheaderThe service resizes large images to Full HD resolution by bicubic interpolation. Resizing can make reading many times faster, but it can reduce the recognition efficiency. If you don't want the service to resize your images, turn this feature on by setting the header value to true. By disabling image resizing, you may also need to enable wide range analysis.Nostring
typepathThe type of code to read in the uploaded images.Yesstring
RequestbodyA multipart/form-data request which contains input images and configuration parameters for a Transport API call.YesRequest
Responses
CodeDescriptionSchema
200The HTTP 200 OK success status response code indicates that the request has succeeded. The response will contain a result in JSON format.Response
400Invalid Image. Recognition can not initiate without a proper image. Please check image input guide for proper input images.Error
401You are unauthorized to access the requested resource. An API key is missing. Your API KEY can be found on the ANPR Cloud Dashboard's 'how to use' page.Error
403Invalid API Key! Your account is not authorized to access the requested resource. Your API KEY may have changed. Please check the validity of your API key in the Cloud Dashboard.Error
405This method type is not currently supported. Only the POST method is allowed for ANPR Cloud SaaS.Error
408Timeout occured.Error
413The requested entity (image's size) is larger than the server is willing or able to process. Please check the image input guide to our maximum image size in MB.Error
429Limit exceeded, or throttled request. Please subscribe to our service through which your free lookups are redeemable.Error
500Unexpected internal server error.Error
503The server is currently unavailable. Due to 'queue full' error, cannot process the request.Error
504No timely response received from upstream server serving as a gateway or proxy.Error

Models

Request

The request body has to include the binary content of the images to be examined. Optionally, it can include the maximum number of reads to be performed (maxreads).

  • image: (binary or base64 string) the binary data (as base64-encoded string or as a binary file content) of the pictures you would like to analyze. To upload multiple pictures, add the image parameter to your request multiple times.
  • maxreads: (integer) an optional parameter, it specifies the maximum number of code searches per image sequence. Use this parameter carefully, because every search increases the processing time. The system will stop searching when there is no more code in the image, or the number of searches reaches the value of maxreads. Its value is 1 by default.

Response

If the service call is successful, the service will return a Response json object.

Response structure
  • data: (Data structure) includes recognition results.
  • nodename: (string) the name of the node this request has been processed by. This is diagnostic information to be included in error reports.
  • nodetime: (number) total processing time spent on the worker node (this includes processing, image loading and latency).
  • version: (string) version of the JSON response format. Incremented each time the response structure changes.
Data structure

Includes recognition results.

  • codes: (array of Code structures) an array containing all codes recognized on the images uploaded.
Code structure

An array containing all codes recognized on the images uploaded.

  • code: (string) the code as a string.
  • confidence: (integer, min: 0, max: 100) the estimated probability of the recognized code being correct as a percentage between 0 and 100.
  • imageResults: (array of Image result structures) an array in which each item corresponds to one image uploaded. The items are objects that describe the recognition results found on their respective input images.
Image result structure

Includes the recognition results found on the given input image.

  • found: (boolean) a boolean indicating whether a code has been found on the image.
  • text: (string) the code found on the image as a string.
  • confidence: (integer, min: 0, max: 100) the estimated probability of the recognized code being correct as a percentage between 0 and 100.
  • characters: (Character structure) an array of objects which describe each character of the recognized code.
Character structure

Describes a single character recognized on the picture.

  • code: (number) the numeric code of the character.
  • bgDark: (boolean) a boolean indicating whether the background is darker than the character found.
  • bgColor: (Color structure) the background color of the character.
  • color: (Color structure) the color of the character.
  • confidence: (integer, min: 0, max: 100) the estimated probability of the recognized character being correct as a percentage between 0 and 100.
  • charROI: (ROI structure) the quadrangle (not necessarily a rectangle) where the character has been found (see (ROI structure)).
Color structure

Represents an RGB color.

  • r: (number, min: 0, max: 255) the red component of the color.
  • g: (number, min: 0, max: 255) the green component of the color.
  • b: (number, min: 0, max: 255) the blue component of the color.
ROI structure

Describes the coordinates of a Rectangle of Interest, giving the coordinates of all four corners.

Coordinate structure

Represents a point on the Cartesian plane.

  • x: (number) x coordinate.
  • y: (number) y coordinate.

Error

The message property of the json response will describe the error.