Skip to content

Collect posts from a specific account by providing the account URL. The results include posts published by the account, retweets, along with detailed metadata such as engagement metrics, timestamps, and author details. There is a default limit set by X to only return 850 results per account.

Base URL

POST https://x-scraper-api.datashake.com/v1/search

Request payload

callback_url

Field type: string
Required: true
Description: A URL to receive API results via a JSON POST request.

url

Field type: string
Required: true
Description: X account URL.

external_identifier

Field type: string
Required: false
Description: A custom identifier for tracking your request. This value will be included in the callback payload.

limit

Field type: int
Required: false
Description: Limits the number of X posts to be returned. If not specified, will return the max posts possible.

Code example
curl --location 'https://x-scraper-api.datashake.com/v1/search' --header 'x-api-key: your-api-key' --header 'Content-Type: application/json' --request POST --data '{"url": "https://x.com/elonmusk", "callback_url": "https://example.com/callback", "external_identifier": "my-custom-id", "limit": 300}'
import requests

url = "https://x-scraper-api.datashake.com/v1/search"

payload = {
    "url": "https://x.com/elonmusk",
    "callback_url": "https://example.com/callback",
    "external_identifier": "my-custom-id",
    "limit": 300
}
headers = {
    "x-api-key": "your-api-key",
}

response = requests.post(url=url, headers=headers, json=payload)

Response and callback payload

API response example
{
    "status": "created",
    "message": "Your request was successfully submitted.",
    "request_id": "1742515679047322765-7538bd54-2bd7-45"
}
Callback payload example
{
    "request_id": "1742515679047322765-7538bd54-2bd7-45",
    "status": "completed",
    "credits_used": 1200,
    "request_metadata": {
        "url": "https://x.com/elonmusk",
        "callback_url": "https://example.com/callback",
        "external_identifier": "my-custom-id",
        "limit": 300
    },
    "results": [
        {
            "post_id": "1906953225632129029",
            "post_url": "https://x.com/elonmusk/status/1906953225632129029",
            "text": "RT @matt_vanswol: I took delivery of my new @Tesla Model Y on Thursday. \n\nToday, I tried Full Self-Driving (FSD) and it FLAWLESSLY drove a…",
            "repost_count": 3589,
            "likes_count": 31267,
            "comments_count": 1628,
            "bookmark_count": 465,
            "lang": "en",
            "upload_date":"2025-04-01",  
            "is_pinned": false,
            "is_retweet": true,
            "is_quote": false,
            "author": {
                "type": "user",
                "username": "elonmusk",
                "url": "https://x.com/elonmusk",
                "id": "44196397",
                "name": "Elon Musk",
                "is_verified": false,
                "profile_picture_url": "https://pbs.twimg.com/profile_images/1893803697185910784/Na5lOWi5_normal.jpg",
                "follower_count": 218465509,
                "following_count": 1099,
                "media_count": 3736,
                "statuses_count": 76193,
            },
            "media": [
                {
                    "type": "video",
                    "url": "https://t.co/i76bozsG9q",
                    "id": "1906728070876200961"
                }
            ],
            "retweet": {
                "post_id": "1906728370534060175".
                "text": "I took delivery of my new @Tesla Model Y on Thursday. \n\nToday, I tried Full Self-Driving (FSD) and it FLAWLESSLY drove a 32 minute trip from my home to my kids' school. \n\nI am absolutely BLOWN AWAY. \n\nHow long has this been possible and why isn't everyone talking about it?! https://t.co/i76bozsG9q",
                "upload_date": "2025-03-31",
                "author": {
                    "type": "user",
                    "username": "matt_vanswol",
                    "url": "https://x.com/matt_vanswol",
                    "id": "1244068896157708289",
                    "name": "Matt Van Swol",
                    "is_verified": false,
                    "profile_picture_url": "https://pbs.twimg.com/profile_images/1580221131985920001/XNlqL_Yx_normal.jpg",
                    "follower_count": 210370,
                    "following_count": 7742,
                    "media_count": 1007,
                    "statuses_count": 11475,
                },
                "media": [
                    {
                        "type": "video",
                        "url": "https://t.co/i76bozsG9q",
                        "id": "1906728070876200961"
                    }
                ]
            },
            "created_at":"2025-03-31T07:22:29.799931Z",
            "updated_at":"2025-03-31T07:22:29.799931Z"
        },
        ...
    ],
    "summary": {
        "total_posts":300,
        "average_comments_per_post":4501,
        "average_likes_per_post":85389,
        "unique_user_count":1,
    },
    "pagination": {
        "total": 300,
        "page": 1,
        "per_page": 10,
        "total_pages": 30
    }
}

Get search results

Use this endpoint to retrieve results in a synchronous manner.

Note that this endpoint is not intended for polling - make sure to check if your request has completed before calling it.

Base URL

GET https://x-scraper-api.datashake.com/v1/search/:request_id

Path parameters

request_id

Field type: string
Required: true
Description: The unique identifier for the request.

Request parameters

page

Field type: integer
Required: false
Description: The page number of the results to retrieve.

per_page

Field type: integer
Required: false
Description: The number of results to retrieve per page.

Code example
curl --location 'https://x-scraper-api.datashake.com/v1/search/1742546457946506999-897b27cc-acd7-4a?page=1&per_page=10' --header 'x-api-key: your-api-key'
import requests

url = "https://x-scraper-api.datashake.com/v1/search/1742546457946506999-897b27cc-acd7-4a"

params = {
    "page": 1,
    "per_page": 10
}
headers = {
    "x-api-key": "your-api-key",
}

response = requests.get(url=url, headers=headers, params=params)

Response

API response example
{
    "request_id": "1742515679047322765-7538bd54-2bd7-45",
    "status": "completed",
    "credits_used": 1200,
    "request_metadata": {
        "url": "https://x.com/elonmusk",
        "callback_url": "https://example.com/callback",
        "external_identifier": "my-custom-id",
        "limit": 300
    },
    "results": [
        {
            "post_id": "1906953225632129029",
            "post_url": "https://x.com/elonmusk/status/1906953225632129029",
            "text": "RT @matt_vanswol: I took delivery of my new @Tesla Model Y on Thursday. \n\nToday, I tried Full Self-Driving (FSD) and it FLAWLESSLY drove a…",
            "repost_count": 3589,
            "likes_count": 31267,
            "comments_count": 1628,
            "bookmark_count": 465,
            "lang": "en",
            "upload_date":"2025-04-01",  
            "is_pinned": false,
            "is_retweet": true,
            "is_quote": false,
            "author": {
                "type": "user",
                "username": "elonmusk",
                "url": "https://x.com/elonmusk",
                "id": "44196397",
                "name": "Elon Musk",
                "is_verified": false,
                "profile_picture_url": "https://pbs.twimg.com/profile_images/1893803697185910784/Na5lOWi5_normal.jpg",
                "follower_count": 218465509,
                "following_count": 1099,
                "media_count": 3736,
                "statuses_count": 76193,
            },
            "media": [
                {
                    "type": "video",
                    "url": "https://t.co/i76bozsG9q",
                    "id": "1906728070876200961"
                }
            ],
            "retweet": {
                "post_id": "1906728370534060175".
                "text": "I took delivery of my new @Tesla Model Y on Thursday. \n\nToday, I tried Full Self-Driving (FSD) and it FLAWLESSLY drove a 32 minute trip from my home to my kids' school. \n\nI am absolutely BLOWN AWAY. \n\nHow long has this been possible and why isn't everyone talking about it?! https://t.co/i76bozsG9q",
                "upload_date": "2025-03-31",
                "author": {
                    "type": "user",
                    "username": "matt_vanswol",
                    "url": "https://x.com/matt_vanswol",
                    "id": "1244068896157708289",
                    "name": "Matt Van Swol",
                    "is_verified": false,
                    "profile_picture_url": "https://pbs.twimg.com/profile_images/1580221131985920001/XNlqL_Yx_normal.jpg",
                    "follower_count": 210370,
                    "following_count": 7742,
                    "media_count": 1007,
                    "statuses_count": 11475,
                },
                "media": [
                    {
                        "type": "video",
                        "url": "https://t.co/i76bozsG9q",
                        "id": "1906728070876200961"
                    }
                ]
            },
            "created_at":"2025-03-31T07:22:29.799931Z",
            "updated_at":"2025-03-31T07:22:29.799931Z"
        },
        ...
    ],
    "summary": {
        "total_posts":300,
        "average_comments_per_post":4501,
        "average_likes_per_post":85389,
        "unique_user_count":1,
    },
    "pagination": {
        "total": 300,
        "page": 1,
        "per_page": 10,
        "total_pages": 30
    }
}