End a staff member’s read-only view
const url = 'https://api.sloose.com/auth/impersonation/end';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.sloose.com/auth/impersonation/end \ --header 'Authorization: Bearer <token>'Ends the session a staff member opened to see this organisation as one of its members (POST /staff/orgs/{orgId}/impersonate), and writes the end down. The widget’s banner calls this; a view that is not ended runs out on its own after an hour. A session that is not such a view is refused with 409 NOT_IMPERSONATING.
Session only.
Authorizations
Section titled “Authorizations”Responses
Section titled “Responses”Ended.
object
Example
{ "ok": true}The session is unknown or expired (code: AUTH_REQUIRED).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}An API token was used (code: SESSION_REQUIRED). Like every route behind a session: a session signed in but in no organisation is refused code: NO_ORG, a banned person code: BANNED, and a closed organisation code: ORG_CLOSED.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}This session is nobody’s view of anything (code: NOT_IMPERSONATING).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}The restore switch is on (code: MAINTENANCE): every route but /health and /robots.txt is refused before anything is read, except the operator’s own POST /staff/people/{id}/delete with the ADMIN_TOKEN. Sloose is down for maintenance. Please try again in a few minutes.
object
Example
{ "code": "MAINTENANCE"}Headers
Section titled “Headers”Seconds until asking again is worth it (300 while the switch is on).