This endpoint removes one or more Organizations from a specific User
Request
To remove one or more Organizations from a User, please make a POST request to the following URL:
| HTTP Method | URL |
|---|---|
| POST | https://industrial.api.ubidots.com/api/v2.0/users/<user_key>/_/remove_organizations/ |
Path Parameters
| Parameter | Type | Use |
|---|---|---|
| user_key | String | The id or username of the User, username should use the prefix ~ |
Query Parameters
| Parameter | Type | Use | Description |
|---|---|---|---|
| token | String | Authentication | Authorization Token can optionally be sent as a query parameter. |
Body Parameters
The body is an array with one object per Organization to remove.
| Parameter | Type | Required? | Description |
|---|---|---|---|
| id | String | Yes (or label) | The id of the Organization. |
| label | String | Yes (or id) | The label of the Organization (without the ~ prefix). |
| role | String | Yes | The label of the Role the User currently has in that Organization, e.g. viewer. |
The Role must matchAn Organization is only removed when the
rolesent is the Role the User currently has in it. If the Role is different, that Organization is left unchanged and the request still returns200. Use Get all Organizations of User to check the current Role first.
Pro TipYou can remove multiple Organizations from a single User in the same request by sending one object per Organization in the array.
Removing an Organization also removes any assignment the User had directly on its sub-Organizations.
Header
| Parameter | Required? | Description |
|---|---|---|
| X-Auth-Token | Yes | Authentication Token of account |
| Content-Type | String (application/json) | Content type of body |
$ curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/users/63d3f1247fefea000cd325af/_/remove_organizations/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '[
{"label": "my-third-customer", "role": "viewer"}
]'{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"url": "https://industrial.api.ubidots.com/api/v2.0/organizations/6298b72cb8f9ee01abd67001",
"id": "6298b72cb8f9ee01abd67001",
"label": "my-first-customer",
"name": "Cliente0",
"createdAt": "2022-06-02T13:12:12.267973Z",
"role": {
"url": "https://industrial.api.ubidots.com/api/v2.0/roles/manager",
"label": "manager",
"name": "Manager",
"createdAt": "2022-06-02T13:06:50.616480Z"
}
}
]
}{
"code": 400001,
"message": "Validation Error.",
"detail": {
....
}
}{
"code": 401001,
"message": "Authentication credentials were not provided.",
"detail": "Authentication credentials were not provided."
}Response
Returns an Object with a results array containing the Organizations the User is still assigned to after the removal, each with the User's role.

