Skip to content

Translate ​

Grok translation for posts, bios and community notes, plus the auto-translate setting and translation feedback.

translate.post(tweetId, opts?) ​

Translate a post. Returns { text, polls, results }.

OptionTypeDescription
opts.langstringTarget language (default en)
opts.rawbooleanReturn the raw result objects
js
const { text } = await client.translate.post("2127370319077966155");

translate.bio(userId, opts?) ​

Translate a user's bio.

translate.note(noteId, opts?) ​

Translate a community note into your account language.

translate.translate(kind, id, opts?) ​

The shared call behind the three above. kind is post, bio or note. Uses POST /2/grok/translation.json.

translate.autoTranslate(language?) / translate.setAutoTranslate(language, enable) ​

Read and change whether posts in language are translated automatically.

js
await client.translate.setAutoTranslate("ja", true);

translate.postFeedback(tweetId, feedback) / translate.noteFeedback(noteId, feedback) ​

Rate a post or note translation. feedback is "Good" or "Bad".

not affiliated with X Corp.