Skip to main content
GET
Tweet embed API for X post HTML and oEmbed
1 credit per call · All plans from $0.00012/credit · Direct MPP: USD 0.00015 per call
Embed tweet returns the HTML that shows one public tweet on a website. The endpoint is GET /api/v1/x/tweets/{id}/embed.
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

string
required
Post ID or URL-encoded post URL, such as x.com/nasa/status/20. See path IDs.

Query parameters

string
Color theme of the embed: light or dark. X uses light when you omit it. Any letter case works.
boolean
Set true to leave photos, videos, and link cards out.
boolean
Set true to leave the tweet this one replies to out.
boolean
Set true to leave the widget script tag out. Use it on pages that load the script once themselves.

Headers

string
Full account key. Sessions and OAuth also work.
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.

Response

200 OK

object
The embed of the tweet. Embed object fields.
string
ID of the embedded tweet.
string
Link to the tweet with its author’s username.
string
Display name of the tweet’s author.
string
Link to the author’s profile.
string
Markup to place on a page. It loads X’s widget script unless omitScript is true.
number
Width of the embed in pixels.
number
Height in pixels. Present only when X fixes it.

400 Invalid input

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

400 Invalid tweet ID

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

401 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

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

502 X API unavailable

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

503 Service busy

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

429 Rate limit exceeded

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

424 Dependency failed

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.
Next steps. Get tweet reads the tweet’s fields as JSON, or Download media saves its photos and videos.