> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mindcase.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Twitter / X Tweets API

> Extract tweets from Twitter (X) by handle, search keyword, or tweet URL, with full text, date, media, quoted/retweeted content, and all engagement metrics

`POST /v1/data/twitter/tweets/run`

**Pricing:** $0.00025 per tweet ($0.25 per 1,000). Search mode adds a flat \$0.003 fee, charged even when nothing is found.

## Ways to call it

* **Handle / Tweet URL**: set `inputs` (optional: `maxResults`)
* **Search**: set `query` (optional: `maxResults`)

## Request

Send the inputs under `params`. Only the keys below are accepted; any other key returns `422 invalid_params`.

**inputs** `string`

A Twitter/X handle (e.g. 'elonmusk' for their timeline including retweets) or a single tweet URL to fetch.

Format e.g. `https://x.com/nasa/status/2039473910987534599`.

**maxResults** `integer`

Maximum number of tweets to return. Use 0 for all.

**query** `string`

Optional advanced-search query string (Twitter search operators supported, e.g. 'from:nasa min\_retweets:50 since:2026-01-01').

## Example

```bash cURL theme={null}
curl -X POST "https://api.mindcase.co/v1/data/twitter/tweets/run?wait=true" \
  -H "Authorization: Bearer $MINDCASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "params": {
    "maxResults": 10,
    "inputs": "elonmusk"
  }
}'
```

```python Python theme={null}
import os, requests

r = requests.post(
    "https://api.mindcase.co/v1/data/twitter/tweets/run",
    params={"wait": "true"},
    headers={"Authorization": f"Bearer {os.environ['MINDCASE_API_KEY']}"},
    json={"params": {
    "maxResults": 10,
    "inputs": "elonmusk"
}},
)
job = r.json()
rows = job.get("data", [])  # if job["status"] == "running", poll /v1/jobs/{job_id}/results
```

```javascript Node.js theme={null}
const r = await fetch("https://api.mindcase.co/v1/data/twitter/tweets/run?wait=true", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MINDCASE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ params: {
  "maxResults": 10,
  "inputs": "elonmusk"
} }),
});
const job = await r.json();
const rows = job.data ?? []; // if job.status === "running", poll /v1/jobs/{job_id}/results
```

## Response fields

Each row in `data` is one tweet, keyed by these fields.

| Field | Name | Type |
| - | - | - |
| `tweetUrl` | Tweet URL | url |
| `tweetId` | Tweet ID | text |
| `tweetText` | Tweet Text | text |
| `postedDate` | Posted Date | text |
| `language` | Language | text |
| `conversationId` | Conversation ID | text |
| `views` | Views | number |
| `likes` | Likes | number |
| `retweets` | Retweets | number |
| `replies` | Replies | number |
| `quotes` | Quotes | number |
| `bookmarks` | Bookmarks | number |
| `isReply` | Is Reply | boolean |
| `isQuote` | Is Quote | boolean |
| `isPinned` | Is Pinned | boolean |
| `repliesRestricted` | Replies Restricted | boolean |
| `replyToHandle` | Reply To Handle | text |
| `replyToTweetUrl` | Reply To Tweet URL | url |
| `retweetedTweetUrl` | Retweeted Tweet URL | url |
| `retweetedTweetText` | Retweeted Tweet Text | text |
| `originalPostDate` | Original Post Date | text |
| `quotedTweetUrl` | Quoted Tweet URL | url |
| `quotedTweetText` | Quoted Tweet Text | text |
| `hashtags` | Hashtags | array |
| `mentions` | Mentions | object\_array |
| `outboundLinks` | Outbound Links | array |
| `cashtags` | Cashtags | array |
| `linkCardTitle` | Link Card Title | text |
| `linkCardDescription` | Link Card Description | text |
| `linkCardDomain` | Link Card Domain | text |
| `tweetMedia` | Tweet Media | object\_array |
| `taggedPlace` | Tagged Place | text |
| `taggedPlaceCountry` | Tagged Place Country | text |
| `authorId` | Author ID | text |
| `author` | Author | object |

## Example response

Abridged: long text and lists are shortened.

```json theme={null}
{
  "job_id": "7f3a1c2e-0b9d-4c55-9a51-3f2e8d1b6a40",
  "agent": "twitter/tweets",
  "status": "completed",
  "row_count": 1,
  "truncated": false,
  "data": [
    {
      "retweets": 623,
      "quotedTweetUrl": "https://x.com/XFreeze/status/2088878954329579963",
      "author": {
        "name": "Elon Musk",
        "handle": "elonmusk",
        "profileUrl": "https://x.com/elonmusk",
        "photo": "https://pbs.twimg.com/profile_images/2053244804520427520/m8mdWZCG_normal.jpg",
        "bio": null,
        "location": null,
        "website": null,
        "followers": 241372421,
        "following": 1389,
        "tweetCount": 107131,
        "accountCreated": "2009-06-02T20:12:29Z",
        "blueVerified": true,
        "affiliationBadge": null,
        "accountType": null,
        "category": null,
        "dmsOpen": false
      },
      "bookmarks": 116,
      "replyToTweetUrl": null,
      "replyToHandle": null,
      "isPinned": false,
      "taggedPlace": null,
      "authorId": "44196397",
      "taggedPlaceCountry": null,
      "cashtags": null,
      "language": "qst",
      "postedDate": "2026-08-17T02:24:41Z",
      "quotedTweetText": "“Having two planets that are both self-sustaining and strong is going to be incredibly important for the long-term survival of civilization”\n\nThis is exactly...",
      "isQuote": true,
      "tweetId": "2089176557747413105",
      "conversationId": "2089176557747413105",
      "tweetText": "Yes",
      "linkCardDescription": null,
      "repliesRestricted": false,
      "retweetedTweetText": null,
      "linkCardTitle": null,
      "linkCardDomain": null,
      "likes": 4955,
      "tweetUrl": "https://x.com/elonmusk/status/2089176557747413105"
    }
  ]
}
```

## Related APIs

For replies under one tweet use [`twitter/replies`](https://docs.mindcase.co/apis/twitter/replies); for who retweeted use [`twitter/retweeters`](https://docs.mindcase.co/apis/twitter/retweeters); for account data use [`twitter/profiles`](https://docs.mindcase.co/apis/twitter/profiles).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.