---
title: "Search X"
method: GET
path: "/x/search"
tags: ["X"]
---

# Search X

`GET /x/search`

## Request

- Base URL: `https://api.scrapefield.com/v1`
- URL: `https://api.scrapefield.com/v1/x/search`
- Auth: one of:
  - HTTP bearer
  - none

Search X as its own search box does, newest first, about 20 a page; X's search operators work inside `query` (`from:nasa`, `since:2026-09-01`, `lang:en`). `type=user` finds accounts instead. Use this to follow a topic, a brand or a campaign.

Costs 13 credits, whether the answer is fetched or served from cache. A failed call is refunded automatically.

## Query parameters

- `query` string, required
- `type` 'post' | 'user'
- `cursor` string
- `fresh` boolean
- `demo` boolean

## Response `200`

The request succeeded.

- object
  - `data` union[], required
    - union: `type=post` returns `x_post`; `type=user` returns `x_user`.
      - XPost: A post on X: a post, a reply or a quote.
        - `id` string, required: X's id for the post.
        - `url` string, uri, required: The post on X.
        - `text` string, nullable, required: The whole text. Links stay as X shortens them.
        - `created_at` string, date-time, nullable, required: When it was posted. `null` when the source does not say.
        - `lang` string, nullable, required: The language X detected, e.g. `en`.
        - `author` object, required: Who posted it.
          - `id` string, nullable, required: X's numeric id for the account.
          - `username` string, required: Without the @.
          - `name` string, nullable, required: The display name.
          - `profile_url` string, uri, required: The account on X.
          - `profile_image_url` string, uri, nullable, required: The profile picture, at full size.
          - `verified` boolean, nullable, required: Whether the account has a checkmark.
        - `conversation_id` string, nullable, required: The first post of the thread it belongs to.
        - `referenced_tweets` object[], required: The post it replies to, quotes or reposts, as X's API names them.
          - `type` 'replied_to' | 'quoted' | 'retweeted', required: How this post refers to it: a reply, a quote or a repost.
          - `id` string, required: X's id for that post.
        - `public_metrics` object, required: `null` where the source does not give one.
          - `retweet_count` integer, nullable, required: Reposts.
          - `reply_count` integer, nullable, required: Replies.
          - `like_count` integer, nullable, required: Likes.
          - `quote_count` integer, nullable, required: Quotes.
          - `bookmark_count` integer, nullable, required: Bookmarks.
          - `impression_count` integer, nullable, required: Views.
        - `media` object[], required: Photos and videos, in order.
          - `type` 'photo' | 'video' | 'animated_gif' | 'null', nullable, required: `null` where the source does not say.
          - `url` string, uri, required: The image, or a video's preview image.
        - `hashtags` string[], required: Without the #.
        - `mentions` string[], required: Usernames, without the @.
      - XUser: An X account.
        - `id` string, required: X's numeric id for the account.
        - `username` string, required: Without the @.
        - `name` string, nullable, required: The display name.
        - `description` string, nullable, required: The bio.
        - `location` string, nullable, required: As they wrote it.
        - `url` string, uri, nullable, required: The link in their profile, unshortened, as X's API names it.
        - `profile_url` string, uri, required: The account on X.
        - `profile_image_url` string, uri, nullable, required: The profile picture, at full size.
        - `profile_banner_url` string, uri, nullable, required: The header image above the profile.
        - `created_at` string, date-time, nullable, required: When the account was made.
        - `verified` boolean, nullable, required: Whether it has a checkmark, of any kind.
        - `protected` boolean, nullable, required: Whether its posts are private.
        - `public_metrics` object, required: The counts on the profile. `null` where the source does not give one.
          - `followers_count` integer, nullable, required: How many accounts follow them.
          - `following_count` integer, nullable, required: How many accounts they follow.
          - `tweet_count` integer, nullable, required: Posts, replies and reposts together, as X counts them.
          - `listed_count` integer, nullable, required: How many lists include them.
          - `like_count` integer, nullable, required: Posts they have liked.
          - `media_count` integer, nullable, required: Posts with photos or videos.
        - `pinned_tweet_id` string, nullable, required: The id of the post pinned to the profile. `null` where there is none, or the source does not say.
  - `meta` Meta, required
    - `request_id` string, required: Quote this if you contact support.
    - `credits_charged` integer, required: The endpoint's published cost. 0 for a demo answer, and for a list emptied because everyone in it asked not to be served. A failed call has no `meta`: it answers with an error, and is refunded.
    - `credits_remaining` integer
    - `cached` boolean, required
    - `fetched_at` string, date-time, required: When the data was actually fetched — the original time on a cache hit, so freshness is always visible.
    - `next_cursor` string, nullable, required: Pass as `cursor` for the next page. `null` on the last page. It lasts as long as the answer is cached.
    - `demo` boolean: Present, and true, on a demo answer (`?demo=true` with no key).
    - `note` string: On a demo answer: what it is, and what a live call costs.

## Other responses

- `400`: Something went wrong. `error.code` is stable; `error.message` says what to do next.
- `401`: Something went wrong. `error.code` is stable; `error.message` says what to do next.
- `403`: Something went wrong. `error.code` is stable; `error.message` says what to do next.
- `404`: Something went wrong. `error.code` is stable; `error.message` says what to do next.
- `429`: Something went wrong. `error.code` is stable; `error.message` says what to do next.
- `500`: Something went wrong. `error.code` is stable; `error.message` says what to do next.
- `501`: Something went wrong. `error.code` is stable; `error.message` says what to do next.
- `502`: Something went wrong. `error.code` is stable; `error.message` says what to do next.

---

[API](https://skmtc.dev/scrapefield/apis/scrapefield-api.md) · [All operations](https://skmtc.dev/scrapefield/apis/scrapefield-api/llms.txt) · [OpenAPI document](https://skmtc.dev/scrapefield/apis/scrapefield-api/revisions/cc5961ac63cf?raw)
