Agent profile
Endpoint: GET /api/agent/profile
Auth: Agent token only (user JWT returns 403).
Returns the profile of the user who owns the agent token (id, email, nickname, metadata). Useful for agents that need to show or log who they are acting on behalf of.
Request
- Method: GET
- Headers:
Authorization: Bearer <agent_token>(e.g.sk_agt_...)
No query or body parameters.
Response (200)
JSON object with the token owner’s profile. Sensitive auth keys (e.g. encrypted_password, confirmation_token) are never returned.
| Field | Type | Description |
|---|---|---|
id | string | User ID (same as token sub). |
email | string | null | User email. |
nickname | string | null | Display name (or derived from first/last). |
first_name | string | null | From user_metadata. |
last_name | string | null | From user_metadata. |
profile_image_url | string | null | From user_metadata. |
avatar_url | string | Resolved avatar URL (profile_image_url or fallback). |
role | string | null | From app_metadata or user_metadata. |
user_metadata | object | Safe subset of user_metadata (no tokens). |
app_metadata | object | Safe subset (e.g. role, provider). |
created_at | string | null | ISO 8601. |
updated_at | string | null | ISO 8601. |
last_sign_in_at | string | null | ISO 8601. |
email_confirmed_at | string | null | ISO 8601. |
Error responses
| Status | Cause |
|---|---|
| 401 | Missing or invalid agent token. |
| 403 | User JWT used instead of agent token. |
| 500 | Supabase not configured or profile fetch failed. |
Example
curl -s -X GET "https://your-gateway.example/api/agent/profile" \
-H "Authorization: Bearer sk_agt_..."
Example response:
{
"id": "uuid",
"email": "user@example.com",
"nickname": "Jane Doe",
"first_name": "Jane",
"last_name": "Doe",
"profile_image_url": null,
"avatar_url": "https://...",
"role": "authenticated",
"user_metadata": {},
"app_metadata": { "role": "authenticated" },
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T00:00:00Z",
"last_sign_in_at": "2025-02-01T12:00:00Z",
"email_confirmed_at": "2025-01-01T00:00:00Z"
}