Skip to content

Scrape post metadata

Retrieve comprehensive details about a specific post by providing its URL. The results include full post metadata, author information, engagement metrics, and any associated media such as images or videos.

Base URL

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

Request payload

url

Field type: string
Required: true
Description: URL of the X post to scrape.

callback_url

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

external_identifier

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

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

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

payload = {
    "url": "https://x.com/garygreenobe/status/1903744705981988867",
    "callback_url": "https://example.com/callback",
    "external_identifier": "my-custom-id"
}
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": 130,
    "request_metadata": {
        "url": "https://x.com/garygreenobe/status/1903744705981988867",
        "callback_url": "https://example.com/callback",
        "external_identifier": "my-custom-id"
    },
    "results": [
        {
            "post_id": "1903744705981988867",
            "post_url": "https://x.com/garygreenobe/status/1903744705981988867",
            "text": "This is just brilliant, the @RMBandService signalling the end of the day with the piece ‘Sunset’ played last night at the Mountbatten Festival of Music - not ashamed to say it always brings a tear to my eye…🫡 https://t.co/1VOtpfVogi",
            "repost_count": 181,
            "likes_count": 1276,
            "comments_count": 49,
            "bookmark_count": 81,
            "lang": "en",
            "upload_date":"2025-03-31",  
            "is_pinned": false,
            "is_retweet": false,
            "is_quote": false,
            "author": {
                "type": "user",
                "username": "garygreenobe",
                "url": "https://x.com/garygreenobe",
                "id": "30011212",
                "name": "Lt Col Gary Green OBE RM (Retd)",
                "is_verified": false,
                "profile_picture_url": "https://pbs.twimg.com/profile_images/801140653279289344/dNWq6h4X_normal.jpg",
                "follower_count": 13387,
                "following_count": 259,
                "media_count": 426,
                "statuses_count": 2573,
            },
            "media": [
                {
                    "type": "video",
                    "url": "https://t.co/1VOtpfVogi",
                    "id": "1903744608162721792"
                }
            ],
            "retweet": null,
            "created_at":"2025-03-31T07:22:29.799931Z",
            "updated_at":"2025-03-31T07:22:29.799931Z"
        },
        ...
    ],
    "summary": null,
    "pagination": null
}

Get scraping 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/scrape/:request_id

Path parameters

request_id

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

Code example
curl --location 'https://x-scraper-api.datashake.com/v1/scrape/1742517759478683074-2b1a61cf-89d0-4d' --header 'x-api-key: your-api-key'
import requests

url = "https://x-scraper-api.datashake.com/v1/scrape/1742517759478683074-2b1a61cf-89d0-4d"

headers = {
    "x-api-key": "your-api-key",
}

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

Response

API response example
{
    "request_id": "1742515679047322765-7538bd54-2bd7-45",
    "status": "completed",
    "credits_used": 130,
    "request_metadata": {
        "url": "https://x.com/garygreenobe/status/1903744705981988867",
        "callback_url": "https://example.com/callback",
        "external_identifier": "my-custom-id"
    },
    "results": [
        {
            "post_id": "1903744705981988867",
            "post_url": "https://x.com/garygreenobe/status/1903744705981988867",
            "text": "This is just brilliant, the @RMBandService signalling the end of the day with the piece ‘Sunset’ played last night at the Mountbatten Festival of Music - not ashamed to say it always brings a tear to my eye…🫡 https://t.co/1VOtpfVogi",
            "repost_count": 181,
            "likes_count": 1276,
            "comments_count": 49,
            "bookmark_count": 81,
            "lang": "en",
            "upload_date":"2025-03-31",  
            "is_pinned": false,
            "is_retweet": false,
            "is_quote": false,
            "author": {
                "type": "user",
                "username": "garygreenobe",
                "url": "https://x.com/garygreenobe",
                "id": "30011212",
                "name": "Lt Col Gary Green OBE RM (Retd)",
                "is_verified": false,
                "profile_picture_url": "https://pbs.twimg.com/profile_images/801140653279289344/dNWq6h4X_normal.jpg",
                "follower_count": 13387,
                "following_count": 259,
                "media_count": 426,
                "statuses_count": 2573,
            },
            "media": [
                {
                    "type": "video",
                    "url": "https://t.co/1VOtpfVogi",
                    "id": "1903744608162721792"
                }
            ],
            "retweet": null,
            "created_at":"2025-03-31T07:22:29.799931Z",
            "updated_at":"2025-03-31T07:22:29.799931Z"
        },
        ...
    ],
    "summary": null,
    "pagination": null
}