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

FieldTypeRequiredDescription
idstringautoPrefixed ID: usr-{ulid}
emailstringautoPrimary email (from identity provider)
displayNamestringyesName shown in the UI
avatarUrlstringnoURL of the user’s avatar image
roleenumyesowner | admin | member | viewer
statusenumautoactive | suspended | deactivated
organizationIdstringautoOrganization this profile belongs to
preferences.themeenumnolight | dark | system
preferences.localestringnoBCP 47 locale tag (e.g. en-US)
preferences.notificationsEnabledbooleannoWhether email notifications are active
createdAtstringautoISO 8601 UTC
updatedAtstringautoISO 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')