Bulk Delete Organizations

This endpoint deletes multiple Organizations at once.

❗️

+++Attention+++

This endpoint is extremely powerful, and with great power comes great responsibility.

Deleting Organizations CANNOT be undone. Back up any Organization data before deleting one or more Organizations.

Request

To delete one or more Organizations, make a POST request to the following URL:

HTTP MethodURL
POSThttps://industrial.api.ubidots.com/api/v2.0/organizations/_/bulk/delete/
🚧

It's a POST

Please note that it's a POST request and not a DELETE request.

Body Parameters

The body is an Array containing one or more <organization_key>. Each <organization_key> object can contain the following body parameters:

ParameterTypeDescription
organization_keyStringThe id or label of the Organization, label should use the prefix ~
📘

<organization_key>

Remember that the <organization_key> has 3 valid formats:
-<organization_id> : "6e3wef09da44fc8455a9cceb5aa"
-<organization_label>: "~second-variable" //Remember to add the ~ before the Variable label
-JSON of <organization_id>: { "id": "1237809ca5pIhpjgc345fc" }

❗️

+++ATTENTION+++

Please be VERY careful using this endpoint, why? Because it's possible to delete many Organizations at once.

We propose one safe alternative:

  • Make a GET All Organizations request using the query parameter fields=id. This returns an array of the Organization IDs. Copy this array and use it in the body for this endpoint. This helps ensure that only the intended Organizations in that array are deleted.

Query Parameters

ParameterTypeUseDescription
tokenStringAuthenticationAuthentication Token can optionally be sent as a query parameter

Header

ParameterRequired?Description
X-Auth-TokenYesAuthentication Token of account
X-Bulk-OperationYesNeed to be set to True for the bulk operation to work
Content-TypeYesContent type of body
$ curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/organizations/_/bulk/delete/' \
 -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
 -H 'Content-Type: application/json' \
 -H 'X-Bulk-Operation: True' \
 -d '[
  "6e309da44fc8455a9cceb5aa",
  "~second-organization",
  "~third-organization",
  {
    "id": "1237809ca5pIhpjgc345fc"
  }
]'
{
  "task": {
    "id": "tyg54645501a9ca5714e7b098721"
  }
}
{
    "code": 400001,
    "message": "Validation Error.",
    "detail": {
        ....
    }
}
{
    "code": 401001,
    "message": "Authentication credentials were not provided.",
    "detail": "Authentication credentials were not provided."
}
{
    "detail": "Header `X-BULK-OPERATION` should be provided for bulk operation."
}

Response

Returns a task ID for the asynchronous process.