> ## Documentation Index
> Fetch the complete documentation index at: https://infisical.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Remove users and groups

> Remove users and groups from an Agent Vault delegation with the Node.js SDK.

`client.agentVault().delegations.removeSubjects()` removes users and groups from a machine identity's delegation. Pass at least one ID. The client must log in as a user or machine identity with the **Admin** role in the [Agent Vault project](https://infisical.com/docs/documentation/platform/agent-vault/access-control#product-membership).

* If the delegation no longer covers a user, the proxy refuses the sessions that the machine identity created on behalf of the user until the delegation covers the user again (to end those sessions for good, [revoke them](https://infisical.com/docs/sdks/languages/node/agent-vault/revoke-session.md))
* If you remove the last user or group, Infisical deletes the delegation

## Parameters

**machineIdentityId** `string` *required*

The ID of the machine identity.

**options** `object` *required*

**properties**

**projectId** `string` *required*

The ID of the [Agent Vault project](https://infisical.com/docs/documentation/platform/agent-vault/projects.md#find-the-project-id) that the delegation is in.

**userIds** `string[]`

The IDs of the users to remove (up to 100).

**groupIds** `string[]`

The IDs of the groups to remove (up to 100).

## Returns

**delegation** `AgentVaultDelegationDetail | null`

The delegation after the change, with `missingAccessBundles`, or `null` if Infisical deleted the delegation.

```typescript Basic theme={"dark"}
const delegation = await client.agentVault().delegations.removeSubjects("<machine-identity-id>", {
  projectId: "<project-id>",
  userIds: ["<user-id>"], // Optional
  groupIds: ["<group-id>"] // Optional
});
```

```json Response theme={"dark"}
null
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.