Skip to content

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"
]
}

References

#/components/parameters/xAccountIdHeader

in: header
name: x-account-id
schema:
type: string
description: Account ID for the request
required: true
example: "2311"

#/components/schemas/Session

type: object
description: User session information
properties:
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

#/components/schemas/ImpersonationError

type: object
properties:
message:
type: string
description: Error message

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