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:



162
163
164
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 162

def initialize(client:)
  @client = client
end

Instance Method Details

#create(external_id: nil, metadata: nil, name: nil, relationship: 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

  • name (String, nil)

    Body param: Display name of the entity this profile represents. Required when re

  • relationship (Symbol, Anthropic::Models::Beta::UserProfileCreateParams::Relationship)

    Body param: How the entity behind a user profile relates to the platform that ow

  • 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:



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 29

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:



148
149
150
151
152
153
154
155
156
157
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 148

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:



120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 120

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:



55
56
57
58
59
60
61
62
63
64
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 55

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, name: nil, relationship: 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

  • name (String, nil)

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

  • relationship (Symbol, Anthropic::Models::Beta::UserProfileUpdateParams::Relationship, nil)

    Body param: How the entity behind a user profile relates to the platform that ow

  • 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:



90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 90

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