API EndpointsUsersConnection OperationsRemove Connection by User ID

Remove Connection by User ID

Endpoint

URL: api.replyke.com/api/v6/:projectId/users/:userId/connection

Method: DELETE

Authentication Required: Yes


Description

This endpoint handles multiple connection removal scenarios based on the current connection status:

  • Decline: If the specified user sent you a pending request, decline it
  • Withdraw: If you sent a pending request to the specified user, withdraw it
  • Disconnect: If you’re connected with the specified user, remove the connection

Request

Path Parameters

ParameterTypeRequiredDescription
userIdstringYesID of the user to decline/withdraw/disconnect with

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication.

Body Parameters

None

Example Request

DELETE /users/user-uuid-123/connection
Authorization: Bearer <ACCESS_TOKEN>

Response

Success Responses

Decline (200 OK)

When other user sent you a pending request:

{
  "id": "connection-uuid",
  "status": "declined",
  "respondedAt": "2024-01-01T12:05:00.000Z"
}

Withdraw (200 OK)

When you sent them a pending request:

{
  "message": "Connection request withdrawn successfully.",
  "action": "withdraw"
}

Disconnect (200 OK)

When you’re connected:

{
  "message": "Connection removed successfully.",
  "action": "disconnect"
}

Error Responses

Invalid User ID (400 Bad Request)

{
  "error": "Invalid userId",
  "code": "connection/invalid-user-id"
}

Self-Disconnect Attempt (400 Bad Request)

{
  "error": "Cannot disconnect from yourself",
  "code": "connection/self-request"
}

No Connection Found (404 Not Found)

{
  "error": "No connection found between these users that can be removed",
  "code": "connection/not-found"
}

Server Error (500 Internal Server Error)

{
  "error": "Internal server error",
  "code": "connection/server-error"
}

Notes

  • Smart endpoint that automatically handles the correct action based on connection status
  • Decline: Updates connection status to “declined” and sets respondedAt timestamp
  • Withdraw: Deletes the connection record (allows fresh request later)
  • Disconnect: Deletes the connection record (allows fresh request later)
  • Cannot disconnect from yourself
  • Returns different response formats based on the action taken
  • Rate limiting: 50 requests per 5 minutes