> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Remove Connection

> Withdraw a pending request or disconnect an accepted connection by connection ID

Removes a connection record by its ID. The behavior depends on the connection's current status:

* **Pending** — only the requester can withdraw the request (record is deleted).
* **Accepted** — either connected user can disconnect (record is deleted).

Use [Remove Connection (by user ID)](https://docs.sublay.io/v7/api-reference/users/connections/remove-connection.md) if you only have the other user's ID.

## Path Parameters

**connectionId** `string` *required*

The ID (UUID) of the connection record to remove.

## Response

On success, returns HTTP `200`:

**message** `string`

Human-readable description: `"Connection request withdrawn successfully."` or `"Connection removed successfully."`.

## Error Responses

> [accordion] Not Found — 404
>
> ```json theme={null}
> {
>   "error": "Connection not found or cannot be withdrawn.",
>   "code": "connection/not-found"
> }
> ```

> [accordion] Unauthorized — 403
>
> ```json theme={null}
> {
>   "error": "Only the requester can withdraw a pending connection request.",
>   "code": "connection/unauthorized"
> }
> ```

## See Also

* [`useRemoveConnection` hook](https://docs.sublay.io/v7/hooks/connections/use-remove-connection)
* [Remove Connection (by user ID)](https://docs.sublay.io/v7/api-reference/users/connections/remove-connection.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.