/impersonate - Exit impersonation mode
Allows user to exit impersonation mode and return to their original account. This endpoint can only be called with an active impersonation token. Returns fresh tokens for the original user and completes the audit session.
DELETE
/impersonate
curl \
--request DELETE 'https://api.your-domain.com/api/impersonate' \
--header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
"code": 200,
"message": "impersonation ended successfully",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_in": 86400
}
}
Response examples (400)
{
"code": 400,
"message": "Not currently impersonating a user"
}
Response examples (401)
{
"code": 401,
"message": "invalid token",
"data": {}
}