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

# Delete Users from Groups

Use this API to delete users from a specific organization user group.

# Endpoint

`POST https://api.velt.dev/v1/organizations/usergroups/users/delete`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="organizationId" type="string" required>
      Organization ID
    </ParamField>

    <ParamField body="organizationUserGroupId" type="string" required>
      Organization User Group ID
    </ParamField>

    <ParamField body="userIds" type="string[]" required>
      Array of User IDs
    </ParamField>

    <ParamField body="deleteAll" type="boolean" required>
      If true, all users in the group will be deleted.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### Delete specific users from group

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "organizationUserGroupId": "yourGroupId",
    "userIds": ["yourUserId1"]
  }
}
```

#### Delete all users from group

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "organizationUserGroupId": "yourGroupId",
    "deleteAll": true
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Deleted users from group successfully.",
    "data": {
      "yourUserId1": {
        "success": true,
        "organizationUserGroupId": "yourGroupId",
        "message": "User deleted from organization user group."
      }
    }
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Deleted users from group successfully.",
      "data": {
        "yourUserId1": {
          "success": true,
          "organizationUserGroupId": "yourGroupId",
          "message": "User deleted from organization user group."
        }
      }
    }
  }
  ```
</ResponseExample>
