Reference

Massachusetts API county codes

Every Massachusetts API well number starts with 20, the state code. The next three digits are the county code, one of the 14 listed below, so a number beginning 20-001 belongs to a well in Barnstable County.

To decode a whole number, including the sidetrack and completion digits, paste it into the API well number decoder.

How to read a Massachusetts API number

20State: Massachusetts
001County: Barnstable
12345Well, unique within the county

The first ten digits identify one well. Two more digits can follow for a sidetrack, and two after that for a later completion. The county is the one where the well starts at the surface, so a horizontal well that crosses a county line keeps its surface county's code. A few state regulators assign the producing county instead, so the state record is the final word on a well near a boundary.

All 14 Massachusetts counties

County code County API numbers start
001 Barnstable 20-001-
003 Berkshire 20-003-
005 Bristol 20-005-
007 Dukes 20-007-
009 Essex 20-009-
011 Franklin 20-011-
013 Hampden 20-013-
015 Hampshire 20-015-
017 Middlesex 20-017-
019 Nantucket 20-019-
021 Norfolk 20-021-
023 Plymouth 20-023-
025 Suffolk 20-025-
027 Worcester 20-027-

County names are the US Census names for these codes. The API standard does not promise the two match, so we checked them against state well records. Across 35 states, where this table names a county it matched the one the agency recorded on 85,091 of 85,100 wells. Offshore state and federal waters use their own pseudo-county codes, which are not listed here.

Finding the well itself

The API number stops at the county. It does not hold the well's coordinates, lease, survey section or operator. Those sit in the well record, which you find by searching the full number in the state agency's system. Search it at the Massachusetts oil and gas regulator.

Frequently asked questions

What is the API state code for Massachusetts?

20. API state codes run alphabetically from 01 for Alabama to 49 for Wyoming, then 50 for Alaska and 51 for Hawaii. They are not the Census FIPS state codes, which is a common source of wrong lookups.

How do I find the county from a Massachusetts API number?

Read digits three to five and find them in the table on this page. In 20-001-12345, the county code is 001, which is Barnstable County. If the code is missing from the table, it is usually an offshore area rather than an onshore county.

Does a Massachusetts API number give the well's exact location?

No. The number stops at the county. Coordinates, the lease and the survey location are in the well record held by the state agency, which you search with the full API number.

State codes: American Petroleum Institute Bulletin D12A well numbering standard. County names: US Census county FIPS names, checked against state well records. Reference generated .

How to cite this page

Sources: American Petroleum Institute Bulletin D12A well numbering standard; US Census county FIPS codes.

TetraSoft. (2026). Massachusetts API county codes. Reference generated 2026-09-24. https://tetrasoftco.com/tools/api-county-codes/massachusetts/