Overview
The User Management endpoint is optional and used for agents that require user-specific contexts or session management. UserTrace can create simulated users at the start of each simulation session if your agent needs to track user state.This endpoint is only required if your agent needs to manage user sessions, preferences, or historical context. Many agents can operate without user management by using the metadata in chat requests.
Endpoint
Request Headers
Request Body
Unique identifier for the simulated user that will be used in subsequent chat requests
Simulation context and user characteristics
User profile information for the simulation
Request Examples
Basic User Creation
Detailed User Profile
Response Format
Echo of the user ID from the request
ISO 8601 timestamp when the user was created
User status. Values:
active, inactive, pendingGenerated session ID for this user (optional)
Internal profile identifier (optional)
List of features available for this user type
Response Examples
Successful Creation
Minimal Response
Error Responses
User Already Exists
Invalid Request
User Deletion (Optional)
If your agent supports user cleanup, you can implement user deletion:Endpoint
Response
Implementation Guidelines
When to Use User Management
Use user management if your agent requires:- User-specific conversation history
- Personalized preferences or settings
- Session state across multiple interactions
- User authentication or authorization
- Custom user profiles or data
- Is stateless and doesn’t need user context
- Can derive all needed information from chat metadata
- Operates as a simple request-response system
- Doesn’t personalize responses based on user data
User ID Format
- Use consistent, unique identifiers
- UserTrace generates IDs in format:
sim_user_{random} - Support alphanumeric characters and underscores
- Maximum length: 64 characters
Lifecycle Management
- Creation: User created before first chat interaction
- Usage: User ID included in all subsequent chat requests
- Session: Optional session management within user context
- Cleanup: Optional deletion after simulation completes
Best Practices
- Validate Input: Check user_id format and required fields
- Handle Duplicates: Return appropriate errors for existing users
- Store Context: Persist user data for the session duration
- Clean Up: Remove users after simulation completes
- Security: Don’t store sensitive data in simulated user profiles
Optional Feature: User management is completely optional. Most agents can function effectively using only the chat completions endpoint with metadata.