Class: Anthropic::Models::UserProfile

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/anthropic/models/user_profile.rb,
sig/anthropic/models/user_profile.rbs

Overview

See Also:

  • Anthropic::Resources::UserProfiles#create

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id:, access_type:, created_at:, enforcement_actions:, enforcement_status:, external_user_details:, metadata:, name:, programs:, updated_at:, type: :user_profile) ⇒ UserProfile

A record of an entity that the platform serves through the API, such as an end-user of the platform's product or a company that the platform resells Claude access to.

A Messages, Message Batches or token counting request can send a profile's id in the anthropic-user-profile-id header to attribute the request to that entity.

Some parameter documentations has been truncated, see Anthropic::Models::UserProfile for more details.

Parameters:

  • id (String) —

    Unique identifier for this user profile, prefixed uprof_.

  • access_type (Symbol, Anthropic::Models::UserProfileAccessType) —

    How the platform uses the API for this entity: application (default) or

  • created_at (Time) —

    When this user profile was created, in RFC 3339 format.

  • enforcement_actions (Array<Anthropic::Models::UserProfileEnforcementActionRestriction, Anthropic::Models::UserProfileEnforcementActionBan>) —

    The enforcement actions open on this profile; empty when none is open. Absent un

  • enforcement_status (Symbol, Anthropic::Models::UserProfileEnforcementStatus) —

    Anthropic's enforcement status of this profile, from its open enforcement action

  • external_user_details (Anthropic::Models::UserProfileExternalUserDetails) —

    Details about the entity this profile represents, as the platform states them; n

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

    Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up t

  • name (String, nil) —

    Real-world name of the entity this profile represents (company or individual). F

  • programs (Anthropic::Models::UserProfilePrograms) —

    The profile's standing in each Anthropic program, such as the Cyber Verification

  • updated_at (Time) —

    When this user profile was last modified, in RFC 3339 format. It normally also u

  • type (Symbol, :user_profile) (defaults to: :user_profile) —

    Object type. Always user_profile.

  • id: (String)
  • access_type: (Anthropic::Models::user_profile_access_type)
  • created_at: (Time)
  • enforcement_actions: (::Array[Anthropic::Models::user_profile_enforcement_action])
  • enforcement_status: (Anthropic::Models::user_profile_enforcement_status)
  • external_user_details: (Anthropic::UserProfileExternalUserDetails)
  • metadata: (::Hash[Symbol, String])
  • name: (String, nil)
  • programs: (Anthropic::UserProfilePrograms)
  • updated_at: (Time)
  • type: (:user_profile) (defaults to: :user_profile)


# File 'lib/anthropic/models/user_profile.rb', line 98

Instance Attribute Details

#access_type ⇒ Symbol, Anthropic::Models::UserProfileAccessType

How the platform uses the API for this entity: application (default) or passthrough. Absent under the legacy user-profiles-2026-03-24 beta header.

Parameters:

  • value (Anthropic::Models::user_profile_access_type)

Returns:



18
# File 'lib/anthropic/models/user_profile.rb', line 18

required :access_type, enum: -> { Anthropic::UserProfileAccessType }

#created_at ⇒ Time

When this user profile was created, in RFC 3339 format.

Parameters:

  • value (Time)

Returns:

  • (Time)


24
# File 'lib/anthropic/models/user_profile.rb', line 24

required :created_at, Time

#enforcement_actions ⇒ Array<Anthropic::Models::UserProfileEnforcementActionRestriction, Anthropic::Models::UserProfileEnforcementActionBan>

The enforcement actions open on this profile; empty when none is open. Absent under the user-profiles-2026-09-04 and earlier beta headers.

Parameters:

  • value (::Array[Anthropic::Models::user_profile_enforcement_action])

Returns:



31
32
# File 'lib/anthropic/models/user_profile.rb', line 31

required :enforcement_actions,
-> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::UserProfileEnforcementAction] }

#enforcement_status ⇒ Symbol, Anthropic::Models::UserProfileEnforcementStatus

Anthropic's enforcement status of this profile, from its open enforcement actions and any identity check under review, by the first rule that applies: banned while any open action is a ban; pending while a restriction that an identity check can clear is open, the end user has submitted that check, Anthropic's review of it has not ended, and no open action's reason is account_compromise; restricted while any action is open; unrestricted while none is. Absent under the user-profiles-2026-09-04 and earlier beta headers.

Parameters:

  • value (Anthropic::Models::user_profile_enforcement_status)

Returns:



45
# File 'lib/anthropic/models/user_profile.rb', line 45

required :enforcement_status, enum: -> { Anthropic::UserProfileEnforcementStatus }

#external_user_details ⇒ Anthropic::Models::UserProfileExternalUserDetails

Details about the entity this profile represents, as the platform states them; not verified by Anthropic. Every field is present, null until the platform supplies a value. Absent under the legacy user-profiles-2026-03-24 and user-profiles-2026-08-18 beta headers, which serve reference_id as the top-level external_id and, under user-profiles-2026-08-18, onboarded_at as external_user_onboarded_at.



56
# File 'lib/anthropic/models/user_profile.rb', line 56

required :external_user_details, -> { Anthropic::UserProfileExternalUserDetails }

#id ⇒ String

Unique identifier for this user profile, prefixed uprof_.

Parameters:

  • value (String)

Returns:

  • (String)


11
# File 'lib/anthropic/models/user_profile.rb', line 11

required :id, String

#metadata ⇒ Hash{Symbol=>String}

Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

Parameters:

  • value (::Hash[Symbol, String])

Returns:

  • (Hash{Symbol=>String})


63
# File 'lib/anthropic/models/user_profile.rb', line 63

required :metadata, Anthropic::Internal::Type::HashOf[String]

#name ⇒ String?

Real-world name of the entity this profile represents (company or individual). For a company the platform resells Claude access to (access_type passthrough) this is that company's name. null until the platform supplies one.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


72
# File 'lib/anthropic/models/user_profile.rb', line 72

required :name, String, nil?: true

#programs ⇒ Anthropic::Models::UserProfilePrograms

The profile's standing in each Anthropic program, such as the Cyber Verification Program. Present when the request sends no user-profiles beta header; absent under the user-profiles-2026-09-04 and earlier beta headers, which serve trust_grants instead.



81
# File 'lib/anthropic/models/user_profile.rb', line 81

required :programs, -> { Anthropic::UserProfilePrograms }

#type ⇒ Symbol, :user_profile

Object type. Always user_profile.

Parameters:

  • value (:user_profile)

Returns:

  • (Symbol, :user_profile)


87
# File 'lib/anthropic/models/user_profile.rb', line 87

required :type, const: :user_profile

#updated_at ⇒ Time

When this user profile was last modified, in RFC 3339 format. It normally also updates shortly after Anthropic gives the profile an approval or withdraws one. Other changes to the statuses that Anthropic reports do not always update it, so read the status itself rather than watching this timestamp.

Parameters:

  • value (Time)

Returns:

  • (Time)


96
# File 'lib/anthropic/models/user_profile.rb', line 96

required :updated_at, Time

Instance Method Details

#to_hash ⇒ { id: String, access_type: Anthropic::Models::user_profile_access_type, created_at: Time, enforcement_actions: ::Array[Anthropic::Models::user_profile_enforcement_action], enforcement_status: Anthropic::Models::user_profile_enforcement_status, external_user_details: Anthropic::UserProfileExternalUserDetails, metadata: ::Hash[Symbol, String], name: String?, programs: Anthropic::UserProfilePrograms, type: :user_profile, updated_at: Time }

Returns:

  • ({ id: String, access_type: Anthropic::Models::user_profile_access_type, created_at: Time, enforcement_actions: ::Array[Anthropic::Models::user_profile_enforcement_action], enforcement_status: Anthropic::Models::user_profile_enforcement_status, external_user_details: Anthropic::UserProfileExternalUserDetails, metadata: ::Hash[Symbol, String], name: String?, programs: Anthropic::UserProfilePrograms, type: :user_profile, updated_at: Time })


55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'sig/anthropic/models/user_profile.rbs', line 55

def to_hash: -> {
  id: String,
  access_type: Anthropic::Models::user_profile_access_type,
  created_at: Time,
  enforcement_actions: ::Array[Anthropic::Models::user_profile_enforcement_action],
  enforcement_status: Anthropic::Models::user_profile_enforcement_status,
  external_user_details: Anthropic::UserProfileExternalUserDetails,
  metadata: ::Hash[Symbol, String],
  name: String?,
  programs: Anthropic::UserProfilePrograms,
  type: :user_profile,
  updated_at: Time
}