API reference OpenAPI 3.1
GET /auth/me

Staff identity

Caller identity for the Bearer JWT session: user_id, email, name, role, tenant_id, the forced-change flag, and (V42) can_view_all plus the assigned companies for the backoffice company switcher.

Bearer API key or staff session operation authMe

Request

This endpoint has no request body.

curl "$MONICHEK_API/auth/me" \
  -H "Authorization: Bearer $MONICHEK_API_KEY"
const res = await fetch(`${MONICHEK_API}/auth/me`, {
  method: "GET",
  headers: {
    Authorization: `Bearer ${MONICHEK_API_KEY}`,
  },
});

const data = await res.json();
import os
import requests

res = requests.get(
    f"{os.environ['MONICHEK_API']}/auth/me",
    headers={"Authorization": f"Bearer {os.environ['MONICHEK_API_KEY']}"},
)
print(res.json())
$ch = curl_init(getenv('MONICHEK_API') . '/auth/me');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('MONICHEK_API_KEY'),
    ],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;

Responses

200 OK staff identity application/json
{
  "user_id": "usr_01M3R...",
  "email": "[email protected]",
  "name": "Ada",
  "role": "analyst",
  "tenant_id": "ten_SANDBOX",
  "must_change_password": false,
  "can_view_all": false,
  "companies": [
    {
      "id": "ten_SANDBOX",
      "name": "Sandbox"
    }
  ]
}
Response fields
FieldTypeRequiredDescription
user_id string Yes —
email string (email) Yes —
name string No —
role string Yes —
tenant_id string No —
must_change_password boolean No —
can_view_all boolean No —
companies array of object No
Show 2 nested fields
FieldTypeRequiredDescription
id string No —
name string No —

Error responses

StatusMeaningBody
401 Unauthorized RFC 9457 problem

Errors use the RFC 9457 problem format with a stable code.