User Profiles
User Profiles represent the identity of users within a cPod tenant. Each authenticated user has exactly one profile per tenant. Profiles store display information, preferences, and organization memberships with associated roles.
UserProfile Schema
| Field | Type | Required | Description |
|---|---|---|---|
id | string | auto | Prefixed ID: usr-{ulid} |
email | string | auto | Primary email (from identity provider) |
displayName | string | yes | Name shown in the UI |
avatarUrl | string | no | URL of the user’s avatar image |
role | enum | yes | owner | admin | member | viewer |
status | enum | auto | active | suspended | deactivated |
organizationId | string | auto | Organization this profile belongs to |
preferences.theme | enum | no | light | dark | system |
preferences.locale | string | no | BCP 47 locale tag (e.g. en-US) |
preferences.notificationsEnabled | boolean | no | Whether email notifications are active |
createdAt | string | auto | ISO 8601 UTC |
updatedAt | string | auto | ISO 8601 UTC |
Get Your Own Profile
Retrieve the profile of the currently authenticated user.
import { CpodClient } from '@cpod/sdk'
const sdk = CpodClient.fromEnv()
const me = await sdk.userProfiles.me()
console.log(me.id, me.displayName, me.role)
// → "usr-01HXYZ..." "Alice Chen" "admin"Get a User Profile
Retrieve a specific user profile by ID. The caller must share an organization with the target user, or be an admin.
const profile = await sdk.userProfiles.get('usr-001')
console.log(profile.email, profile.status)Update Your Profile
Users may update their own displayName, avatarUrl, and preferences. Admins may update any member’s profile.
const updated = await sdk.userProfiles.update('usr-001', {
displayName: 'Alice C.',
avatarUrl: 'https://cdn.acme.com/avatars/alice.png',
preferences: {
theme: 'dark',
locale: 'en-US',
notificationsEnabled: true,
},
})List Organization Members
List all user profiles that are members of a given organization. Supports filtering by role and status.
// List all admin members of an organization
const result = await sdk.userProfiles.listMembers('org-001', {
role: 'admin',
status: 'active',
limit: 50,
})
for (const member of result.items) {
console.log(member.id, member.displayName, member.role)
}Update a Member’s Role
Promote, demote, or suspend a user’s membership in an organization. Requires admin or owner role.
// Promote a member to admin
const updated = await sdk.userProfiles.updateMembership('org-001', 'usr-002', {
role: 'admin',
})
// Suspend a member
await sdk.userProfiles.updateMembership('org-001', 'usr-003', {
status: 'suspended',
})Remove a Member
Remove a user from an organization. The user’s profile is not deleted — they simply lose access to that organization’s resources.
Owners cannot remove themselves. Transfer ownership before removing yourself.
await sdk.userProfiles.removeMember('org-001', 'usr-003')