Follow User

Endpoint

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

Method: POST

Authentication Required: Yes


Description

Create a follow relationship between the authenticated user and another user. This establishes a one-way follow relationship where the authenticated user will follow the specified user.


Request

Path Parameters

ParameterTypeRequiredDescription
userIdstringYesID of the user to follow.

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication.

Body Parameters

None

Example Request

POST /users/user-uuid-123/follow
Authorization: Bearer <ACCESS_TOKEN>

Response

Success Response (201 Created)

{
  "id": "follow-uuid",
  "followerId": "current-user-id",
  "followedId": "target-user-id",
  "createdAt": "2024-01-01T12:00:00.000Z"
}

Error Responses

Invalid User ID (400 Bad Request)

{
  "error": "Invalid or missing userId",
  "code": "follow/invalid-user-id"
}

Self-Follow Attempt (400 Bad Request)

{
  "error": "Cannot follow yourself",
  "code": "follow/self-follow"
}

User Not Found (404 Not Found)

{
  "error": "User not found",
  "code": "follow/user-not-found"
}

Already Following (409 Conflict)

{
  "error": "Already following this user",
  "code": "follow/already-following"
}

Server Error (500 Internal Server Error)

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

Notes

  • This endpoint creates a Follow relationship in the database
  • Follows are one-way relationships that do not require approval
  • Users cannot follow themselves
  • Duplicate follow requests return a 409 status
  • Rate limiting: 75 requests per 5 minutes