Claude Platform Docs

Workspace-Mitglied erstellen

BetaWorkspaceMember beta().organization().workspaces().members().add(params, requestOptions = RequestOptions.none())
POST/v1/organizations/workspaces/{workspace_id}/members

Workspace-Mitglied erstellen

Parameters
MemberAddParams params
Optional<String> workspaceId⁠Path parameter

ID of the Workspace.

String userId

ID of the User.

Role of the new Workspace Member. Cannot be workspace_billing.

Returns
class BetaWorkspaceMember { type = "workspace_member"; userId; workspaceId; workspaceRole; }
JsonValue type = "workspace_member"

Object type.

For Workspace Members, this is always "workspace_member".

String userId

ID of the User.

String workspaceId

ID of the Workspace.

BetaWorkspaceRole workspaceRole

Role of the Workspace Member.

One of the following:
WORKSPACE_ADMIN("workspace_admin")
WORKSPACE_BILLING("workspace_billing")
WORKSPACE_DEVELOPER("workspace_developer")
WORKSPACE_RESTRICTED_DEVELOPER("workspace_restricted_developer")
WORKSPACE_USER("workspace_user")
Errors

Any method can also return the general HTTP errors.

WorkspaceMemberLimitExceededExceptionHTTP status 400error code workspace_member_limit_exceeded

The workspace has reached the member limit that Anthropic set for it.

SandboxEgressRestrictedExceptionHTTP status 403error code sandbox_egress_restricted

The request came from a Claude sandbox with restricted network access, which is not allowed to make this request. Send it from outside the sandbox, or from a sandbox with unrestricted network access.

Workspace-Mitglied erstellen
package com.anthropic.example;

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.beta.organization.workspaces.BetaNoBillingWorkspaceRole;
import com.anthropic.models.beta.organization.workspaces.BetaWorkspaceMember;
import com.anthropic.models.beta.organization.workspaces.members.MemberAddParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        AnthropicClient client = AnthropicOkHttpClient.fromEnv();

        MemberAddParams params = MemberAddParams.builder()
            .workspaceId("workspace_id")
            .userId("user_01WxYzAbCdEfGhJkMnPqRsTu")
            .workspaceRole(BetaNoBillingWorkspaceRole.WORKSPACE_ADMIN)
            .build();
        BetaWorkspaceMember betaWorkspaceMember = client.beta().organization().workspaces().members().add(params);
    }
}
Returns Examples
Response 200
{
  "type": "workspace_member",
  "user_id": "user_01WxYzAbCdEfGhJkMnPqRsTu",
  "workspace_id": "wrkspc_01AbCdEfGhJkLmNpQrStUvWx",
  "workspace_role": "workspace_admin"
}