Introduction
X is committed to our community of developers who build with the X API. As part of this commitment, we aim to make our API open and fair to developers, safe for people on X, and beneficial for the X platform as a whole. It is crucial that any developer who stores X content offline, ensures the data reflects user intent and the current state of content on X. For example,when someone on X deletes a Post or their account, protects their Posts, or scrubs the geo information from their Posts, it is critical for both X and our developers to honor that person’s expectations and intent. The batch compliance endpoints provide developers an easy tool to help maintain X data in compliance with the X Developer Agreement and Policy.
These batch compliance endpoints allow you to upload large datasets of Post or user IDs to retrieve their compliance status in order to determine what data requires action in order to bring your datasets into compliance. Please note, use of the batch compliance endpoints is restricted to aforementioned use cases, and any other purpose is prohibited and may result in enforcement action.
Typically, there are 4 steps involved in working with this endpoint:
- Create a compliance job
You can specify the job type (with the value tweets or users to indicate whether the dataset you want to upload has Post IDs or user IDs. You can have one concurrent job per job type at any time. - Upload your dataset to the upload_url
Next, you upload your dataset as a plain text file to the provided upload_url, with each line of the file containing a single Post ID or user ID. The upload_url expires after 15 minutes. - (Optional) Check the job status
You can check the status of your compliance job to see whether it is created, in_progress, failed or complete. - Download the results
When your job is complete, you can download the results using the download_url. The download_url expires after one week (from when the job was created).
This result will contain a set of JSON objects (one object per line). Each object will contain a Post ID, the Post's creation date (useful to locate Posts organized by date), required action, the reason for the compliance action, and the date the user was suspended.
You will receive the following compliance event types in your results:
- deleted - indicates that the Post or User account was deleted
- deactivated - indicates that the Post or User account has been deactivated
- scrub_geo - indicates that the geo information associated with the Post or User was removed
- protected - indicates the account that made the Post became private
- suspended - indicates the account that made the Post was suspended
Account setup
To access these endpoints, you will need:
- An approved developer account.
- To authenticate using the keys and tokens from a developer App that is located within a Project.
Learn more about getting access to the X API v2 endpoints in our getting started guide.