BlogCore API

X (Twitter) Video Transcript API: Get the Text From a Post Link

The X API has no transcript endpoint. Get a timestamped transcript for any public X video post in one call, captions or not.

On this page6 sections

Apps that track what people say on X, clip tools, research dashboards and AI note-takers all want the same thing from a video post: the words, as text they can search, quote or summarize. X makes that awkward:

  • There's no transcript endpoint. The X API can hand you a post's video files if you have a developer account with read access, but it never gives you the text of what's said.
  • Most posts have no captions. Few people upload a caption file with a video on X, so anything that only reads captions comes back empty for most posts.
  • It breaks on the server. Fetching a post's video works from your laptop and then gets blocked or rate-limited from AWS, Fly, a Vercel function or an agent sandbox.

Doing it yourself

If you have X API read access, the do-it-yourself route is three steps: look up the post with expansions=attachments.media_keys and media.fields=variants, download the MP4 with the highest bit_rate (the X video download API post walks through it), then send the audio to a speech-to-text service. That works and stays within X's terms. You maintain the developer account and its limits, a downloader, audio extraction and a second account for speech-to-text, and you still need a route for users who paste posts your API access can't read.

One call with Importly

Send the post link your user pasted with "mode": "auto". If the video has captions you get them; if it doesn't, which is most of the time on X, speech-to-text runs in the same request. "wait": true returns the finished transcript in the response:

bash
curl -X POST https://api.importly.io/transcribe \
  -H "Authorization: Bearer $IMPORTLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://x.com/<user>/status/<id>",
    "mode": "auto",
    "wait": true,
    "maxCostDollars": 0.25
  }'

You get the full text plus timestamped segments, so you can show the transcript under the video or jump to the moment a quote was said:

json
{
  "text": "...",
  "source": "importly",
  "language": "en",
  "duration": 111,
  "data": {
    "segments": [
      { "start": 0.0, "end": 4.2, "text": "..." }
    ]
  },
  "costInDollars": 0.02
}

source is platform_captions when captions were used and importly when speech-to-text ran. The shape is the same either way. Details are in the transcripts docs.

A few things worth knowing:

  • Both domains work. Send x.com or twitter.com links, with or without tracking parameters.
  • Deleted, private and login-only posts fail with a clear code, so you can tell the user instead of retrying. Failed transcriptions are refunded.
  • Other languages: pass language, such as es. Built-in speech-to-text assumes English unless you set it.
  • Long videos: if a job is still running when wait runs out, the response has a jobId; collect the transcript with GET /transcribe/status or a webhookUrl.

Transcript and video together

If your app keeps the clip too, ask for both in one import:

bash
curl https://api.importly.io/import \
  -H "Authorization: Bearer $IMPORTLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://x.com/<user>/status/<id>",
    "includeTranscript": true,
    "transcriptProvider": "importly",
    "webhookUrl": "https://example.com/webhooks/import"
  }'

The webhook brings the MP4 and the transcript in one job.

What it costs

  • Speech-to-text: $0.01 per minute of audio, fetching included, with a $0.01 minimum. A two-minute clip is $0.02.
  • From captions, when a post has them: $0.003.
  • maxCostDollars caps a request, so an unexpectedly long video fails instead of running over.

It's free to try, no card required. See pricing.

Have your AI agent build it in

Connect https://mcp.importly.io/mcp to Claude Code, Cursor or another coding agent and ask it to add X video transcripts to your app. It gets working code for your stack, writes the integration and tests real calls with your API key, and your backend uses the same key. The steps are in Have your agent build Importly into your app.

FAQ

Does the X API return transcripts?

No. The X API can return a video's file variants for a post, with a developer account and read access, but it has no transcript or captions-as-text endpoint. You download the video and run speech-to-text yourself, or use an API that does both.

How do I transcribe an X video with no captions?

Run speech-to-text on its audio. With Importly, "mode": "auto" does that when there are no captions, at $0.01 a minute.

Can I check a post has a video before paying?

Yes. POST /metadata/basic returns the title and duration for $0.003, so you can confirm a post has a video and how long it is before transcribing. See the video metadata API post.

Why does my script work locally but fail on my server?

X blocks or limits a lot of datacenter traffic, so the same request that works at home fails from cloud servers and sandboxes. Importly works the same from a server as from your laptop.

Related: X video download API, Video transcription API, TikTok transcript API.

Keep reading

Put video and audio links to work in your app

One API for files, transcripts and metadata. Free to try, no card required.

Try free →