Skip to main content
This guide walks you through adding and removing bookmarks using the X API.
PrerequisitesBefore you begin, you’ll need:
  • A developer account with an approved App
  • User Access Token with bookmark.write scope (OAuth 2.0 PKCE)

Add a bookmark

1

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.
2

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
3

Add the bookmark

cURL
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"}'
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}")
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}`);
4

Review the response

{
  "data": {
    "bookmarked": true
  }
}

Remove a bookmark

Delete a Post from your bookmarks:
cURL
curl -X DELETE "https://api.x.com/2/users/2244994945/bookmarks/1460323737035677698" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN"
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}")
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}`);
Response:
{
  "data": {
    "bookmarked": false
  }
}

Required scopes

When using OAuth 2.0 PKCE, your access token must have these scopes:
ScopeDescription
bookmark.writeAdd and remove bookmarks
tweet.readRead Post data
users.readRead user data

Next steps

Bookmarks lookup

Get your bookmarked Posts

API Reference

Full endpoint documentation