# 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**

   ```shell
   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"
   }'
   ```

   **Node.js**

   ```javascript
   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()
   ```

   **Python**

   ```python
   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 `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

   ```json
   {
     "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

   ```json
   {
     "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**

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

   **Node.js**

   ```javascript
   // `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()
   ```

   **Python**

   ```python
   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.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

   ```json
   {
     "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](https://www.prufy.dev/docs/guides/keep-a-domain-verified.md) 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](https://www.prufy.dev/docs/api-reference/rotate-challenge.md). | `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

```javascript
// 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)
  }
}
```

> **One thing worth copying from the app**
>
> Right after a claim is made, our first check usually finds nothing, because nobody has had time to add the record. That arrives as `fix_needed` with the reason `nothing_at_name`. The Prufy app keeps showing the steps for that case instead of an error: the person isn't wrong, they're just not finished.

Every reason a check can give is in [What each failure means](https://www.prufy.dev/docs/guides/failures.md).

## 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](https://www.prufy.dev/docs/api-reference/create-setup-link.md) 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](https://www.prufy.dev/docs/api-reference/zone-file.md) 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](https://bun.sh/), Docker for Postgres, and [the repository](https://github.com/agnelnieves/prufy).

Start a local server in fixture mode

```shell
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](https://www.prufy.dev/docs/guides/failures.md) 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](https://www.prufy.dev/docs/api-reference/advance-clock.md) and [run the worker](https://www.prufy.dev/docs/api-reference/run-worker.md) on demand. Both answer `not_found` in production.

---

Every page of these docs, as a list: https://www.prufy.dev/llms.txt
