Articles

Update Article Content

Replace the body of an article you own with a new content_state, identified by its entity id. content_state is Draft.js editor-state JSON ({ blocks: [...], entityMap: [...] }) that you build client-side; in the shape the X Article editor produces. Blocks are forwarded with only key, text, type, data, entityRanges and inlineStyleRanges; X's schema rejects any other block field (depth included). Block types: unstyled, header-two, unordered-list-item, ordered-list-item, blockquote and atomic (a one-space block that carries an entity through entityRanges). entityMap is an ARRAY of { key, value: { type, mutability, data } }; entity data is snake_case on input and comes back camelCase: TWEET (an embedded post) { tweet_id }, MEDIA (an inline image) { caption, entity_key, media_items: [{ local_media_id, media_category: "DraftTweetImage", media_id }] } with media_id from media/upload, DIVIDER {}, LINK { url } over a text range, MARKDOWN { markdown } for tables. A field X does not know is refused with 422, reason validation_failed and the offending path in detail. Measured live 2026-09-18. Requires a registered session. Billed at $0.0016 per call. Cost: $0.0016 per call.

post/article/update_content

Request

  • Base URL: https://api.twitterapis.com/twitter
  • URL: https://api.twitterapis.com/twitter/article/update_content
  • Auth: HTTP bearer

Request body

idstring required

The article's base64 entity id, returned by article/create or article/list (the id field, not rest_id).

content_statestring required

The article body as a Draft.js content-state JSON object: { blocks: [...], entityMap: [...] }, sent as-is in the JSON request body, not as a string field. Blocks carry key, text, type, data, entityRanges, inlineStyleRanges only. entityMap is an array of { key, value: { type, mutability, data } } with snake_case data keys on input (tweet_id, media_items, local_media_id, media_category, media_id, entity_key, url, markdown).

Example request

{
  "id": "QXJ0aWNsZUVudGl0eToyMDg2NjUwMjI4OTUwNjgzNjQ4",
  "content_state": "{\"blocks\":[{\"key\":\"a1b2c\",\"text\":\"Opening paragraph.\",\"type\":\"unstyled\",\"inlineStyleRanges\":[],\"entityRanges\":[]},{\"key\":\"em1\",\"text\":\" \",\"type\":\"atomic\",\"inlineStyleRanges\":[],\"entityRanges\":[{\"key\":0,\"offset\":0,\"length\":1}]},{\"key\":\"im1\",\"text\":\" \",\"type\":\"atomic\",\"inlineStyleRanges\":[],\"entityRanges\":[{\"key\":1,\"offset\":0,\"length\":1}]}],\"entityMap\":[{\"key\":\"0\",\"value\":{\"type\":\"TWEET\",\"mutability\":\"Immutable\",\"data\":{\"tweet_id\":\"2077572855194157402\"}}},{\"key\":\"1\",\"value\":{\"type\":\"MEDIA\",\"mutability\":\"Immutable\",\"data\":{\"caption\":\"\",\"entity_key\":\"img-1\",\"media_items\":[{\"local_media_id\":\"1\",\"media_category\":\"DraftTweetImage\",\"media_id\":\"2101008406014312448\"}]}}}]}"
}

Response

Replace an article's body with a new Draft.js content_state.

okboolean

True when the content was updated.

articleobject

The updated article, full shape: id, rest_id, title, preview_text, lifecycle, content_state (your new blocks/entityMap, echoed back), cover_media, media_entities, author, created_at_secs, modified_at_secs, first_published_at_secs, visibility_setting, tweet_id, public_url.

Changes

No recorded changes to this operation across all 1 revision of this API.