Me¶
Endpoints for the currently authenticated user to read and update their own profile and organization memberships.
Base path: /api/me
Authentication: All endpoints require a valid session.
Endpoints¶
| Method | Path | Description |
|---|---|---|
GET |
/api/me/organizations |
List the caller's organization memberships |
POST |
/api/me/switch-organization |
Switch the active organization context |
GET |
/api/me/current-organization |
Get details of the currently active organization |
Profile endpoints
To read or update the current user's profile (name, avatar, phone, birth date), use GET /api/users/me and PATCH /api/users/me.
GET /api/me/organizations¶
Returns all active organization memberships for the current user, along with the user's role in each org and which organization is currently active.
Response 200:
{
"data": {
"organizations": [
{
"id": "org-uuid",
"name": "Praxia Academy",
"description": "Educational consultants",
"logoUrl": "https://...",
"status": "active",
"userRole": "Coach",
"isPrimary": true,
"joinedAt": "2025-01-15T09:00:00.000Z",
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-15T09:00:00.000Z"
}
],
"currentOrganizationId": "org-uuid"
}
}
Response fields:
| Field | Type | Description |
|---|---|---|
organizations |
array | All active org memberships |
organizations[].userRole |
string | The caller's role in this org (OrganizationAdmin, Manager, Coach, Teacher) |
organizations[].isPrimary |
boolean | Whether this is the user's primary organization |
organizations[].joinedAt |
string | ISO 8601 timestamp when the membership was created |
currentOrganizationId |
string | null | The active org used to resolve orgRole in API requests |
POST /api/me/switch-organization¶
Change the caller's active organization context. Future requests using the session cookie will resolve orgId and orgRole from this organization.
The caller must be an active member of the target organization.
Request body:
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId |
string | Yes | Must be a valid UUID; caller must be an active member |
Response 200:
Error responses:
| Code | Condition |
|---|---|
400 |
organizationId is not a valid UUID |
403 |
Caller is not an active member of that organization |
GET /api/me/current-organization¶
Returns full details of the currently active organization, including the caller's role in it.
Response 200 (active organization set):
{
"data": {
"id": "org-uuid",
"name": "Praxia Academy",
"description": "Educational consultants",
"logoUrl": "https://...",
"status": "active",
"settings": {},
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-15T09:00:00.000Z",
"userRole": "Coach"
}
}
Response 200 (no active organization):
Response fields:
| Field | Type | Description |
|---|---|---|
userRole |
string | null | The caller's role in the current org |