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

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/user_profiles.rb,
lib/anthropic/resources/beta/user_profiles/providers.rb,
lib/anthropic/resources/beta/user_profiles/action_urls.rb,
lib/anthropic/resources/beta/user_profiles/providers/google.rb,
lib/anthropic/resources/beta/user_profiles/providers/google/data_controls.rb,
sig/anthropic/resources/beta/user_profiles.rbs,
sig/anthropic/resources/beta/user_profiles/providers.rbs,
sig/anthropic/resources/beta/user_profiles/action_urls.rbs,
sig/anthropic/resources/beta/user_profiles/providers/google.rbs,
sig/anthropic/resources/beta/user_profiles/providers/google/data_controls.rbs

Overview

Register the end customers that your platform serves, so each request can name who it's for. To get started, see the User profiles guide.

Defined Under Namespace

Classes: ActionURLs, Providers

Instance Attribute Summary collapse

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:



284
285
286
287
288
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 284

def initialize(client:)
  @client = client
  @action_urls = Anthropic::Resources::Beta::UserProfiles::ActionURLs.new(client: client)
  @providers = Anthropic::Resources::Beta::UserProfiles::Providers.new(client: client)
end

Instance Attribute Details

#action_urls ⇒ Anthropic::Resources::Beta::UserProfiles::ActionURLs (readonly)



11
12
13
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 11

def action_urls
  @action_urls
end

#providers ⇒ Anthropic::Resources::Beta::UserProfiles::Providers (readonly)



14
15
16
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 14

def providers
  @providers
end

Instance Method Details

#create(access_type: nil, external_id: nil, external_user_details: nil, external_user_onboarded_at: nil, metadata: nil, name: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaUserProfile

Register one of your end customers and get the ID to send on the requests you make for them.

See the User profiles guide for what to send.

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

Parameters:

  • access_type (Symbol, Anthropic::Models::Beta::UserProfileCreateParams::AccessType) —

    Body param: How the platform uses the API for this entity. application (defaul

  • external_id (String, nil) —

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

  • external_user_details (Anthropic::Models::Beta::BetaUserProfileExternalUserDetailsParams) —

    Body param: Details about the entity this profile represents, as the platform st

  • external_user_onboarded_at (Time) —

    Body param: When the entity this profile represents opened its account with the

  • metadata (Hash{Symbol=>String}) —

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

  • name (String, nil) —

    Body param: Optional for all profiles. Real-world name of the entity this profil

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

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

  • workspace_id (String) —

    Header param: Optional header to select the Workspace for this request. The valu

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • access_type: (Anthropic::Models::Beta::UserProfileCreateParams::access_type)
  • external_id: (String, nil)
  • external_user_details: (Anthropic::Beta::BetaUserProfileExternalUserDetailsParams)
  • external_user_onboarded_at: (Time)
  • metadata: (::Hash[Symbol, String])
  • name: (String, nil)
  • betas: (::Array[Anthropic::Models::anthropic_beta])
  • workspace_id: (String)
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 49

def create(params = {})
  parsed, options = Anthropic::Beta::UserProfileCreateParams.dump_request(params)
  header_params = {betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"}
  @client.request(
    qualifiers: {beta: "true"},
    span_name: Anthropic::Internal::Tracing::SpanName::USER_PROFILES_CREATE,
    span_created_id: "anthropic.user_profile.id",
    span_route: "/v1/user_profiles",
    method: :post,
    path: "v1/user_profiles",
    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-08-18"}, **options}
  )
end

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

Create a link that sends the profile's end customer to the Verification Portal from Claude Platform on AWS.

On the Claude API, create an action URL instead. See Send an end customer a link to the Verification Portal for when to create the link and what the end customer sees.

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

Parameters:

  • user_profile_id (String) —

    The ID of the user profile to create an enrollment URL for (uprof_...).

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

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

  • workspace_id (String) —

    Optional header to select the Workspace for this request. The value is a Workspa

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • betas: (::Array[Anthropic::Models::anthropic_beta])
  • workspace_id: (String)
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 266

def create_enrollment_url(, params = {})
  parsed, options = Anthropic::Beta::UserProfileCreateEnrollmentURLParams.dump_request(params)
  @client.request(
    qualifiers: {beta: "true"},
    span_name: Anthropic::Internal::Tracing::SpanName::USER_PROFILES_CREATE_ENROLLMENT_URL,
    span_attributes: {"anthropic.user_profile.id" => },
    span_route: "/v1/user_profiles/{user_profile_id}/enrollment_url",
    method: :post,
    path: ["v1/user_profiles/%1$s/enrollment_url", ],
    headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"),
    model: Anthropic::Beta::BetaUserProfileEnrollmentURL,
    options: {extra_headers: {"anthropic-beta" => "user-profiles-2026-08-18"}, **options}
  )
end

#delete(user_profile_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDeletedUserProfile

Delete a user profile, for example when the end customer closes their account.

Stop sending the profile's ID first. See the User profiles guide for what happens after a delete.

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

Parameters:

  • user_profile_id (String) —

    The ID of the user profile to delete (uprof_...).

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

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

  • workspace_id (String) —

    Optional header to select the Workspace for this request. The value is a Workspa

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • betas: (::Array[Anthropic::Models::anthropic_beta])
  • workspace_id: (String)
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 227

def delete(, params = {})
  parsed, options = Anthropic::Beta::UserProfileDeleteParams.dump_request(params)
  @client.request(
    qualifiers: {beta: "true"},
    span_name: Anthropic::Internal::Tracing::SpanName::USER_PROFILES_DELETE,
    span_attributes: {"anthropic.user_profile.id" => },
    span_route: "/v1/user_profiles/{user_profile_id}",
    method: :delete,
    path: ["v1/user_profiles/%1$s", ],
    headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"),
    model: Anthropic::Beta::BetaDeletedUserProfile,
    options: {extra_headers: {"anthropic-beta" => "user-profiles-2026-08-18"}, **options}
  )
end

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

List the user profiles in your organization, newest first by default.

See the User profiles guide for how to set up and manage profiles.

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

Parameters:

  • limit (Integer) —

    Query param: The maximum number of user profiles to return, from 1 to 100. Defau

  • order (Symbol, Anthropic::Models::Beta::UserProfileListParams::Order) —

    Query param: The sort direction, applied to the field that order_by selects. D

  • order_by (Symbol, Anthropic::Models::Beta::UserProfileListParams::OrderBy) —

    Query param: The field to sort user profiles by, in the direction that order s

  • page (String) —

    Query param: The cursor for the page to return, taken from next_page in a prev

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

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

  • workspace_id (String) —

    Header param: Optional header to select the Workspace for this request. The valu

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • limit: (Integer)
  • order: (Anthropic::Models::Beta::UserProfileListParams::order)
  • order_by: (Anthropic::Models::Beta::UserProfileListParams::order_by)
  • page: (String)
  • betas: (::Array[Anthropic::Models::anthropic_beta])
  • workspace_id: (String)
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 183

def list(params = {})
  query_params = [:limit, :order, :order_by, :page]
  parsed, options = Anthropic::Beta::UserProfileListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    qualifiers: {beta: "true"},
    span_name: Anthropic::Internal::Tracing::SpanName::USER_PROFILES_LIST,
    span_route: "/v1/user_profiles",
    span_query: %w[limit order order_by page],
    method: :get,
    path: "v1/user_profiles",
    query: query,
    headers: parsed.except(*query_params).transform_keys(
      betas: "anthropic-beta",
      workspace_id: "anthropic-workspace-id"
    ),
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Beta::BetaUserProfile,
    options: {extra_headers: {"anthropic-beta" => "user-profiles-2026-08-18"}, **options}
  )
end

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

Get a user profile by ID to check the details stored for it.

See the User profiles guide for how to set up and manage profiles.

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

Parameters:

  • user_profile_id (String) —

    The ID of the user profile to get (uprof_...).

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

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

  • workspace_id (String) —

    Optional header to select the Workspace for this request. The value is a Workspa

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • betas: (::Array[Anthropic::Models::anthropic_beta])
  • workspace_id: (String)
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



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

def retrieve(, params = {})
  parsed, options = Anthropic::Beta::UserProfileRetrieveParams.dump_request(params)
  @client.request(
    qualifiers: {beta: "true"},
    span_name: Anthropic::Internal::Tracing::SpanName::USER_PROFILES_RETRIEVE,
    span_attributes: {"anthropic.user_profile.id" => },
    span_route: "/v1/user_profiles/{user_profile_id}",
    method: :get,
    path: ["v1/user_profiles/%1$s", ],
    headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"),
    model: Anthropic::Beta::BetaUserProfile,
    options: {extra_headers: {"anthropic-beta" => "user-profiles-2026-08-18"}, **options}
  )
end

#update(user_profile_id, access_type: nil, external_id: nil, external_user_details: nil, external_user_onboarded_at: nil, metadata: nil, name: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaUserProfile

Change the details of a user profile, leaving the fields that you don't send as they are.

See the User profiles guide for how each field is updated.

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

Parameters:

  • user_profile_id (String) —

    Path param: The ID of the user profile to update (uprof_...).

  • access_type (Symbol, Anthropic::Models::Beta::UserProfileUpdateParams::AccessType, nil) —

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

  • external_id (String, nil) —

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

  • external_user_details (Anthropic::Models::Beta::BetaUserProfileExternalUserDetailsParams) —

    Body param: Details about the entity this profile represents, as the platform st

  • external_user_onboarded_at (Time) —

    Body param: If present, replaces the stored account creation time. Omit to leave

  • 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

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

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

  • workspace_id (String) —

    Header param: Optional header to select the Workspace for this request. The valu

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • access_type: (Anthropic::Models::Beta::UserProfileUpdateParams::access_type, nil)
  • external_id: (String, nil)
  • external_user_details: (Anthropic::Beta::BetaUserProfileExternalUserDetailsParams)
  • external_user_onboarded_at: (Time)
  • metadata: (::Hash[Symbol, String])
  • name: (String, nil)
  • betas: (::Array[Anthropic::Models::anthropic_beta])
  • workspace_id: (String)
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/anthropic/resources/beta/user_profiles.rb', line 138

def update(, params = {})
  parsed, options = Anthropic::Beta::UserProfileUpdateParams.dump_request(params)
  header_params = {betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"}
  @client.request(
    qualifiers: {beta: "true"},
    span_name: Anthropic::Internal::Tracing::SpanName::USER_PROFILES_UPDATE,
    span_attributes: {"anthropic.user_profile.id" => },
    span_route: "/v1/user_profiles/{user_profile_id}",
    method: :post,
    path: ["v1/user_profiles/%1$s", ],
    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-08-18"}, **options}
  )
end