What a Schedule D port code is and where it goes
Schedule D is the Census Bureau’s list of U.S. customs districts and ports. Each district has a two-digit code and each port of entry a four-digit code whose first two digits are its district: 3801 is Detroit in district 38, 5201 is Miami in district 52, 2704 is Los Angeles in district 27.
CBP uses the same four-digit code as the port code on Form 7501 (the entry summary), in ACE and AMS filings, and in the Importer Security Filing (ISF). Brokers, forwarders and self-filing importers look it up constantly, which is why so many searches are for the code on its own.
Schedule D code vs. UN/LOCODE: which goes where
The carrier books under the UN/LOCODE; the broker enters the Schedule D code. A UN/LOCODE (USLAX, USNYC) is a five-character international place code used on carrier bookings and bills of lading. A Schedule D code (2704, 1001) is a U.S. customs identifier used on entry documents. They describe the same place from two directions and never substitute for each other.
Where a port in this directory also has a UN/LOCODE reference page on this site, the two are linked both ways. Many Schedule D ports — airports, land border crossings, user-fee airports and inland ports — have no UN/LOCODE seaport entry at all.