Skip to main content
POST
Publish a tweet on behalf of the authenticated source user. Proxies the official X v2 POST /2/tweets endpoint, routed through the AIsa gateway at https://api.aisa.one/apis/v1/twitter/post_twitter. One endpoint covers every variant:

Plain text

{ "text": "Hello, World!" }

Reply

Set reply.in_reply_to_tweet_id.

Quote tweet

Set quote_tweet_id.

With a poll

Set poll.options + poll.duration_minutes.

With media

Set media.media_ids (1–4 IDs).

Edit a tweet

Set edit_options.previous_post_id (within X’s edit window).

Prerequisites

  • An AIsa API key (Bearer token for every request).
  • A one-time OAuth authorization for the source user account. Link your X account by calling POST /apis/v1/twitter/auth_twitter — AIsa stores the session against your API key and uses it automatically on every write call.
  • The X session must hold tweet.read, tweet.write, users.read.

Mutually exclusive fields

At most one of these may appear in a single request:
  • media
  • poll
  • quote_tweet_id
  • card_uri
X will reject the request (400 invalid-request) if more than one is set.

Response

On success the endpoint returns 201 Created:
The returned text reflects what X actually stored (e.g., shortened URLs). Use data.id to reference this tweet in subsequent calls (reply, quote, like, edit, delete).

Editing tweets

Pass edit_options.previous_post_id to edit an existing tweet instead of creating a new one. Edits are subject to X’s edit window and edit count limits; the endpoint returns 409 conflict if the window has passed or the edit quota is exhausted.

Reply settings

Restrict who can reply with reply_settings: Omit the field for the default (everyone).

Common 4xx causes

  • 400 invalid-request — set two mutually-exclusive fields, text too long, invalid poll duration, etc.
  • 403 client-forbidden — OAuth session missing the tweet.write scope. Re-link via auth_twitter.
  • 404 resource-not-found — referenced in_reply_to_tweet_id, quote_tweet_id, or previous_post_id doesn’t exist or isn’t visible to the source user.
  • 409 conflict — duplicate content, or edit outside the allowed window.
See the full list on Error Codes and Rate Limits for tier caps.

Link an X Account

Start the OAuth flow this endpoint requires.

Follow a User

Another write endpoint using the same OAuth session.

Twitter Autopilot skill

Agent skill that wraps the full Twitter surface.

Request contract

Complete OpenAPI definition Effective request and pricing declaration (including authentication and referenced schemas):

Cost and request rules

Usage-based billing; Default request estimate: $0.015 USD (not a fixed price). Account-specific pricing and final settlement may differ. Published reference values are not an account-specific quote or a settled charge. For endpoints supporting X-AISA-Cost-Mode: quote, obtain a free quote for your exact request before execution; reconcile the settled cost with response metadata and Usage Logs. USD amounts use 1,000,000 integer micro-USD per dollar.
  • Default request reference estimate (USD): 0.015
  • Cost contract: request_formula
  • Published reference multiplier: 1.0
  • Settlement evidence source: request_snapshot

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

content
default:""
required
Maximum string length: 280
in_reply_to_tweet_id
default:""
required
Maximum string length: 64
media_ids
required
aisa_api_key
string
Maximum string length: 64
card_uri
string
Maximum string length: 256
media
object
media_files
string
poll
object
quote_tweet_id
string
Maximum string length: 64
reply
object
reply_settings
string
Maximum string length: 32
text
any

Alternate spelling for /content; ignored when the canonical value is present and nonempty.

Response

Successful ApiResponse serialized by the owning service.

code
integer
required
msg
string
required
data
object | null

The owning service explicitly declares an optional dictionary of arbitrary values; nested Twitter result fields are opaque.