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

# Remove Group Members

> Take people out of a group, and take back what it was giving them.

Removes users from a group, leaving everybody else in it. They lose every grant they held **through** the group, immediately. Grants they hold in their own right are untouched.

<Note>
  The ids go in the **request body**, not the URL — this endpoint removes several people at once and addresses the group, not one member of it.
</Note>

## Request body

| Parameter | Type              | Required | Description                                           |
| --------- | ----------------- | -------- | ----------------------------------------------------- |
| `users`   | array of integers | Yes      | User ids to remove. Ids not in the group are ignored. |

```bash theme={null}
curl --request DELETE \
  --url https://api.nekt.ai/api/v1/organization/permission-groups/GROUP_ID/users/ \
  --header "x-api-key: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"users": [42]}'
```

## Response

`204`, with no body.

## Offboarding somebody from a team

Removing them from every group takes back everything they inherited, and is the part of offboarding that is easy to miss when you only revoke direct grants.

```python theme={null}
import os

import requests

BASE_URL = "https://api.nekt.ai"
headers = {"x-api-key": os.environ["NEKT_API_KEY"], "Content-Type": "application/json"}
user_id = 42

groups = requests.get(
    f"{BASE_URL}/api/v1/organization/permission-groups/",
    headers=headers,
    params={"users": user_id},
).json()

for group in groups["results"]:
    if group["all_group"]:
        continue  # Membership is automatic; it goes when the account is deactivated.

    requests.delete(
        f"{BASE_URL}/api/v1/organization/permission-groups/{group['id']}/users/",
        headers=headers,
        json={"users": [user_id]},
    ).raise_for_status()
    print(f"removed from {group['name']}")
```

<Warning>
  This removes inherited access only. Grants made directly to the person survive — see [Revoke Permission](/platform-api/permissions/catalog/revoke) for those.
</Warning>

## Errors

| Status | When                                                       |
| ------ | ---------------------------------------------------------- |
| `400`  | The group is the All group, whose membership is automatic. |
| `403`  | Your API key was created by a Member.                      |
| `404`  | No group with that id in your workspace.                   |

## Related

* [Add Members](/platform-api/permission-groups/add-members) — the reverse.
* [List Groups](/platform-api/permission-groups/list) — with `users`, every group somebody is in.
* [Delete a Group](/platform-api/permission-groups/delete) — when the whole team is going away.


## OpenAPI

````yaml DELETE /api/v1/organization/permission-groups/{permission_group_pk}/users/
openapi: 3.0.3
info:
  title: Nekt API
  version: v1
  description: Nekt API Documentation
  contact:
    email: support@nekt.ai
servers:
  - url: https://api.nekt.ai
security: []
paths:
  /api/v1/organization/permission-groups/{permission_group_pk}/users/:
    delete:
      tags:
        - v1
      summary: Remove users from a permission group
      operationId: v1_organization_permission_groups_users_destroy
      parameters:
        - in: path
          name: permission_group_pk
          schema:
            type: string
            format: uuid
          description: The permission group's id.
          required: true
      responses:
        '204':
          description: The users were removed from the group.
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: 'API Key authentication. Format: ''x-api-key: api_key'''

````