APIPLSSDeveloperAutocompleteLegal Description

Building a PLSS Legal Description Autocomplete with the Township America API

Build a PLSS autocomplete for legal description search with the Township America API: debounced typeahead, meridian disambiguation, and GeoJSON output.

Ask a user to type a PLSS legal description from memory and you will collect typos. A string like T15N R2E Sec 22 NW, 6th Principal Meridian has four moving parts, each with its own notation, and one transposed character (R2E instead of R3E, for example) points the result at a different section a few miles away. If your app accepts legal descriptions as input, the text field itself is where most of the errors start.

A PLSS autocomplete fixes that at the source. As the user types, the field suggests valid legal descriptions and lets them pick one instead of finishing it by hand. In this post you will build that typeahead against the Township America API, handle the case where the same township and range exists under more than one principal meridian, and hand the chosen description to the lookup endpoint to get coordinates and a boundary back.

What the autocomplete endpoint does

The Township America REST API exposes single lookup, batch, autocomplete, and map tile endpoints, alongside the Python and TypeScript SDKs and an MCP server for AI agents. The autocomplete endpoint is the one built for input: you send a partial legal description and it returns suggestions that complete it.

Because PLSS resolution covers 30+ PLSS states and 37 principal meridians, a partial query is often ambiguous on its own. The endpoint returns each matching candidate with the principal meridian it resolves under, so the user can choose the correct one rather than guessing. Texas descriptions work in the same field: the Texas Abstract, Block, and Survey grid resolver means an Abstract reference autocompletes the same way a township-range-section string does.

Build the typeahead

The pattern has three parts: debounce the keystrokes so you are not firing a request per character, call the endpoint, and render the suggestions. Here is a vanilla JavaScript version you can adapt to any framework.

const input = document.querySelector("#legal-search")
const list = document.querySelector("#suggestions")

let timer
input.addEventListener("input", () => {
  clearTimeout(timer)
  const query = input.value.trim()
  if (query.length < 3) return
  timer = setTimeout(() => fetchSuggestions(query), 200)
})

async function fetchSuggestions(query) {
  const res = await fetch(`/api/plss-autocomplete?q=${encodeURIComponent(query)}`)
  const results = await res.json()
  renderSuggestions(results)
}

Two choices here matter. The minimum query length (three characters) keeps you from sending requests for input too short to match anything useful. The 200 millisecond debounce waits for a short pause in typing before it calls out, which collapses a burst of keystrokes into a single request. Both reduce the request volume you send, and request volume is what the API meters.

Notice that the fetch above calls /api/plss-autocomplete, a route on your own backend, not the Township America endpoint directly. That is deliberate. A typeahead runs in the browser, and a request from the browser would expose your API key to anyone who opens the network tab. Keep the key on the server and let a thin proxy forward the query:

// server route: /api/plss-autocomplete
export default async function handler(req, res) {
  const q = req.query.q
  const upstream = await fetch(
    `https://developer.townshipamerica.com/autocomplete/legal-location?location=${encodeURIComponent(q)}&limit=5`,
    { headers: { "x-api-key": process.env.TOWNSHIP_API_KEY } },
  )
  res.json(await upstream.json())
}

Rendering the suggestions is the last client-side piece. The endpoint returns a GeoJSON FeatureCollection, and each feature's properties carry the normalized legal_location (which names the principal meridian) along with the state and county it falls in. Check the API reference for the full field list, then map the features onto list items the user can click:

function renderSuggestions(results) {
  list.innerHTML = ""
  for (const { properties: item } of results.features ?? []) {
    const li = document.createElement("li")
    li.textContent = `${item.legal_location} (${item.state})`
    li.addEventListener("click", () => selectSuggestion(item))
    list.appendChild(li)
  }
}

Handle the meridian ambiguity

Townships and ranges are numbered relative to a principal meridian, and those grids repeat across the country. T2N R3E is a valid origin under several of the 37 principal meridians, so a short query can match real sections in different states. This is the single most common source of a confident-looking wrong answer in PLSS software.

Showing the meridian and state on each suggestion, as the render step above does, turns that ambiguity into a choice the user makes on purpose. A landman working the Anadarko Basin sees the Indian Meridian candidate and picks it; a user in Colorado picks the 6th Principal Meridian version of the same township and range. The field stops guessing, and the user confirms the one description they meant.

Complete the flow with a lookup

Autocomplete validates the input. To do something with it, pass the chosen description to the single lookup endpoint, which returns a GeoJSON FeatureCollection with the parcel centroid, the full BLM survey polygon boundary, state, county, and principal meridian.

async function selectSuggestion(item) {
  input.value = item.legal_location
  list.innerHTML = ""
  const res = await fetch(
    `/api/plss-lookup?location=${encodeURIComponent(item.legal_location)}`,
  )
  const geojson = await res.json()
  drawOnMap(geojson) // your Leaflet, Mapbox, or ArcGIS handler
}

Because the lookup returns the actual survey polygon and not just a center point, you can draw the parcel outline straight onto a map, run a spatial query against it, or write it to a record. The same pattern underpins server-side work too: if you need to resolve many descriptions at once rather than one at a time, the batch endpoint accepts up to 100 per request. For the mechanics of that conversion on its own, see the guide on converting section, township, and range to coordinates.

Choosing an API tier

A typeahead is request-heavy by nature: even with debouncing, an active search field sends more calls than a one-off lookup does. The metered API tiers are priced on request volume, so start on the Build tier while traffic is light and move up to Scale as your usage grows. Current limits and prices are on the pricing page, and the API quickstart walks through issuing a key.

You now have a legal description search field that suggests valid PLSS descriptions as the user types, disambiguates by principal meridian, keeps your API key off the client, and resolves the chosen description to a boundary on the map. From here, the natural extension is to cache common queries in your proxy to trim request volume further, or to pass the proximity parameter so suggestions near the user's map view rank first.