/impersonate/consent - Enable impersonation consent
Allows a user to enable consent for being impersonated by authorized users (Super Admin role or Owner organization users). This is a privacy-friendly approach where users explicitly control if and for how long they can be impersonated.
Key Features:
- User controls their own impersonation consent
- Custom duration (1-168 hours)
- Only active while consent is valid
- Complete audit trail of all impersonation activities
POST
/impersonate/consent
curl \
--request POST 'https://api.your-domain.com/api/impersonate/consent' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"duration_hours":24}'
Request examples
{
"duration_hours": 24
}
Response examples (200)
{
"code": 200,
"message": "impersonation consent enabled successfully",
"data": {
"consent": {
"id": "consent_123",
"user_id": "usr_456",
"expires_at": "2025-09-04T14:30:00Z",
"max_duration_minutes": 60,
"created_at": "2025-09-03T14:30:00Z"
}
}
}
Response examples (400)
{
"code": 400,
"message": "Duration must be between 1 and 168 hours"
}
Response examples (401)
{
"code": 401,
"message": "invalid token",
"data": {}
}