# Block User

{% hint style="danger" %}
Block User is now Generally Available (GA) - please see [here](/social-plus-sdk/social/block-and-unblock-user.md) for more detail. Beta Feature (Beta) here has been deprecated and is intended for legacy use only. This Block User (Beta) feature will be removed on 28 February 2024
{% endhint %}

The block/unblock user service is designed to support block/unblock users feature. The primary function of this service is to:

1. **Block/Unblock other users**
2. **Check whether or not the system should hide the content of the specified user ID, based on block/unblock from**
3. **Get a list of users blocked by the current user**

{% hint style="info" %}
Block User is currently in Private Beta. Please submit your request to the [**social.plus Help Center**](https://socialplus.atlassian.net/servicedesk/customer/portals) to enable this feature. It will take approximately 5 business days to process your request.
{% endhint %}

### Block Other Users

With the Block API, you can add a user to the list of users to be blocked.

#### API Reference

<mark style="color:green;">`POST`</mark> `https://beta.amity.services/block/members`

#### Headers

| Name                                            | Type   | Description                                                                 |
| ----------------------------------------------- | ------ | --------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | <p>Bearer {accessToken}</p><p>(accessToken is retrieved from Amity SDK)</p> |

#### Request Body

| Name                                          | Type   | Description                                         |
| --------------------------------------------- | ------ | --------------------------------------------------- |
| blockUserId<mark style="color:red;">\*</mark> | Number | userId of the user that the current user will block |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
"status": "success"
}
```

{% endtab %}
{% endtabs %}

#### Example curl

{% code overflow="wrap" %}

```powershell
curl --location --request POST 'https://beta.amity.services/block/members' \
--header 'Authorization: Bearer <ACCESSTOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "blockUserId":"userId"
}'
```

{% endcode %}

#### Limitations

Current limitations of the block API are:

* Only 1 user can be blocked at a time.
* The Block API has no influence on the social.plus Feed API. Developers must filter the blocked content themselves in the frontend.

### Unblock Other Users

With the Unblock API, you can remove a user from the list of currently blocked users.

#### API Reference

<mark style="color:red;">`DELETE`</mark> `https://beta.amity.services/block/members`

#### Headers

| Name                                            | Type   | Description                                                                 |
| ----------------------------------------------- | ------ | --------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | <p>Bearer {accessToken}</p><p>(accessToken is retrieved from Amity SDK)</p> |

#### Request Body

| Name                                          | Type   | Description                                         |
| --------------------------------------------- | ------ | --------------------------------------------------- |
| blockUserId<mark style="color:red;">\*</mark> | Number | userId of the user that the current user will block |

{% tabs %}
{% tab title="200: OK {     " %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

#### Example curl

{% code overflow="wrap" %}

```powershell
curl --location --request DELETE 'https://beta.amity.services/block/members' \
--header 'Authorization: Bearer <ACCESSTOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "blockUserId":"testBlock"
}'
```

{% endcode %}

#### Limitations

The current limitations of the Unblock Posts API are:

* Only 1 user can be unblocked at a time.
* The blocking API does not affect the social.plus feed API. Developers have to filter blocked content themselves on the frontend.

### Block User List

With the Block user list API, you can retrieve the list of users who have been blocked by the current user.

#### API Reference

<mark style="color:green;">`POST`</mark> `https://beta.amity.services/block`

#### Headers

| Name                                            | Type   | Description                                                                 |
| ----------------------------------------------- | ------ | --------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | <p>Bearer {accessToken}</p><p>(accessToken is retrieved from Amity SDK)</p> |

#### Request Body

| Name            | Type   | Description                                                                                                                         |
| --------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| paginationToken | String | The primary key of the first object evaluated by this operation. Use the value returned for `paginationToken` in the previous call. |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "results": [
        {
            "blocked_userId": "xxxx",
            "netid_uid": "xxxx"
        },
        {
            "blocked_userId": "xxxx",
            "netid_uid": "xxxx"
        }
    ],
    "paginationToken": {
        "netid_uid": "xxxx",
        "blocked_userId": "xxxx"
    }
}
```

{% endtab %}
{% endtabs %}

#### Example curl

```powershell
curl --location --request POST 'https://beta.amity.services/block' \
--header 'authorization: Bearer <ACCESSTOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{}'
```

#### Limitations

Current limitations on Unblock Posts API are:

* Each request returns only 20 posts.
* The block API does not affect the social.plus feed API. Developers have to filter the blocked content themselves in the frontend.

### Check Whether the Content Should be Hidden or Not

checkIsHide API can be used to Check wether contents from users should be hidden or not.

#### API Reference

<mark style="color:blue;">`GET`</mark> `https://beta.amity.services/block/members`

#### Query Parameters

| Name                                        | Type   | Description                                                                                                                                                                                                                                                                        |
| ------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| checkList<mark style="color:red;">\*</mark> | String | <p>userIds from content(post,comment,message) that the current user wants to check whether the content should be hidden or not.</p><p>you can add multiple query to check multiple content at the same time.</p><p>ex.</p><p>checkList=user1\&checkList=user2\&checkList=user3</p> |

#### Headers

| Name                                            | Type   | Description                                                                 |
| ----------------------------------------------- | ------ | --------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | <p>Bearer {accessToken}</p><p>(accessToken is retrieved from Amity SDK)</p> |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "user1": true,
    "user2": true,
    "user3": false
}
```

{% endtab %}
{% endtabs %}

#### Example curl

{% code overflow="wrap" %}

```powershell
curl --location --request GET 'https://beta.amity.services/block/members?checkList=userId1&checkList=userId2' \
--header 'Authorization: Bearer <ACCESSTOKEN>'
```

{% endcode %}

#### Limitations

The current limitations of the Unblock Posts API are:

* You can check a maximum of 20 users for each request.
* The Block API does not affect the social.plus feed API. Developers have to filter the blocked content themselves in the frontend.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.social.plus/developers/beta-features/block-user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
