---
title: "Bulk add groups to users"
method: POST
path: "/api/groups/bulk/add"
tags: ["Groups"]
---

# Bulk add groups to users

`POST /api/groups/bulk/add`

Bulk assign groups to multiple users, users under specific admins, or all users.

- **group_ids**: List of group IDs to add (required)
- **users**: Optional list of user IDs to assign the groups to
- **admins**: Optional list of admin IDs — their users will be targeted

Notes:
- If neither 'users' nor 'admins' are provided, groups will be added to *all users*
- Existing user-group associations will be ignored (no duplication)
- Returns list of affected users (those who received new group associations)

## Request body

- BulkGroup
  - `group_ids` integer[], required
  - `has_group_ids` integer[]
  - `admins` integer[]
  - `users` integer[]
  - `dry_run` boolean

## Response `200`

Success confirmation

- unknown

## Other responses

- `401` — Unauthorized Error
- `403` — Forbidden Error
- `422` — Validation Error

---

[API](https://skmtc.dev/rain/apis/pasarguardapi.md) · [All operations](https://skmtc.dev/rain/apis/pasarguardapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/rain/pasarguardapi/revisions/b3bebca20611/schema)
