# Bulk Delete Integrations

## API Overview

An Integration is a connection from a SendGrid Marketing Campaign to a supported third-party application. Integrations with different external applications allow you to sync data and create a more cohesive cross-product data experience.

Currently, only [Segment](https://segment.com/docs) Integrations are supported. Segment Integrations allow you to customize and automate email event forwarding to your Segment account.

The Integrations API allows you to create, retrieve, update, and delete your Integrations.

## Operation overview

```json
{"path":"https://api.sendgrid.com/v3/marketing/integrations","method":"delete","servers":[{"url":"https://api.sendgrid.com","description":"for global users and subusers"},{"url":"https://api.eu.sendgrid.com","description":"for EU regional subusers"}]}
```

This endpoint deletes Integrations.

## Operation details

### Authentication

API Key

### Headers

```json
[{"in":"header","name":"Authorization","required":true,"default":"Bearer <<YOUR_API_KEY_HERE>>","schema":{"type":"string"}}]
```

### Query string

```json
[{"name":"ids","in":"query","description":"Comma-delimited Integration IDs for the Integrations to delete.","schema":{"type":"array","items":{"type":"string","description":"The unique ID of an Integration.","properties":{"integration_id":{"type":"string","example":"12345"}},"refName":"Id","modelName":"Id"}},"required":true}]
```

### Responses

```json
[{"responseCode":"204","schema":{"description":"Successful Operation"}},{"responseCode":"400","schema":{"description":"Invalid Request","content":{"application/json":{"schema":{"properties":{"errors":{"type":"array","items":{"type":"object","refName":"InvalidDeleteRequest","modelName":"InvalidDeleteRequest","properties":{"message":{"type":"string","description":"The error message tells you the cause of failure.","example":"IDs cannot be an empty string"},"parameter":{"type":"string","example":"ids[1]","description":"The parameter shows more information about where the error is. The number in the brackets is the invalid ID indexed."}}}}}}}}}},{"responseCode":"403","schema":{"description":"Forbidden. You may not have the required API token scope.","content":{"application/json":{"schema":{"properties":{"errors":{"type":"array","items":{"type":"object","refName":"Forbidden","modelName":"Forbidden","properties":{"message":{"type":"string","description":"The error message tells you the cause of failure.","example":"access forbidden. please ensure you have the correct scopes defined. see /docs/sendgrid/api-reference/how-to-use-the-sendgrid-v3-api/authorization#api-key-permissions-list"}}}}}}}}}},{"responseCode":"404","schema":{"description":"Not Found. The Integration you specified was not found.","content":{"application/json":{"schema":{"properties":{"errors":{"type":"array","items":{"type":"object","refName":"IntegrationNotFound","modelName":"IntegrationNotFound","properties":{"message":{"type":"string","description":"The error message tells you the cause of failure.","example":"integration does not exist (abc)"}}}}}}}}}},{"responseCode":"500","schema":{"description":"Internal Error","content":{"application/json":{"schema":{"properties":{"errors":{"type":"array","items":{"type":"object","refName":"InternalError","modelName":"InternalError","properties":{"message":{"type":"string","description":"The error message tells you the cause of failure.","example":"internal error"}}}}}}}}}}]
```

Bulk Delete Integrations

```js
const client = require("@sendgrid/client");
client.setApiKey(process.env.SENDGRID_API_KEY);

const queryParams = { ids: ["ids"] };

const request = {
  url: `/v3/marketing/integrations`,
  method: "DELETE",
  qs: queryParams,
};

client
  .request(request)
  .then(([response, body]) => {
    console.log(response.statusCode);
    console.log(response.body);
  })
  .catch((error) => {
    console.error(error);
  });
```

```python
import os
from sendgrid import SendGridAPIClient


sg = SendGridAPIClient(os.environ.get("SENDGRID_API_KEY"))

params = {"ids": ["ids"]}

response = sg.client.marketing.integrations.delete(query_params=params)

print(response.status_code)
print(response.body)
print(response.headers)
```

```csharp
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using SendGrid;

public class Program {
    public static async Task Main() {
        string apiKey = Environment.GetEnvironmentVariable("SENDGRID_API_KEY");
        var client = new SendGridClient(apiKey);

        var queryParams =
            @"{'ids': [
    'ids'
]}";

        var response = await client.RequestAsync(
            method: SendGridClient.Method.DELETE,
            urlPath: "marketing/integrations",
            queryParams: queryParams);

        Console.WriteLine(response.StatusCode);
        Console.WriteLine(response.Body.ReadAsStringAsync().Result);
        Console.WriteLine(response.Headers.ToString());
    }
}
```

```java
import com.sendgrid.*;
import java.io.IOException;

public class Example {
    public static void main(String[] args) throws IOException {
        try {
            SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
            Request request = new Request();
            request.setMethod(Method.DELETE);
            request.setEndpoint("/marketing/integrations");
            request.addQueryParam("ids", "ids");
            Response response = sg.api(request);
            System.out.println(response.getStatusCode());
            System.out.println(response.getBody());
            System.out.println(response.getHeaders());
        } catch (IOException ex) {
            throw ex;
        }
    }
}
```

```go
package main

import (
	"fmt"
	"github.com/sendgrid/sendgrid-go"
	"os"
)

func main() {
	apiKey := os.Getenv("SENDGRID_API_KEY")
	host := "https://api.sendgrid.com"
	request := sendgrid.GetRequest(apiKey, "/v3/marketing/integrations", host)
	request.Method = "DELETE"
	queryParams := make(map[string]string)
	queryParams["ids"] = "ids"
	request.QueryParams = queryParams
	response, err := sendgrid.API(request)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		fmt.Println(response.StatusCode)
		fmt.Println(response.Body)
		fmt.Println(response.Headers)
	}
}
```

```php
<?php
// Uncomment the next line if you're using a dependency loader (such as Composer) (recommended)
// require 'vendor/autoload.php';

// Uncomment next line if you're not using a dependency loader (such as Composer)
// require_once '<PATH TO>/sendgrid-php.php';

$apiKey = getenv("SENDGRID_API_KEY");
$sg = new \SendGrid($apiKey);
$query_params = json_decode('{
    "ids": [
    "ids"
]
}');

try {
    $response = $sg->client
        ->marketing()
        ->integrations()
        ->delete(null, $query_params);
    print $response->statusCode() . "\n";
    print_r($response->headers());
    print $response->body() . "\n";
} catch (Exception $ex) {
    echo "Caught exception: " . $ex->getMessage();
}
```

```ruby
require 'sendgrid-ruby'
include SendGrid

sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
params = JSON.parse('{
  "ids": [
  "ids"
]
}')

response = sg.client.marketing.integrations.delete(query_params: params)
puts response.status_code
puts response.headers
puts response.body
```

```bash
curl -X DELETE "https://api.sendgrid.com/v3/marketing/integrations?ids=ids" \
--header "Authorization: Bearer $SENDGRID_API_KEY"
```
