# Delete Connection

Delete a connection, revoking it with the provider first when the app supports that. Parent delegation cannot delete Embedded end-user or installation connections. A key deletes only the connections its creator may use: shared ones, and their own personal ones.

`DELETE https://connect.mindcloud.co/v2/connections/:connectionId`

Permissions: `credential:delete`.

## Parameters

### Path

- `connectionId` (string, required): The connection's id, from List Connections.

### Headers

- `X-Company-Id` (string): Optional. The id of the organization to act in. Leave it out to act in the API key's own organization. A key can also act in its child organizations, and, with "Use this key across all of your organizations" on, in every organization its creator can open in the app. List them with GET /v2/companies. Every response's X-Company-Id header names the organization it acted in. See [Organizations](https://mindcloud.co/docs/api/rest/introduction/organizations).

## Example request

```bash
curl --request DELETE \
  --url 'https://connect.mindcloud.co/v2/connections/Cn6vH3jW8qYt' \
  --header 'Authorization: Bearer $MINDCLOUD_API_TOKEN'
```

## Response fields

- `id` (string): The id of the resource that was deleted.

## Example response

```json
{
  "success": true,
  "data": {
    "id": "Cn6vH3jW8qYt"
  }
}
```

## Errors

- 400 Bad request (INVALID_QUERY, CREDENTIAL_DELETE_INVALID_REQUEST, CONNECTION_DELETE_FAILED): `VALIDATION_FAILED` / `INVALID_QUERY` ""connectionId" is required."
- 403 Missing permission (API_KEY_PERMISSION_DENIED, API_KEY_CREATOR_INACTIVE): `FORBIDDEN` / `API_KEY_PERMISSION_DENIED` "This API key needs the workflow:run permission for this operation."
- 404 Connection or app not found (NOT_FOUND, CREDENTIAL_DELETE_APP_NOT_FOUND): `NOT_FOUND` "Connection "Cn6vH3jW8qYt" was not found."
- 409 Connection in use: `CONFLICT` / `CONNECTION_IN_USE` "This connection is used by 2 active workflows."
- 500 Delete failed: `INTERNAL_ERROR` / `CREDENTIAL_DELETE_FAILED` "Failed to delete the credential."
- 502 Provider revoke failed: `PROVIDER_ERROR` / `CREDENTIAL_DELETE_ACTION_FAILED` "Deletion action failed. Invalid or expired token."
