Authentication
A Nexiel API key is an OAuth 2.0 client: exchange its client id and secret for a short-lived access token, then send the token as a bearer token on every call to https://compliance.nexiel.io.
Get a key
- Test keys (client id
nx-test-...) are free and need no account review. Get a Verify key and a Screen key in about 30 seconds from the test keys page. They are valid for 30 days. With a Nexiel account, create more on the dashboard's API Keys page in test mode. - Live keys (client id
nx-live-...) are created on the dashboard's API Keys page once your organization's business verification (KYB) is approved. See Going live.
Each key belongs to one product: a Verify key calls the Verify, Age, Sign and Seal routes (/v1/verify, /v1/sign, /v1/seal), and a Screen key calls the Screen routes (/v1/screen, /v1/wallet-risk). The secret is shown once, when the key is created. Store it in a secret manager or an environment variable, never in source code or a browser.
export NEXIEL_CLIENT_ID="nx-test-..."
export NEXIEL_CLIENT_SECRET="..."Exchange the key for an access token
Send the client credentials grant to the token endpoint, https://auth.nexiel.io/realms/nexiel/protocol/openid-connect/token. The response is standard OAuth 2.0 JSON with access_token, token_type (Bearer) and expires_in.
export NEXIEL_ACCESS_TOKEN=$(curl -s https://auth.nexiel.io/realms/nexiel/protocol/openid-connect/token \
-d grant_type=client_credentials \
-d client_id="$NEXIEL_CLIENT_ID" \
-d client_secret="$NEXIEL_CLIENT_SECRET" | jq -r .access_token)const response = await fetch('https://auth.nexiel.io/realms/nexiel/protocol/openid-connect/token', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
grant_type: 'client_credentials',
client_id: process.env.NEXIEL_CLIENT_ID,
client_secret: process.env.NEXIEL_CLIENT_SECRET,
}),
});
if (!response.ok) throw new Error(`token request failed: ${response.status}`);
const { access_token: accessToken, expires_in: expiresIn } = await response.json();import os
import requests
response = requests.post(
"https://auth.nexiel.io/realms/nexiel/protocol/openid-connect/token",
data={
"grant_type": "client_credentials",
"client_id": os.environ["NEXIEL_CLIENT_ID"],
"client_secret": os.environ["NEXIEL_CLIENT_SECRET"],
},
timeout=10,
)
response.raise_for_status()
access_token = response.json()["access_token"]Send the token
Put the access token, never the client secret, in the Authorization header of every request:
curl -s https://compliance.nexiel.io/v1/verify/sessions \
-H "Authorization: Bearer $NEXIEL_ACCESS_TOKEN"const response = await fetch('https://compliance.nexiel.io/v1/verify/sessions', {
headers: { Authorization: `Bearer ${accessToken}` },
});response = requests.get(
"https://compliance.nexiel.io/v1/verify/sessions",
headers={"Authorization": f"Bearer {access_token}"},
timeout=10,
)A failed authentication returns 401 with a WWW-Authenticate: Bearer challenge and one of three codes: token_expired (request a new token and retry), invalid_token (malformed, revoked, or issued for another product) or unauthorized (no credential sent). See Errors.
Token lifetime
An access token is valid for 300 seconds. Cache it, request a new one shortly before expires_in runs out, and request a new one and retry once if a call returns 401 token_expired. Every call is checked against Nexiel's authorization server, so a revoked key stops working at once, even while its tokens are still within their lifetime.
let cached = { token: null, expiresAt: 0 };
async function accessToken() {
if (cached.token && Date.now() < cached.expiresAt - 30_000) return cached.token;
const { access_token, expires_in } = await requestToken(); // the exchange above
cached = { token: access_token, expiresAt: Date.now() + expires_in * 1000 };
return cached.token;
}Rotation and revocation
- An organization can hold several active keys per product, so you can roll a new key out before retiring the old one.
- Rotating a key on the dashboard issues a replacement key and keeps the old one working for an overlap window (7 days by default), so you can redeploy without a hard cutover.
- Nexiel recommends rotating every 90 days, and sends an
api_key.expiring_soonwebhook event 14 days before a key reaches that age. Nothing is revoked automatically at 90 days. - Revoking a key takes effect on the next request.
Restricted keys
A Verify key can carry the agent-readonly restriction for the Agent Toolkit. It can start and read sessions, and it is refused with 403 forbidden_scope on routes that complete a session, change webhook endpoints or relying-party identity, or create signing requests.
Source restrictions
On the dashboard's Source restrictions page you can limit your keys to IPv4 address ranges, browser origins, or both. A request passes when either matches. A request from anywhere else returns 403 client_access_restricted. Restrictions are off until you turn them on.
Calls that use other credentials
- A browser can read one session with that session's
sessionTokenin theX-Nexiel-Verify-Session-Tokenheader. It can read only that session. See session tokens. - Nexiel Login connections authenticate with their own OIDC client id and secret at
/v1/login/token. See Sign in with EUDI Wallet. - Wallets call their own protocol endpoints (request objects, responses, credential issuance) without an API key, by design.