End Staff View (tab closed)
POST/api/portal/auth/view-as/end
Sent by the portal tab as a navigator.sendBeacon on page hide, to end a staff "View as buyer" session when its tab closes without Exit. A beacon cannot send an Authorization header, so the view's own token travels in the body (the route is exempt from CSRF). The session ends with reason closed; a reload of the same tab within ~20 seconds resumes it. Anything that is not a live view-as token on this tenant is ignored. Always answers 204. Throttled 30/min.
This endpoint currently requires session authentication; Personal Access Token scope support is in progress.
Request
Responses
- 204
- 401
- 403
- 422
- 429
No Content
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Validation failed — the body is a field → messages map (Laravel shape) or the platform envelope with a stable machine-readable code. Fix the payload and resubmit.
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.