Docs
User likes

User likes

Tweets a user has liked.

GET/user/{userId}/likes

Parameters

  • userIdpath · string · required

    Numeric user ID (digits only, up to 30). To pass a handle instead, use -1 here and set username.

  • usernamequery · string · optional

    Handle, with or without @. When set, it is used instead of userId: the API looks up the ID first, which makes the call a little slower. Still one billed call.

  • countquery · integer · optional · default 20

    Number of items to ask X for. Sent to X as is; X treats it as a hint and decides how many it returns (follower and following pages often hold 50 to 70 users for count=20). A value that is not a number falls back to 20.

  • cursorquery · string · optional

    Bottom cursor from the previous page. Leave it out for the first page. See Pagination.

Paginated: pass the bottom cursor of one page as cursor to get the next. Each page is one billed call. See Pagination.

Notes

  • X made likes private in June 2024 and shows them only to the account owner. The API does not read as the owner, so the result is empty: {"data": {"user": {"result": {"__typename": "User", "timeline": {}}}}}, without instructions or cursor.

Example request

curl 'https://api.twittrapi.com/user/12/likes?count=20' \
  --header 'X-API-KEY: YOUR_API_KEY'

Base URL https://api.twittrapi.com, key in the X-API-KEY header. Python and Node.js use the official SDKs.

Response

Raw JSON of X's Likes query.

Simple format (?format=simple or X-Response-Format: simple): Collection of Tweet objects: {data: [Tweet], nextCursor, previousCursor, hasNextPage}. Empty since X made likes private: {data: [], nextCursor: null}. Schema.

{
  "data": {
    "user": {
      "result": {
        "__typename": "User",
        "timeline": {}
      }
    }
  }
}

In the raw format, field names and nesting come from X and can change without notice. See Response format; the simple format keeps a fixed schema.

Errors

  • 422userId is not numeric, or the username lookup failed.
  • 400userId is -1 and username is missing, the username contains characters X blocks, or the user could not be found.

Errors every endpoint can return (401, 402, 403, 404, 408, 409, 429, 5xx), and which of them are charged, are on the Errors page. Calls that fail with 400, 408, 409 or a 5xx error are refunded.