Anthropic::BetaUserProfiles
User Profiles API (beta) for creating and managing per-end-user state.
Access via client.beta.user_profiles.
profile = client.beta.user_profiles.create(
external_id: "user-123",
metadata: {"plan" => "pro"}
)
enrollment = client.beta.user_profiles.create_enrollment_url(profile.id)
puts enrollment.url
# Pass the profile id when creating a message so the API applies
# per-user state like memory.
client.beta.messages.create(
model: Anthropic::Model::CLAUDE_OPUS_4_7,
max_tokens: 1024,
messages: [Anthropic::MessageParam.user("Hi!")],
user_profile_id: profile.id
)
Constants
BETA_HEADER = USER_PROFILES_BETA
Constructors
new(client : Client)
SourceInstance methods
create(external_id : String | Nil = nil, metadata : Hash(String, String) | Nil = nil) : BetaUserProfile
Create a new user profile.
Create an enrollment URL for the given user profile.
Send the returned URL to the end user so they can complete enrollment.