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
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" }'const response = await fetch("https://www.prufy.dev/api/v1/claims", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ input: "yourcompany.com" }), }) // The session cookie is what makes this claim yours. Keep it for later requests. const cookie = response.headers.getSetCookie()[0]?.split(";")[0] const data = await response.json()import requests # A Session keeps the cookie the response sets, and sends it from then on. session = requests.Session() response = session.post( "https://www.prufy.dev/api/v1/claims", json={"input": "yourcompany.com"}, ) data = response.json()A domain we can't accept answers
422with a message that says what to type instead, so it can go straight under the input.Show the record
The claim comes back with one TXT record.
record.hostis what goes in the provider's host field, already adjusted for providers that add the domain themselves.record.valuehas to be pasted exactly.view.record{ "type": "TXT", "host": "_prufy-challenge", "fullName": "_prufy-challenge.yourcompany.com", "value": "prufy-domain-verification=xwqyp4hnsmgqxceo2xd6orgeay", "ttl": 300 }view.instructionssays 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.expiresAtsays exactly when.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// `cookie` is the session cookie that Create a claim returned. const response = await fetch("https://www.prufy.dev/api/v1/claims/clm_4b1f7c1e-52e7-4c0a-9a3b-7d2f0c6e8a10/checks", { method: "POST", headers: { cookie }, }) const data = await response.json()import requests # `session` is the requests.Session() that created the claim. response = session.post("https://www.prufy.dev/api/v1/claims/clm_4b1f7c1e-52e7-4c0a-9a3b-7d2f0c6e8a10/checks") data = response.json()One check per claim every 10 seconds.
view.timing.canCheckNowAtsays when the next one is allowed, so a button can count down instead of failing.Read the answer
Every response carries the claim as it now stands. When
view.phaseisverified, it's done. Until then,view.explanationsays 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.
| Phase | What's going on | Action |
|---|---|---|
add_record | No check of this code has run yet. | check_now |
checking | A check is running right now. | wait |
waiting_for_dns | The record is right, and some servers don't have it yet. Nothing to fix. | wait |
fix_needed | Something needs changing. explanation.fix is the one thing to do, and view.outcome has the detail. | check_now |
try_again_later | DNS couldn't be reached. Nothing the person did, and nothing for them to do. | wait |
verified | Done. | none |
expired | The 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:
// 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.
bun install
bun run db:up
bun run db:migrate
DNS_MODE=fixtures bun run devIt 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 this | What happens |
|---|---|
typo-then-fixed.prufy-demo.dev | A lookalike character on the first check, verified on the second. |
propagating.prufy-demo.dev | Waiting on public resolvers, verified on the third check. |
disagree.prufy-demo.dev | Waiting on the provider's own servers, verified on the third check. |
record-removed.prufy-demo.dev | Verified 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.