Skip to content

End impersonation

POST
/auth/impersonation/end

Ends the impersonation you’re in and signs you back in as yourself with a new session cookie.

Send it with the impersonation session’s cookie; no capability is checked. The server first tries to end the impersonation session, then creates a new session for your own account, with whatever capabilities that account has now. If ending the old session fails, that’s only logged and you still get the new one. If creating the new session fails you get a 500 and no new cookie: you’re signed out if the old session was ended, and still impersonating if it wasn’t.

A 400 means the current session isn’t an impersonation. An API token in Authorization still takes precedence over the cookie on later requests. Ending is recorded in the audit log as admin.impersonation.ended on a best-effort basis.

Impersonation ended. The response sets your new session cookie.

object
admin_user_ref
required

Your own user ref: the account you’re signed in as now.

integer format: int64
admin_username
required
string

Current session is not an impersonation.

object
error
required

Human-readable error summary

string
Example
the request could not be completed

Authentication required, missing, or invalid

object
error
required

Human-readable error summary

string
Example
the request could not be completed
Example
{
"error": "authentication required: sign in and retry with a valid session or API token"
}