[[delete-connector-api]]
=== Delete connector API
++++
<titleabbrev>Delete connector</titleabbrev>
++++

beta::[]

Removes a connector and associated sync jobs.
This is a destructive action that is not recoverable.

Note: this action doesn't delete any API key, ingest pipeline or data index associated with the connector. These need to be removed manually.

To get started with Connector APIs, check out the {enterprise-search-ref}/connectors-tutorial-api.html[tutorial^].

[[delete-connector-api-request]]
==== {api-request-title}

`DELETE _connector/<connector_id>`

[[delete-connector-api-prereq]]
==== {api-prereq-title}

* To sync data using self-managed connectors, you need to deploy the {enterprise-search-ref}/build-connector.html[Elastic connector service] on your own infrastructure. This service runs automatically on Elastic Cloud for native connectors.
* The `connector_id` parameter should reference an existing connector.

[[delete-connector-api-path-params]]
==== {api-path-parms-title}

`<connector_id>`::
(Required, string)

`delete_sync_jobs`::
(Optional, boolean) A flag indicating if associated sync jobs should be also removed. Defaults to `false`.

[[delete-connector-api-response-codes]]
==== {api-response-codes-title}

`400`::
The `connector_id` was not provided.

`404` (Missing resources)::
No connector matching `connector_id` could be found.

[[delete-connector-api-example]]
==== {api-examples-title}

The following example deletes the connector with ID `my-connector`:

////
[source, console]
--------------------------------------------------
PUT _connector/my-connector
{
  "name": "My Connector",
  "service_type": "google_drive"
}

PUT _connector/another-connector
{
  "name": "My Connector",
  "service_type": "google_drive"
}
--------------------------------------------------
// TESTSETUP
////

[source,console]
----
DELETE _connector/another-connector?delete_sync_jobs=true
----

[source,console-result]
----
{
    "acknowledged": true
}
----

The following example deletes the connector with ID `another-connector` and its associated sync jobs.
