Class: Anthropic::Resources::Organization::Analytics::Users

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/organization/analytics/users.rb,
sig/anthropic/resources/organization/analytics/users.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Users

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 Users.

Parameters:



64
65
66
# File 'lib/anthropic/resources/organization/analytics/users.rb', line 64

def initialize(client:)
  @client = client
end

Instance Method Details

#list(date: nil, ending_date: nil, filter: nil, group_by: nil, limit: nil, order: nil, order_by: nil, page: nil, starting_date: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Organization::AnalyticsUserActivity>

Get per-user activity for a given day, with cursor-based pagination.

Returns activity metrics for each user in the organization, sorted by email address. Use group_by[] for per-RBAC-group aggregates, or filter[] to scope results to specific members, groups, or a chat project. Available to organizations on a Claude Enterprise plan. Requires an API key with the read:analytics scope.

Some parameter documentations has been truncated, see Models::Organization::Analytics::UserListParams for more details.

Parameters:

  • date (Date, nil) —

    UTC date in YYYY-MM-DD format. The day to get user activity for. Data is typical

  • ending_date (Date, nil) —

    UTC date in YYYY-MM-DD format. End of the date range (exclusive); only valid wit

  • filter (Array<String>, nil) —

    Filters as dimension:value, e.g. filter[]=rbac_group_id:{id}. Repeat the par

  • group_by (Array<Symbol, Anthropic::Models::Organization::AnalyticsUserGroupBy>, nil) —

    Dimensions to break results out by (e.g. group_by[]=rbac_group_id). Supported

  • limit (Integer, nil) —

    Number of results per page (1-1000, default 100).

  • order (Symbol, Anthropic::Models::Organization::AnalyticsOrder, nil) —

    Sort direction: asc or desc. Defaults to asc for the endpoint's sort colum

  • order_by (String, nil) —

    Sort field. Restricted to the endpoint's sort column plus its rankable metrics (

  • page (String, nil) —

    Opaque cursor from a previous response's next_page field.

  • starting_date (Date, nil) —

    UTC date in YYYY-MM-DD format. Start of a date range (inclusive). Enables rollup

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • date: (Date, nil)
  • ending_date: (Date, nil)
  • filter: (::Array[String], nil)
  • group_by: (::Array[Anthropic::Models::Organization::analytics_user_group_by], nil)
  • limit: (Integer, nil)
  • order: (Anthropic::Models::Organization::analytics_order, nil)
  • order_by: (String, nil)
  • page: (String, nil)
  • starting_date: (Date, nil)
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/anthropic/resources/organization/analytics/users.rb', line 44

def list(params = {})
  parsed, options = Anthropic::Organization::Analytics::UserListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed)
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_ANALYTICS_USERS_LIST,
    span_route: "/v1/organizations/analytics/users",
    span_query: %w[date ending_date filter group_by limit order order_by page starting_date],
    span_content_query: %w[page],
    method: :get,
    path: "v1/organizations/analytics/users",
    query: query,
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Organization::AnalyticsUserActivity,
    options: options
  )
end