Skip to content

Using the REST API

Passlock includes a REST API, along with the @passlock/server library to manage your tenancy data. The REST API allows you to:

  • Create, inspect, verify, and delete mailbox challenges for email one-time code flows
  • Exchange a passkey registration or authentication code for an ExtendedPrincipal
  • List passkeys in your vault
  • Fetch a passkey from your vault
  • Delete a passkey from your vault
  • Update a passkey in your vault
  • Prepare and complete passkey registration and authentication operations

REST API calls operate on a specific tenancy. You will need your Tenancy ID, along with the relevant API Key. API endpoints are typically prefixed with the Tenancy ID, e.g.

GET https://api.passlock.dev/v2/{tenancyId}/passkeys/ HTTP/1.1

Server-side REST API calls require authentication. Provide your tenancy-specific API Key via a Bearer authorization header:

GET https://api.passlock.dev/v2/{tenancyId}/passkeys/ HTTP/1.1
Authorization: Bearer {apiKey}

The passkey registration and authentication options and verification endpoints are browser-facing continuations of a prepared operation. They use the registrationToken, authenticationToken, or sessionToken issued earlier in the flow rather than a tenancy API key.

REST calls return JSON:

GET https://api.passlock.dev/v2/{tenancyId}/passkeys/ HTTP/1.1
Authorization: Bearer {apiKey}
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
  • GET /v2/{tenancyId}/principal/{code} exchanges a browser-issued code for an ExtendedPrincipal
  • GET /v2/{tenancyId}/passkeys/ lists passkey summaries
  • GET /v2/{tenancyId}/passkeys/{passkeyId} fetches a passkey
  • PATCH /v2/{tenancyId}/passkeys/{passkeyId} updates a passkey username
  • DELETE /v2/{tenancyId}/passkeys/{passkeyId} deletes a passkey
  • PATCH /v2/{tenancyId}/users/{userId}/passkeys/ updates username metadata for a user’s passkeys
  • DELETE /v2/{tenancyId}/users/{userId}/passkeys/ deletes a user’s passkeys
  • POST /v2/{tenancyId}/challenges creates a mailbox challenge
  • GET /v2/{tenancyId}/challenges/{challengeId} reads a pending mailbox challenge
  • POST /v2/{tenancyId}/challenges/verify verifies a mailbox challenge
  • DELETE /v2/{tenancyId}/challenges/{challengeId} deletes a mailbox challenge
  • POST /v2/{tenancyId}/passkey/registration/prepare prepares a passkey registration
  • POST /v2/{tenancyId}/passkey/registration/options creates WebAuthn registration options
  • POST /v2/{tenancyId}/passkey/registration/verification verifies a registration response
  • POST /v2/{tenancyId}/passkey/authentication/prepare prepares a passkey authentication
  • POST /v2/{tenancyId}/passkey/authentication/options creates WebAuthn authentication options
  • POST /v2/{tenancyId}/passkey/authentication/verification verifies an authentication response