Authentication
All Users API methods require authentication via theAuthMiddleware. Include a valid bearer token in your requests.
Methods
Get Current User
Retrieve information about the currently authenticated user.No parameters required
Unique identifier for the user
ID of the user’s current organization (nullable)
User’s role in the organization
User’s email address
User’s first name
User’s last name
URL to the user’s avatar image
Whether the user has completed onboarding
User’s timezone (IANA timezone identifier)
User’s settings object
UnauthorizedError- User is not authenticatedInternalServerError- Unexpected server error
Update User
Update an existing user’s profile information. Only users with appropriate permissions can update user data.ID of the user to update
Updated first name
Updated last name
Updated avatar URL (set to null to clear)
Updated email address
Updated timezone (IANA timezone identifier)
Updated user settings
The updated user object
Transaction ID for optimistic updates
UserNotFoundError- User with the specified ID doesn’t existUnauthorizedError- User lacks permission to update this userInternalServerError- Unexpected server error (including WorkOS sync failures)
- Updates are synchronized with WorkOS user management
- Changes are performed within a database transaction
- Policy checks ensure users can only update authorized accounts
Delete User
Delete a user account (soft delete). Only users with appropriate permissions can delete users.ID of the user to delete
Transaction ID for optimistic updates
UserNotFoundError- User with the specified ID doesn’t existUnauthorizedError- User lacks permission to delete this userInternalServerError- Unexpected server error (including WorkOS sync failures)
- Deletion is synchronized with WorkOS user management
- Changes are performed within a database transaction
- Policy checks ensure proper authorization
Finalize Onboarding
Mark the current authenticated user as having completed onboarding. This sets theisOnboarded flag to true.
No parameters required
The updated user object with isOnboarded set to true
Transaction ID for optimistic updates
UnauthorizedError- User is not authenticatedInternalServerError- Unexpected server error
- Updates the current authenticated user only
- Performed within a database transaction
- No additional permissions required beyond authentication
Reset Avatar
Reset the current user’s avatar to their original WorkOS profile picture (e.g., Google/GitHub OAuth avatar). Clears the avatar if WorkOS doesn’t have a profile picture.No parameters required
The updated user object with the reset avatar
Transaction ID for optimistic updates
UnauthorizedError- User is not authenticatedInternalServerError- Unexpected server error (including WorkOS fetch failures)
- Fetches the user’s profile picture from WorkOS
- If WorkOS has a profile picture URL, it’s set as the avatar
- If no profile picture is available, the avatar is set to null
- Performed within a database transaction
Error Handling
Related APIs
- User Presence Status API - Manage user presence and status
- Notifications API - Manage user notifications