Passkey (WebAuthn) Server API
Add passkeys to any backend: create WebAuthn registration and login options, verify attestations and assertions; your app only stores the credential.
A stateless passkey server built on SimpleWebAuthn. POST /v1/webauthn/register/options with rp_id (your domain) and user_name returns the options for navigator.credentials.create() (or startRegistration() of @simplewebauthn/browser), the challenge and a challenge_token: an HMAC-signed token that carries the challenge, the RP ID and a 5-minute expiry (timeout_ms, up to 10 minutes), so you do not need a session store. Then POST /register/verify with the browser response, the challenge_token (or your own stored expected_challenge + rp_id) and expected_origin: attestation formats none, packed, TPM, Android Key / SafetyNet, Apple and FIDO U2F are checked and you get credential.id, credential.public_key (COSE, base64url, plus JWK and PEM), counter, transports, the AAGUID with a provider name for well-known passkey managers, user_verified, device_type and backed_up.
To sign in, POST /login/options (optionally with allow_credentials) and POST /login/verify with the response, the token and the stored credential {id, public_key, counter}: the signature, origin, RP ID hash, user presence / verification (require_user_verification) and the signature counter are verified; save new_counter. Algorithms: EdDSA, ES256/384/512, RS256 and PS256 by default [-8, -7, -257].
Nothing is stored on our side: you keep the credentials (one user can have several) and you decide what a successful verification means. Tokens are stateless and valid until they expire: mark them as used if you need strict one-time challenges. The FIDO Metadata Service is not included (its terms forbid redistribution), so authenticator models are not certified-checked.
Markdown · OpenAPI · Postman · llms.txt
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
operation | path | string | yes | register/options, register/verify, login/options or login/verify (or send op in the body). | |
rp_id | body | string | yes | Relying party ID: your domain without scheme (options; verify when using expected_challenge). | |
rp_name | body | string | no | Name shown by the browser (register/options). | |
user_name | body | string | yes | Account name, e.g. an e-mail (register/options). | |
user_id | body | string | no | Opaque user id, max 64 bytes (random when omitted; returned base64url). | |
user_display_name | body | string | no | Display name (register/options). | |
attestation | body | string | no | none | none, direct or enterprise. |
authenticator_attachment | body | string | no | platform (device passkey) or cross-platform (security key). | |
resident_key | body | string | no | preferred | required, preferred or discouraged (discoverable credential). |
user_verification | body | string | no | preferred | required, preferred or discouraged. |
exclude_credentials | body | array | no | Credential ids (or {id, transports}) the user already has (register/options). | |
allow_credentials | body | array | no | Credentials allowed to sign in (login/options); empty = discoverable passkeys. | |
timeout_ms | body | number | no | 300000 | Ceremony timeout and token lifetime, 30 000-600 000 ms. |
response | body | object | yes | The credential JSON from the browser (verify). | |
challenge_token | body | string | no | Token from the options call (verify). | |
expected_challenge | body | string | no | Your stored challenge instead of the token (verify, with rp_id). | |
expected_origin | body | string | no | Allowed origin(s), e.g. https://example.com (default https://<rp_id>). | |
credential | body | object | no | Stored credential {id, public_key, counter, transports} (login/verify). | |
require_user_verification | body | boolean | no | false | Fail when the authenticator did not verify the user (PIN / biometrics). |
Example
curl -X POST "https://apibox.io.vn/v1/webauthn/register/options" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"rp_id":"example.com","rp_name":"Example","user_name":"an@example.vn","user_id":"user-42"}'const res = await fetch('https://apibox.io.vn/v1/webauthn/register/options', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"rp_id": "example.com",
"rp_name": "Example",
"user_name": "an@example.vn",
"user_id": "user-42"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/webauthn/register/options",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"rp_id": "example.com", "rp_name": "Example", "user_name": "an@example.vn", "user_id": "user-42"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/webauthn/register/options');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"rp_id":"example.com","rp_name":"Example","user_name":"an@example.vn","user_id":"user-42"}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"options": {
"challenge": "Wbjgnz1u4oqN_OSWuvCfxO0QJ_E08LK0EM5t58J69w0",
"rp": {
"name": "Example",
"id": "example.com"
},
"user": {
"id": "dXNlci00Mg",
"name": "an@example.vn",
"displayName": "an@example.vn"
},
"pubKeyCredParams": [
{
"alg": -8,
"type": "public-key"
},
{
"alg": -7,
"type": "public-key"
},
{
"alg": -257,
"type": "public-key"
}
],
"timeout": 300000,
"attestation": "none",
"excludeCredentials": [],
"authenticatorSelection": {
"residentKey": "preferred",
"userVerification": "preferred",
"requireResidentKey": false
},
"extensions": {
"credProps": true
},
"hints": []
},
"challenge": "Wbjgnz1u4oqN_OSWuvCfxO0QJ_E08LK0EM5t58J69w0",
"challenge_token": "eyJrIjoicmVnIiwiYyI6IldiamduejF1NG9xTl9PU1d1dkNmeE8wUUpfRTA4TEswRU01dDU4SjY5dzAiLCJyIjoiZXhhbXBsZS5jb20iLCJlIjoxNzk0Mzk0MzYyLCJvIjoiZGVtbyJ9.tT-u26UHsnaeEQj8K_fcWoIEi20XctaQPWXjveP0q7k",
"expires_at": "2026-11-11T10:52:42.000Z",
"user_id": "dXNlci00Mg",
"next": "Pass `options` to navigator.credentials.create() (or startRegistration() of @simplewebauthn/browser), then POST the result as `response` with `challenge_token` to /v1/webauthn/register/verify."
}
Use cases
- Add passkey login to a PHP, WordPress, Laravel or Apps Script backend without a WebAuthn library
- Replace SMS OTP with phishing-resistant passkeys for customer accounts
- Offer passwordless sign-in in internal tools and admin panels
- Prototype WebAuthn flows and inspect real authenticator responses
FAQ
What does my app have to store?
The credential id, public key, counter and transports of each passkey, linked to the user. Optionally the challenge (instead of the challenge_token) and used tokens.
Does it work with iPhone, Android and Windows Hello passkeys?
Yes. Synced passkeys usually use attestation "none" and keep the counter at 0, which is accepted.
Which origin should I send?
The exact origin of the page that called WebAuthn, e.g. https://example.com (several allowed). The rp_id must be that domain or a parent domain.
Related APIs
Hash Generator
Compute MD5, SHA-1, SHA-256, SHA-384, SHA-512 and CRC32 of text or files in one call, as hex or base64, with optional HMAC signing.
B64Encode / Decode
Encode or decode text as Base64, Base64URL, hex, URL encoding, HTML entities, Unicode escapes, ROT13 or binary with one simple API call.
***Password Generator
Generate cryptographically secure random passwords (4–256 chars, up to 100 at once) or check a password’s strength, entropy and estimated crack time.