# Delete a connector

Delete a saved connector. Deletion cannot be reversed and does not delete data that was previously written through the connector.

```text
DELETE https://moi.matrixorigin.cn/newmoi/connectors/{connector_id}
```

## Before you call

First [get connector details](get-connector.md) and check `related_task_ids`. Prepare a personal access token that can access the target workspace, the target workspace ID, and the connector ID.

The example uses:

- `$AI_STUDIO_API_KEY`: your personal access token, sent in the `X-API-Key` header.
- `$WORKSPACE_ID`: the target workspace ID, sent in the `X-Workspace-ID` header.
- `$CONNECTOR_ID`: the connector ID to delete.

The deletion request is rejected while incomplete import tasks still use the connector. Handle those tasks first.

## Request example

```bash
curl -X DELETE "https://moi.matrixorigin.cn/newmoi/connectors/$CONNECTOR_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Path parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `connector_id` | string | Connector ID to delete. |

## Successful response

When the response `code` is `OK`, the deletion request has been accepted and `data` is `null`. The endpoint does not return the deleted object. After confirming that the connector no longer appears in the list, deletion cannot be reversed.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": null
}
```

Response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` means the deletion request was accepted. |
| `msg` | string | Processing message for the deletion request. |
| `data` | null | This endpoint does not return the deleted object. |

## Error response

`HTTP 200` does not necessarily mean that the deletion request was accepted. Always check `code`; only `code: "OK"` means the endpoint accepted it.

```json
{
  "code": "ErrConnectorInUse",
  "msg": "connector is in use",
  "data": null
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status
  - Error code
  - Common cause
  - Recommended action
* - `409`
  - `ErrConnectorInUse`
  - The connector is still used by incomplete import tasks.
  - Stop, migrate, or delete the related tasks first.
* - `200`
  - `ErrServer`
  - The service could not delete the connector.
  - Check `code`; the connector was not deleted and can be retried later.
* - `503`
  - `ErrServer`
  - The service is temporarily unable to complete deletion.
  - Retry later.
```

## Next steps

Use [List connectors](list-connectors.md) to confirm that the connector no longer appears. The deletion endpoint does not return a resource object, and a details response cannot replace that confirmation.
