B2B Saas Authentication

/

API reference

/

Multi-Factor Authentication (MFA)

/

Recovery codes

/

Recover

Recover

POSThttps://test.stytch.com/v1/b2b/recovery_codes/recover

Allows a Member to complete an MFA flow by consuming a recovery code. This consumes the recovery code and returns a session token that can be used to authenticate the Member.


Body parameters


organization_id*string

member_id*string

recovery_code*string

intermediate_session_tokenstring

session_tokenstring

session_jwtstring

session_duration_minutesint

session_custom_claimsmap<string, any>

Response fields


request_idstring

status_codeint

member_idstring

memberobject

organizationobject

session_tokenstring

session_jwtstring

member_sessionobject

recovery_codes_remaininginteger
curl --request POST \
  --url https://test.stytch.com/v1/b2b/recovery_codes/recover \
  -u 'PROJECT_ID:SECRET' \
  -H 'Content-Type: application/json' \
  -d '{
    "organization_id": "organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931",
    "member_id": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
    "recovery_code": "ckss-2skx-ebow"
  }'

RESPONSE

200
{
  "status_code": 200,
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "member_id": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
  "organization_id": "organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931",
  "session_jwt": "example_jwt",
  "session_token": "mZAYn5aLEqKUlZ_Ad9U_fWr38GaAQ1oFAhT8ds245v7Q",
  "member_session": {...},
  "member": {...},
  "organization": {...},
  "recovery_codes_remaining": 9
}