Select an Account from a pre-auth session (multi-Account login)
/v1/auth/select-accountSecond step of multi-Account login: exchanges the pre-auth session for an access token bound to the chosen Account's first Application. Guarded by UserJwtGuard with @AllowPreAuth, accepting account_id; the caller must be an active member of that Account or 401 is returned. Entering the Account runs its administrator MFA policy against what the pre-auth token proved: an SSO sign-in into an Account whose after_sso is require answers requires_mfa_challenge with a challenge bound to the Account, an Account that requires a factor the admin lacks answers mfa_enrollment_pending with the session while the grace window lasts and requires_mfa_enrollment with an enrollment continuation after it. Otherwise issues a fresh access and refresh token (Bearer, 900s), sets the refresh and session-marker cookies, and clears the pre-auth cookie; no cookie changes on a refusal. There is no Application picker — switching Apps happens later via switch-application.
Request body
application/json
account_idstring Required Account ID to bind the new access token to
Responses
application/json
data *SelectAccountResponseDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
Returned object
curl -X POST "https://auth.canopy-io.com/v1/auth/select-account" \ -H "Content-Type: application/json" \ -d '{ "account_id": "string" }'
{ "data": { "mfa_enrollment_pending": false, "grace_expires_at": "2026-04-20T12:00:00.000Z", "requires_mfa_enrollment": false, "mfa_enrollment": { "enrollment_token": "string", "available_factors": [ "totp" ], "totp": { "otpauth_uri": "string", "manual_entry_key": "string" } }, "requires_mfa_challenge": false, "mfa_challenge": { "challenge_token": "string", "available_factors": [ "totp" ], "expires_at": "2026-04-20T12:00:00.000Z" }, "access_token": "string", "token_type": "string", "expires_in": 0, "account": { "id": "string", "name": "string", "slug": "string" }, "application": { "id": "string", "name": "string", "slug": "string" }, "default_environment_slug": "string" } }
Tell us how we can improve this guide.