neosourceDocs
Search docs

Remove a passkey

DELETE/api/auth/webauthn/credentials/{credential_id}

deletePasskey

Sudo-gated — removing a login method is exactly the class of change that must not ride on a stolen session cookie alone. Refuses with `409` when this passkey is the account's last remaining way in (no password, no linked identity, no other passkey). TOTP does not count: it is a second factor, so an account holding only TOTP is locked out. Scoped to the caller's own credentials: deleting someone else's is a 404.

Requires authentication using a session cookie — see tokens and scopes.

curl

curl -X DELETE 'https://neosource.dev/api/auth/webauthn/credentials/CREDENTIAL_ID' \
  -b 'ns_session=$NEOSOURCE_SESSION'

fetch

fetch("https://neosource.dev/api/auth/webauthn/credentials/CREDENTIAL_ID", {
  method: "DELETE",
  credentials: "include",
});

Path parameters

credential_idrequired

Base64url credential ID from the list response

string

Responses

204Removed

403Sudo required — the `challenge` field names which sudo-prove endpoint to call

application/json

SudoRequiredError

object

Wire shape of the 403 a sudo-gated endpoint returns when sudo is missing or expired. `challenge` tells the SPA which sudo-prove endpoint to call.

challengerequired

string

Which sudo-prove endpoint the account should use: `"passkey"` (`/api/auth/sudo/passkey/{start,finish}`), `"password"` (`/api/auth/sudo/password`), or `"totp"` (`/api/auth/sudo/totp`), chosen from the account's registered credentials — passkey first when present, since it is both the strongest credential and the least friction. A hint for which prompt to show first, not an authorization decision: each sudo route verifies its own credential regardless of what was advertised here, so a client may use a different one.

errorrequired

string

Always `sudo_required` — this body exists to carry the extra fields that kind needs.

"sudo_required"

messagerequired

string

Standard errors

Bodies documented once for the whole API — see standard errors.

  • 401Authentication required
  • 404No such passkey on this account
  • 409This is the account's only remaining login method
  • 429Rate limited — retry after the `Retry-After` header
  • 500Internal server error
  • 503Service temporarily unavailable / at capacity — retry after the `Retry-After` header
  • 504Gateway timeout — the request exceeded the server's handling budget