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

# Tweet embed API for X post HTML and oEmbed

> Get the HTML that embeds one public tweet on a website, with the tweet link and author. Pick a light or dark theme, hide media or the thread. 1 credit a call.

<Panel>
  <Tabs defaultTabIndex={0} sync={false}>
    <Tab title="200" id="response-x-tweet-embed-200">
      ```json theme={null}
      {
        "embed": {
          "tweetId": "2102882545427714266",
          "url": "https://x.com/NASA/status/2102882545427714266",
          "authorName": "NASA",
          "authorUrl": "https://x.com/NASA",
          "html": "<blockquote class=\"twitter-tweet\">...</blockquote>"
        }
      }
      ```
    </Tab>

    <Tab title="400" id="response-x-tweet-embed-400">
      ```json theme={null}
      {
        "error": "invalid_input",
        "message": "Invalid input. Check the request body."
      }
      ```
    </Tab>

    <Tab title="401" id="response-x-tweet-embed-401">
      ```json theme={null}
      {
        "error": "unauthenticated",
        "message": "Authentication required. Provide a valid API key or bearer token."
      }
      ```
    </Tab>

    <Tab title="402" id="response-x-tweet-embed-402">
      ```json theme={null}
      {
        "error": "insufficient_credits",
        "message": "Insufficient credits. Top up or subscribe to continue."
      }
      ```
    </Tab>

    <Tab title="404" id="response-x-tweet-embed-404">
      ```json theme={null}
      {
        "error": "tweet_not_found",
        "message": "Tweet not found. Check the tweet ID."
      }
      ```
    </Tab>

    <Tab title="424" id="response-x-tweet-embed-424">
      ```json theme={null}
      {
        "error": "x_api_unavailable",
        "message": "X data source temporarily unavailable. Try again later."
      }
      ```
    </Tab>

    <Tab title="429" id="response-x-tweet-embed-429">
      ```json theme={null}
      {
        "error": "rate_limit_exceeded",
        "message": "Too many requests. Try again later.",
        "retryAfter": 60
      }
      ```
    </Tab>

    <Tab title="502" id="response-x-tweet-embed-502">
      ```json theme={null}
      {
        "error": "x_api_unavailable",
        "message": "X data source temporarily unavailable. Try again later."
      }
      ```
    </Tab>

    <Tab title="503" id="response-x-tweet-embed-503">
      ```json theme={null}
      {
        "error": "x_api_unavailable",
        "message": "Xquik is busy right now. Retry shortly."
      }
      ```
    </Tab>
  </Tabs>
</Panel>

<blockquote className="agent-llms-directive">
  For the complete documentation index, see <a href="/llms.txt">llms.txt</a>.
</blockquote>

<Callout icon="coins" color="#5c3327">
  **1 credit per call** · [All plans](https://xquik.com/#pricing) from \$0.00012/credit · Direct [MPP](/mpp/machine-payments-protocol): USD 0.00015 per call
</Callout>

Embed tweet returns the HTML that shows one public tweet on a website.
The endpoint is `GET /api/v1/x/tweets/{id}/embed`.

<CodeGroup>
  ```bash cURL theme={null}
  curl -G https://xquik.com/api/v1/x/tweets/2102882545427714266/embed \
    --data-urlencode "theme=dark" \
    -H "x-api-key: xq_your_api_key_here" | jq
  ```

  ```javascript Node.js theme={null}
  const tweetId = "2102882545427714266";
  const params = new URLSearchParams({ theme: "dark", omitScript: "true" });
  const response = await fetch(`https://xquik.com/api/v1/x/tweets/${tweetId}/embed?${params}`, {
    headers: { "x-api-key": "xq_your_api_key_here" },
  });
  const { embed } = await response.json();
  const embedRow = {
    tweet_id: embed.tweetId,
    tweet_url: embed.url,
    author_name: embed.authorName,
    html: embed.html,
    width: embed.width ?? null,
  };

  process.stdout.write(`${JSON.stringify(embedRow)}\n`);
  ```

  ```python Python theme={null}
  import json
  import requests

  tweet_id = "2102882545427714266"
  response = requests.get(
      f"https://xquik.com/api/v1/x/tweets/{tweet_id}/embed",
      params={"theme": "dark", "omitScript": "true"},
      headers={"x-api-key": "xq_your_api_key_here"},
  )
  embed = response.json()["embed"]
  embed_row = {
      "tweet_id": embed["tweetId"],
      "tweet_url": embed["url"],
      "author_name": embed["authorName"],
      "html": embed["html"],
      "width": embed.get("width"),
  }
  print(json.dumps(embed_row))
  ```
</CodeGroup>

Use `GET /x/tweets/{id}/embed` when a page, CMS, or newsletter tool shows a tweet.
The HTML is the markup X gives websites for that tweet.
Each call costs 1 credit. A refused request costs nothing.

## Place the embed on a page

Insert `embed.html` where the tweet belongs.
The markup holds the tweet text and a script tag that loads X's widget.
The widget then draws the full tweet card in the reader's browser.

Send `omitScript=true` when a page shows several tweets.
Load X's widget script once on that page instead.

Store `embed.html` with the tweet ID and the options you sent.
A stored embed saves a second call for the same tweet and look.

## Path parameters

<ParamField path="id" type="string" required>
  Post ID or URL-encoded post URL, such as `x.com/nasa/status/20`. See [path IDs](/api-reference/overview#path-ids).
</ParamField>

## Query parameters

<ParamField query="theme" type="string">
  Color theme of the embed: `light` or `dark`. X uses `light` when you omit it. Any letter case works.
</ParamField>

<ParamField query="hideMedia" type="boolean">
  Set `true` to leave photos, videos, and link cards out.
</ParamField>

<ParamField query="hideThread" type="boolean">
  Set `true` to leave the tweet this one replies to out.
</ParamField>

<ParamField query="omitScript" type="boolean">
  Set `true` to leave the widget script tag out. Use it on pages that load the script once themselves.
</ParamField>

## Headers

<ParamField header="x-api-key" type="string">
  Full account key. Sessions and OAuth also work.
</ParamField>

<ParamField header="Authorization" type="string">
  `Bearer xq_your_guest_key_here` authenticates `paid_reads` guest keys. Direct MPP uses the `Payment ...` credential. Get it from the `WWW-Authenticate: Payment` challenge.
</ParamField>

## Response

### 200 OK

<ResponseField name="embed" type="object">
  The embed of the tweet.
  **Embed object fields.**

  <ResponseField name="tweetId" type="string">
    ID of the embedded tweet.
  </ResponseField>

  <ResponseField name="url" type="string">
    Link to the tweet with its author's username.
  </ResponseField>

  <ResponseField name="authorName" type="string">
    Display name of the tweet's author.
  </ResponseField>

  <ResponseField name="authorUrl" type="string">
    Link to the author's profile.
  </ResponseField>

  <ResponseField name="html" type="string">
    Markup to place on a page. It loads X's widget script unless `omitScript` is `true`.
  </ResponseField>

  <ResponseField name="width" type="number">
    Width of the embed in pixels.
  </ResponseField>

  <ResponseField name="height" type="number">
    Height in pixels. Present only when X fixes it.
  </ResponseField>
</ResponseField>

```json theme={null}
{
  "embed": {
    "tweetId": "2102882545427714266",
    "url": "https://x.com/NASA/status/2102882545427714266",
    "authorName": "NASA",
    "authorUrl": "https://x.com/NASA",
    "html": "<blockquote class=\"twitter-tweet\" data-theme=\"dark\"><p lang=\"en\" dir=\"ltr\">Welcome to the Artemis Accords, Croatia</p>&mdash; NASA (@NASA) <a href=\"https://x.com/NASA/status/2102882545427714266?ref_src=twsrc%5Etfw\">September 23, 2026</a></blockquote>\n<script async src=\"https://platform.x.com/widgets.js\" charset=\"utf-8\"></script>\n",
    "width": 550
  }
}
```

### 400 Invalid input

```json theme={null}
{
  "error": "invalid_input",
  "message": "Send theme as light or dark, and hideMedia, hideThread & omitScript as true or false."
}
```

An option has a value the endpoint does not take. Fix the option and send the request again.

### 400 Invalid tweet ID

```json theme={null}
{ "error": "invalid_tweet_id" }
```

The provided tweet ID is empty or not a valid format.

### 401 Unauthenticated

```json theme={null}
{ "error": "unauthenticated" }
```

Missing or invalid API key. Check the `x-api-key` header value.

### 402 Payment required

Account keys get account options. Guest keys get guest top-up only.
Anonymous calls receive a direct MPP `WWW-Authenticate: Payment` challenge plus a guest wallet creation action.
No checkout starts automatically. Confirm any payment action.

### 404 Tweet not found

```json theme={null}
{ "error": "tweet_not_found" }
```

X has no embed for the tweet. The author may have deleted it, or the account is private.

### 502 X API unavailable

```json theme={null}
{ "error": "x_api_unavailable" }
```

The read service returned an error. Retry after a short delay.

### 503 Service busy

```json theme={null}
{ "error": "x_api_unavailable" }
```

X returned no embed, or Xquik is busy. Retry after a short delay. The request costs nothing.

### 429 Rate limit exceeded

```json theme={null}
{ "error": "rate_limit_exceeded", "retryAfter": 60 }
```

You exceeded your tier rate limit. Wait for the `Retry-After` header before retrying.

### 424 Dependency failed

```json theme={null}
{ "error": "x_api_unavailable" }
```

The normalized v1 response contract can return 424 when the read service is unavailable.

## Tweet embed API questions

### How do I embed a tweet on a website with an API?

Call `GET /x/tweets/{id}/embed` with the tweet ID or URL.
Insert `embed.html` into your page where the tweet belongs.

### How do I get a dark theme tweet embed?

Send `theme=dark`. The returned markup then asks X's widget for the dark card.

### How do I embed many tweets on one page?

Send `omitScript=true` for each tweet.
Load X's widget script once on the page.

### How much does a tweet embed cost?

Each call costs 1 credit. A refused or failed request costs nothing.

### Does this replace X's official API?

No. This page documents Xquik, an independent third-party service.
It does not document X's official API.

<Note>
  **Next steps.** [Get tweet](/api-reference/x/get-tweet) reads the tweet's fields as JSON, or [Download media](/api-reference/x/download-media) saves its photos and videos.
</Note>

<div className="related-api-links">
  <Accordion title="Related tweet, reply & media APIs" icon="link">
    * Tweets: [Get tweet](/api-reference/x/get-tweet) · [Batch tweets](/api-reference/x/batch-tweets) · [Tweet thread](/api-reference/x/tweet-thread) · [Hidden replies](/api-reference/x/tweet-hidden-replies) · [Translate tweet](/api-reference/x/tweet-translation) · [Embed tweet](/api-reference/x/tweet-embed) · [Resolve links](/api-reference/x/resolve-links) · [Tweet subtitles](/api-reference/x/tweet-subtitles) · [X Article](/api-reference/x/get-article)
    * Engagement: [Tweet replies](/api-reference/x/tweet-replies) · [Quote tweets](/api-reference/x/tweet-quotes) · [Likers](/api-reference/x/favoriters) · [Reposters](/api-reference/x/retweeters) · [Check repost](/api-reference/x/tweet-repost-check)
    * Profiles: [User tweets](/api-reference/x/user-tweets) · [Batch user tweets](/api-reference/x/batch-user-tweets) · [User replies](/api-reference/x/user-replies) · [User likes](/api-reference/x/user-likes) · [User media](/api-reference/x/user-media) · [User highlights](/api-reference/x/user-highlights) · [User articles](/api-reference/x/user-articles)
    * Feeds: [List tweets](/api-reference/x/list-tweets) · [Trends](/api-reference/x/trends) · [Trend locations](/api-reference/x/trend-locations) · [Search Spaces](/api-reference/x/search-spaces) · [Get Space](/api-reference/x/get-space) · [Space replay](/api-reference/x/space-replay) · [Get broadcast](/api-reference/x/get-broadcast) · [Hashflags](/api-reference/x/hashflags) · [Search places](/api-reference/x/search-places) · [Download media](/api-reference/x/download-media)
  </Accordion>
</div>


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