This document outlines the API endpoints for managing users in PySpur.
Users and sessions are required for deploying agents and chatbots that maintain message history.
Description: Creates a new user. If a user with the given external ID already exists, returns the existing user.URL: /user/Method: POSTRequest Payload:
Copy
class UserCreate: external_id: str # External identifier for the user user_metadata: Optional[Dict[str, Any]] = None # Additional metadata about the user
Response Schema:
Copy
class UserResponse: id: str # User ID (prefixed with 'U') external_id: str # External identifier for the user user_metadata: Optional[Dict[str, Any]] # Additional metadata about the user created_at: datetime # When the user was created updated_at: datetime # When the user was last updated
Description: Gets a specific user by ID.URL: /user/{user_id}/Method: GETParameters:
Copy
user_id: str # User ID (prefixed with 'U')
Response Schema:
Copy
class UserResponse: id: str # User ID (prefixed with 'U') external_id: str # External identifier for the user user_metadata: Optional[Dict[str, Any]] # Additional metadata about the user created_at: datetime # When the user was created updated_at: datetime # When the user was last updated
Description: Updates a user.URL: /user/{user_id}/Method: PATCHParameters:
Copy
user_id: str # User ID (prefixed with 'U')
Request Payload:
Copy
class UserUpdate: external_id: Optional[str] = None # External identifier for the user user_metadata: Optional[Dict[str, Any]] = None # Additional metadata about the user
Response Schema:
Copy
class UserResponse: id: str # User ID (prefixed with 'U') external_id: str # External identifier for the user user_metadata: Optional[Dict[str, Any]] # Additional metadata about the user created_at: datetime # When the user was created updated_at: datetime # When the user was last updated