Class UserProfile

  • All Implemented Interfaces:

    
    public final class 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.

    • Constructor Detail

    • Method Detail

      • id

         final String id()

        Unique identifier for this user profile, prefixed uprof_.

      • accessType

         final UserProfileAccessType accessType()

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

      • enforcementStatus

         final UserProfileEnforcementStatus enforcementStatus()

        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.

      • externalUserDetails

         final UserProfileExternalUserDetails externalUserDetails()

        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.

      • metadata

         final UserProfile.Metadata metadata()

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

      • name

         final Optional<String> name()

        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.

      • programs

         final UserProfilePrograms programs()

        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.

      • updatedAt

         final OffsetDateTime updatedAt()

        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.

      • _type

         final JsonValue _type()

        Object type. Always user_profile.

        Expected to always return the following:

        JsonValue.from("user_profile")

        However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).

      • _id

         final JsonField<String> _id()

        Returns the raw JSON value of id.

        Unlike id, this method doesn't throw if the JSON field has an unexpected type.

      • _createdAt

         final JsonField<OffsetDateTime> _createdAt()

        Returns the raw JSON value of createdAt.

        Unlike createdAt, this method doesn't throw if the JSON field has an unexpected type.

      • _name

         final JsonField<String> _name()

        Returns the raw JSON value of name.

        Unlike name, this method doesn't throw if the JSON field has an unexpected type.

      • _updatedAt

         final JsonField<OffsetDateTime> _updatedAt()

        Returns the raw JSON value of updatedAt.

        Unlike updatedAt, this method doesn't throw if the JSON field has an unexpected type.

      • validate

         final UserProfile validate()

        Validates that the types of all values in this object match their expected types recursively.

        This method is not forwards compatible with new types from the API for existing fields.

      • builder

         final static UserProfile.Builder builder()

        Returns a mutable builder for constructing an instance of UserProfile.

        The following fields are required:

        .id()
        .accessType()
        .createdAt()
        .enforcementActions()
        .enforcementStatus()
        .externalUserDetails()
        .metadata()
        .name()
        .programs()
        .updatedAt()