Guides

How to Screenshot X (Twitter)

A working configuration for screenshotting X/Twitter programmatically using the Urlbox Screenshot API.

Arnold Cubici-Jones
Arnold Cubici-Jones
February 27, 2026

Quick Reference

Use delay, scroll_delay, and wait_until to ensure page assets load. Use min_size_bytes and retry_on to retry on blank or error pages. Use click_accept, press_escape, and hide_cookie_banners to dismiss modals and banners.

See the full configuration below or browse all available options.

X (formerly Twitter) is more forgiving than other social platforms when it comes to automated screenshots. You don't need Point of View for most public content, but you do need to handle dynamic content loading properly.

This guide provides a working configuration for capturing X/Twitter content using the Urlbox Screenshot API.

Early Access Pricing

The retry_on option used in this example is currently in early access. This feature will incur additional costs once fully launched. Contact us for current pricing details.

Why X Screenshots Can Fail

Even though X is more accessible than Instagram or Facebook, you might still encounter:

  • Dynamic content: Client-side rendering means the page might not be fully loaded when the screenshot is taken
  • Lazy loading: Images and media load as you scroll, potentially leaving blank spots
  • Cookie banners: Consent dialogs can obstruct the content

Working Configuration

This configuration uses delays, wait_until, and retry logic to handle dynamic content loading reliably.

{
  "url": "https://x.com/karpathy/status/1617979122625712128",
  "full_page": true,
  "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
  "wait_until": "mostrequestsfinished",
  "delay": 4000,
  "scroll_delay": 1000,
  "retry_on": "small_size,timeout,5xx,4xx",
  "retry_delay_ms": 5000,
  "max_retries": 3,
  "min_size_bytes": 10000,
  "press_escape": true,
  "click_accept": true,
  "hide_cookie_banners": true
}
Successful X/Twitter post screenshot

What Each Option Does

OptionDescription
wait_until: "mostrequestsfinished"Allows page assets to load by waiting for most network requests to finish
delay: 4000Gives time for Javascript on the page to settle after requests finish
scroll_delay: 1000When scrolling the page in steps, this delays each scroll to allow lazy-loaded content to appear
retry_on: "small_size,timeout,5xx,4xx"Retries the render when it's smaller than min_size_bytes, the request times out, or returns an error
min_size_bytes: 10000Checks the minimum file size to catch blank or error pages
max_retries: 3Maximum number of retry attempts when retry_on is applied.
retry_delay_ms: 5000The time to wait between retries in milliseconds when retry_on is applied.
user_agentThis tells our browser who to act as. It's often better to let us handle this, but if you're finding yourself blocked then mixing this up could help with bot fingerprinting
click_accept: trueAccepts cookie consent banners
hide_cookie_banners: trueRemoves cookie and other bothersome banners using common heuristics
press_escape: truePresses the ESC key to help dismiss modals

Alternative: Using oEmbed

For cleaner individual tweet screenshots, consider using Twitter's oEmbed to get embed HTML, then screenshot that with Urlbox's HTML rendering mode. This gives you a styled tweet card without the surrounding page chrome.

Important Notes

Response times: Using retry_on can significantly increase response times. Each retry adds the base render time plus retry_delay_ms, so a request with 3 retries and a 5 second delay could take considerably longer than a single render. For time-sensitive use cases, consider using webhooks or the async endpoint for asynchronous delivery instead.

Public content only: This configuration is designed for public content. Results may vary for protected accounts or content that requires login.

Things change: These configurations work as of February 2026. X occasionally updates its platform, so you may need to tweak these over time. If something stops working, get in touch and we'll help you through it.

More Social Media Guides

Looking to screenshot other platforms? See our guides for Instagram, Facebook, and TikTok, or our complete social media screenshot guide.

Looking for a no-code solution? CaptureDeck lets you screenshot social media at scale without writing any code.

Free Trial

Ready to start rendering?

Designers, law firms and infrastructure engineers trust Urlbox to accurately and securely convert HTML to images at scale. Experience it for yourself.

7 day free trial.No credit card required.