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

# Manage Bookmarks

> This guide walks you through adding and removing bookmarks using the X API. Reference for the X API v2 standard tier covering quickstart.

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <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>;
};

This guide walks you through adding and removing bookmarks using the X API.

<Note>
  **Prerequisites**

  Before you begin, you'll need:

  * A [developer account](https://developer.x.com/en/portal/petition/essential/basic-info) with an approved App
  * User Access Token with `bookmark.write` scope (OAuth 2.0 PKCE)
</Note>

***

## Add a bookmark

<Steps>
  <Step title="Get your user ID">
    You need your authenticated user's ID. You can find it using the `/2/users/me` endpoint or the [user lookup endpoint](/x-api/users/lookup/introduction).
  </Step>

  <Step title="Get the Post ID">
    Find the Post ID in the URL when viewing a Post:

    ```
    https://x.com/XDevelopers/status/1460323737035677698
                                    └── This is the Post ID
    ```
  </Step>

  <Step title="Add the bookmark">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl -X POST "https://api.x.com/2/users/2244994945/bookmarks" \
        -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{"tweet_id": "1460323737035677698"}'
      ```

      ```python Python SDK theme={null}
      from xdk import Client

      client = Client(bearer_token="YOUR_USER_ACCESS_TOKEN")

      # Add a bookmark
      response = client.bookmarks.create(
          user_id="2244994945",
          tweet_id="1460323737035677698"
      )

      print(f"Bookmarked: {response.data.bookmarked}")
      ```

      ```javascript JavaScript SDK theme={null}
      import { Client } from "@xdevplatform/xdk";

      const client = new Client({ accessToken: "YOUR_USER_ACCESS_TOKEN" });

      // Add a bookmark
      const response = await client.bookmarks.create("2244994945", {
        tweetId: "1460323737035677698",
      });

      console.log(`Bookmarked: ${response.data?.bookmarked}`);
      ```
    </CodeGroup>
  </Step>

  <Step title="Review the response">
    ```json theme={null}
    {
      "data": {
        "bookmarked": true
      }
    }
    ```
  </Step>
</Steps>

***

## Remove a bookmark

Delete a Post from your bookmarks:

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.x.com/2/users/2244994945/bookmarks/1460323737035677698" \
    -H "Authorization: Bearer $USER_ACCESS_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_USER_ACCESS_TOKEN")

  # Remove a bookmark
  response = client.bookmarks.delete(
      user_id="2244994945",
      tweet_id="1460323737035677698"
  )

  print(f"Bookmarked: {response.data.bookmarked}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ accessToken: "YOUR_USER_ACCESS_TOKEN" });

  // Remove a bookmark
  const response = await client.bookmarks.delete("2244994945", "1460323737035677698");

  console.log(`Bookmarked: ${response.data?.bookmarked}`);
  ```
</CodeGroup>

**Response:**

```json theme={null}
{
  "data": {
    "bookmarked": false
  }
}
```

***

## Required scopes

When using OAuth 2.0 PKCE, your access token must have these scopes:

| Scope            | Description              |
| :--------------- | :----------------------- |
| `bookmark.write` | Add and remove bookmarks |
| `tweet.read`     | Read Post data           |
| `users.read`     | Read user data           |

***

## Next steps

<CardGroup cols={2}>
  <Card title="Bookmarks lookup" icon="bookmark" href="/x-api/posts/bookmarks/quickstart/bookmarks-lookup">
    Get your bookmarked Posts
  </Card>

  <Card title="API Reference" icon="code" href="/x-api/users/create-bookmark">
    Full endpoint documentation
  </Card>
</CardGroup>
