Skip to content

Articles ​

Read and write long-form Articles. Writing needs an eligible Premium account.

Reading ​

articles.get(articleEntityId, opts?) ​

Gets an article. author: true reads it through the composer, which also returns your drafts.

articles.forTweet(tweetId) ​

Gets the article attached to a post, or null.

articles.readerMode(tweetId) ​

Gets the reader mode view of an article post.

articles.mediaViewer(tweetId) ​

Gets the media viewer data of an article post.

articles.eventsSummary(tweetId) ​

Gets the native events summary of an article post.

articles.byUser(screenName, opts?) ​

Lists a user's article posts. A numeric user ID is resolved to a screen name first.

js
const { tweets } = await client.articles.byUser("elonmusk");

articles.slice(userId, lifecycle?, opts?) ​

Lists your articles in one lifecycle, "Published" or "Draft".

articles.published(userId, opts?) / articles.drafts(userId, opts?) ​

Shortcuts for slice.

Writing ​

articles.createDraft(contentState?, opts?) ​

Creates a draft and returns it. Pass title in opts.

js
const draft = await client.articles.createDraft(null, { title: "Notes" });

articles.updateTitle(articleEntityId, title) ​

Sets the title.

articles.updateContent(articleEntityId, contentState) ​

Replaces the body with a Draft.js style content_state.

articles.updateCoverMedia(articleEntityId, mediaId) ​

Sets the cover image from an uploaded media ID.

articles.publish(articleEntityId, opts?) ​

Publishes an article. Takes tweetText, visibility and conversationControl.

articles.unpublish(articleEntityId) ​

Unpublishes an article.

articles.remove(articleEntityId) ​

Deletes an article.

not affiliated with X Corp.