# Turn managed mode OFF without disconnecting

> Turn managed mode OFF without disconnecting: CustomDomain™ API reference in the connections group. Covers parameters, request body, responses and error codes.

Source: https://docs.customdomain.ai/docs/api-reference/connections/disableManagedConnection

## `DELETE https://api.customdomain.ai/v1/connections/{id}/grant`

Drops the stored grant (async one-click, or a kept provider sign-in, which is also revoked at the provider where it allows it) and clears the connection's `managed` flag, leaving the connection and its applied records in place. The records the provider already wrote stay live; the control plane simply stops holding a credential to re-apply / revert them. This is **not** `DELETE /v1/connections/{id}` (which reverts the template at the provider and removes the whole connection). Idempotent: a connection that is already unmanaged returns `200`.

A widget token must be the connection's end user: a connection that names another end user than the token's `end_user_ref`, or names one while the token names none, answers `403` `token_wrong_end_user` before the grant is touched, and a connection that names none is the token's as before. An API key and an app-scoped token are not limited by it.

### Authentication

`widgetJWT`, `apiKey`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Responses

| Status | Description |
| --- | --- |
| `200` | Managed mode disabled (grant dropped, managed=false, connection kept) |
| `401` | Error envelope: {code, title, details}. |
| `403` | `token_wrong_end_user` (a widget token: the connection names another end user, or names one while the token names none; the grant is kept and nothing is changed) or `forbidden` (a role that cannot write connections). |
| `404` | Error envelope: {code, title, details}. |

### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `connection_id` | string | yes |  |
| `managed` | `false` | yes |  |

The full specification is served at `GET https://api.customdomain.ai/v1/openapi.json`.
