Impersonate User
curl --request POST \
--url https://api.example.com/api/v1/ops/users/{user_id}/impersonate \
--header 'Content-Type: application/json' \
--data '
{
"reason": "",
"ttl_minutes": 60
}
'import requests
url = "https://api.example.com/api/v1/ops/users/{user_id}/impersonate"
payload = {
"reason": "",
"ttl_minutes": 60
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({reason: '', ttl_minutes: 60})
};
fetch('https://api.example.com/api/v1/ops/users/{user_id}/impersonate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/ops/users/{user_id}/impersonate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reason' => '',
'ttl_minutes' => 60
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/ops/users/{user_id}/impersonate"
payload := strings.NewReader("{\n \"reason\": \"\",\n \"ttl_minutes\": 60\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/ops/users/{user_id}/impersonate")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"\",\n \"ttl_minutes\": 60\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/ops/users/{user_id}/impersonate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"\",\n \"ttl_minutes\": 60\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}ops
Impersonate User
Begin a “log in as user” session (superadmin only, audited). Mints a signed, 1-hour
impersonation cookie that current_principal honours ahead of the operator’s own session, so
the operator’s browser acts AS the target across the apps (with an always-visible banner +
one-click exit via /auth/impersonate/stop). Refuses to impersonate a suspended user (reactivate
first) — the principal would 403 on every tenant route anyway.
Wave-2 guardrails: a REASON IS REQUIRED (422 without one) and the operator picks a TTL (15 or 60 min) that is signed into the claim — the session hard-expires server-side.
POST
/
api
/
v1
/
ops
/
users
/
{user_id}
/
impersonate
Impersonate User
curl --request POST \
--url https://api.example.com/api/v1/ops/users/{user_id}/impersonate \
--header 'Content-Type: application/json' \
--data '
{
"reason": "",
"ttl_minutes": 60
}
'import requests
url = "https://api.example.com/api/v1/ops/users/{user_id}/impersonate"
payload = {
"reason": "",
"ttl_minutes": 60
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({reason: '', ttl_minutes: 60})
};
fetch('https://api.example.com/api/v1/ops/users/{user_id}/impersonate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/ops/users/{user_id}/impersonate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reason' => '',
'ttl_minutes' => 60
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/ops/users/{user_id}/impersonate"
payload := strings.NewReader("{\n \"reason\": \"\",\n \"ttl_minutes\": 60\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/ops/users/{user_id}/impersonate")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"\",\n \"ttl_minutes\": 60\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/ops/users/{user_id}/impersonate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"\",\n \"ttl_minutes\": 60\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}⌘I