DEV Community

Cover image for Cleaner US ZIP Codes: Automatic ZIP+4 Exclusion in Fetchify's Address Autocomplete API
Fiona Paton
Fiona Paton

Posted on

Cleaner US ZIP Codes: Automatic ZIP+4 Exclusion in Fetchify's Address Autocomplete API

If you build checkout, shipping, or CRM forms for US customers, you've probably run into the ZIP+4 code, the extended, nine-digit US postal format that looks like 90210-1234. The last four digits pinpoint a delivery route down to a specific building, floor, or even a mail slot. Useful for USPS routing, less useful when your order management system, courier API, or CRM only expects a standard five-digit ZIP code.

Fetchify's Address Autocomplete API now supports automatic ZIP+4 exclusion, so every US address lookup can return a clean five-digit ZIP code by default, no regex, no post-processing, no extra code on your end.

Why the ZIP+4 format causes problems downstream

US ZIP+4 codes are great for postal routing, but they create friction almost everywhere else in a typical order or address validation flow:

Courier compatibility: many shipping platforms and courier APIs are built around the standard five-digit ZIP and will reject, truncate, or mangle the +4 suffix, causing failed label creation or delayed fulfilment.
Address-validation errors at checkout: mismatched or unexpected ZIP formats are a common cause of failed address validation during checkout, especially when the field is validated against a five-digit pattern.
Messy order and customer data: a consistent five-digit ZIP is far easier to store, deduplicate, and match against records in your CRM, ERP, or accounting software.
Manual clean-up: without this option, teams end up writing their own string-splitting logic to strip the +4 suffix after every lookup, one more thing to maintain.

How ZIP+4 exclusion works in Fetchify

You can enable ZIP+4 exclusion in either of the two ways you already integrate with Fetchify's USA address lookup API:

1. Calling the Address Autocomplete API directly
Add the usa_exclude_zip_plus4 flag to the extra object on your Find or Retrieve request. Setting it to true strips the plus-four suffix from any US ZIP code in the response:

2. Using the **clicktoaddress-js JavaScript library**
If you're using Fetchify's clicktoaddress-js library to power an address search box on your site, set the excludeZipPlusFour configuration option to true when you initialize the widget:

Why it matters for your integration

Better courier compatibility: keep orders flowing smoothly to fulfilment and delivery partners built around the standard five-digit ZIP.
Cleaner order data: a consistent, five-digit US ZIP code format is easier to validate, store, and match against your database.
Fewer failed shipments: reduce address-validation errors at checkout and during label creation caused by unexpected ZIP formats.
Zero extra engineering: it's a single configuration flag — no need to post-process or reformat address data yourself.

Getting started

Both the API flag and the JavaScript option default to false, so existing integrations are completely unaffected until you turn ZIP+4 exclusion on. Update your integration whenever you're ready — there's no breaking change to plan around.

Questions about setting it up? Reach out to support@fetchify.com.

Related keywords

US ZIP+4 exclusion, five-digit ZIP code, USPS ZIP+4 format, address autocomplete API, USA address validation, checkout address validation, shipping address formatting, clicktoaddress-js, Fetchify address lookup API.

Top comments (0)