# Add Locations to User

```http
POST https://api.synup.com/api/v4/users/locations/add
```

This API associates specific locations with a user, granting them access to manage those locations.

**Behavior:**
- Supports assigning multiple locations to a single user.
- Updates the user's permissions and access scope based on assigned locations.

Source: https://developer.synup.com/api/user-management/add-locations-to-user

## Request body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `input` | object | required |  |
| `input.userId` | string | required | ID of the user to associate locations with |
| `input.locationIds` | array of string | required | Array of location IDs to associate with the user |

## Example request

```bash
curl -X POST 'https://api.synup.com/api/v4/users/locations/add' \
  -H 'Authorization: API YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "input": {
    "userId": "VXNlcjoxMjMyMDE=",
    "locationIds": [
      "TG9jYXRpb246MTE3NjE5NQ==",
      "TG9jYXRpb246MTE0NzgxNA=="
    ]
  }
}'
```

## Responses

| Status | Description |
| --- | --- |
| `200` | Locations successfully added to user |
| `400` | Bad Request - Invalid input parameters |
| `401` | Unauthorized - Valid API key required |
| `403` | Forbidden - Insufficient permissions |
| `404` | Not Found - User or locations not found |
