# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.butlr.io/asset-management/delete-resources.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
