POST /2/users/:id/bookmarks

POST /2/users/:id/bookmarks

Causes the user ID of an authenticated user identified in the path parameter to Bookmark the target Tweet provided in the request body.

Endpoint URL

https://api.twitter.com/2/users/:id/bookmarks

Authentication and rate limits

Authentication methods
supported by this endpoint

OAuth 2.0 Authorization Code with PKCE

Rate limit

User rate limit (User context): 50 requests per 15-minute window per each authenticated user

OAuth 2.0 scopes required by this endpoint

tweet.read

users.read

bookmark.write

Learn more about OAuth 2.0 Authorization Code with PKCE

Path parameters

NameTypeDescription
id
 Required 
stringThe user ID of an authenticated user who you are bookmarking a Tweet on behalf of. It must match your own user ID or that of an authenticating user, meaning that you must pass the Access Token associated with the user ID when authenticating your request.


JSON body parameters

NameTypeDescription
tweet_id
 Required 
stringThe ID of the Tweet that you would like an id to Bookmark.


Example code with offical SDKs

TypeScript
Java
      (async () => {
  try {
    const postBookmark = await twitterClient.bookmarks.postUsersIdBookmarks(
      //User ID
      "2244994945",
      {
        tweet_id: "1228393702244134912",
      }
    );
    console.dir(postBookmark, {
      depth: null,
    });
  } catch (error) {
    console.log(error);
  }
})();

    
      // String | The ID of the user for whom to add bookmarks
String id = "2244994945";

// String | The ID of the tweet that the user is adding to bookmarks
String tweetId = "1228393702244134912";

AddBookmarkRequest addBookmarkRequest = new AddBookmarkRequest(); // AddBookmarkRequest | 
addBookmarkRequest.tweetId(tweetId);

try {
    BookmarkMutationResponse result = apiInstance.bookmarks().postUsersIdBookmarks(addBookmarkRequest, id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling BookmarksApi#postUsersIdBookmarks");
    System.err.println("Status code: " + e.getCode());
    System.err.println("Reason: " + e.getResponseBody());
    System.err.println("Response headers: " + e.getResponseHeaders());
    e.printStackTrace();
  }

    

Example responses

Successful response
      {
  "data": {
    "bookmarked": true
  }
}
    

Response fields

NameTypeDescription
bookmarkedbooleanIndicates whether the user bookmarks the specified Tweet as a result of this request.