---
title: "Search posts"
canonical_url: "https://tweetstream.io/docs/api/search-posts"
last_updated: 2026-11-05
---

# Search posts

Returns recent X posts that match an X search query, in X's Latest order (not strictly by ID), and the URL of the next page. One search returns at most 100 posts across all its pages; after the 100th post, next is null.

Canonical URL: https://tweetstream.io/docs/api/search-posts

## `GET /api/search/posts`

`https://api.tweetstream.io/api/search/posts`

## Authorization

| Name | Type | Description |
| --- | --- | --- |
| `Authorization` | `string`, required | Bearer authentication with your TweetStream API key: `Bearer <key>`. |

## Query parameters

| Name | Type | Description |
| --- | --- | --- |
| `query` | `string`, required | X search query, operators included. |
| `limit` | `integer` | Most posts to return. |
| `page` | `string` | Opaque; only ever taken from next. |

## Response fields

| Name | Type | Description |
| --- | --- | --- |
| `next` | `string \| null`, required | Absolute URL of the next page: request it as it is, with the same API key. Null when there is nothing more or the search has returned 100 posts. Works for 30 minutes. |
| `posts` | `object[]`, required |  |
| `posts.kind` | `enum<string>` |  |
| `posts.quoted` | `object` | The post a reply also quotes. A quote keeps the post it quotes in ref and has no quoted. |
| `posts.quoted.type` | `string`, required |  |
| `posts.ref` | `object` |  |
| `posts.ref.type` | `enum<string>`, required |  |
| `posts.metrics` | `object`, required |  |
| `posts.metrics.bookmarks` | `integer`, required |  |
| `posts.metrics.likes` | `integer`, required |  |
| `posts.metrics.quotes` | `integer`, required |  |
| `posts.metrics.replies` | `integer`, required |  |
| `posts.metrics.reposts` | `integer`, required |  |
| `posts.metrics.views` | `integer \| null`, required |  |
| `posts.tweetId` | `string`, required |  |

## Responses

| Status | Description | Headers |
| --- | --- | --- |
| `200` | Success |  |
| `400` | Invalid query or limit, or a page link that was changed or is over 30 minutes old. Search again without page. |  |
| `401` | Missing or invalid API key |  |
| `403` | The API key's account has no current Pro, Ultra Speed, Scale subscription. |  |
| `405` | Only GET is supported |  |
| `429` | The account's search allowance is spent or its searches in progress are at the plan's limit: Pro 60 per minute (bursts of 10, 4 in progress); Ultra Speed 120 per minute (bursts of 10, 6 in progress); Scale 300 per minute (bursts of 10, 10 in progress) | `Retry-After` |
| `503` | Post search or authentication is temporarily unavailable | `Retry-After` |

### 200

```json
{
  "posts": [
    {
      "tweetId": "2118183412095201280",
      "text": "Solana validators shipped the new client today.",
      "createdAt": 1793849254045,
      "kind": "post",
      "link": "https://x.com/marketdesk/status/2118183412095201280",
      "author": {
        "id": "1189745302",
        "handle": "@marketdesk",
        "name": "Market Desk",
        "platform": "twitter",
        "verifiedType": "blue",
        "followersCount": 48210,
        "followingCount": 312,
        "profileImage": "https://pbs.twimg.com/profile_images/marketdesk_400x400.jpg"
      },
      "metrics": {
        "likes": 1204,
        "replies": 87,
        "reposts": 230,
        "quotes": 19,
        "bookmarks": 41,
        "views": null
      }
    }
  ],
  "next": "https://api.tweetstream.io/api/search/posts?limit=1&page=AZx3q0Vh1mR2k9Q&query=solana+lang%3Aen+-is%3Aretweet"
}
```

### 400

```json
{
  "error": "<string>"
}
```

### 401

```json
{
  "error": "<string>"
}
```

### 403

```json
{
  "error": "<string>"
}
```

### 429

```json
{
  "error": "<string>",
  "retryAfterSeconds": 0
}
```

### 503

```json
{
  "error": "<string>"
}
```

## Code samples

### cURL

```bash
curl --request GET \
  --url 'https://api.tweetstream.io/api/search/posts?query=solana+lang%3Aen+-is%3Aretweet' \
  --header "Authorization: Bearer $TWEETSTREAM_API_KEY"
```

### JavaScript

```javascript
const response = await fetch("https://api.tweetstream.io/api/search/posts?query=solana+lang%3Aen+-is%3Aretweet", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.TWEETSTREAM_API_KEY}`,
  },
});

console.log(response.status, await response.json());
```

### Python

```python
import os
import requests

response = requests.get(
    "https://api.tweetstream.io/api/search/posts",
    headers={"Authorization": f"Bearer {os.environ['TWEETSTREAM_API_KEY']}"},
    params=[("query", "solana lang:en -is:retweet")],
)

print(response.status_code, response.json())
```
