Skip to main content

Calling the REST API from your backend

Use Authorization: Bearer with a personal access key npk_* from Access keys for servers, scripts, and MCP (MCP Auth). That is how non-browser clients authenticate to the same HTTP API the SDK uses under the hood. End-user browsers normally do not need this—use hosted checkout and NeusClient instead.

Hosted

  1. getHostedCheckoutUrl + returnUrl - Hosted Verify
  2. User finishes on neus.network
  3. Continue in your app with the proof result; for server-to-API calls, use npk_* as in API authentication.
Access keysAuthorization: Bearer on API/MCP. MCP: Auth (neus_me).

In-app verify (default)

Use NeusClient.verify() so the SDK prepares the signing payload and submits - see Quickstart.
import { NeusClient } from '@neus/sdk';

const client = new NeusClient({ appId: 'your-app-id' });
await client.verify({
  verifier: 'ownership-basic',
  content: 'Hello NEUS',
  wallet: window.ethereum,
});

Advanced: manual standardize + sign

Only when you need full control over the request body (custom verifierIds / data) before submit:
import { standardizeVerificationRequest, signMessage } from '@neus/sdk';

const standardized = await standardizeVerificationRequest(body, {
  apiUrl: 'https://api.neus.network',
});
const signature = await signMessage({
  provider: window.ethereum,
  walletAddress: body.walletAddress,
  message: standardized.signerString,
});
Use SDK helpers - don’t craft strings by hand. Signing format | API authentication