API
Prufy API
Prove a domain is yours with one DNS record, and keep it proven. Everything the Prufy app does, it does through this API, so anything you can do there you can build yourself.
Your first request
Send a domain. You get back a claim, and inside it the one TXT record that proves the domain is yours. No sign-up comes first: the response sets a session cookie, and that cookie is what makes the claim yours.
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()The part to act on is view.record: add it at the domain's DNS provider, then run a check or wait for ours. The whole answer is on the Create a claim page.
{
"record": {
"type": "TXT",
"host": "_prufy-challenge",
"fullName": "_prufy-challenge.yourcompany.com",
"value": "prufy-domain-verification=xwqyp4hnsmgqxceo2xd6orgeay",
"ttl": 300
}
}Requests and responses are JSON. The base address is https://www.prufy.dev, and the whole API is described in one OpenAPI document, generated from the same schemas the server validates with.
The basics
Create a claim, add the record, run a check. Start to verified.
Sessions without sign-up, and the tokens that stand in for one.
One shape for every error, and what each kind means.
How often each thing can be done, and what a limited response says.
Versioning
Every route lives under /api/v1. Within a version, changes only add: a new route, a new optional field in a request, a new field in a response, or a new value in a list that says it can grow. Removing or renaming a field, changing its type, or making something required is a new version.
- Ignore fields you don't know. A response may gain fields at any time.
- Expect new values in open lists. An event's
type, an error'skindand a check'striggercan gain values. Skip an event you don't know, and treat an unknown error by its HTTP status. - Watch for two headers. A deprecated address answers with
DeprecationandSunset, and aLinkto its replacement.
The addresses from before versioning, like /api/claims for /api/v1/claims, still answer the same way, with those headers. They stay until at least 2027-06-01, and until the clients still calling them have moved. The unsubscribe address in alert emails never goes away.
Foundations
The seven statuses, what moves a claim between them, and when we check.
Every outcome a check can have, and the one thing that fixes it.
Re-checks, the grace period, alerts, and getting ownership back.
API reference
One page per route, each with the request in three languages and a real response.
Claims
- POSTCreate a claimStart proving a domain is yours, and get the one DNS record to add.
- GETList claimsEvery domain this session has claimed, with where each one stands.
- GETRetrieve a claimOne claim: its status, the record to add, the last check and its history.
- POSTRun a checkLook for the record now, without waiting for the next scheduled check.
- POSTGet a new codeReplace the claim's code with a fresh one that works for 7 days.
- POSTAbandon a claimStop a claim you no longer want. It can't be undone.
- GETGet the record as a zone-file lineThe record in BIND zone-file format, for providers that take an import.
Setup links
- POSTCreate a setup linkMake a link that lets someone else add the record, and optionally email it.
- GETRetrieve a claim by setup linkWhat the person helping gets to see: the record, the steps and the status.
- POSTRun a check by setup linkLook for the record now, on behalf of whoever holds the link.
Alerts
- GETRetrieve alert settingsWhere alerts go for this session, and which channels this server can use.
- PUTSet the alert emailChoose the address alerts go to. We send a confirmation link first.
- DELRemove the alert emailStop sending alerts by email and forget the address.
- POSTConfirm the alert emailTurn a confirmation token into a confirmed address.
- POSTUnsubscribe from alert emailsStop alert emails using the token from any alert's footer.
- POSTSubscribe a browser to pushRegister a browser's push subscription, so alerts arrive as notifications.
- DELUnsubscribe a browser from pushRemove one browser's push subscription.
- POSTSend a test alertSend a sample alert to every channel this account has set up.
Signing in
- POSTRequest a sign-in linkEmail a sign-in link to an account's confirmed alert address.
- POSTUse a sign-in linkTurn the token from a sign-in link into a session on this device.
- POSTRedeem a sign-in codeA terminal trades the page's code and its own secret for a session.
- GETRetrieve this sessionWhether this device is signed in, and how many devices share the account.
- DELSign outEnd this device's session on the server and clear its cookie.
- DELSign out everywhere elseEnd every other session on this account. This one stays signed in.
Domain Connect
- POSTGet a one-click setup URLA signed link to the DNS provider's own page, where the owner approves the record.
System
- GETCheck the API is upAnswers `{ ok: true }` when the server is running and its database answers.
Development
- GETInspect a name's DNSWhat every resolver answers for any name, without creating a claim.
- POSTMove the clock forwardAdvance the server's clock, so time-based states can be reached by hand.
- POSTRun the workerDo everything that's due right now: scheduled checks, expiries and lapses.