> For the complete documentation index, see [llms.txt](https://docs.butlr.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.butlr.io/asset-management/delete-resources.md).

# Delete Resources

{% hint style="danger" %}
Restricted to Internal Butlr usage only.
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location 'https://api.butlr.io/api/v3/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer [insert access_token here]' \
--data '{"query":"mutation updateSensors($sensor: UpdateSensorInput!) {\n  updateSensors(sensors: [$sensor]) {\n    sensor_id\n    name\n  }\n}","variables":{"sensor":{"sensor_id":"sensor_2k53witHHhYxj7iMK4qdefI5zoO","name":"updated_sensor_name"}}}'
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.butlr.io/api/v3/graphql"
  method := "POST"

  payload := strings.NewReader("{\"query\":\"mutation updateSensors($sensor: UpdateSensorInput!) {\\n  updateSensors(sensors: [$sensor]) {\\n    sensor_id\\n    name\\n  }\\n}\",\"variables\":{\"sensor\":{\"sensor_id\":\"sensor_2k53witHHhYxj7iMK4qdefI5zoO\",\"name\":\"updated_sensor_name\"}}}")

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "Bearer [insert access_token here]")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = "https://api.butlr.io/api/v3/graphql"

payload = "{\"query\":\"mutation updateSensors($sensor: UpdateSensorInput!) {\\n  updateSensors(sensors: [$sensor]) {\\n    sensor_id\\n    name\\n  }\\n}\",\"variables\":{\"sensor\":{\"sensor_id\":\"sensor_2k53witHHhYxj7iMK4qdefI5zoO\",\"name\":\"updated_sensor_name\"}}}"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer [insert access_token here]'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}
{% endtabs %}

***

### Delete sensor(s)

```graphql
mutation ($ids: [String!]) {
    deleteSensors(ids: $ids) {
        sensor_id
        name
    }
}

# Variables
{
  "ids": ["sensor_2k53witHHhYxj7iMK4qdefI5zoO"]
}
```

### Code Examples

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location 'https://api.butlr.io/api/v3/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer [insert access_token here]' \
--data '{"query":"mutation ($ids: [String!]) {\n    deleteSensors(ids: $ids) {\n        sensor_id\n        name\n    }\n}","variables":{"ids":["sensor_2m0aPoCbMoTjO6Om4F92ra1JphN"]}}'
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.butlr.io/api/v3/graphql"
  method := "POST"

  payload := strings.NewReader("{\"query\":\"mutation ($ids: [String!]) {\\n    deleteSensors(ids: $ids) {\\n        sensor_id\\n        name\\n    }\\n}\",\"variables\":{\"ids\":[\"sensor_2m0aPoCbMoTjO6Om4F92ra1JphN\"]}}")

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "Bearer [insert access_token here]")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = "https://api.butlr.io/api/v3/graphql"

payload = "{\"query\":\"mutation ($ids: [String!]) {\\n    deleteSensors(ids: $ids) {\\n        sensor_id\\n        name\\n    }\\n}\",\"variables\":{\"ids\":[\"sensor_2m0aPoCbMoTjO6Om4F92ra1JphN\"]}}"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer [insert access_token here]'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}
{% endtabs %}
