POSTapi.synup.com/api/v4/users/locations/add
Add Locations to User
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.
Requires an API key. Send it as
Authorization: API <your-key> — see Getting started.Parameters
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 |
Request
Request
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=="
]
}
}'const res = await fetch('https://api.synup.com/api/v4/users/locations/add', {
method: 'POST',
headers: {
Authorization: 'API YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"input": {
"userId": "VXNlcjoxMjMyMDE=",
"locationIds": [
"TG9jYXRpb246MTE3NjE5NQ==",
"TG9jYXRpb246MTE0NzgxNA=="
]
}
}),
});
const data = await res.json();import requests
res = requests.post(
"https://api.synup.com/api/v4/users/locations/add",
headers={
"Authorization": "API YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"input": {
"userId": "VXNlcjoxMjMyMDE=",
"locationIds": [
"TG9jYXRpb246MTE3NjE5NQ==",
"TG9jYXRpb246MTE0NzgxNA=="
]
}
},
)
data = res.json()req, _ := http.NewRequest("POST", "https://api.synup.com/api/v4/users/locations/add", bytes.NewBufferString(payload))
req.Header.Set("Authorization", "API YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)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 |
Example response
{
"data": {
"addLocationsForUser": {
"status": [
{
"errors": null,
"locationId": "TG9jYXRpb246MTE3NjE5NQ==",
"success": true
},
{
"errors": null,
"locationId": "TG9jYXRpb246MTE0NzgxNA==",
"success": true
}
]
}
}
}Response body
| Name | Type | Required | Description |
|---|---|---|---|
data | object | optional | |
data.addLocationsForUser | object | optional | |
data.addLocationsForUser.status | array of object | optional | |
data.addLocationsForUser.status[].errors | array of string | optional | Array of error messages if any occurred |
data.addLocationsForUser.status[].locationId | string | optional | ID of the location being added |
data.addLocationsForUser.status[].success | boolean | optional | Indicates if the location was successfully added |