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

# Follow/Unfollow User

> Follow or unfollow another user with the social.plus SDKs.

Use the follow API to create a relationship from the current user to another user. The SDK returns the resulting follow status where the platform exposes one. Depending on network configuration, the status can become `accepted` immediately or remain `pending` until the target user accepts the request.

Use the unfollow API to cancel a pending request or remove an accepted follow relationship.

> [!NOTE]
>
> If the relationship is blocked, follow and unfollow calls can fail or return a blocked status. Read the connection status before rendering a follow button when the UI needs to distinguish blocked users.

## Parameters

| Operation | Parameter | Required | Description |
| - | - | - | - |
| Follow user | `userId` / `targetUserId` | Yes | ID of the user the current user wants to follow. |
| Unfollow user | `userId` / `targetUserId` | Yes | ID of the user the current user wants to unfollow or whose pending request should be canceled. |

## Follow User

Follow a user when the current user starts a relationship that may become accepted immediately or remain pending.

```swift iOS theme={null}
let relationship = AmityUserRelationship()
let response = try await relationship.follow(withUserId: "target-user-id")
_ = response
```

```kotlin Android theme={null}
val disposable = AmityCoreClient.newUserRepository()
    .relationship()
    .follow(userId = targetUserId)
    .subscribe(
        { status: AmityFollowStatus ->
            showSuccessMessage(status.apiKey)
        },
        { error ->
            handleGeneralError(error)
        },
    )
```

```typescript TypeScript theme={null}
import { UserRepository } from '@amityco/ts-sdk';

const { data: followStatus } = await UserRepository.Relationship.follow(userId);

if (followStatus.status === 'accepted') {
  showSuccessMessage('Following');
}
```

```dart Flutter theme={null}
final status = await AmityCoreClient.newUserRepository()
    .relationship()
    .follow(targetUserId);

final statusValue = status.value;
```

## Unfollow User

Unfollow a user to remove an accepted relationship or cancel a pending follow request.

```swift iOS theme={null}
let relationship = AmityUserRelationship()
let response = try await relationship.unfollow(withUserId: "target-user-id")
_ = response
```

```kotlin Android theme={null}
val disposable = AmityCoreClient.newUserRepository()
    .relationship()
    .unfollow(userId = targetUserId)
    .subscribe(
        {
            showSuccessMessage()
        },
        { error ->
            handleGeneralError(error)
        },
    )
```

```typescript TypeScript theme={null}
import { UserRepository } from '@amityco/ts-sdk';

const didUnfollow = await UserRepository.Relationship.unfollow(userId);

if (didUnfollow) {
  showSuccessMessage('Unfollowed');
}
```

```dart Flutter theme={null}
final status = await AmityCoreClient.newUserRepository()
    .relationship()
    .unfollow(targetUserId);

final statusValue = status.value;
```

## Related Topics

> [card] [Accept/Decline Requests](/social-plus-sdk/social/user-relationship/following/accept-decline-follow-request.md)
>
> Handle incoming follow requests.

> [card] [Connection Status](/social-plus-sdk/social/user-relationship/following/get-connection-status.md)
>
> Read status and counters.

> [card] [Follower Lists](/social-plus-sdk/social/user-relationship/following/get-follower-following-list.md)
>
> Query followers and following.


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