Authentication
Authenticate with the Namefi API using an API key, EIP-712 wallet signatures, or SIWE sessions
Use /v4 for new integrations. /v-next remains available for legacy signed
requests and is deprecated.
| Method | Carrier | Typical use |
|---|---|---|
| API key | x-api-key | Account API access |
| OAuth | Authorization: Bearer | CLI and connected clients |
| EIP-712 typed data | $metadata.auth in the JSON body | Wallet-signed operations that declare signing types |
| SIWE | x-namefi-siwe-token | Wallet sessions, including protected GET reads |
These credentials establish identity. Each operation still enforces its own permissions, ownership, organization access, and account restrictions.
API key authentication
The simplest authentication method. Works for all operations including DNS record creation, updates, deletes, domain registration, and parking.
Important: The API key inherits permissions from the wallet that generated it. To manage DNS records for a domain, generate the key from the wallet that owns that domain's NFT.
Direct HTTP usage (no SDK needed)
For AI agents, scripts, and quick integrations, pass the API key directly as an HTTP header:
curl -X POST "https://api.namefi.io/v4/dns/records" \
-H "x-api-key: $NAMEFI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"zoneName":"example.com","type":"A","name":"@","rdata":"1.2.3.4","ttl":300}'SDK usage
Create a client with an API key:
import { createNamefiClient } from '@namefi/api-client';
const client = createNamefiClient({
authentication: {
apiKey: process.env.NAMEFI_API_KEY!,
type: 'API_KEY',
},
logger: true,
});Generate an API key
EIP-712 authentication
For /v4, attach $metadata.auth with method: "eip712" and
mode: "typed-data". The alias mode: "payload" is also accepted. Send the
account and chain ID without a signature to receive HTTP 401 with the typed data
to sign. No operation is executed and no stored challenge is created.
Sign those exact typed data and retry the same operation with its nonce, timestamp, and signature. The server binds the proof to the operation, account, chain, canonical API origin, and business input, then consumes the nonce once. Do not submit a different business payload with the signature. Nonces and timestamps are not idempotency keys: retain the operation's existing retry rules.
The SDK handles signed writes using type: 'EIP712'. Set authentication.chainId
(or siwe.chainId); contract wallets can also set authentication.account.
Protected GET reads use SIWE rather than JSON request bodies.
See the EIP-712 Signing guide for the request shape
and the retained /v-next format.
SIWE authentication
SIWE uses a short challenge-response flow:
GET /v4/siwe/allowed-chainsGET /v4/siwe/nonceGET /v4/siwe/message- Sign
messageStringwith ERC-191personal_sign POST /v4/siwe/verify- Reuse the returned
x-namefi-siwe-token
If you use @namefi/api-client with type: 'EIP712', the client bootstraps SIWE automatically for protected non-EIP-712 operations.
For manual flows and raw HTTP examples, see the SIWE Authentication guide.
Preparing requests without an SDK signer
For raw integrations, use the live helper endpoints and the manual Prepare Auth Requests workflow. Preparation produces the message or typed data; your wallet signs it separately.
The public namefi-skills repository
provides API-key REST helpers in skills/namefi-domain-api and an MCP connection
skill in skills/namefi-mcp. Follow that repository's current entrypoints.
Account-level wallet authentication uses the server's default NFT chain, matching
its existing account-verification policy. Unsigned discovery reports that chain;
other-chain signed login proofs are rejected before account lookup. This does not
change chain-specific action verification for an already authenticated user.
Use the canonical API origin when configuring SDK signed requests (production:
https://api.namefi.io). Proofs cannot be reused against another API origin.
Typed-data payloads use bounded canonical JSON: at most 16,384 UTF-16 code units, 2,048 nodes, and depth 16. Body metadata is supported on object-body operations without URL path parameters; GET/HEAD and other operations retain their existing API-key/OAuth/SIWE authentication.