How the upload flow works
When you create a job withPOST /2/compliance/jobs, the response includes two pre-authorized URLs:
upload_url— aPUTendpoint of the formhttps://api.x.com/2/compliance/jobs/{id}/upload?token=.... Upload your newline-delimited ID file here. See Upload Compliance Job Submission.download_url— aGETendpoint of the formhttps://api.x.com/2/compliance/jobs/{id}/download?token=.... Download results here once the job status iscomplete. See Download Compliance Job Results.
token query parameter is an opaque signed token scoped to the job. Use each URL exactly as returned; do not modify or strip the token.
Both URLs expire. The job object reports the expiry times in the upload_expires_at and download_expires_at fields. If a URL expires before you use it, create a new job.
Step one: create a job
Specify whether you are uploading Post IDs or user IDs with thetype parameter (tweets or users). Replace $APP_ACCESS_TOKEN with your App only Access Token.
id, upload_url, download_url, and their expiry times:
Step two: upload your ID file
Prepare a plain text file with one Post ID or user ID per line, thenPUT it to the upload_url from the create response:
upload_expires_at.
Step three: poll job status
PollGET /2/compliance/jobs/{id} until the status is complete:
Step four: download results
Once the job status iscomplete, GET the download_url before download_expires_at:
Constraints
- One unfinished job per type at a time. Cancel an in-progress job with
DELETE /2/compliance/jobs/{id}before creating another job of the same type. - The ID file must be plain text with exactly one numeric ID per line, and every ID must match the job
type. - The job creation, status, and list endpoints are rate limited to 150 requests per 15 minutes per App. See Rate limits.
Next steps
Quickstart
Create your first compliance job
API Reference
Full endpoint documentation