
Fetching X Timelines with API v2 Pay-Per-Use: Cost Breakdown, Caching, and the Gotchas
X's Pay-Per-Use pricing changed how I think about API integrations. Before it existed, "display a Twitter/X timeline on a website" meant either a bloated embed widget or a $200/month API plan — neither made sense for small projects. Pay-Per-Use flips that. You pay per request. For fetching 10 posts three times a day, the real-world cost lands around $2–3/month . That's a different conversation. This article covers how I implemented X API v2 timeline fetching in PHP/WordPress — including the cost math, the API structure, retweet handling, caching strategy, and two WP-Cron gotchas that will bite you if you're not ready. Cost Breakdown First Before writing a line of code, it's worth understanding what you're paying for. Timeline fetching is a two-step process: Action Cost User lookup (Step 1) $0.010 / cycle Per post fetched (Step 2) $0.005 / post 5 posts per cycle $0.035 10 posts per cycle $0.060 At 10 posts × 3 updates/day, the ceiling is $0.060 × 90 = $5.40/month . In practice it's lowe
Continue reading on Dev.to Webdev
Opens in a new tab



