Skip to main content

Run the Mailwoman HTTP server

In this tutorial you start the native Mailwoman HTTP server on your machine and send it four requests: a health check, a parseaddress parsingThe process of decomposing a free-text postal address string into structured components — house number, street name, locality, region, postcode, and country — so a geocoder can resolve them to coordinates., a geocode, and a request with a missing field. You then stop the server. Each step shows the complete response the server returned.

Prerequisites​

  • Node.js ^24.22.3 || >=26.13.1.
  • An empty project directory.

Start by installing the required packages:

sh
npm install mailwoman

The server doesn't start without geographic data. It exits with status 1 before listening when it finds neither a candidate database nor Who's On FirstWOF (Who's On First). An open-source gazetteer of places maintained by Mapzen/whosonfirst. Mailwoman builds a custom SQLite database from WOF GeoJSON repos, extended with postcode data, importance scores, and coincident-role relations. databases. Download the global place candidates and the address pointssitus dataA dataset of exact address-point coordinates (rooftop-level). Mailwoman's geocoder uses a national situs layer (124.9M US points built from state address-point sources) as the highest-precision tier of the geocode cascade. for Washington, DC:

sh
export MAILWOMAN_DATA_ROOT="$HOME/mailwoman-data"

npx mailwoman data pull candidate
npx mailwoman data pull us --only us-dc

The two pulls download about 3 GB: candidate 2.9 GB and DC 127.5 MB. If you completed Geocode a file of addresses, you already have both. The responses below were captured with local builds of these bundlesevidence bundleThe pair of retrieval-augmented input channels (street-type + locality-surface) that feed lexicon membership as soft per-token evidence alongside the text. Shipped in 6.7.0; trained natively from step 0 in the from-scratch base line. that are newer than the 11.0.0 registry entries, so a coordinate or source release in your responses can differ.

1. Start the server​

Start the server on port 7801 with one worker process, bound to your own machine only:

sh
npx mailwoman serve --port 7801 --host 127.0.0.1 --cpus 1

The server reads its data from $MAILWOMAN_DATA_ROOT. It prints the database it opened, then the process IDs of its manager and worker once the worker is listening:

text
[resolver] candidate-table backend (demo-parity, population-first): /home/you/mailwoman-data/db/wof/candidate.db
mailwoman is licensed AGPL-3.0-only: modified or network-served copies must offer their source.
A commercial license waives that obligation: https://mailwoman.post/license

Manager process: 3934763
Workers:
ℹ Listening (3934800) "HTTP server ready"

Your process IDs will differ. Leave this terminal running and open a second terminal for the next steps. Without --cpus, the server starts one worker per CPU core.

2. Check its health​

sh
curl -i http://127.0.0.1:7801/health
http
HTTP/1.1 200 OK
access-control-allow-origin: *
content-type: application/json
link: <https://mailwoman.post/license>; rel="license"
server: mailwoman/11.0.0 (AGPL-3.0-only)
content-length: 861
Date: Wed, 11 Nov 2026 04:01:03 GMT
Connection: keep-alive
Keep-Alive: timeout=5

{"status":"ok","uptime_s":10,"model":{"name":"neural-weights-en-us","version":"10.8.0","locale":"en-us","labels":33,"format":{"model":"ONNX int8 dynamic (quantized from fp32, opset 17)","tokenizer":"SentencePiece unigram, byte_fallback=true, vocab_size=73143 (v0.9.0-multisplice; ships WITH the model, both runtimes load it from this bundle)","max_sequence_length":128,"opset":17,"fp32_size_mb":146.6,"int8_size_mb":37.6,"pair_index_us_bin":"PIX1 binary (schema 3), 1,341,264 bytes, 47,878 pairs, δ=10, β=5, parentDelta=5"}},"data":{"data_root":"/home/you/mailwoman-data","versions":null,"wof_dbs":["/home/you/mailwoman-data/db/wof/admin-global-priority.db","/home/you/mailwoman-data/db/wof/postalcode-us.db","/home/you/mailwoman-data/db/wof/postalcode-geonames-tail.db","/home/you/mailwoman-data/db/wof/postalcode-intl.db","/home/you/mailwoman-data/db/wof/postalcode-nl-pc6.db","/home/you/mailwoman-data/db/wof/postalcode-ni-osm.db"],"situs_states":0,"interpolation_states":0}}

This page shows the data directory as /home/you/mailwoman-data, so the body is longer than the captured content-length. status: "ok" means the server answered. model identifies the loaded en-US modelneural classifierThe machine learning model at the core of Mailwoman's parser — a transformer encoder (~30M parameters) trained from scratch to do BIO token classification over addresses. It learns the 'grammar' of address formats; the gazetteer supplies the 'atlas.', version 10.8.0. data lists the data root and the place databases the server found there. This health response doesn't show that a geocode will succeed. Step 4 checks that.

On the host used for this page, the health route answered 13 seconds after the start command. The manager and worker processes then held 133,192 kB and 474,140 kB of resident memory after one geocode, about 607 MB in total. Those are single measurements from one Linux host. A server with more workers uses more memory.

3. Parse an address​

Send an address to GET /v1/parse:

sh
curl -i --get http://127.0.0.1:7801/v1/parse --data-urlencode "address=1 Main St, Burlington, VT 05401"
http
HTTP/1.1 200 OK
access-control-allow-origin: *
content-type: application/json
link: <https://mailwoman.post/license>; rel="license"
server: mailwoman/11.0.0 (AGPL-3.0-only)
content-length: 1288
Date: Wed, 11 Nov 2026 04:01:15 GMT
Connection: keep-alive
Keep-Alive: timeout=5

{"input":"1 Main St, Burlington, VT 05401","components":[{"tag":"house_number","value":"1"},{"tag":"street","value":"Main"},{"tag":"street_suffix","value":"St"},{"tag":"locality","value":"Burlington"},{"tag":"region","value":"VT"},{"tag":"postcode","value":"05401"}],"tree":{"raw":"1 Main St, Burlington, VT 05401","roots":[{"tag":"region","start":23,"end":25,"value":"VT","confidence":0.9226666048278145,"children":[{"tag":"locality","start":11,"end":21,"value":"Burlington","confidence":0.9404526283967346,"children":[{"tag":"street","start":2,"end":6,"value":"Main","confidence":0.9411343728470462,"children":[{"tag":"house_number","start":0,"end":1,"value":"1","confidence":0.922763171600838,"children":[]},{"tag":"street_suffix","start":7,"end":9,"value":"St","confidence":0.9155597718291063,"children":[]}]},{"tag":"postcode","start":26,"end":31,"value":"05401","confidence":0.9149451157238078,"children":[]}]}]}],"country":"US","localeCountry":{"country":"US","confidence":0.9999990244989009}},"debug":null,"engine":{"name":"mailwoman","version":"11.0.0","license":"AGPL-3.0-only","license_url":"https://mailwoman.post/license","notice":"mailwoman is licensed AGPL-3.0-only: modified or network-served copies must offer their source. A commercial license waives that obligation."}}

components lists the tagged parts in input order. tree nests them from regionregionThe first-level administrative subdivision of a country — a US state, a French region, a province. The component between country and locality. down to house numberhouse numberThe numeric or alphanumeric identifier of a building on a street. Mailwoman's house_number component; its position relative to the street name flips between locales., and each node's start and end give its character offsets in the input. A parseaddress parsingThe process of decomposing a free-text postal address string into structured components — house number, street name, locality, region, postcode, and country — so a geocoder can resolve them to coordinates. reads only the text. It doesn't look up any place, so it answers for a Vermont address even though this server has no Vermont address pointssitus dataA dataset of exact address-point coordinates (rooftop-level). Mailwoman's geocoder uses a national situs layer (124.9M US points built from state address-point sources) as the highest-precision tier of the geocode cascade..

4. Geocode an address​

Send a JSON body to POST /v1/geocode:

sh
curl -i -X POST http://127.0.0.1:7801/v1/geocode -H "content-type: application/json" -d '{"address":"1600 Pennsylvania Ave NW, Washington, DC 20500"}'
http
HTTP/1.1 200 OK
access-control-allow-origin: *
content-type: application/json
link: <https://mailwoman.post/license>; rel="license"
server: mailwoman/11.0.0 (AGPL-3.0-only)
content-length: 1680
Date: Wed, 11 Nov 2026 04:01:09 GMT
Connection: keep-alive
Keep-Alive: timeout=5

{"input":"1600 Pennsylvania Ave NW, Washington, DC 20500","components":{"region":"DC","locality":"Washington","postcode":"20500","street":"Pennsylvania Ave NW","house_number":"1600"},"dropped_components":null,"unfollowed_components":null,"lat":38.89767510742324,"lon":-77.03654697024702,"resolution_tier":"address_point","epistemic_status":"observed","uncertainty_m":1,"locality":"Washington","region":"DC","postcode":"20500","house_number":"1600","street":"Pennsylvania Ave NW","venue":null,"dependent_locality":null,"unit":null,"countryCode":"US","hierarchy":[{"tag":"locality","value":"Washington","name":"Washington","lat":38.904831,"lon":-77.016216,"placeID":"wof:85931779","in_winner_lineage":true},{"tag":"region","value":"DC","name":"District of Columbia","lat":38.912097,"lon":-77.014683,"placeID":"wof:85688741","in_winner_lineage":true}],"candidates":[{"name":"District of Columbia","tag":"region","lat":38.912097,"lon":-77.014683,"countryCode":"US","placeID":"wof:85688741","score":5.831852504495296,"matchedAlias":true}],"rooftop":{"localityNorm":"washington","postcode":"20500"},"coordinate_source":{"source":"overture:NAD","release":"2026-05-20.0"},"admin_coherence":{"region":"confirmed","country":"unstated"},"postcode_country_scope":"US","capital_promotion":null,"variant_alias_exemption":"not_applied","intent_markers":[],"derivation":null,"entity":null,"authoritative":null,"tree":null,"engine":{"name":"mailwoman","version":"11.0.0","license":"AGPL-3.0-only","license_url":"https://mailwoman.post/license","notice":"mailwoman is licensed AGPL-3.0-only: modified or network-served copies must offer their source. A commercial license waives that obligation."}}

The server returned an address_point coordinate from the US National Address Database (coordinate_source.source: "overture:NAD"). This is the same result shape that mailwoman geocode prints on the command line. Geocode a file of addresses walks through each of its fields.

5. Read an error response​

Send a geocode request without an address:

sh
curl -i -X POST http://127.0.0.1:7801/v1/geocode -H "content-type: application/json" -d '{}'
http
HTTP/1.1 400 Bad Request
access-control-allow-origin: *
content-type: application/json
link: <https://mailwoman.post/license>; rel="license"
server: mailwoman/11.0.0 (AGPL-3.0-only)
content-length: 45
Date: Wed, 11 Nov 2026 04:01:17 GMT
Connection: keep-alive
Keep-Alive: timeout=5

{"error":"address is required","detail":null}

A request error returns a 4xx status with an error message. Check the status code in your client before reading the body as a result.

6. Stop the server​

Send a termination signal to the manager process that the server printed at startup:

sh
kill 3934763

The server drains its worker and exits with status 0. Its terminal prints:

text
[serve] worker 3934800 draining

What you have now​

You have a data root that mailwoman serve starts from, and the requests that check a running server: GET /health reports the loaded modelneural classifierThe machine learning model at the core of Mailwoman's parser — a transformer encoder (~30M parameters) trained from scratch to do BIO token classification over addresses. It learns the 'grammar' of address formats; the gazetteer supplies the 'atlas.' and databases, GET /v1/parse reads text without looking up places, and POST /v1/geocode returns a coordinate and its source. A request error returns a 4xx status with an error message, and a termination signal to the manager process stops the server.

The HTTP reference lists every native route and the Nominatim, Photon and libpostallibpostalAn open-source C address parser used by Pelias. Mailwoman's rule-based v0 and neural classifier supersede it. compatibility routes. Choose a deployment compares running this server with the library and browser options.