openapi: 3.0.0 info: description: X API v2 available endpoints version: '2.161' title: X API v2 Account Activity Compliance API termsOfService: https://developer.x.com/en/developer-terms/agreement-and-policy.html contact: name: X Developers url: https://developer.x.com/ license: name: X Developer Agreement and Policy url: https://developer.x.com/en/developer-terms/agreement-and-policy.html servers: - description: X API url: https://api.x.com tags: - name: Compliance description: Endpoints related to keeping X data in your systems compliant externalDocs: description: Find out more url: https://developer.twitter.com/en/docs/twitter-api/compliance/batch-tweet/introduction paths: /2/compliance/jobs: get: security: - BearerToken: [] tags: - Compliance summary: X Get Compliance Jobs description: Retrieves a list of Compliance Jobs filtered by job type and optional status. externalDocs: url: https://developer.twitter.com/en/docs/twitter-api/compliance/batch-compliance/api-reference/get-compliance-jobs operationId: getComplianceJobs parameters: - name: type in: query description: Type of Compliance Job to list. required: true schema: type: string enum: - tweets - users style: form example: tweets - name: status in: query description: Status of Compliance Job to list. required: false schema: type: string enum: - created - in_progress - failed - complete style: form example: created - $ref: '#/components/parameters/ComplianceJobFieldsParameter' responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Get2ComplianceJobsResponse' default: description: The request has failed. content: application/json: schema: $ref: '#/components/schemas/Error' application/problem+json: schema: $ref: '#/components/schemas/Problem' x-microcks-operation: delay: 0 dispatcher: FALLBACK post: security: - BearerToken: [] tags: - Compliance summary: X Create Compliance Job description: Creates a new Compliance Job for the specified job type. externalDocs: url: https://developer.twitter.com/en/docs/twitter-api/compliance/batch-compliance/api-reference/post-compliance-jobs operationId: createComplianceJobs parameters: [] requestBody: content: application/json: schema: $ref: '#/components/schemas/CreateComplianceJobRequest' required: true responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/CreateComplianceJobResponse' default: description: The request has failed. content: application/json: schema: $ref: '#/components/schemas/Error' application/problem+json: schema: $ref: '#/components/schemas/Problem' x-microcks-operation: delay: 0 dispatcher: FALLBACK /2/compliance/jobs/{id}: get: security: - BearerToken: [] tags: - Compliance summary: X Get Compliance Job by ID description: Retrieves details of a specific Compliance Job by its ID. externalDocs: url: https://developer.twitter.com/en/docs/twitter-api/compliance/batch-compliance/api-reference/get-compliance-jobs-id operationId: getComplianceJobsById parameters: - name: id in: path description: The ID of the Compliance Job to retrieve. required: true schema: $ref: '#/components/schemas/JobId' style: simple example: '1234567890' - $ref: '#/components/parameters/ComplianceJobFieldsParameter' responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Get2ComplianceJobsIdResponse' default: description: The request has failed. content: application/json: schema: $ref: '#/components/schemas/Error' application/problem+json: schema: $ref: '#/components/schemas/Problem' x-microcks-operation: delay: 0 dispatcher: FALLBACK /2/likes/compliance/stream: get: security: - BearerToken: [] tags: - Compliance summary: X Stream Likes Compliance Data description: Streams all compliance data related to Likes for Users. operationId: streamLikesCompliance parameters: - name: backfill_minutes in: query description: The number of minutes of backfill requested. required: false schema: type: integer minimum: 0 maximum: 5 format: int32 style: form example: 42 - name: start_time in: query description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. required: false example: '2021-02-01T18:40:40.000Z' schema: type: string format: date-time style: form - name: end_time in: query description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. required: false example: '2021-02-01T18:40:40.000Z' schema: type: string format: date-time style: form responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/LikesComplianceStreamResponse' default: description: The request has failed. content: application/json: schema: $ref: '#/components/schemas/Error' application/problem+json: schema: $ref: '#/components/schemas/Problem' x-twitter-streaming: true x-microcks-operation: delay: 0 dispatcher: FALLBACK /2/tweets/compliance/stream: get: security: - BearerToken: [] tags: - Compliance summary: X Stream Posts Compliance Data description: Streams all compliance data related to Posts. operationId: streamPostsCompliance parameters: - name: backfill_minutes in: query description: The number of minutes of backfill requested. required: false schema: type: integer minimum: 0 maximum: 5 format: int32 style: form example: 42 - name: partition in: query description: The partition number. required: true schema: type: integer minimum: 1 maximum: 4 format: int32 style: form example: 42 - name: start_time in: query description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. required: false example: '2021-02-01T18:40:40.000Z' schema: type: string format: date-time style: form - name: end_time in: query description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. required: false example: '2021-02-14T18:40:40.000Z' schema: type: string format: date-time style: form responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/TweetComplianceStreamResponse' default: description: The request has failed. content: application/json: schema: $ref: '#/components/schemas/Error' application/problem+json: schema: $ref: '#/components/schemas/Problem' x-twitter-streaming: true x-microcks-operation: delay: 0 dispatcher: FALLBACK /2/tweets/label/stream: get: security: - BearerToken: [] tags: - Compliance summary: X Stream Post Labels description: Streams all labeling events applied to Posts. operationId: streamLabelsCompliance parameters: - name: backfill_minutes in: query description: The number of minutes of backfill requested. required: false schema: type: integer minimum: 0 maximum: 5 format: int32 style: form example: 42 - name: start_time in: query description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. required: false example: '2021-02-01T18:40:40.000Z' schema: type: string format: date-time style: form - name: end_time in: query description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. required: false example: '2021-02-01T18:40:40.000Z' schema: type: string format: date-time style: form responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/TweetLabelStreamResponse' default: description: The request has failed. content: application/json: schema: $ref: '#/components/schemas/Error' application/problem+json: schema: $ref: '#/components/schemas/Problem' x-twitter-streaming: true x-microcks-operation: delay: 0 dispatcher: FALLBACK /2/users/compliance/stream: get: security: - BearerToken: [] tags: - Compliance summary: X Stream Users Compliance Data description: Streams all compliance data related to Users. operationId: streamUsersCompliance parameters: - name: backfill_minutes in: query description: The number of minutes of backfill requested. required: false schema: type: integer minimum: 0 maximum: 5 format: int32 style: form example: 42 - name: partition in: query description: The partition number. required: true schema: type: integer minimum: 1 maximum: 4 format: int32 style: form example: 42 - name: start_time in: query description: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. required: false example: '2021-02-01T18:40:40.000Z' schema: type: string format: date-time style: form - name: end_time in: query description: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. required: false example: '2021-02-01T18:40:40.000Z' schema: type: string format: date-time style: form responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/UserComplianceStreamResponse' default: description: The request has failed. content: application/json: schema: $ref: '#/components/schemas/Error' application/problem+json: schema: $ref: '#/components/schemas/Problem' x-twitter-streaming: true x-microcks-operation: delay: 0 dispatcher: FALLBACK components: schemas: TweetNotice: type: object required: - tweet - event_type - event_at - application properties: application: type: string description: If the label is being applied or removed. Possible values are ‘apply’ or ‘remove’. example: apply details: type: string description: Information shown on the Tweet label event_at: type: string description: Event time. format: date-time example: '2021-07-06T18:40:40.000Z' event_type: type: string description: The type of label on the Tweet example: misleading extended_details_url: type: string description: Link to more information about this kind of label label_title: type: string description: Title/header of the Tweet label tweet: type: object required: - id - author_id properties: author_id: $ref: '#/components/schemas/UserId' id: $ref: '#/components/schemas/TweetId' UnlikeComplianceSchema: type: object required: - favorite - event_at properties: event_at: type: string description: Event time. format: date-time example: '2021-07-06T18:40:40.000Z' favorite: type: object required: - id - user_id properties: id: $ref: '#/components/schemas/TweetId' user_id: $ref: '#/components/schemas/UserId' UserScrubGeoObjectSchema: type: object required: - user - up_to_tweet_id - event_at properties: event_at: type: string description: Event time. format: date-time example: '2021-07-06T18:40:40.000Z' up_to_tweet_id: $ref: '#/components/schemas/TweetId' user: type: object required: - id properties: id: $ref: '#/components/schemas/UserId' TweetLabelStreamResponse: description: Tweet label stream events. oneOf: - type: object description: Tweet Label event. required: - data properties: data: $ref: '#/components/schemas/TweetLabelData' - type: object required: - errors properties: errors: type: array minItems: 1 items: $ref: '#/components/schemas/Problem' UserProtectComplianceSchema: type: object required: - user_protect properties: user_protect: $ref: '#/components/schemas/UserComplianceSchema' LikeComplianceSchema: type: object required: - delete properties: delete: $ref: '#/components/schemas/UnlikeComplianceSchema' CreateComplianceJobRequest: type: object description: A request to create a new batch compliance job. required: - type properties: name: $ref: '#/components/schemas/ComplianceJobName' resumable: type: boolean description: If true, this endpoint will return a pre-signed URL with resumable uploads enabled. type: type: string description: Type of compliance job to list. enum: - tweets - users ComplianceJobStatus: type: string description: Status of a compliance job. enum: - created - in_progress - failed - complete - expired TweetWithheldComplianceSchema: type: object required: - withheld properties: withheld: $ref: '#/components/schemas/TweetTakedownComplianceSchema' DownloadUrl: type: string description: URL from which the user will retrieve their compliance results. format: uri LikesComplianceStreamResponse: description: Likes compliance stream events. oneOf: - type: object description: Compliance event. required: - data properties: data: $ref: '#/components/schemas/LikeComplianceSchema' - type: object required: - errors properties: errors: type: array minItems: 1 items: $ref: '#/components/schemas/Problem' TweetEditComplianceSchema: type: object required: - tweet_edit properties: tweet_edit: $ref: '#/components/schemas/TweetEditComplianceObjectSchema' TweetComplianceSchema: type: object required: - tweet - event_at properties: event_at: type: string description: Event time. format: date-time example: '2021-07-06T18:40:40.000Z' quote_tweet_id: $ref: '#/components/schemas/TweetId' tweet: type: object required: - id - author_id properties: author_id: $ref: '#/components/schemas/UserId' id: $ref: '#/components/schemas/TweetId' UserSuspendComplianceSchema: type: object required: - user_suspend properties: user_suspend: $ref: '#/components/schemas/UserComplianceSchema' TweetUnviewableSchema: type: object required: - public_tweet_unviewable properties: public_tweet_unviewable: $ref: '#/components/schemas/TweetUnviewable' ComplianceJobType: type: string description: Type of compliance job to list. enum: - tweets - users ComplianceJobName: type: string description: User-provided name for a compliance job. maxLength: 64 example: my-job UserUnprotectComplianceSchema: type: object required: - user_unprotect properties: user_unprotect: $ref: '#/components/schemas/UserComplianceSchema' TweetEditComplianceObjectSchema: type: object required: - tweet - event_at - initial_tweet_id - edit_tweet_ids properties: edit_tweet_ids: type: array minItems: 1 items: $ref: '#/components/schemas/TweetId' event_at: type: string description: Event time. format: date-time example: '2021-07-06T18:40:40.000Z' initial_tweet_id: $ref: '#/components/schemas/TweetId' tweet: type: object required: - id properties: id: $ref: '#/components/schemas/TweetId' JobId: type: string description: Compliance Job ID. pattern: ^[0-9]{1,19}$ example: '1372966999991541762' ComplianceJob: type: object required: - id - type - created_at - upload_url - download_url - upload_expires_at - download_expires_at - status properties: created_at: $ref: '#/components/schemas/CreatedAt' download_expires_at: $ref: '#/components/schemas/DownloadExpiration' download_url: $ref: '#/components/schemas/DownloadUrl' id: $ref: '#/components/schemas/JobId' name: $ref: '#/components/schemas/ComplianceJobName' status: $ref: '#/components/schemas/ComplianceJobStatus' type: $ref: '#/components/schemas/ComplianceJobType' upload_expires_at: $ref: '#/components/schemas/UploadExpiration' upload_url: $ref: '#/components/schemas/UploadUrl' TweetLabelData: description: Tweet label data. oneOf: - $ref: '#/components/schemas/TweetNoticeSchema' - $ref: '#/components/schemas/TweetUnviewableSchema' TweetTakedownComplianceSchema: type: object required: - tweet - withheld_in_countries - event_at properties: event_at: type: string description: Event time. format: date-time example: '2021-07-06T18:40:40.000Z' quote_tweet_id: $ref: '#/components/schemas/TweetId' tweet: type: object required: - id - author_id properties: author_id: $ref: '#/components/schemas/UserId' id: $ref: '#/components/schemas/TweetId' withheld_in_countries: type: array minItems: 1 items: $ref: '#/components/schemas/CountryCode' TweetComplianceStreamResponse: description: Tweet compliance stream events. oneOf: - type: object description: Compliance event. required: - data properties: data: $ref: '#/components/schemas/TweetComplianceData' - type: object required: - errors properties: errors: type: array minItems: 1 items: $ref: '#/components/schemas/Problem' CreateComplianceJobResponse: type: object properties: data: $ref: '#/components/schemas/ComplianceJob' errors: type: array minItems: 1 items: $ref: '#/components/schemas/Problem' UserUnsuspendComplianceSchema: type: object required: - user_unsuspend properties: user_unsuspend: $ref: '#/components/schemas/UserComplianceSchema' TweetId: type: string description: Unique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers. pattern: ^[0-9]{1,19}$ example: '1346889436626259968' TweetComplianceData: description: Tweet compliance data. oneOf: - $ref: '#/components/schemas/TweetDeleteComplianceSchema' - $ref: '#/components/schemas/TweetWithheldComplianceSchema' - $ref: '#/components/schemas/TweetDropComplianceSchema' - $ref: '#/components/schemas/TweetUndropComplianceSchema' - $ref: '#/components/schemas/TweetEditComplianceSchema' Error: type: object required: - code - message properties: code: type: integer format: int32 message: type: string CreatedAt: type: string description: Creation time of the compliance job. format: date-time example: '2021-01-06T18:40:40.000Z' Get2ComplianceJobsResponse: type: object properties: data: type: array minItems: 1 items: $ref: '#/components/schemas/ComplianceJob' errors: type: array minItems: 1 items: $ref: '#/components/schemas/Problem' meta: type: object properties: result_count: $ref: '#/components/schemas/ResultCount' UserComplianceStreamResponse: description: User compliance stream events. oneOf: - type: object description: User compliance event. required: - data properties: data: $ref: '#/components/schemas/UserComplianceData' - type: object required: - errors properties: errors: type: array minItems: 1 items: $ref: '#/components/schemas/Problem' ResultCount: type: integer description: The number of results returned in this response. format: int32 UserUndeleteComplianceSchema: type: object required: - user_undelete properties: user_undelete: $ref: '#/components/schemas/UserComplianceSchema' CountryCode: type: string description: A two-letter ISO 3166-1 alpha-2 country code. pattern: ^[A-Z]{2}$ example: US DownloadExpiration: type: string description: Expiration time of the download URL. format: date-time example: '2021-01-06T18:40:40.000Z' TweetUnviewable: type: object required: - tweet - event_at - application properties: application: type: string description: If the label is being applied or removed. Possible values are ‘apply’ or ‘remove’. example: apply event_at: type: string description: Event time. format: date-time example: '2021-07-06T18:40:40.000Z' tweet: type: object required: - id - author_id properties: author_id: $ref: '#/components/schemas/UserId' id: $ref: '#/components/schemas/TweetId' TweetNoticeSchema: type: object required: - public_tweet_notice properties: public_tweet_notice: $ref: '#/components/schemas/TweetNotice' UserWithheldComplianceSchema: type: object required: - user_withheld properties: user_withheld: $ref: '#/components/schemas/UserTakedownComplianceSchema' TweetUndropComplianceSchema: type: object required: - undrop properties: undrop: $ref: '#/components/schemas/TweetComplianceSchema' UploadExpiration: type: string description: Expiration time of the upload URL. format: date-time example: '2021-01-06T18:40:40.000Z' TweetDeleteComplianceSchema: type: object required: - delete properties: delete: $ref: '#/components/schemas/TweetComplianceSchema' UserComplianceData: description: User compliance data. oneOf: - $ref: '#/components/schemas/UserProtectComplianceSchema' - $ref: '#/components/schemas/UserUnprotectComplianceSchema' - $ref: '#/components/schemas/UserDeleteComplianceSchema' - $ref: '#/components/schemas/UserUndeleteComplianceSchema' - $ref: '#/components/schemas/UserSuspendComplianceSchema' - $ref: '#/components/schemas/UserUnsuspendComplianceSchema' - $ref: '#/components/schemas/UserWithheldComplianceSchema' - $ref: '#/components/schemas/UserScrubGeoSchema' - $ref: '#/components/schemas/UserProfileModificationComplianceSchema' Problem: type: object description: An HTTP Problem Details object, as defined in IETF RFC 7807 (https://tools.ietf.org/html/rfc7807). required: - type - title properties: detail: type: string status: type: integer title: type: string type: type: string discriminator: propertyName: type mapping: about:blank: '#/components/schemas/GenericProblem' https://api.twitter.com/2/problems/client-disconnected: '#/components/schemas/ClientDisconnectedProblem' https://api.twitter.com/2/problems/client-forbidden: '#/components/schemas/ClientForbiddenProblem' https://api.twitter.com/2/problems/conflict: '#/components/schemas/ConflictProblem' https://api.twitter.com/2/problems/disallowed-resource: '#/components/schemas/DisallowedResourceProblem' https://api.twitter.com/2/problems/duplicate-rules: '#/components/schemas/DuplicateRuleProblem' https://api.twitter.com/2/problems/invalid-request: '#/components/schemas/InvalidRequestProblem' https://api.twitter.com/2/problems/invalid-rules: '#/components/schemas/InvalidRuleProblem' https://api.twitter.com/2/problems/noncompliant-rules: '#/components/schemas/NonCompliantRulesProblem' https://api.twitter.com/2/problems/not-authorized-for-field: '#/components/schemas/FieldUnauthorizedProblem' https://api.twitter.com/2/problems/not-authorized-for-resource: '#/components/schemas/ResourceUnauthorizedProblem' https://api.twitter.com/2/problems/operational-disconnect: '#/components/schemas/OperationalDisconnectProblem' https://api.twitter.com/2/problems/resource-not-found: '#/components/schemas/ResourceNotFoundProblem' https://api.twitter.com/2/problems/resource-unavailable: '#/components/schemas/ResourceUnavailableProblem' https://api.twitter.com/2/problems/rule-cap: '#/components/schemas/RulesCapProblem' https://api.twitter.com/2/problems/streaming-connection: '#/components/schemas/ConnectionExceptionProblem' https://api.twitter.com/2/problems/unsupported-authentication: '#/components/schemas/UnsupportedAuthenticationProblem' https://api.twitter.com/2/problems/usage-capped: '#/components/schemas/UsageCapExceededProblem' UserComplianceSchema: type: object required: - user - event_at properties: event_at: type: string description: Event time. format: date-time example: '2021-07-06T18:40:40.000Z' user: type: object required: - id properties: id: $ref: '#/components/schemas/UserId' UserScrubGeoSchema: type: object required: - scrub_geo properties: scrub_geo: $ref: '#/components/schemas/UserScrubGeoObjectSchema' Get2ComplianceJobsIdResponse: type: object properties: data: $ref: '#/components/schemas/ComplianceJob' errors: type: array minItems: 1 items: $ref: '#/components/schemas/Problem' UserDeleteComplianceSchema: type: object required: - user_delete properties: user_delete: $ref: '#/components/schemas/UserComplianceSchema' UserTakedownComplianceSchema: type: object required: - user - withheld_in_countries - event_at properties: event_at: type: string description: Event time. format: date-time example: '2021-07-06T18:40:40.000Z' user: type: object required: - id properties: id: $ref: '#/components/schemas/UserId' withheld_in_countries: type: array minItems: 1 items: $ref: '#/components/schemas/CountryCode' UserProfileModificationObjectSchema: type: object required: - user - profile_field - new_value - event_at properties: event_at: type: string description: Event time. format: date-time example: '2021-07-06T18:40:40.000Z' new_value: type: string profile_field: type: string user: type: object required: - id properties: id: $ref: '#/components/schemas/UserId' UserId: type: string description: Unique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers. pattern: ^[0-9]{1,19}$ example: '2244994945' UploadUrl: type: string description: URL to which the user will upload their Tweet or user IDs. format: uri UserProfileModificationComplianceSchema: type: object required: - user_profile_modification properties: user_profile_modification: $ref: '#/components/schemas/UserProfileModificationObjectSchema' TweetDropComplianceSchema: type: object required: - drop properties: drop: $ref: '#/components/schemas/TweetComplianceSchema' parameters: ComplianceJobFieldsParameter: name: compliance_job.fields in: query description: A comma separated list of ComplianceJob fields to display. required: false schema: type: array description: The fields available for a ComplianceJob object. minItems: 1 uniqueItems: true items: type: string enum: - created_at - download_expires_at - download_url - id - name - resumable - status - type - upload_expires_at - upload_url example: - created_at - download_expires_at - download_url - id - name - resumable - status - type - upload_expires_at - upload_url explode: false style: form securitySchemes: BearerToken: type: http scheme: bearer OAuth2UserToken: type: oauth2 flows: authorizationCode: authorizationUrl: https://api.x.com/2/oauth2/authorize tokenUrl: https://api.x.com/2/oauth2/token scopes: block.read: View accounts you have blocked. bookmark.read: Read your bookmarked Posts. bookmark.write: Create and delete your bookmarks. dm.read: Read all your Direct Messages. dm.write: Send and manage your Direct Messages. follows.read: View accounts you follow and accounts following you. follows.write: Follow and unfollow accounts on your behalf. like.read: View Posts you have liked and likes you can see. like.write: Like and unlike Posts on your behalf. list.read: View Lists, members, and followers of Lists you created or are a member of, including private Lists. list.write: Create and manage Lists on your behalf. media.write: Upload media, such as photos and videos, on your behalf. mute.read: View accounts you have muted. mute.write: Mute and unmute accounts on your behalf. offline.access: Request a refresh token for the app. space.read: View all Spaces you have access to. timeline.read: View all Custom Timelines you can see, including public Custom Timelines from other developers. tweet.moderate.write: Hide and unhide replies to your Posts. tweet.read: View all Posts you can see, including those from protected accounts. tweet.write: Post and repost on your behalf. users.read: View any account you can see, including protected accounts. UserToken: type: http scheme: OAuth