Skip to content

Mailbox challenges

Passlock exposes mailbox challenge endpoints for email one-time code flows such as signup verification, passwordless login, and email-change verification.

Request
POST https://api.passlock.dev/{tenancyId}/challenges HTTP/1.1
Authorization: Bearer {apiKey}
Accept: application/json
Content-Type: application/json
{
"email": "jdoe@example.com",
"purpose": "signup",
"metadata": {
"signupId": "signup_123"
},
"invalidateOthers": true
}
Response
HTTP/1.1 201 Created
Content-Type: application/json
{
"_tag": "ChallengeCreated",
"challenge": {
"challengeId": "abc123def456ghi",
"purpose": "signup",
"email": "jdoe@example.com",
"createdAt": 1710000000000,
"expiresAt": 1710000600000,
"metadata": {
"signupId": "signup_123"
},
"secret": "ABC123def-GHI456jkl-MNO789pqr",
"code": "123456",
"message": {
"html": "<html><body><p>Your Passlock code is <strong>123456</strong>.</p></body></html>",
"text": "Your Passlock code is 123456."
}
}
}

Create success returns the raw code plus a rendered message object with html and text content. You can email that rendered content directly, or use code to build your own template.

  • 429 @error/ChallengeRateLimited with Retry-After and retryAfterSeconds
  • 403 @error/Forbidden
Request
GET https://api.passlock.dev/{tenancyId}/challenges/{challengeId} HTTP/1.1
Authorization: Bearer {apiKey}
Accept: application/json
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"_tag": "Challenge",
"challengeId": "abc123def456ghi",
"purpose": "signup",
"email": "jdoe@example.com",
"createdAt": 1710000000000,
"expiresAt": 1710000600000,
"metadata": {
"signupId": "signup_123"
}
}
  • 404 @error/NotFound
  • 403 @error/Forbidden
Request
POST https://api.passlock.dev/{tenancyId}/challenges/verify HTTP/1.1
Authorization: Bearer {apiKey}
Accept: application/json
Content-Type: application/json
{
"challengeId": "abc123def456ghi",
"secret": "ABC123def-GHI456jkl-MNO789pqr",
"code": "123456"
}
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"_tag": "ChallengeVerified",
"challenge": {
"_tag": "Challenge",
"challengeId": "abc123def456ghi",
"purpose": "signup",
"email": "jdoe@example.com",
"createdAt": 1710000000000,
"expiresAt": 1710000600000,
"metadata": {
"signupId": "signup_123"
}
}
}

Verification success returns a readable nested challenge. The secret and one-time code are not returned.

  • 400 @error/InvalidChallenge
  • 400 @error/InvalidChallengeCode
  • 400 @error/ChallengeExpired
  • 400 @error/ChallengeAttemptsExceeded
  • 403 @error/Forbidden
Request
DELETE https://api.passlock.dev/{tenancyId}/challenges/{challengeId} HTTP/1.1
Authorization: Bearer {apiKey}
Accept: application/json
Response
HTTP/1.1 202 Accepted
Content-Type: application/json
{
"_tag": "ChallengeDeleted"
}
  • 403 @error/Forbidden