Skip to main content
This guide walks you through creating and deleting Posts using the X API.
PrerequisitesBefore you begin, you’ll need:
  • A developer account with an approved App
  • User Access Tokens (OAuth 1.0a or OAuth 2.0 PKCE)

Create a Post

1

Prepare your request

The POST /2/tweets endpoint requires a JSON body with at least text or media:
2

Send the request

cURL
3

Review the response

A successful response includes the new Post’s id and text:

Advanced examples

cURL
cURL
First, upload media using the Media Upload endpoint, then reference the media_id:
cURL
cURL
Use the paid_partnership field to indicate that this Post is a paid partnership (i.e., the author is disclosing it contains paid promotion). When set to true, the Post will be labeled as a paid promotion.
cURL

Delete a Post

1

Get the Post ID

You need the ID of the Post you want to delete. This is returned when you create a Post.
2

Send a DELETE request

cURL
3

Confirm deletion

You can only delete Posts that you authored.

Next steps

Integration guide

Key concepts and best practices

Media upload

Upload media for Posts

API Reference

Full endpoint documentation

Sample code

Working code examples