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.

POSThttps://apibox.io.vn/v1/webauthn/{operation}
Security & Crypto▶ Try it online

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

NameInTypeRequiredDefault
operationpathstringyesregister/options, register/verify, login/options or login/verify (or send op in the body).
rp_idbodystringyesRelying party ID: your domain without scheme (options; verify when using expected_challenge).
rp_namebodystringnoName shown by the browser (register/options).
user_namebodystringyesAccount name, e.g. an e-mail (register/options).
user_idbodystringnoOpaque user id, max 64 bytes (random when omitted; returned base64url).
user_display_namebodystringnoDisplay name (register/options).
attestationbodystringnononenone, direct or enterprise.
authenticator_attachmentbodystringnoplatform (device passkey) or cross-platform (security key).
resident_keybodystringnopreferredrequired, preferred or discouraged (discoverable credential).
user_verificationbodystringnopreferredrequired, preferred or discouraged.
exclude_credentialsbodyarraynoCredential ids (or {id, transports}) the user already has (register/options).
allow_credentialsbodyarraynoCredentials allowed to sign in (login/options); empty = discoverable passkeys.
timeout_msbodynumberno300000Ceremony timeout and token lifetime, 30 000-600 000 ms.
responsebodyobjectyesThe credential JSON from the browser (verify).
challenge_tokenbodystringnoToken from the options call (verify).
expected_challengebodystringnoYour stored challenge instead of the token (verify, with rp_id).
expected_originbodystringnoAllowed origin(s), e.g. https://example.com (default https://<rp_id>).
credentialbodyobjectnoStored credential {id, public_key, counter, transports} (login/verify).
require_user_verificationbodybooleannofalseFail 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"}'

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

Start with 1,000 free requests every month. Get free API key →