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

# Blocks

> The Blocks endpoints let you retrieve the list of users blocked by the authenticated user, as well. Reference for the X API v2 standard tier covering blocks.

export const Button = ({href, children}) => {
  return <div className="not-prose">
    <a href={href}>
      <button className="x-btn">
        <span>{children}</span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

The Blocks endpoints let you retrieve the list of users blocked by the authenticated user, as well as block and unblock users.

<Callout icon="/icons/xds/icon-key.svg" color="#22C55E" iconType="regular">
  The block and unblock users endpoints are only available under the Enterprise plan. You can fill out the Enterprise interest form [here](/forms/enterprise-api-interest).
</Callout>

## Overview

<CardGroup cols={2}>
  <Card title="Blocked users" icon="https://mintcdn.com/x-preview-mintlify-b90e1c4d/HEs9RRCCIaKc_EuF/icons/xds/icon-bulleted-list.svg?fit=max&auto=format&n=HEs9RRCCIaKc_EuF&q=85&s=512acd91661d1f34f5cda828393dae8e" width="24" height="24" data-path="icons/xds/icon-bulleted-list.svg">
    Get your blocked user list
  </Card>

  <Card title="Block" icon="https://mintcdn.com/x-preview-mintlify-b90e1c4d/FzxSSaEcmuIUnJHr/icons/xds/icon-block.svg?fit=max&auto=format&n=FzxSSaEcmuIUnJHr&q=85&s=42ac9746ca17d836bbd2e62835fb0797" width="24" height="24" data-path="icons/xds/icon-block.svg">
    Block a user
  </Card>

  <Card title="Unblock" icon="https://mintcdn.com/x-preview-mintlify-b90e1c4d/HEs9RRCCIaKc_EuF/icons/xds/icon-checkmark-circle.svg?fit=max&auto=format&n=HEs9RRCCIaKc_EuF&q=85&s=b8bbbdb3bba4d5e5bbf6e728e82a6162" width="24" height="24" data-path="icons/xds/icon-checkmark-circle.svg">
    Unblock a user
  </Card>
</CardGroup>

***

## Endpoints

| Method | Endpoint                                             | Description       | Availability                                                                                                                                                                    |
| :----- | :--------------------------------------------------- | :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| GET    | [`/2/users/:id/blocking`](/x-api/users/get-blocking) | Get blocked users | <div className="flex items-center gap-1 flex-nowrap whitespace-nowrap"><Badge color="blue" size="xs">Pay-per-use</Badge><Badge color="green" size="xs">Enterprise</Badge></div> |
| POST   | `/2/users/:id/blocking`                              | Block a user      | <Badge color="green" size="xs">Enterprise</Badge>                                                                                                                               |
| DELETE | `/2/users/:source_user_id/blocking/:target_user_id`  | Unblock a user    | <Badge color="green" size="xs">Enterprise</Badge>                                                                                                                               |

***

## Example: Get blocked users

```bash theme={null}
curl "https://api.x.com/2/users/123456789/blocking?\
user.fields=username,description" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN"
```

## Example: Block a user (Enterprise only)

```bash theme={null}
curl -X POST "https://api.x.com/2/users/123456789/blocking" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"target_user_id": "9876543210"}'
```

***

## Getting started

<Note>
  **Prerequisites**

  * An approved [developer account](https://developer.x.com/en/portal/petition/essential/basic-info)
  * A [Project and App](/resources/fundamentals/developer-apps) in the Developer Console
  * User Access Tokens via [OAuth 2.0 PKCE](/resources/fundamentals/authentication#oauth-2-0-authorization-code-flow-with-pkce-2)
</Note>

<CardGroup cols={2}>
  <Card title="Quickstart" icon="https://mintcdn.com/x-preview-mintlify-b90e1c4d/azCBEsesh7C8Sy1b/icons/xds/icon-rocket.svg?fit=max&auto=format&n=azCBEsesh7C8Sy1b&q=85&s=875b30c0ff514c2a738094c97fb79bc4" href="/x-api/users/blocks/quickstart" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    Get started with blocks
  </Card>

  <Card title="Integration guide" icon="https://mintcdn.com/x-preview-mintlify-b90e1c4d/FzxSSaEcmuIUnJHr/icons/xds/icon-book.svg?fit=max&auto=format&n=FzxSSaEcmuIUnJHr&q=85&s=53c80edab12a4d2023f5bf925c9049dd" href="/x-api/users/blocks/integrate" width="24" height="24" data-path="icons/xds/icon-book.svg">
    Key concepts and best practices
  </Card>

  <Card title="API Reference" icon="https://mintcdn.com/x-preview-mintlify-b90e1c4d/HEs9RRCCIaKc_EuF/icons/xds/icon-code.svg?fit=max&auto=format&n=HEs9RRCCIaKc_EuF&q=85&s=8a18cd907c79967a27fee26193a7e244" href="/x-api/users/get-blocking" width="24" height="24" data-path="icons/xds/icon-code.svg">
    Full endpoint documentation
  </Card>
</CardGroup>
