Class: Anthropic::Resources::Beta::Organization::Workspaces

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/organization/workspaces.rb,
lib/anthropic/resources/beta/organization/workspaces/members.rb,
lib/anthropic/resources/beta/organization/workspaces/rate_limits.rb,
lib/anthropic/resources/beta/organization/workspaces/service_accounts.rb,
sig/anthropic/resources/beta/organization/workspaces.rbs,
sig/anthropic/resources/beta/organization/workspaces/members.rbs,
sig/anthropic/resources/beta/organization/workspaces/rate_limits.rbs,
sig/anthropic/resources/beta/organization/workspaces/service_accounts.rbs

Defined Under Namespace

Classes: Members, RateLimits, ServiceAccounts

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Workspaces

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

Parameters:



270
271
272
273
274
275
276
# File 'lib/anthropic/resources/beta/organization/workspaces.rb', line 270

def initialize(client:)
  @client = client
  @rate_limits = Anthropic::Resources::Beta::Organization::Workspaces::RateLimits.new(client: client)
  @members = Anthropic::Resources::Beta::Organization::Workspaces::Members.new(client: client)
  @service_accounts =
    Anthropic::Resources::Beta::Organization::Workspaces::ServiceAccounts.new(client: client)
end

Instance Attribute Details

#members ⇒ Anthropic::Resources::Beta::Organization::Workspaces::Members (readonly)



12
13
14
# File 'lib/anthropic/resources/beta/organization/workspaces.rb', line 12

def members
  @members
end

#rate_limits ⇒ Anthropic::Resources::Beta::Organization::Workspaces::RateLimits (readonly)



9
10
11
# File 'lib/anthropic/resources/beta/organization/workspaces.rb', line 9

def rate_limits
  @rate_limits
end

#service_accounts ⇒ Anthropic::Resources::Beta::Organization::Workspaces::ServiceAccounts (readonly)



15
16
17
# File 'lib/anthropic/resources/beta/organization/workspaces.rb', line 15

def service_accounts
  @service_accounts
end

Instance Method Details

#archive(workspace_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaWorkspace

Archive Workspace

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

Parameters:

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

    Optional. Send efs-2026-10-01 in this header to use this endpoint's beta featu

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

Returns:

Raises:

See Also:



252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/anthropic/resources/beta/organization/workspaces.rb', line 252

def archive(workspace_id, params = {})
  parsed, options = Anthropic::Beta::Organization::WorkspaceArchiveParams.dump_request(params)
  @client.request(
    qualifiers: {beta: "true"},
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_ARCHIVE,
    span_attributes: {"anthropic.organization.workspace.id" => workspace_id},
    span_route: "/v1/organizations/workspaces/{workspace_id}/archive",
    method: :post,
    path: ["v1/organizations/workspaces/%1$s/archive", workspace_id],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Beta::Organization::BetaWorkspace,
    options: options
  )
end

#create(name:, data_residency: nil, display_color: nil, external_key_id: nil, inference_data_privacy: nil, tags: nil, user_profile_id: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaWorkspace

Create Workspace

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

Parameters:

  • name (String) —

    Body param: Name of the Workspace.

  • data_residency (Anthropic::Models::Beta::Organization::BetaDataResidencyCreateConfig, nil) —

    Body param: Data residency configuration for the workspace. If omitted, defaults

  • display_color (String, nil) —

    Body param: Hex color code representing the Workspace in the Anthropic Console.

  • external_key_id (String, nil) —

    Body param: ID of the customer-managed encryption key (CMEK) configuration to us

  • inference_data_privacy (Anthropic::Models::Beta::Organization::BetaInferenceDataPrivacyCreateParam, nil) —

    Body param: Where the Workspace's retained inference data and transcript copies

  • tags (Hash{Symbol=>String}, nil) —

    Body param: User-defined tags as string key-value pairs. Keys may not begin with

  • user_profile_id (String, nil) —

    Body param: ID of a user profile to attach to the Workspace. Every inference req

  • betas (Array<Symbol, String, 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)
  • name: (String)
  • data_residency: (Anthropic::Beta::Organization::BetaDataResidencyCreateConfig, nil)
  • display_color: (String, nil)
  • external_key_id: (String, nil)
  • inference_data_privacy: (Anthropic::Beta::Organization::BetaInferenceDataPrivacyCreateParam, nil)
  • tags: (::Hash[Symbol, String], nil)
  • user_profile_id: (String, nil)
  • betas: (::Array[Anthropic::Models::anthropic_beta])
  • request_options: (Anthropic::request_opts)

Returns:

Raises:

See Also:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/anthropic/resources/beta/organization/workspaces.rb', line 66

def create(params)
  parsed, options = Anthropic::Beta::Organization::WorkspaceCreateParams.dump_request(params)
  header_params = {betas: "anthropic-beta"}
  @client.request(
    qualifiers: {beta: "true"},
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_CREATE,
    span_created_id: "anthropic.organization.workspace.id",
    span_route: "/v1/organizations/workspaces",
    method: :post,
    path: "v1/organizations/workspaces",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Beta::Organization::BetaWorkspace,
    options: options
  )
end

#list(after_id: nil, before_id: nil, ids: nil, include_archived: nil, include_default: nil, limit: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::Page<Anthropic::Models::Beta::Organization::BetaWorkspace>

List Workspaces

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

Parameters:

  • after_id (String) —

    Query param: ID of the object to use as a cursor for pagination. When provided,

  • before_id (String) —

    Query param: ID of the object to use as a cursor for pagination. When provided,

  • ids (Array<String>) —

    Query param: Only the Workspaces with these IDs, at most 100. include_archived

  • include_archived (Boolean) —

    Query param: Whether to include Workspaces that have been archived in the respon

  • include_default (Boolean) —

    Query param: Whether to include the organization's default Workspace in the resp

  • limit (Integer) —

    Query param: Number of items to return per page.

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

    Header param: Optional. Send efs-2026-10-01 in this header to use this endpoin

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • after_id: (String)
  • before_id: (String)
  • ids: (::Array[String])
  • include_archived: (Boolean)
  • include_default: (Boolean)
  • limit: (Integer)
  • betas: (::Array[Anthropic::Models::anthropic_beta])
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/anthropic/resources/beta/organization/workspaces.rb', line 213

def list(params = {})
  query_params = [:after_id, :before_id, :ids, :include_archived, :include_default, :limit]
  parsed, options = Anthropic::Beta::Organization::WorkspaceListParams.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::ORGANIZATION_WORKSPACES_LIST,
    span_route: "/v1/organizations/workspaces",
    span_query: %w[after_id before_id ids include_archived include_default limit],
    method: :get,
    path: "v1/organizations/workspaces",
    query: query,
    headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"),
    page: Anthropic::Internal::Page,
    model: Anthropic::Beta::Organization::BetaWorkspace,
    options: options
  )
end

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

Get Workspace

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

Parameters:

  • workspace_id (String) —

    ID of the Workspace.

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

    Optional. Send efs-2026-10-01 in this header to use this endpoint's beta featu

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

Returns:

See Also:



100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/anthropic/resources/beta/organization/workspaces.rb', line 100

def retrieve(workspace_id, params = {})
  parsed, options = Anthropic::Beta::Organization::WorkspaceRetrieveParams.dump_request(params)
  @client.request(
    qualifiers: {beta: "true"},
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_RETRIEVE,
    span_attributes: {"anthropic.organization.workspace.id" => workspace_id},
    span_route: "/v1/organizations/workspaces/{workspace_id}",
    method: :get,
    path: ["v1/organizations/workspaces/%1$s", workspace_id],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Beta::Organization::BetaWorkspace,
    options: options
  )
end

#update(workspace_id, data_residency: nil, display_color: nil, external_key_id: nil, inference_data_privacy: nil, name: nil, tags: nil, user_profile_id: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaWorkspace

Update Workspace

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

Parameters:

  • workspace_id (String) —

    Path param

  • data_residency (Anthropic::Models::Beta::Organization::BetaDataResidencyUpdateConfig, nil) —

    Body param: Data residency configuration for the workspace.

  • display_color (String) —

    Body param: Hex color code representing the Workspace in the Anthropic Console.

  • external_key_id (String) —

    Body param: ID of the customer-managed encryption key (CMEK) configuration to us

  • inference_data_privacy (Anthropic::Models::Beta::Organization::BetaInferenceDataPrivacyUpdateParam, nil) —

    Body param: Changes to where the Workspace's retained inference data and transcr

  • name (String) —

    Body param: Name of the Workspace.

  • tags (Hash{Symbol=>String, nil}, nil) —

    Body param: User-defined tags as string key-value pairs. Keys may not begin with

  • user_profile_id (String) —

    Body param: ID of a user profile to attach to the Workspace. Every inference req

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

    Header param: Optional. Send efs-2026-10-01 in this header to use this endpoin

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • data_residency: (Anthropic::Beta::Organization::BetaDataResidencyUpdateConfig, nil)
  • display_color: (String)
  • external_key_id: (String)
  • inference_data_privacy: (Anthropic::Beta::Organization::BetaInferenceDataPrivacyUpdateParam, nil)
  • name: (String)
  • tags: (::Hash[Symbol, String?], nil)
  • user_profile_id: (String)
  • betas: (::Array[Anthropic::Models::anthropic_beta])
  • request_options: (Anthropic::request_opts)

Returns:

Raises:

See Also:



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/anthropic/resources/beta/organization/workspaces.rb', line 170

def update(workspace_id, params = {})
  parsed, options = Anthropic::Beta::Organization::WorkspaceUpdateParams.dump_request(params)
  header_params = {betas: "anthropic-beta"}
  @client.request(
    qualifiers: {beta: "true"},
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_UPDATE,
    span_attributes: {"anthropic.organization.workspace.id" => workspace_id},
    span_route: "/v1/organizations/workspaces/{workspace_id}",
    method: :post,
    path: ["v1/organizations/workspaces/%1$s", workspace_id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Beta::Organization::BetaWorkspace,
    options: options
  )
end