USPS Intelligent Mail Barcode API
US postal service 65-bar routing code
Sample USPS Intelligent Mail barcode
Generated live by the BarGen API from 0123456709498765432101234567891
The Intelligent Mail Barcode is the USPS height-modulated barcode that encodes a 20 to 31 digit routing and tracking code across four bar states: ascender, descender, tracker, and full bar. Introduced in 2009 and made mandatory for USPS automation pricing in 2013, it replaced the earlier POSTNET and PLANET codes with a single symbol that carries both delivery point routing and unique mailpiece tracking data for USPS Confirm services.
BarGen renders an Intelligent Mail Barcode from a 20 to 31 digit numeric string through the REST API, returning SVG or PNG output formatted to USPS bar height and spacing specifications.
The Intelligent Mail Barcode (IMB), also known as the 4-State Customer Barcode, is a 65-bar code used by the United States Postal Service (USPS) for mail routing and tracking. It replaced POSTNET and PLANET barcodes in 2013.
The barcode encodes 31 digits of data: a 20-digit tracking code (barcode ID, service type, mailer ID, and serial number) and an optional 0, 5, 9, or 11-digit routing code (ZIP code information). This enables both tracking and delivery point routing.
IMB uses four bar states: full bar, ascender (top half), descender (bottom half), and tracker (middle third). This 4-state encoding allows high data density while maintaining readability by high-speed mail sorting machines.
Using IMB qualifies mailers for postal discounts and provides full visibility into mail delivery. The USPS Informed Visibility service uses IMB data to provide real-time tracking of mail pieces through the postal network.
Common use cases
Automated mail sortation
USPS sorting equipment reads the IMb routing code to direct mailpieces through the correct processing and delivery stream.
Mailpiece tracking
Mailers use the IMb's unique tracking segment with USPS Informed Visibility to follow individual mailpieces through the postal network.
Address quality and postal discounts
Presorted and automation-rate mailings require a valid IMb encoding the delivery point ZIP+4 to qualify for USPS discount pricing.
Generate USPS Intelligent Mail via the REST API
curl "https://api.bargen.pro/v1/barcode/imb?data=0123456709498765432101234567891&format=svg" \
-H "X-API-Key: YOUR_API_KEY"
Returns the barcode as SVG; PNG, PDF and EPS are available on higher plans. See the API documentation for all options.
Frequently asked questions
How many digits does an Intelligent Mail Barcode encode?
IMb encodes a 20-digit tracking code at minimum, extendable to 25 or 31 digits when a ZIP or ZIP+4 delivery point code is appended.
Did the Intelligent Mail Barcode replace POSTNET?
Yes, USPS required all automation-rate mail to use IMb instead of POSTNET or PLANET starting January 2013, since IMb combines routing and tracking data that the older codes handled separately.
What are the four bar states in an IMb symbol?
Each bar is printed as an ascender, descender, tracker, or full bar, and the combination across all bars encodes the underlying digits using a specific USPS algorithm.
Specifications
- Bars
- 65 bars in 4 states
- Tracking Code
- 20 digits (barcode ID + service + mailer + serial)
- Routing Code
- 0, 5, 9, or 11 digits (ZIP code)
Related formats
Start generating USPS Intelligent Mail barcodes
Free tier with 1,000 API calls per month. No credit card required.