Twitter (X) Compliance API: Batch Jobs, Compliance Streams and Keeping Stored Tweets Current

- What it is: X's compliance endpoints report which stored post or user IDs were deleted, protected, suspended, deactivated, edited or had geo data removed, with an
actiontelling you what to do with your copy. - Two flavors: batch compliance jobs (
POST /2/compliance/jobs, upload IDs, download results, 36-hour processing ceiling) and compliance streams (near real time, Enterprise access per docs.x.com). - Why it exists: the X Developer Policy requires stored X content to match its current state on X, and changes are due as soon as reasonably possible or within 24 hours of a request from X.
- TwitterAPI.io has no compliance endpoint. The honest substitute is a re-check:
GET /twitter/tweetswith up to 50 IDs per call returns only posts X still serves, so the missing ones are the ones to delete. - Our re-check: 8 of 1,158 stored post IDs were gone after about 45 days; 0 of 1,000 organization and reposted posts, 8 of 158 topic-search posts (5.1%).
- Cost: re-checking returns posts at 15 credits each ($0.15 per 1,000); our 37-request study cost about $0.26. Reading the same 1,150 posts at X's $0.005 rate would be $5.75.
This page is about keeping a dataset you already stored in line with X, which is a different job from our hydrate tweets guide. Hydrating turns a shared list of tweet IDs into full posts once; compliance is the recurring check that removes or updates what you hold after people delete posts, lock their accounts, get suspended or edit what they wrote. The two use the same lookup call, but compliance adds a schedule, a decision for every missing ID, and a reason for each decision.
X built two official tools for this job, the batch compliance endpoints and the compliance streams, and documents them on docs.x.com. Below we cover what each one returns, who can use them today, what the X Developer Policy actually asks of you, and what to do when you collected your data somewhere that has no compliance feed. We also ran our own re-check of stored post IDs to show how much of a real dataset drifts in about six weeks, and where the drift comes from.
5.1%
What the Twitter (X) compliance API is for
Every post or profile you copy out of X is a snapshot. The person who wrote it can delete it a minute later, switch the account to protected, deactivate, or get suspended by X. Posts can be edited (the docs' tweet_edited reason), and location data can be scrubbed from posts after the fact. The compliance API exists so that the snapshot in your database can follow those changes.
The rule behind it sits in the X Developer Policy (docs.x.com/developer-terms/policy). Its wording is direct: "If you store X Content offline, you must keep it up to date with the current state of that content on X," and "you must delete or modify any content you have if it is deleted or modified on X." The policy names the kinds of modification it means: content that was made private or gained protected status, was suspended from the platform, had geotags removed, or was withheld or removed from X.
The timing language matters for planning. Updates are due "as soon as reasonably possible, or within 24 hours after receiving a request to do so by X" or the account owner. There is no fixed sweep interval in the policy, so teams pick one that fits their data volume and risk; the policy text, not a vendor, is the reference point for that decision.
Who needs this. Research teams holding post archives, social listening tools with stored mentions, model training pipelines that kept post text, and any product that shows stored posts back to users. If you only read data live and never store it, compliance work shrinks to not caching stale copies.
Batch compliance jobs: how the official endpoint works
Batch compliance is the asynchronous half of the API. Per the docs.x.com introduction and integration guide fetched this session, you create a job, upload a file of IDs to a signed URL, wait while X processes it, then download the results. There are two job types: tweets (post IDs) and users (user IDs).
Limits worth planning around. Only one active job per type: a second tweets job while one is created or in_progress returns 409 Conflict, though a users job can run alongside. The upload URL expires about 15 minutes after the job is created and cannot be refreshed, so create the job only when the file is ready. The download URL lasts about 7 days. Processing has a 36-hour ceiling, and the integration guide states there is no resumable or chunked upload: an interrupted upload means retrying the whole PUT or starting a new job.
What a result line says. Each line carries the ID, an action that tells you what to do with your stored copy, and a reason. For posts, delete comes with deleted, protected, deactivated or suspended; rehydrate comes with tweet_edited (fetch the post again for its current revision); scrub_geo comes with geo_scrubbed (remove stored location data). For users, the action is delete with the same four reasons. Lines also carry created_at and redacted_at (the docs describe deleted_at as an alias of redacted_at). An unparseable line in your upload does not fail the job; it comes back as {"id": "not_a_valid_id", "error": "invalid_id"}.
{"id": "1234567890", "action": "delete", "created_at": "2024-01-10T12:00:00.000Z", "redacted_at": "2024-01-12T08:30:00.000Z", "deleted_at": "2024-01-12T08:30:00.000Z", "reason": "deleted"}
{"id": "1234567891", "action": "rehydrate", "redacted_at": "2024-01-13T14:20:00.000Z", "reason": "tweet_edited"}
{"id": "1234567892", "action": "scrub_geo", "reason": "geo_scrubbed"}
{"id": "not_a_valid_id", "error": "invalid_id"}Compliance streams and the compliance firehose
The second half is real time. docs.x.com describes "near real-time streams of compliance events" in two streams, one for post events and one for user events, and states that they require Enterprise access. This is what older material calls the compliance firehose: instead of asking about a list you hold, you receive every compliance event as it happens and match it against your store.
Two things stand out. The streams carry reversals (undrop, user_undelete, user_unprotect, user_unsuspend), which a batch job cannot express because it only reports the current state. And the streams carry withheld events, which matter if you serve stored content in countries where X withholds it. If your store holds tens of millions of posts and you need same-hour accuracy, the stream is the tool X built for it; for smaller stores, a periodic batch check against the IDs you hold answers the same question with less infrastructure.
Do not confuse it with the data firehose. The compliance stream carries events about content, not the content itself. Our Twitter firehose API guide covers the data side.
Who can use the X compliance endpoints today
The batch compliance pages list the prerequisites as an approved developer account, a Project and App in the developer console, and the App's Bearer Token. They do not name a pricing tier. The integration guide adds that a 403 can mean the App is not enrolled for the endpoint, and tells you to check your App's access level. The compliance stream pages state Enterprise access outright.
The X pricing page (docs.x.com/x-api/getting-started/pricing, fetched this session) lists pay-per-usage read and write rates and does not mention the compliance endpoints at all. We therefore make no claim about what a batch compliance job costs or whether a pay-per-usage App is enrolled by default: check your own developer console before you plan around it.
If your data came from TwitterAPI.io. We are not a compliance service and do not offer a compliance endpoint. What we do offer is the read path a re-check needs: a post lookup that returns only what X still serves, and a profile lookup that shows whether an author is missing, suspended or protected.
The re-check method: look stored IDs up again and act on what is missing
Without a compliance feed, the dependable signal is absence. TwitterAPI.io's GET /twitter/tweets takes up to 50 comma-separated IDs in tweet_ids, and its documentation on docs.twitterapi.io states that deleted posts, posts from private accounts and posts from suspended accounts are not returned. The response array does not keep the input order, so match by id. Anything you sent that did not come back is a candidate for deletion.
Step 1, batch. Split your stored IDs into groups of 50 and call the lookup. A call that returns 50 posts costs 750 credits ($0.0075); a call that returns nothing costs the 15-credit minimum ($0.00015).
Step 2, refresh what came back. Overwrite the stored text, counts and place with the live values. This covers the rehydrate (edited) and scrub_geo cases that a compliance job would flag, because the live copy is already the current revision.
Step 3, classify what is missing. For each missing post, look its author up once with GET /twitter/user/info. An unknown account returns HTTP 200 with status: "error" and msg: "user not found"; in our study, suspended authors came back with unavailable: true and unavailableReason: "Suspended"; a protected author has protected: true. If the author looks normal, the single post was deleted or removed.
Step 4, act and log. Delete the stored post in every case. Delete the stored profile too when the author was not found or suspended, and stop displaying the author's other stored posts when the account is protected or suspended. Keep a log row per action (ID, date, inferred reason) so you can show what you removed and when.
What this method cannot see. It cannot tell you that a post was withheld in one country but is still visible elsewhere, it cannot report reversals (an account that comes back from suspension simply starts returning posts again), and the reason for a missing post is inferred from the author's state rather than stated by X. Those gaps are exactly what the official stream exists for.
Our study: how much of a stored dataset changes in about 45 days
To put a number on drift, we took post IDs that earlier TwitterAPI.io studies had stored 43 to 46 days before, and looked all 1,158 of them up again with the method above. The sample has three strata with very different authors, because who wrote the posts is the biggest driver of how fast a dataset decays.
Organization accounts such as github, vercel, Docker, NASA and nvidia did not delete a single one of the 600 sampled posts, and none of the 400 posts they reposted or quoted had disappeared either. The topic-search stratum, written by 157 different and mostly private accounts, lost 8 of 158 posts (5.1%) in the same window.
Why the missing posts were missing. For each of the eight we looked the author up once.
Three quarters of the loss came from the account, not the post: 6 of 8 missing posts belonged to authors who were suspended or no longer found. That is why the author check in Step 3 matters. When one post goes missing because the account went away, every other stored post and the stored profile from that account have to go too, and a post-by-post check would only find them one at a time.
Text changes. Of the 1,150 posts that came back, 4 no longer matched the stored text after we ignored whitespace and link differences, all in the topic-search stratum (4 of 150). We cannot tell from our side whether each was an edit or a stored copy that held a shorter form of the text, which is exactly the distinction a tweet_edited reason would give you. Refreshing the stored text from the lookup covers both.
Engagement drift. Counts move even when a post stays. Across 1,086 returned posts with a stored like count, the median ratio of current to stored likes was 0.999, and 50.9% had slightly fewer likes than when stored, which is consistent with likes disappearing when the accounts that gave them are removed. Views behaved differently: 12.2% grew by 10% or more. If you publish stored counts, they are a snapshot and should be labeled as one.
Consistency check. We also looked up the authors of every returned post (486 accounts) with /twitter/user/batch_info_by_ids. None were protected and none were unavailable or suspended. In this sample, then, a returned post always came from an account in good standing, which is the property the re-check method relies on.
Age is not the driver here. Seven of the eight missing posts were under a week old when stored, but that is because the topic-search stratum was made of recent posts. Within the organization strata, posts over a year old were as stable as new ones. Treat author type, not post age, as the first predictor of decay in your own data, and measure it on your own store.

Cost of a re-check compared with the official X API
A re-check is billed like any read. On TwitterAPI.io, post lookups cost 15 credits per post returned, which is $0.15 per 1,000 posts, with a minimum of 15 credits ($0.00015) per request. Profile lookups are 18 credits per user ($0.18 per 1,000). Missing posts do not add per-post charges, so a batch that comes back half empty costs half as much.
On the official X API pay-per-usage rate card (docs.x.com/x-api/getting-started/pricing), a post read is $0.005 and a user read is $0.010, with pay-per-usage plans capped at 3 million post reads per monthly billing cycle and Enterprise above that. At those two rates, re-reading 1,000 posts costs $0.15 on TwitterAPI.io and $5 on the official pay-per-usage card, about 33x apart.
Our own study re-read 1,150 posts and checked 494 profiles for about $0.26; the same 1,150 post reads at X's rate would be $5.75 before any user reads. If your App already has batch compliance enrolled, that route answers the same question without re-reading content at all, so compare against what your console shows. Full rates and plans are on our pricing page.
Throughput. Accounts can make 0.2 requests per second before the first payment and 20 once paid (50 on Scale, 500 on Business). At 20 requests per second and 50 IDs per request, a one-million-ID sweep is 20,000 requests, under 17 minutes of calls.
Choosing a schedule and building the pipeline
Pick the sweep interval from your risk, not from habit. The policy's 24-hour clock starts when X or the account owner asks you to change something; outside that, the standard is "as soon as reasonably possible." A dataset that is only analyzed in aggregate and never displayed carries different risk from a product that shows stored posts back to users.
Re-check before you display or publish. Whatever the schedule, look a post up again right before you render it, quote it in a paper, or export it to a partner. That single call is billed at 15 credits per post returned.
Sweep accounts before posts. Since three quarters of our missing posts were explained by the account, a profile sweep over distinct authors (fewer requests than posts) catches whole accounts at once. /twitter/user/batch_info_by_ids returned all 486 authors we sent in five requests of 100 IDs each (the batch size we used).
Keep IDs, not just text. Every method on this page starts from IDs. Store the post ID and the author's user ID with every row; a dataset of text without IDs cannot be re-checked by anyone. Our conversation ID guide explains how to keep reply threads joinable as well.
Log decisions. For each removal keep the ID, the date of the check and the inferred reason. If you ever move to official batch compliance, the same log lets you compare the two.
How we collected this
Question. How much of a stored X dataset is no longer returned when its post IDs are re-checked about six weeks later without a compliance feed, and what account state sits behind each missing post?
Accounts and sample. 1,158 post IDs that earlier TwitterAPI.io studies had stored 43 to 46 days before the re-check: 600 posts by 34 public organization accounts (developer, brand and agency accounts such as github, vercel, Docker, CloudflareDev, OpenAIDevs, NASA and nvidia), 400 third-party posts those accounts had reposted or quoted, and 158 posts from an earlier topic search with 157 different authors. The third stratum was added after the first two came back complete; the protocol file records this.
Method. 24 requests to /twitter/tweets with up to 50 IDs each, matched by id; 8 /twitter/user/info calls for the authors of missing posts; 5 /twitter/user/batch_info_by_ids calls for the authors of returned posts. 37 requests in total, collected in 2026.
What the sample cannot show. It is small and leans toward stable accounts, so it does not estimate a platform-wide deletion rate. A six-week gap says nothing about decay over a year. Reasons for missing posts are inferred from author state, not reported by X, and withheld-in-country content is invisible to this method.
Privacy. Aggregates only. Organization accounts are named; the third-party and topic-search authors are not named or profiled. New API responses were kept outside the repository; the published sample holds de-identified rows with no IDs, URLs, text or handles.
import time
import requests
API_KEY = "YOUR_TWITTERAPI_IO_KEY"
BASE = "https://api.twitterapi.io"
HEADERS = {"X-API-Key": API_KEY}
def lookup_batch(ids):
"""Return {id: tweet} for the IDs that X still serves (max 50 per call)."""
r = requests.get(f"{BASE}/twitter/tweets",
params={"tweet_ids": ",".join(ids)},
headers=HEADERS, timeout=30)
r.raise_for_status()
body = r.json()
if body.get("status") != "success":
raise RuntimeError(body.get("msg"))
# The tweets array does not keep the input order: match by id.
return {str(t["id"]): t for t in body.get("tweets", [])}
def author_state(user_name):
"""Classify why a stored post is gone, from the author's current state."""
r = requests.get(f"{BASE}/twitter/user/info",
params={"userName": user_name},
headers=HEADERS, timeout=30)
body = r.json()
data = body.get("data")
if body.get("status") == "error" or not data:
return "author_not_found" # deleted, deactivated or renamed
if data.get("unavailable"):
return "author_unavailable" # e.g. unavailableReason "Suspended"
if data.get("protected"):
return "author_protected"
return "post_removed" # author fine, this post is gone
def recheck(stored):
"""stored: dict of tweet_id -> {"author": userName, "text": ...}."""
ids = list(stored)
actions = []
for i in range(0, len(ids), 50):
batch = ids[i:i + 50]
live = lookup_batch(batch)
for tid in batch:
if tid in live:
t = live[tid]
# Refresh the stored copy: picks up edits and removed geo data.
stored[tid].update(text=t["text"], likeCount=t["likeCount"],
viewCount=t.get("viewCount"), place=t.get("place"))
actions.append((tid, "keep_refreshed"))
else:
actions.append((tid, "delete:" + author_state(stored[tid]["author"])))
time.sleep(0.1) # fixed pacing, well under the paid rate limit
return actions
if __name__ == "__main__":
stored = {
"1846987139428634858": {"author": "OpenAI", "text": ""},
"1866332309399781537": {"author": "OpenAI", "text": ""},
}
for tweet_id, action in recheck(stored):
print(tweet_id, action)
Researching this?Free starter credits cover end-to-end testing — Google sign-in, no card. Get a key.
Questions readers ask
What is the Twitter compliance API?
It is a set of official X API v2 endpoints that tell developers which stored post or user IDs have changed state on X: deleted, protected, suspended, deactivated, edited or stripped of geo data. Batch compliance jobs answer for a list of IDs you upload; compliance streams push events in near real time and, per docs.x.com, require Enterprise access.
Is the X batch compliance endpoint free?
The X pricing page fetched this session does not list the compliance endpoints, and the batch compliance docs do not name a tier; they say a 403 can mean your App is not enrolled for the endpoint. Check your App's access in the developer console rather than assuming a price.
Does TwitterAPI.io have a compliance endpoint?
No. TwitterAPI.io offers reads (and authenticated writes), not a compliance feed. You can keep a stored dataset current with a re-check: GET /twitter/tweets with up to 50 IDs per call returns only posts X still serves, and GET /twitter/user/info shows whether a missing post's author was not found, suspended or protected.
How do I check if tweets are deleted with an API?
Look the IDs up again and see which ones come back. With TwitterAPI.io, send up to 50 comma-separated IDs to /twitter/tweets; deleted posts and posts from private or suspended accounts are not returned, so any ID missing from the response is gone or hidden. Match by id, because the response does not keep the input order.
How quickly do I have to delete stored tweets?
The X Developer Policy asks you to keep stored content up to date with its current state on X and to make changes as soon as reasonably possible, or within 24 hours after receiving a request from X or the account owner. A cheap habit is to re-check a stored post right before you display it.
What is the difference between batch compliance and the compliance stream?
Batch compliance is pull: you upload a file of IDs (up to 100 MB, about 5 million IDs), wait up to 36 hours, and download the current state of each changed ID. The compliance stream is push: you receive every compliance event as it happens, including reversals such as user_unsuspend and undrop, and it requires Enterprise access per docs.x.com.
What does a batch compliance result mean by rehydrate and scrub_geo?
rehydrate with reason tweet_edited means the post was edited and you should fetch it again for the current revision. scrub_geo with reason geo_scrubbed means location data was removed and you should delete the stored geo fields. delete means remove your stored copy; the reason says whether it was deleted, protected, deactivated or suspended.
How much of a dataset disappears over time?
It depends on who wrote it. In our re-check about 45 days after storage, 0 of 1,000 organization-authored and organization-reposted posts were gone, while 8 of 158 posts from a topic search (5.1%) were missing, 6 of them because the author was suspended or no longer found. Measure decay on your own data before choosing a schedule.
Continue
- X API docs: Batch compliance introduction (job types, actions and reasons)
- X API docs: Batch compliance integration guide (limits, URL expiry, statuses)
- X API docs: Compliance streams (Enterprise access, event types)
- X Developer Policy: keeping stored X content up to date
- X API pricing: pay-per-usage rate card
- TwitterAPI.io docs: Get tweets by IDs (50 IDs per call)
- X API guides and references
- how to hydrate a tweet ID dataset
- Twitter dataset export guide for researchers
- Twitter Academic Research API guide
- Twitter firehose API developer guide
- Twitter conversation ID explained
- TwitterAPI.io pricing and rate limits
- 01B2B on Twitter (X) in 2026: Is It Worth It, and What Actually Works
- 02Twitter (X) Lead Generation: Finding and Qualifying Buyers with Search
- 03Twitter (X) Influencer Marketing: Find and Vet Creators With Data
- 04Twitter (X) and MongoDB: store tweets as documents, upsert by id, query them fast
- 05Supabase + Twitter (X) API: store tweets in Postgres with an Edge Function and pg_cron
- 06Grok for Startups: what the xAI credits cover, who qualifies, and where Twitter (X) data fits
- 07Twitter (X) Account Locked: Why It Happens and How to Unlock It
- 08GetXBot: What the Twitter (X) Video Bot Is, Whether It Is Safe, and Alternatives
Writing about something you built with TwitterAPI.io? Our community rewards program pays API credits for honest tutorials, build logs and videos.
Stop reading. Start building.
Starter credits cover real testing on real data. Google sign-in, no card, no application queue.
Get an API keyAlready building with TwitterAPI.io? Publish an honest tutorial or build log about it and earn up to $200 a month in API credits.