Skip to content

Concept by Reed Tereski

ferrule

Verify a postal address with one POST

curl -s https://api.ferrule.example/v1/verify \ -H "Authorization: Bearer fr_sample_PUBLIC_not_a_real_key" \ -d '{"line1":"118 Tannery Row","city":"Alderfield","region":"OH","postal_code":"00014","country":"US"}'

try another address

200 OK, verdict deliverable

200 OK

deliverable

latency
155 ms
request
req_7341f731

body

{  "request_id": "req_7341f731",  "verdict": "deliverable",  "deliverable": true,  "address": {    "line1": "118 TANNERY ROW",    "line2": null,    "city": "ALDERFIELD",    "region": "OH",    "postal_code": "00014",    "country": "US"  },  "changes": []}

field by field

Each field you sent, what Ferrule returned, and what it means
fieldyou sentferrule returnedreading
verdictnothingdeliverable confirmedMail can reach this address as sent. Store the returned form.
line1118 Tannery Row118 TANNERY ROW confirmedMatches the postal record. Returned in postal case.
line2nothingnothing absentNot sent and not needed.
cityAlderfieldALDERFIELD confirmedMatches the postal record. Returned in postal case.
regionOHOH confirmedAlready in postal form.
postal_code0001400014 confirmedAlready in postal form.
countryUSUS confirmedAlready in postal form.

Pasting this into a terminal fails: Ferrule is invented and the host is reserved. The response above came from a simulator in this page.

Ferrule tells you whether a postal address can receive mail.

Send one POST to /v1/verify. The response gives a verdict, the address in postal form, and every change made to it. Your checkout decides what to do from the verdict alone.

  1. Create a sample key

    The console issues one. It is shown once, then masked, and it only works inside this page.

    open the console
    export FERRULE_KEY=fr_sample_PUBLIC_not_a_real_key
  2. Send an address

    Export the key as FERRULE_KEY and post the fields you have. Leave out what you do not have.

    const res = await fetch("https://api.ferrule.example/v1/verify", {  method: "POST",  headers: {    Authorization: `Bearer ${process.env.FERRULE_KEY}`,    "Content-Type": "application/json",  },  body: JSON.stringify({    "line1": "118 Tannery Row",    "city": "Alderfield",    "region": "OH",    "postal_code": "00014",    "country": "US",  }),});const result = await res.json();
  3. Branch on the verdict

    A 200 means Ferrule answered. Whether the mail arrives is in verdict.

    switch (result.verdict) {  case "deliverable":    return saveAddress(result.address);  case "corrected":    return confirmChanges(result.changes, result.address);  case "unit_required":    return askForUnit();  case "undeliverable":    return askForNewAddress();}

Every 200 carries one of four verdicts

Verdicts and what to do with each
verdictdeliverablewhat your code does
deliverabletrueStore the returned address and continue.
correctedtrueShow the changes, confirm with the customer, store the returned address.
unit_requiredfalseAsk for an apartment or suite, then send again with line2.
undeliverablefalseAsk for a different address. Do not retry this one.

Every error names what to do next

Error statuses and how to handle them
statuscodewhat your code does
401api_key_missingSend a key as a Bearer token. Does not count against the limit.
422address_malformedRead error.fields, show each message beside its input, and let the customer fix it.
429too_many_requestsWait the seconds in Retry-After, then retry once.
error schemas

Ferrule is an invented product. api.ferrule.example is a reserved host and does not resolve, so every response here comes from a simulator in this page. Addresses you type stay in its memory.

Ferrule is an invented company.

About this concept

The measure that sets this layout is time to first response: how long a developer waits between opening the docs and seeing the API answer. The docs home opens on a command with its response already printed, and the console lets you send before you have a key, because the 401 that comes back names the next step.

Errors get the same care as success because errors are what an integration shows you first. The 422 lists every bad field and jumps to its input, and the 429 counts down its Retry-After and holds the send button until the window clears.

The command is the call to action because copying it is the real first move, and other actions invert through one difference-blend layer, so a single hover rule holds on black, bone and acid.

Figma mockups

Ferrule desktop mockup in Figma.
Desktop, 1440 wide
Ferrule phone mockup in Figma.
Phone, 390 wide

Prototype map

3 screens and 6 prototype links, drawn from the Figma file.

Map of the Ferrule prototype: Docs home, Console and Reference, joined by 6 links.