---
title: "Generate a DNS verification token for a domain"
method: POST
path: "/domainverification/generatednstoken"
---

# Generate a DNS verification token for a domain

`POST /domainverification/generatednstoken`

Available on Pro subscriptions. Generates the domain-specific TXT record value used to verify control of a domain via DNS before it can be searched through the domain search APIs.

## Headers

- `user-agent` string, required

## Request body

- DomainVerificationRequest
  - `DomainName` string, required — Domain name to generate or verify a domain-verification token for.

## Response `200`

The TXT record value to publish on the domain.

- DomainVerificationDnsTokenResponse
  - `txtRecordValue` string, required — TXT record value to publish on the domain before calling verifydnstoken.

## Other responses

- `400` — Bad request — the request body was invalid, the domain was invalid, or the domain cannot be verified.
- `401` — Unauthorized — the hibp-api-key header was missing, malformed, or invalid.
- `403` — Forbidden — no user agent has been specified in the request, or the current subscription does not include permission to add domains via the API.

---

[API](https://skmtc.net/haveibeenpwned/apis/have-i-been-pwned-api-v3.md) · [All operations](https://skmtc.net/haveibeenpwned/apis/have-i-been-pwned-api-v3/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/haveibeenpwned/have-i-been-pwned-api-v3/revisions/b6c35caec844/schema)
