Claude Platform Docs

Create Workspace Member

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

Create Workspace Member

Parameters
MemberAddParams params
Optional<String> workspaceId

ID of the Workspace.

String userId

ID of the User.

Role of the new Workspace Member. Cannot be workspace_billing.

Returns
class BetaWorkspaceMember:
JsonValue type "workspace_member"constant

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")

Create Workspace Member

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_01WCz1FkmYMm4gnmykNKUu3Q")
            .workspaceRole(BetaNoBillingWorkspaceRole.WORKSPACE_ADMIN)
            .build();
        BetaWorkspaceMember betaWorkspaceMember = client.beta().organization().workspaces().members().add(params);
    }
}
{
  "type": "workspace_member",
  "user_id": "user_01WCz1FkmYMm4gnmykNKUu3Q",
  "workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",
  "workspace_role": "workspace_admin"
}
Returns Examples
{
  "type": "workspace_member",
  "user_id": "user_01WCz1FkmYMm4gnmykNKUu3Q",
  "workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",
  "workspace_role": "workspace_admin"
}