POST /users/{email}/impersonate
Impersonate a user
Allows account admins and super admins to impersonate a user.
Authentication Required
Authorization: Bearer {token}
header string This header is required to access this endpoint
Required Parameters
x-account-id
header string Account ID for the request
email
path string The email of the user to impersonate.
Optional Parameters
Click here to view an exhaustive list of all available parameters
stop
query string If set, stops the current impersonation session.
Try it out
Loading...
Output:
Responses
Description
Successful impersonation or stop of impersonation.
{ "sessionId": "string", "userId": 0, "userEmail": "string", "userName": "string", "isImpersonating": false, "originalUserEmail": "string", "accountId": "string", "accountName": "string", "flatPermissionsList": [ "string" ], "flatRolesList": [ "string" ]}Description
Bad request (e.g., identity crisis, user must have a primary account).
{ "message": "string"}Description
Unauthorized request (e.g., no session).
{ "message": "string"}Description
No permission to impersonate (e.g., non-admin attempting to impersonate).
{ "message": "string"}Description
User not found.
{ "message": "string"}References
#/components/parameters/xAccountIdHeader#/components/schemas/Session#/components/schemas/ImpersonationError
#/components/parameters/xAccountIdHeader
in: headername: x-account-idschema: type: stringdescription: Account ID for the requestrequired: trueexample: "2311"|export type xAccountIdHeader = any; // Schema type not fully supported#/components/schemas/Session
type: objectdescription: User session informationproperties: sessionId: type: string description: Unique identifier for the session userId: type: integer description: User ID associated with the session userEmail: type: string format: email description: Email of the user userName: type: string description: Name of the user isImpersonating: type: boolean description: Whether this is an impersonation session originalUserEmail: type: string format: email description: Email of the original user (if impersonating) accountId: type: string description: Current account ID accountName: type: string description: Current account name flatPermissionsList: type: array items: type: string description: List of permissions for the current user in this session flatRolesList: type: array items: type: string description: List of roles for the current user in this session|export interface Session { /** Unique identifier for the session */ sessionId?: string; /** User ID associated with the session */ userId?: number; /** Email of the user */ userEmail?: string; /** Name of the user */ userName?: string; /** Whether this is an impersonation session */ isImpersonating?: boolean; /** Email of the original user (if impersonating) */ originalUserEmail?: string; /** Current account ID */ accountId?: string; /** Current account name */ accountName?: string; /** List of permissions for the current user in this session */ flatPermissionsList?: string[]; /** List of roles for the current user in this session */ flatRolesList?: string[];}#/components/schemas/ImpersonationError
type: objectproperties: message: type: string description: Error message|export interface ImpersonationError { /** Error message */ message?: string;}Route Source Code
Check out the source code for this route entrypoint here: /users/[email]/impersonate/route.ts
Or the swagger.yaml spec this documentation was generated from:
/users/swagger.yaml