Email-based MFA for identity creation, reauthentication, and agent sessions.
Anchor supports one-time password (OTP) as its email MFA method. Each identity is assigned a dedicated mailbox — simply configure a forwarding rule with your email provider to route OTP codes to Anchor during identity creation, reauthentication, and agent sessions.
Use the mailbox and identity email APIs to provision an inbox, attach it to an identity, verify forwarding, and read OTP emails programmatically. All endpoints require the anchor-api-key header.
After setting up your email forwarding rule, send a probe to confirm delivery, then poll for incoming messages. Use the since query parameter to fetch only emails received after a given ISO timestamp.
const identityId = 'IDENTITY_ID';const mailboxId = 'MAILBOX_ID';// Send a probe email to verify forwardingawait anchorClient.post(`/v1/mailboxes/${mailboxId}/send-probe`, { body: {} });// List recent emails for the identityconst since = new Date(Date.now() - 5 * 60 * 1000).toISOString();const emails = await anchorClient.get(`/v1/identities/${identityId}/email/emails`, { query: { since },});// Read full content of the newest emailif (emails.length > 0) { const email = await anchorClient.get( `/v1/identities/${identityId}/email/emails/${emails[0].id}`, ); console.log(email.subject, email.body_text);}
During identity creation and agent sessions, Anchor automatically reads OTP codes from the mailbox. Use the list and get email endpoints when you need to handle codes in your own integration.