logo

Prepare Auth Requests

Prepare signer-neutral Namefi API requests using live authentication helpers

Keep request preparation separate from wallet signing. Resolve the operation's method, URL, parameters and authentication requirements from the current OpenAPI reference and authentication overview. A global security declaration alone does not identify every operation's effective authentication mode.

Operation modePreparation
noneBuild the anonymous request from its input schema.
siwe-optionalUse the anonymous request when appropriate, or prepare a SIWE session for authenticated behavior.
siwe-requiredObtain and verify a SIWE message, then attach the returned session token.
eip712Fetch the operation's live typed-data definition and sign a fresh envelope.

SIWE requests

  1. Fetch GET /v4/siwe/allowed-chains and choose an allowed chain.
  2. Get a nonce for the signer from GET /v4/siwe/nonce.
  3. Pass the signer, nonce and chain to GET /v4/siwe/message.
  4. Have the wallet sign the returned messageString using ERC-191 personal_sign.
  5. Send the structured message and signature to POST /v4/siwe/verify.
  6. Attach the returned token as x-namefi-siwe-token to the protected request.

Preserve the returned message exactly. Preparation does not prove wallet access; verification must succeed before treating the session as authenticated. The SIWE guide contains request and response examples.

EIP-712 requests

  1. Send the normal operation body with $metadata.auth containing method: "eip712", mode: "typed-data", the wallet account and the server's configured account-authentication chain ID. A different chain returns 400; it is never silently replaced.
  2. Read the HTTP 401 response's signing requirements, including the validated chain and canonical API audience; no action has run.
  3. Have the wallet sign the returned typed data exactly.
  4. Retry the same operation body with the returned nonce and timestamp and the signature in $metadata.auth.

mode: "payload" is a compatibility alias. This flow has no stored challenge or challenge ID. Inspect the action before signing; the EIP-712 guide includes the request format and the separate legacy /v-next envelope.

SDK and agent options

@namefi/api-client handles signing and SIWE bootstrapping when configured with its EIP-712 signer. For API-key REST helpers or an MCP-capable client, see the current namefi-skills repository: skills/namefi-domain-api contains curl scripts and skills/namefi-mcp describes the MCP connection.

On this page