> ## 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

> Remove, withdraw, or decline a connection by user ID

Removes the connection relationship between the authenticated user and the specified user. The behavior depends on the current connection state:

* **Pending (sent by current user)** — withdraws the request (record is deleted).
* **Pending (sent by other user)** — declines the request (status updated to `"declined"`).
* **Accepted** — disconnects both users (record is deleted).

## Path Parameters

**userId** `string` *required*

The Sublay user ID (UUID) of the other user.

## Response

On success, returns HTTP `200`.

**When withdrawn or disconnected:**

**message** `string`

Human-readable description of the action taken.

**action** `string`

`"withdraw"` or `"disconnect"`.

**When declined:**

**id** `string`

Connection record ID.

**status** `string`

`"declined"`.

**respondedAt** `string`

ISO timestamp of when the request was declined.

## Error Responses

> [accordion] Self-Disconnect — 400
>
> ```json theme={null}
> {
>   "error": "Cannot disconnect from yourself",
>   "code": "connection/self-disconnect"
> }
> ```

> [accordion] No Connection Found — 404
>
> ```json theme={null}
> {
>   "error": "No connection found between these users that can be removed.",
>   "code": "connection/not-found"
> }
> ```

## See Also

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


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