Class: Anthropic::Resources::Beta::UserProfiles

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/user_profiles.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ UserProfiles

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of UserProfiles.

Parameters:



154
155
156
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 154

def initialize(client:)
  @client = client
end

Instance Method Details

#create(external_id: nil, metadata: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaUserProfile

Some parameter documentations has been truncated, see Models::Beta::UserProfileCreateParams for more details.

Create User Profile

Parameters:

  • external_id (String, nil)

    Body param: Platform’s own identifier for this user. Not enforced unique. Maximu

  • metadata (Hash{Symbol=>String})

    Body param: Free-form key-value data to attach to this user profile. Maximum 16

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 25

def create(params = {})
  parsed, options = Anthropic::Beta::UserProfileCreateParams.dump_request(params)
  header_params = {betas: "anthropic-beta"}
  @client.request(
    method: :post,
    path: "v1/user_profiles?beta=true",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Beta::BetaUserProfile,
    options: {extra_headers: {"anthropic-beta" => "user-profiles-2026-03-24"}, **options}
  )
end

#create_enrollment_url(user_profile_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaUserProfileEnrollmentURL

Create Enrollment URL

Parameters:

Returns:

See Also:



140
141
142
143
144
145
146
147
148
149
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 140

def create_enrollment_url(, params = {})
  parsed, options = Anthropic::Beta::UserProfileCreateEnrollmentURLParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/user_profiles/%1$s/enrollment_url?beta=true", ],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Beta::BetaUserProfileEnrollmentURL,
    options: {extra_headers: {"anthropic-beta" => "user-profiles-2026-03-24"}, **options}
  )
end

#list(limit: nil, order: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::BetaUserProfile>

List User Profiles

Parameters:

Returns:

See Also:



112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 112

def list(params = {})
  query_params = [:limit, :order, :page]
  parsed, options = Anthropic::Beta::UserProfileListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "v1/user_profiles?beta=true",
    query: query,
    headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"),
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Beta::BetaUserProfile,
    options: {extra_headers: {"anthropic-beta" => "user-profiles-2026-03-24"}, **options}
  )
end

#retrieve(user_profile_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaUserProfile

Get User Profile

Parameters:

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 51

def retrieve(, params = {})
  parsed, options = Anthropic::Beta::UserProfileRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/user_profiles/%1$s?beta=true", ],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Beta::BetaUserProfile,
    options: {extra_headers: {"anthropic-beta" => "user-profiles-2026-03-24"}, **options}
  )
end

#update(user_profile_id, external_id: nil, metadata: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaUserProfile

Some parameter documentations has been truncated, see Models::Beta::UserProfileUpdateParams for more details.

Update User Profile

Parameters:

  • user_profile_id (String)

    Path param: Path parameter user_profile_id

  • external_id (String, nil)

    Body param: If present, replaces the stored external_id. Omit to leave unchanged

  • metadata (Hash{Symbol=>String})

    Body param: Key-value pairs to merge into the stored metadata. Keys provided ove

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 82

def update(, params = {})
  parsed, options = Anthropic::Beta::UserProfileUpdateParams.dump_request(params)
  header_params = {betas: "anthropic-beta"}
  @client.request(
    method: :post,
    path: ["v1/user_profiles/%1$s?beta=true", ],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Beta::BetaUserProfile,
    options: {extra_headers: {"anthropic-beta" => "user-profiles-2026-03-24"}, **options}
  )
end