Deactivate inactive users
POST/v1/users/deactivate-inactive
Sweep deactivation for stale accounts. A user is deactivated when all of:
created_atis older thandaysdays ago (so brand-new accounts that haven't had a chance to log in yet are not killed).- They have no
login_successrow inauthentication_audit_logwithin the lastdaysdays. Impersonation logins are excluded (rows whereimpersonation_session_id IS NOT NULLdon't count). - Their
login_accountis not inexclude_login_accounts. - They are currently
is_active = true(already-inactive users are skipped).
Affected users get is_active=false and active_to=NOW() — same as DELETE /users.
The response includes up to 1000 affected users with last_login_at (NULL if they've never logged in). If more were affected, truncated: true is set on the response.
Use dry_run: true to see who would be deactivated without writing anything.
Request
Responses
- 200
- 400
- 403
Sweep completed
Validation error (missing/invalid days, etc.)
Forbidden — insufficient permissions (POST_USER or POST_DATA required)