The Twitter Posts Search API allows users to search for relevant links based on Twitter search queries with leveraging AI-powered models. This API analyze links from Twitter posts that match the given prompt. This API is useful for tracking trends, gathering insights, and retrieving real-time information from Twitter.

Using the Twitter Posts Search API

The following examples demonstrate how to interact with the Twitter Posts Search API using multiple coding platform.

Request Sample

This script sends:

  • A POST request to the AI-powered search API endpoint https://apis.datura.ai/desearch/ai/search/links/twitter.

  • The request body (payload) contains a “prompt” field with the query “What are the recent sport events?” and specifies “model”: “NOVA” as the AI model to be used.

  • The Authorization header includes an API key, and the Content-Type is set to “application/json”.

  • The script sends the request , passing the url, payload, and headers, and then prints the raw response text.

    import requests

    url = "https://apis.datura.ai/desearch/ai/search/links/twitter"

    payload = {
        "prompt": "What are the recent sport events?",
        "model": "NOVA",
    }
    headers = {
        "Authorization": "<your-api-key>",
        "Content-Type": "application/json"
    }

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

    print(response.text)

Parameters

Required

  • url: The endpoint for the X (Twitter) Posts Search API.

  • payload / body: A JSON string or dictionary containing:

    • prompt: A string representing the search query.
    • model: The model to be used for processing, e.g., “NOVA”.

Response Sample

Based on the above code, here is how the response is retrieve as JSON. Each coding language has its own way of retrieving data from the below JSON.

    {
        "miner_tweets": [
            {
            "user": {
                "id": "1582652879428624384",
                "url": "https://x.com/Theolaw19",
                "name": "TheophilusLawrence",
                "username": "Theolaw19",
                "created_at": "2022-10-19T08:41:03Z",
                "description": "Obedient Citizen// Advocate for good governance// An Accountant.",
                "followers_count": 2432,
                "profile_image_url": "https://pbs.twimg.com/profile_images/1743878815720357888/DgLOLAMT_normal.jpg",
                "profile_banner_url": "https://pbs.twimg.com/profile_banners/1582652879428624384/1718389043",
                "statuses_count": 40490,
                "verified": false,
                "is_blue_verified": true,
                "location": "Abuja, Nigeria"
            },
            "id": "1889532907418689681",
            "text": "Tesla's meteoric rise vs. Toyota's steady performance. Tesla's EV dominance continues, while Toyota faces challenges transitioning from combustion to electric.",
            "reply_count": 46,
            "like_count": 50,
            "bookmark_count": 16,
            "url": "https://x.com/Theolaw19/status/1889532907418689681",
            "created_at": "2025-02-12T04:32:05Z",
            "media": [
                {
                "media_url": "https://pbs.twimg.com/media/Gjj4KUBW4AA07pb.jpg",
                "type": "photo"
                }
            ],
            "lang": "en"
            }
        ]
    }

Models

Nova 1.0

Quick insights, broad coverage.

Orbit 1.0

Balanced analysis, targeted relevance.

Horizon 1.0

In-depth exploration, profound insights.

Test API

To experiment with the X (Twitter) Posts Search API and see it in action, visit the X (Twitter) Posts Search API.