---
title: "Create tweet"
method: POST
path: "/api/v1/x/tweets"
tags: ["X Write"]
---

# Create tweet

`POST /api/v1/x/tweets`

Publishes a post through a connected X account.

## Headers

- `Idempotency-Key` string, required

## Request body

- object
  - `account` string, required — X account (@username or account ID)
  - `text` string — Tweet text (optional when media is provided)
  - `reply_to_tweet_id` string
  - `community_id` string
  - `is_note_tweet` boolean
  - `media` string[] — Array of public media URLs to attach. Supports up to 4 images or exactly 1 MP4 video up to 100 MB. Each URL must be publicly reachable. Attached media adds 2 credits per started MB across all files.

## Response `200`

Write reached a terminal state.

- XWriteAction — Durable write record. Poll statusUrl until terminal is true. Reusing its Idempotency-Key returns this record. Create another action only when safeToRetry is true.
  - `object` 'x_write_action', required
  - `id` string, required
  - `writeActionId` string, required
  - `action` 'create_tweet' | 'delete_tweet' | 'like' | 'unlike' | 'retweet' | 'unretweet' | 'follow' | 'unfollow' | 'remove_follower' | 'send_dm' | 'upload_media' | 'update_profile' | 'update_avatar' | 'update_banner' | 'create_community' | 'delete_community' | 'join_community' | 'leave_community', required
  - `status` 'accepted' | 'dispatching' | 'pending_confirmation' | 'success' | 'failed' | 'expired', required
  - `terminal` boolean, required
  - `retryable` boolean, required — True only when a new attempt can reasonably succeed.
  - `safeToRetry` boolean, required — True only when no write was dispatched and a new idempotency key may be used.
  - `statusUrl` string, required
  - `pollAfterMs` integer, nullable, required
  - `charged` boolean, required
  - `chargedCredits` string, required
  - `billing` XWriteActionBilling, required — plannedCredits is the approved maximum. chargedCredits comes from the settled credit ledger. Pending or failed writes are not charged.
    - `status` 'not_charged' | 'pending' | 'charged' | 'charge_failed' | 'refunded', required
    - `charged` boolean, required
    - `plannedCredits` string, required
    - `chargedCredits` string, required
  - `request` XWriteActionRequest, required — Stable fingerprint and sanitized payload for replay checks.
    - `hash` string, nullable, required — Stable hash of account, action, target, and payload.
    - `payload` object, nullable, required — Exact sanitized payload dispatched for this action.
  - `account` XWriteActionAccount, nullable, required — Connected account selected for the write.
    - `id` string, required
    - `username` string, required
  - `target` XWriteActionTarget, nullable, required — Existing X resource targeted by the write, when applicable.
    - `type` 'tweet' | 'user' | 'community', required
    - `id` string, required
  - `targetId` string, nullable, required
  - `result` XWriteActionResult, nullable, required — Confirmed result produced by the write, when available.
    - `type` 'tweet' | 'direct_message' | 'media' | 'community' | 'state_change'
    - `id` string
    - `state` string
  - `nextAction` XWriteActionNextAction, nullable, required — Exact follow-up an API client or agent should perform.
    - `type` 'poll' | 'retry' | 'verify_result' | 'fix_request', required
    - `url` string
    - `afterMs` integer
    - `requiresNewIdempotencyKey` boolean
  - `requestHash` string
  - `requestId` string
  - `idempotent` boolean
  - `error` string
  - `message` string
  - `sendDispatched` boolean, required
  - `sendDispatchedAt` string, date-time — Dispatch timestamp when the write reached execution.
  - `createdAt` string, date-time
  - `updatedAt` string, date-time
  - `completedAt` string, date-time
  - `expiresAt` string, date-time — Deadline for resolving a non-terminal write. This is not the Idempotency-Key retention deadline.
  - `confirmedAt` string, date-time
  - `confirmationCheckedAt` string, date-time
  - `confirmationAttempts` integer
  - `tweetId` string — Compatibility field for a confirmed tweet result ID.
  - `messageId` string — Compatibility field for a confirmed direct message ID.
  - `mediaId` string — Compatibility field for a confirmed media upload ID.
  - `mediaUrl` string, uri — Public media URL when the upload creates one.
  - `communityId` string — Compatibility field for a confirmed community ID.
  - `communityName` string — Confirmed community name when available.
  - `resultId` string — Compatibility result ID for other write actions.
  - `media` object — Media count, kind, size, and billing details when used.
  - `details` object — Structured recovery context for a failed write.
  - `success` boolean, required

## Other responses

- `202` — Write was accepted or dispatched. Poll Location after Retry-After. Never submit another write while this action remains nonterminal.
- `400` — The write request is invalid and no action was dispatched.
- `401` — Unauthenticated
- `402` — Payment required. MPP reads include `WWW-Authenticate`. Authenticated reads include balances and checkout; a failed request never creates checkout. Guest keys offer top-up.
- `403` — The connected X account needs reauthentication or is currently restricted (locked, suspended, or recovering). Returns an error code of `account_needs_reauth` or `account_restricted`.
- `409` — The idempotency key belongs to a different write request.
- `422` — X rejected the write or download. Read Error.code for the exact reason. Media failures cover URL, size, origin, and timeout.
- `429` — The write hit an Xquik or X limit. Follow `Retry-After` when present. Otherwise back off before retrying.
- `500` — Write failed. Inspect code, safeToRetry, and nextAction before retrying. Common codes cover upstream failures, ambiguity, duplicates, and daily limits.
- `503` — Durable tracking or the write service is temporarily unavailable. Inspect safeToRetry before creating another action.
- `default` — Unexpected error.

## Changes

- **2026-08-21** `18302a60cfee` — 1 breaking, 1 info
  - the `oneOf[subschema #4]/allOf[subschema #2]/` response's property type/format changed from ``/`` to `object`/`` for status `402`
  - added 'propertyNames' constraint to the `oneOf[subschema #4]/allOf[subschema #2]/` response property for the status `402`
- **2026-08-12** `5d4938bb7de3` — 126 warning
  - added the new `closed` enum value to the `allOf[#/components/schemas/Error]/error/oneOf[subschema #1: LegacyErrorCode]/` response property for the response status `429`
  - added the new `closed` enum value to the `allOf[#/components/schemas/Error]/error/oneOf[subschema #2: StructuredError]/code` response property for the response status `429`
  - added the new `closed` enum value to the `error/oneOf[subschema #1: LegacyErrorCode]/` response property for the response status `401`
  - added the new `closed` enum value to the `error/oneOf[subschema #1: LegacyErrorCode]/` response property for the response status `403`
  - …122 more
- …earlier changes not shown

[Full history](https://skmtc.dev/xquik-dev/apis/xquik-api-2/changes/api/v1/x/tweets/post.md)

---

[API](https://skmtc.dev/xquik-dev/apis/xquik-api-2.md) · [All operations](https://skmtc.dev/xquik-dev/apis/xquik-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/xquik-dev/xquik-api-2/revisions/834c16fa45e8/schema)
