prufy
Skip to the page

APIVerify a domain in five minutes

API

Verify a domain in five minutes

Four requests take a domain from typed to verified: create a claim, show the record, run a check, read the answer. The slow part is DNS, and that's usually a few minutes.

The four steps

  1. Create a claim

    Send the domain as the person typed it. A URL or an email address works too: we keep the host. The response sets a session cookie, so save it, and keep claimId.

    curl -X POST 'https://www.prufy.dev/api/v1/claims' \
      -c cookies.txt -b cookies.txt \
      -H 'content-type: application/json' \
      -d '{
      "input": "yourcompany.com"
    }'

    A domain we can't accept answers 422 with a message that says what to type instead, so it can go straight under the input.

  2. Show the record

    The claim comes back with one TXT record. record.host is what goes in the provider's host field, already adjusted for providers that add the domain themselves. record.value has to be pasted exactly.

    view.record
    {
      "type": "TXT",
      "host": "_prufy-challenge",
      "fullName": "_prufy-challenge.yourcompany.com",
      "value": "prufy-domain-verification=xwqyp4hnsmgqxceo2xd6orgeay",
      "ttl": 300
    }

    view.instructions says how to get there at this domain's provider, in that provider's own words: what it calls each field, and the steps to the right screen. Show them. They're the difference between a record that's added and one that's added in the wrong place.

    view.instructions
    {
      "providerId": "namecheap",
      "name": "Namecheap",
      "hostFieldLabel": "Host",
      "valueFieldLabel": "Value",
      "settingsUrl": "https://ap.www.namecheap.com/Domains/DomainControlPanel/yourcompany.com/advancedns",
      "steps": [
        "Sign in to Namecheap and open Domain List.",
        "Click Manage next to your domain, then open the Advanced DNS tab.",
        "Click Add New Record and choose TXT Record."
      ],
      "notes": [
        "Namecheap adds your domain to the Host automatically. Enter only the part shown, without your domain."
      ]
    }

    The code works for 7 days. view.timing.expiresAt says exactly when.

  3. Run a check, or wait for ours

    We look on our own, starting 30 seconds after the claim is made, so doing nothing works. To look the moment the person says they've added the record, ask:

    curl -X POST 'https://www.prufy.dev/api/v1/claims/clm_4b1f7c1e-52e7-4c0a-9a3b-7d2f0c6e8a10/checks' \
      -b cookies.txt

    One check per claim every 10 seconds. view.timing.canCheckNowAt says when the next one is allowed, so a button can count down instead of failing.

  4. Read the answer

    Every response carries the claim as it now stands. When view.phase is verified, it's done. Until then, view.explanation says where things are in words you can show as they are.

    Verified
    {
      "view": {
        "phase": "verified",
        "status": "verified",
        "explanation": {
          "headline": "yourcompany.com is verified",
          "why": "We last saw your record on 2026-11-10.",
          "fix": "Keep the record in place. We re-check it daily so ownership stays current.",
          "action": {
            "kind": "none",
            "label": "Nothing to do"
          }
        },
        "verifiedAt": "2026-11-10T09:41:03.115Z"
      }
    }

    The record has to stay. We re-check it daily, and Keep a domain verified covers what happens if it goes missing.

What to show for each phase

A check that doesn't pass is still a 200. The answer is in view.phase, and view.explanation.action.kind says what the main button should do.

PhaseWhat's going onAction
add_recordNo check of this code has run yet.check_now
checkingA check is running right now.wait
waiting_for_dnsThe record is right, and some servers don't have it yet. Nothing to fix.wait
fix_neededSomething needs changing. explanation.fix is the one thing to do, and view.outcome has the detail.check_now
try_again_laterDNS couldn't be reached. Nothing the person did, and nothing for them to do.wait
verifiedDone.none
expiredThe code ran out. Get a new code.new_code

Following a claim to the end is one loop. This one reads the claim just after each of our scheduled checks:

Following a claim
// Read the claim until it settles. Reading is free, so there's no limit to meet.
async function follow(claimId, cookie) {
  for (;;) {
    const response = await fetch(`https://www.prufy.dev/api/claims/${claimId}`, {
      headers: { cookie },
    })
    const { view } = await response.json()

    if (view.phase === "verified") return view
    if (view.status !== "pending") throw new Error(view.explanation.headline)

    // Show view.explanation as it is: a headline, why, and the one fix.
    render(view.explanation)

    // We check on our own. Come back just after the next one.
    const next = new Date(view.timing.nextCheckAt).getTime()
    await sleep(Math.max(next - Date.now(), 0) + 1_000)
  }
}

Every reason a check can give is in What each failure means.

When someone else adds the record

The person claiming a domain often isn't the one who can change its DNS. Create a setup link and send it to whoever can: it shows the record and the steps, and lets them run a check, with no session and no access to anything else. Add email and we send it for you.

For providers that take an import, the zone-file line is the same record in a form that can be pasted whole.

Try it without a real domain

Run the server with recorded DNS answers and every outcome is one claim away. You need Bun, Docker for Postgres, and the repository.

Start a local server in fixture mode
bun install
bun run db:up
bun run db:migrate
DNS_MODE=fixtures bun run dev

It listens on http://localhost:5200. Choose localhost:5200 in any request example on this site and every example points there, using verified.prufy-demo.dev, which passes on its first check.

Any name under prufy-demo.dev with a recorded scenario works. Most give one outcome every time, and What each failure means names the one for each. These four change between checks, so you can watch a claim move:

Claim thisWhat happens
typo-then-fixed.prufy-demo.devA lookalike character on the first check, verified on the second.
propagating.prufy-demo.devWaiting on public resolvers, verified on the third check.
disagree.prufy-demo.devWaiting on the provider's own servers, verified on the third check.
record-removed.prufy-demo.devVerified on the first check, the record gone on the second and third (at risk), back on the fourth.

Waiting 7 days for a code to expire isn't practical, so a local server can move its clock forward and run the worker on demand. Both answer not_found in production.