Auth API reference

Auth API · Consumer-Mfa

post/{app_slug}/v1/me/mfa/factors/{id}/verifyAuth

Confirm enrollment of a pending factor

TOTP: submit two `codes` from consecutive 30-second windows. Email: submit the emailed 6-digit `code`. On success the factor flips to enabled, recovery codes are minted (returned once), and prior recovery codes for the account are invalidated. Subsequent calls with the same `:id` fail with 400.

Path parameters

id*string

Id of the factor.

app_slug*string

Slug of the app.

Request body

codesarray

TOTP factors: two codes from consecutive 30-second windows of the authenticator app. The second must come from a different period than the first.

Example: ["123456","654321"]

codestring

Email factors: the single 6-digit code that was emailed when enrollment started.

Example: "123456"

credentialobject

Passkey factors: the `PublicKeyCredential` returned by `navigator.credentials.create()`, ArrayBuffers base64url-encoded. The challenge inside `clientDataJSON` must be the one issued when enrollment started.

Response · 200

factor*object
id*string

Unique identifier of the factor.

type*string

Factor type — `totp` (authenticator app), `email` (single-use code delivered to a verified email contact), or `webauthn` (a passkey). Further factor types will extend this list without a breaking change to the response shape.

Example: "totp"

label*string

Label the user gave the factor, or `null`.

enabled*boolean

Whether the factor is enabled.

created_at*string · date-time

When the factor was created (ISO 8601).

enabled_at*string · date-time

When the factor was enabled (ISO 8601), or `null`.

recovery_codes*array

Single-use recovery codes for this account. Shown once — store them now.

Example: ["a1b2-c3d4-e5f6-7890","1234-5678-9abc-def0"]

Example

Request

POST https://api.auth.productcraft.co/{app_slug}/v1/me/mfa/factors/{id}/verify
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "codes": [
    "123456",
    "654321"
  ],
  "code": "123456",
  "credential": {}
}

Response

{
  "factor": {
    "id": "string",
    "type": "totp",
    "label": "string",
    "enabled": false,
    "created_at": "2026-01-01T00:00:00.000Z",
    "enabled_at": "2026-01-01T00:00:00.000Z"
  },
  "recovery_codes": [
    "a1b2-c3d4-e5f6-7890",
    "1234-5678-9abc-def0"
  ]
}