> For the complete documentation index, see [llms.txt](https://docs.vomevolunteer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vomevolunteer.com/resources/editor-7/write-operations/assign-users-to-sites.md).

# Assign users to sites

This endpoint assigns one or more users to one or more sites. Every listed site is applied to every listed user (a cartesian assignment). It supports single or bulk input using the same body shape.

**Endpoint Description:**

* **Endpoint**: `POST /api/sites/assign/`
* **Base URL**: `https://api.vomevolunteer.com`

**API specification:**

* **user\_ids** (`array`): List of Vome IDs.
* **site\_ids** (`array`): List of site ids.
* **user\_id** (`string`): Single Vome ID; normalized into `user_ids`.
* **site\_id** (`string`): Single site id; normalized into `site_ids`.

**Authorization:**

Requests to this endpoint must include an `API-KEY` in the header for authentication.

```python
headers = {
    "API-KEY": "your_unique_api_key_here"
}
response = requests.post("https://api.vomevolunteer.com/api/sites/assign/", headers=headers)
```

**Example Request Payload:**

```json
{
    "user_ids": ["<VOME_ID_1>", "<VOME_ID_2>"],
    "site_ids": ["<SITE_ID_A>", "<SITE_ID_B>"]
}
```

**Response Structure:**

```json
{
    "assigned": [
        { "user_id": "<VOME_ID_1>", "assigned_site_ids": ["<SITE_ID_A>", "<SITE_ID_B>"] },
        { "user_id": "<VOME_ID_2>", "assigned_site_ids": ["<SITE_ID_A>", "<SITE_ID_B>"] }
    ],
    "skipped_user_ids": []
}
```

*Note: Assigning a site the user already has is a no-op; existing memberships are not removed. Any `user_id` that is not a profile in your organization is returned in `skipped_user_ids`; the rest still process. Unknown sites fail the whole call with a `400`: `{ "site_ids": "Unknown site(s): <SITE_ID_X>" }`.*
