GET /2/users/compliance/stream

GET /2/users/compliance/stream

Connect to one of four partitions of the User compliance stream.

Endpoint URL

Authentication and rate limits

Authentication methods
supported by this endpoint

OAuth 2.0 App-only

Rate limit

App rate limit (Application-only): 100 requests per 15-minute window shared among all users of your app

Query parameters

numberMust be set to 1, 2, 3 or 4. User compliance events are split across 4 partitions, so 4 separate streams are needed to receive all events.
numberBy passing this parameter, you can recover up to five minutes worth of data that you might have missed during a disconnection. The backfilled events will automatically flow through a reconnected stream, with older events generally being delivered before any newer events. You must include a whole number between 1 and 5 as the value to this parameter. nThis feature will deliver all events that published during the timeframe selected, meaning that if you were disconnected for 90 seconds, and you requested two minutes of backfill, you will receive 30 seconds worth of duplicate events. Due to this, you should make sure your system is tolerant of duplicate data.

Example code with offical SDKs

      (async () => {
  try {
    const userComplianceStream = await twitterClient.users.complianceStream();
    console.dir(userComplianceStream, {
      depth: null,
  } catch (error) {

      try {
    InputStream result = apiInstance.users().complianceStream(null, null, null, null, null, null, null);
        JSON json = new JSON();
        Type localVarReturnType = new TypeToken<StreamingUserCompliance>(){}.getType();
        BufferedReader reader = new BufferedReader(new InputStreamReader(result));
        String line = reader.readLine();
        while (line != null) {
          System.out.println(json.getGson().fromJson(line, localVarReturnType).toString());
          line = reader.readLine();
    } catch (Exception e) {
} catch (ApiException e) {
    System.err.println("Exception when calling TweetsApi#usersComplianceStream");
    System.err.println("Status code: " + e.getCode());
    System.err.println("Reason: " + e.getResponseBody());
    System.err.println("Response headers: " + e.getResponseHeaders());


Example responses

Successful response
  "data": {
    "user_protect": {
      "user": {
        "id": "906948460078698496"
      "event_at": "2022-07-01T21:44:57.895Z"

Response fields

user_deletestringA delete user event.
user_undeletestringA undelete user event.
user_withheldstringA withheld user event.
user_protectstringA protect user event.
user_unprotectstringA unprotect user event.
user_suspendstringA suspend user event.
user_unsuspendstringA unsuspend user event.
scrub_geostringA geo scrub user event.
user_profile_modificationstringA modified user profile event.
idstringThe ID of the user triggering a compliance event.
event_atdate (ISO 8601)Time of when event happended.
withheld_in_countriesstringCountry where user is withheld.
up_to_tweet_idstringProvided when a user removes their geo metadata.
profile_fieldstringIndicates what Profile attribute was updated.