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

# Introduction

> The manage DM blocks endpoints enable you to block or unblock a specified account on behalf of an. Reference for the X API v2 standard tier covering blocks.

The manage DM blocks endpoints enable you to block or unblock a specified account on behalf of an authenticated user. For these endpoints, there are two POST methods available:

* **/2/users/:id/dm/block**: Allows you to block an account
* **/2/users/:id/dm/unblock**: Allows you to unblock an account

### Getting started

### Authentication

Since you are making requests on behalf of a user, you must authenticate these endpoints with either [OAuth 1.0a User Context](/resources/fundamentals/authentication#obtaining-access-tokens-using-3-legged-oauth-flow) or [OAuth 2.0 Authorization Code with PKCE](/resources/fundamentals/authentication#oauth-2-0-authorization-code-flow-with-pkce-2), and utilize the user Access Tokens associated with the user you are making the request on behalf of. You can generate this user Access Token using the [3-legged OAuth flow](https://developer.x.com/resources/fundamentals/authentication/obtaining-user-access-tokens) (OAuth 1.0a) or using the [Authorization Code with PKCE grant flow](/resources/fundamentals/authentication#oauth-2-0-authorization-code-flow-with-pkce-2) (OAuth 2.0).

### Making a request

Block

Once a user has authenticated with your app, you can call the Block endpoint on behalf of user as shown below:

```
curl --request POST 'https://api.x.com/2/users/:id/dm/block' --header 'Authorization: ••••••'
```

If the request is successful, you should see the JSON response as shown below:

```
{
   "data": {
       "blocked": true
   }
}
```

**Unblock**

Once a user has authenticated with your app, you can call the Unblock endpoint on behalf of user as shown below:

```
curl --request POST 'https://api.x.com/2/users/:id/dm/unblock' --header 'Authorization: ••••••'
```

If the request is successful, you should see the JSON response as shown below:

```
{
   "data": {
       "blocked": false
   }
}
```
