Twitter/X Webhooks API
The Webhooks API from Twitter/X — 5 operation(s) for webhooks.
The Webhooks API from Twitter/X — 5 operation(s) for webhooks.
openapi: 3.0.0
info:
description: X API v2 available endpoints
version: '2.166'
title: X API v2 Account Activity Webhooks 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: Webhooks
paths:
/2/tweets/search/webhooks:
get:
security:
- BearerToken: []
tags:
- Webhooks
summary: Get stream links
description: Get a list of webhook links associated with a filtered stream ruleset.
externalDocs:
url: https://docs.x.com/x-api/webhooks/introduction
operationId: getWebhooksStreamLinks
parameters: []
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookLinksGetResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/tweets/search/webhooks/{webhook_id}:
delete:
security:
- BearerToken: []
tags:
- Webhooks
summary: Delete stream link
description: Deletes a link from FilteredStream events to the given webhook.
externalDocs:
url: https://docs.x.com/x-api/webhooks/introduction
operationId: deleteWebhooksStreamLink
parameters:
- name: webhook_id
in: path
description: The webhook ID to link to your FilteredStream ruleset.
required: true
schema:
$ref: '#/components/schemas/WebhookConfigId'
style: simple
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookLinksDeleteResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
post:
security:
- BearerToken: []
tags:
- Webhooks
summary: Create stream link
description: Creates a link to deliver FilteredStream events to the given webhook.
externalDocs:
url: https://docs.x.com/x-api/webhooks/introduction
operationId: createWebhooksStreamLink
parameters:
- name: webhook_id
in: path
description: The webhook ID to link to your FilteredStream ruleset.
required: true
schema:
$ref: '#/components/schemas/WebhookConfigId'
style: simple
- name: tweet.fields
in: query
description: A comma separated list of Tweet fields to display.
required: false
schema:
type: string
style: form
- name: expansions
in: query
description: A comma separated list of fields to expand.
required: false
schema:
type: string
style: form
- name: media.fields
in: query
description: A comma separated list of Media fields to display.
required: false
schema:
type: string
style: form
- name: poll.fields
in: query
description: A comma separated list of Poll fields to display.
required: false
schema:
type: string
style: form
- name: user.fields
in: query
description: A comma separated list of User fields to display.
required: false
schema:
type: string
style: form
- name: place.fields
in: query
description: A comma separated list of Place fields to display.
required: false
schema:
type: string
style: form
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookLinksCreateResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/webhooks:
get:
security:
- BearerToken: []
tags:
- Webhooks
summary: Get webhook
description: Get a list of webhook configs associated with a client app.
externalDocs:
url: https://docs.x.com/x-api/webhooks/introduction
operationId: getWebhooks
parameters:
- $ref: '#/components/parameters/WebhookConfigFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2WebhooksResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
post:
security:
- BearerToken: []
- UserToken: []
tags:
- Webhooks
summary: Create webhook
description: Creates a new webhook configuration.
externalDocs:
url: https://docs.x.com/x-api/webhooks/introduction
operationId: createWebhooks
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookConfigCreateRequest'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookConfigCreateResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/webhooks/replay:
post:
security:
- BearerToken: []
tags:
- Webhooks
summary: Create replay job for webhook
description: Creates a replay job to retrieve events from up to the past 24 hours for all events delivered or attempted to be delivered to the webhook.
externalDocs:
url: https://docs.x.com/x-api/webhooks/introduction
operationId: createWebhookReplayJob
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookReplayCreateRequest'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/ReplayJobCreateResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/webhooks/{webhook_id}:
delete:
security:
- BearerToken: []
- UserToken: []
tags:
- Webhooks
summary: Delete webhook
description: Deletes an existing webhook configuration.
externalDocs:
url: https://docs.x.com/x-api/webhooks/introduction
operationId: deleteWebhooks
parameters:
- name: webhook_id
in: path
description: The ID of the webhook to delete.
required: true
schema:
$ref: '#/components/schemas/WebhookConfigId'
style: simple
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookConfigDeleteResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
put:
security:
- BearerToken: []
- UserToken: []
tags:
- Webhooks
summary: Validate webhook
description: Triggers a CRC check for a given webhook.
externalDocs:
url: https://docs.x.com/x-api/webhooks/introduction
operationId: validateWebhooks
parameters:
- name: webhook_id
in: path
description: The ID of the webhook to check.
required: true
schema:
$ref: '#/components/schemas/WebhookConfigId'
style: simple
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookConfigPutResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
components:
schemas:
WebhookConfigDeleteResponse:
type: object
properties:
data:
type: object
properties:
deleted:
type: boolean
errors:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Problem'
WebhookConfigPutResponse:
type: object
properties:
data:
type: object
properties:
attempted:
type: boolean
errors:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Problem'
Get2WebhooksResponse:
type: object
properties:
data:
type: array
minItems: 1
items:
$ref: '#/components/schemas/WebhookConfig'
errors:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Problem'
meta:
type: object
properties:
result_count:
$ref: '#/components/schemas/ResultCount'
WebhookLinksCreateResponse:
type: object
properties:
data:
type: object
properties:
provisioned:
type: boolean
errors:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Problem'
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'
WebhookConfigCreateResponse:
type: object
description: A Webhook Configuration
required:
- id
- url
- valid
- created_at
properties:
created_at:
type: string
format: date-time
id:
$ref: '#/components/schemas/WebhookConfigId'
url:
type: string
description: The callback URL of the webhook.
valid:
type: boolean
ReplayJobCreateResponse:
type: object
description: Confirmation that the replay job request was accepted.
required:
- job_id
- created_at
properties:
created_at:
type: string
description: The UTC timestamp indicating when the replay job was created.
format: date-time
example: '2025-04-24T20:57:15.242Z'
job_id:
type: string
description: The unique identifier for the initiated replay job.
example: '1915510368169844736'
WebhookLinksDeleteResponse:
type: object
properties:
data:
type: object
properties:
deleted:
type: boolean
errors:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Problem'
WebhookConfigId:
type: string
description: The unique identifier of this webhook config.
pattern: ^[0-9]{1,19}$
example: '1146654567674912769'
WebhookLinksGetResponse:
type: object
properties:
data:
type: object
description: The list of active webhook links for a given stream
required:
- links
properties:
links:
type: array
description: list of links
items:
type: object
properties:
application_id:
type: string
description: The application ID
business_user_id:
type: string
description: The user ID
created_at:
type: string
description: The datetime the webhook was linked to the stream
format: data-time
fields:
type: array
description: Requested fields to be rendered
items:
type: string
description: A query-parameter formatted field or expansion, e.g., 'expansions=author_id' or 'user.fields=name,username'
instance_id:
type: string
description: The stream ID associated with the FilteredStream instance
webhook_id:
type: string
description: The unique identifier for the webhook
errors:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Problem'
WebhookConfigCreateRequest:
type: object
required:
- url
properties:
url:
type: string
minLength: 1
maxLength: 200
ResultCount:
type: integer
description: The number of results returned in this response.
format: int32
WebhookConfig:
type: object
description: A Webhook Configuration
required:
- id
- url
- valid
- created_at
properties:
created_at:
type: string
format: date-time
id:
$ref: '#/components/schemas/WebhookConfigId'
url:
type: string
description: The callback URL of the webhook.
valid:
type: boolean
WebhookReplayCreateRequest:
type: object
required:
- webhook_id
- from_date
- to_date
properties:
from_date:
type: string
description: The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in yyyymmddhhmm format.
pattern: ^[0-9]{12}$
example: '202504242000'
to_date:
type: string
description: The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in yyyymmddhhmm format.
pattern: ^[0-9]{12}$
example: '202504242000'
webhook_id:
$ref: '#/components/schemas/WebhookConfigId'
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
parameters:
WebhookConfigFieldsParameter:
name: webhook_config.fields
in: query
description: A comma separated list of WebhookConfig fields to display.
required: false
schema:
type: array
description: The fields available for a WebhookConfig object.
minItems: 1
uniqueItems: true
items:
type: string
enum:
- created_at
- id
- url
- valid
example:
- created_at
- id
- url
- valid
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