Container Size and Type Codes (22G1, 45G1, 45R1)

Read ISO 6346 size and type codes such as 22G1, 42G1, 45G1, and 45R1 to tell container length, height, and type apart.

Size code

The first character gives the length (2 = 20 ft, 4 = 40 ft, L = 45 ft) and the second gives height (for example 2 = 8 ft 6 in, 5 = 9 ft 6 in high cube).

Extracting It Automatically

When you read this data from photos, the Container Number OCR API returns it as structured JSON, and you can apply the rules on this page as validation. Try it with the free scanner.

Where This Fits

  • Type code: The last two characters give the type: G for general purpose, R for reefer, U for open top, P for platform and flat rack, T for tank, followed by a detail digit.
  • Common examples: 22G1 is a 20 ft standard dry container, 42G1 a 40 ft standard, 45G1 a 40 ft high cube, and 45R1 a 40 ft high-cube reefer.
Need more testing? Create a free account to get 200 free credits (equals 100 Passport scans).

Extract It with the API

Read the document from a photo and validate the returned fields.

Prerequisite: Python 3.9+, `pip install requests`, and a STRUCTOCR_API_KEY

PYTHON EXAMPLE
import base64
import os
import requests

with open("container.jpg", "rb") as image_file:
    image = base64.b64encode(image_file.read()).decode("ascii")

response = requests.post(
    "https://api.structocr.com/v1/container",
    headers={"x-api-key": os.environ["STRUCTOCR_API_KEY"]},
    json={"img": image},
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]
print("container_number:", data.get("container_number"))
print("is_valid:", data.get("is_valid"))
print("confidence:", data.get("confidence"))

Technical Specs

  • •Endpoint: POST https://api.structocr.com/v1/container
  • •Authentication: x-api-key request header
  • •Inputs: JPG, PNG, or WebP as Base64 JSON; maximum 4.5MB
  • •Price: 1 credit per successful request; failed requests are not billed
  • •Free trial: 200 free credits on sign-up, no credit card required

Key Features

  • •Type code: The last two characters give the type: G for general purpose, R for reefer, U for open top, P for platform and flat rack, T for tank, followed by a detail digit.
  • •Common examples: 22G1 is a 20 ft standard dry container, 42G1 a 40 ft standard, 45G1 a 40 ft high cube, and 45R1 a 40 ft high-cube reefer.
  • •Validate after OCR: Apply these rules to API output before storing it.

Reference Summary

Key facts from this page in structured form, for quick lookup.

{
  "Size code": "The first character gives the length (2 = 20 ft, 4 = 40 ft, L = 45 ft) and the second gives height (for example 2 = 8 ft 6 in, 5 = 9 ft 6 in high cube)..",
  "Type code": "The last two characters give the type: G for general purpose, R for reefer, U for open top, P for platform and flat rack, T for tank, followed by a detail digit..",
  "Common examples": "22G1 is a 20 ft standard dry container, 42G1 a 40 ft standard, 45G1 a 40 ft high cube, and 45R1 a 40 ft high-cube reefer.."
}

Frequently Asked Questions

Does the API read size-type codes?

The container API focuses on the container number. Capture the size-type code separately if your workflow needs it.

Why does the code matter?

Terminals and depots use it for stacking, billing, and equipment planning.

You May Also Like

Related tutorials, platform guides, and comparisons

Tutorial

Node.js Shipping Container OCR API

Tutorial: How to use the StructOCR Node.js SDK to extract data from Shipping Containers. Upload an image for a free test! Includes code samples and JSON schema.

Node.js · Container
Tutorial

Container Number OCR API Pricing and Cost per Scan

What container number OCR costs with StructOCR: 1 credit per successful scan, prepaid credits that never expire, and no charge for failed requests.

Container
Tutorial

ISO 6346 Container Number Structure Explained

How a shipping container number is built: owner code, equipment category, serial number, and check digit, with examples.

Container
Tutorial

Go Shipping Container OCR API

Upload an image for a free test! Tutorial: Learn how to use the StructOCR Go Client to extract data from Shipping Containers. Extract ISO 6346 container numbers and check them against the ISO check digit. Includes code samples and JSON schema.

Go · Container
Tutorial

Java Shipping Container OCR API

Upload an image for a free test! Tutorial: Learn how to use the StructOCR Java Client to extract data from Shipping Containers. Extract ISO 6346 container numbers and check them against the ISO check digit.

Java · Container
Tutorial

Jaguar VIN Location and VIN OCR API

Where to find the VIN on a Jaguar, what its first characters mean, and how to read it from a photo with an API and decode the model year.

VIN
Country Tutorial

Norway Passport OCR with Node.js SDK

Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Norway passports.

Node.js · Passport
Country Tutorial

Pakistan CNIC OCR Python SDK

Python Tutorial: Automate KYC in Pakistan. Extract data from CNIC using StructOCR Python SDK. Supports native text.

Python · cnic
Country Tutorial

Norway Passport OCR with Python SDK

Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Norway passports with a server-side integration.

Python · Passport
Country Tutorial

Pakistan Passport OCR with Node.js SDK

Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Pakistan passports.

Node.js · Passport

Technical Comparisons & Integrations

Explore platform integrations and competitive analysis

From tutorial to production in 5 minutes.

You've seen the code. Now get your API key, grab your 200 free credits, and see it work with your own images. No credit card required.

Instant Access Cancel Anytime No Credit Card