Compose
Tweet composer API with X algorithm guidance
Plan, refine, and validate one X post with source-backed guidance from the public X recommendation algorithm, deterministic checks, examples, and intent URLs.
- 200
- 400
- 401
- 429
POST
Tweet composer API with X algorithm guidance
Free. This endpoint does not consume credits.
xai-org/x-algorithm.
It never returns finished Tweet text. It never publishes a post. It never
predicts likes, replies, reposts, bookmarks, profile visits, or follower growth.
Use 3 Compose calls for one complete writing cycle.
Workflow
- Call
composewith a topic. - Answer its 4 questions.
- Call
refinewith the topic, goal, and tone. - Write the draft. Call
scorewith its full text.
Choose the correct tweet writing step
Each call returns only its step-specific shape. Do not deserialize every result
into one generic response type.
Match the goal to your tweet intent
Thegoal selects one question and matching source guidance.
compose defaults to engagement when goal is omitted. Send one documented
goal explicitly when downstream behavior must remain stable.
Requests
- 1. Compose
- 2. Refine
- 3. Score
Returns 10 source facts and 4 follow-up questions.Required fields:
step, topic.Optional fields:goal:engagement,followers,authority, orconversation. Defaults toengagement.styleUsername: An analyzed X username or saved custom style label.
Refine request context
Thetone field accepts any non-empty string. The response preserves the
requested tone, topic, goal, media, action, and additional context. It then
adds source-backed viewer-action guidance. It does not invent style rules.
Headers
Sendx-api-key with an Xquik API key. OAuth clients can send a bearer token
through the Authorization header instead.
string
OAuth bearer token using
Bearer YOUR_TOKEN.string
required
Use
application/json.Body
string
required
Use exactly
compose, refine, or score.string
Non-empty subject. Required for
compose and refine.string
Use
engagement, followers, authority, or conversation. Required for
refine. Optional for compose.string
Account-scoped analyzed username or custom label. Only used by
compose.
Xquik lowercases the lookup value.string
Non-empty voice description. Required for
refine.string
Optional
photo, video, or none value for refine.string
Optional requested action for
refine.string
Optional audience, constraint, or verified source context for
refine.
Include selected Radar facts only when current context helps.string
Non-empty full post text. Required for
score.boolean
Set true when a separate link card is attached during
score.boolean
Deprecated compatibility field. Text checks ignore it.
Response
200 OK
The response shape matches the requested workflow step.Compose response
object[]
required
10 source facts from the public X recommendation code.
string
required
One concrete editorial rule for the requested goal.
string[]
required
4 questions for the next writing step.
object[]
required
Deprecated compatibility field. Always empty.
object[]
required
26 published signal names. Every
multiplier states that X does not publish
the production weight.string
required
Human-readable public signal name.
string
required
States that X does not publish the production multiplier.
object[]
required
26 published signal names. Every
weight is null.string
required
Signal name from X’s public ranking repository.
string
required
Signal direction and the limit of public evidence.
null
required
Always
null because X does not publish production weights.string
required
States that X publishes no universal engagement window or decay rate.
string[]
required
5 negative predictions named by X’s public model. No severity order is
claimed.
string
required
Signal source and evidence limits.
string
required
X post intent seeded with the topic.
string
required
Exact fields required for
refine.object[]
Saved styles. Present when saved styles exist and
styleUsername is omitted.string
Saved analyzed username or custom style label.
integer
Cached post count for the style.
string[]
Cached examples. Present when
styleUsername matches a cached style.string
Fallback instruction when the requested style is unavailable.
Match a saved Twitter writing style
styleUsername searches only styles owned by the authenticated account.
Xquik lowercases the lookup value before searching.
The 200 fallback still returns the complete Compose response. The 400 branch
returns only the documented error object. Analyze the username first when the
account can run a new style analysis.
Refine response
string[]
required
Goal, tone, media, and editorial guidance.
object[]
required
Deprecated compatibility field. Always empty.
string
required
X post intent seeded with the topic.
string
required
Exact fields required for the
score call.Score response
Runs one deterministic input check. Checks that the draft contains text. It does not score quality or predict ranking.intentUrl appears only when the draft contains text.
object[]
required
One deterministic input check.
string
required
Stable name for the evaluated rule.
boolean
required
Whether the draft satisfies this rule.
string
Add the post text. when the draft is blank.boolean
required
True when the draft contains text.
integer
required
1 for text. 0 for a blank draft.integer
required
Always
1 for the current contract.string
required
The missing-text fix or the source limit on deterministic ranking scores.
string
X post intent containing the draft. Present only when every check passes.
string
required
Publishing instructions after success. Revision instructions after failure.
Errors
- 400 Invalid input
- 401 Unauthenticated
- 429 Rate limited
invalid_input.Tweet composer questions
What does the tweet composer generate?
It returns source facts, 4 questions, request context, and one input check. You write the draft betweenrefine and score.
Is this endpoint a tweet generator?
No. A Tweet generator usually writes final post text from one prompt. This endpoint guides a deliberate writing workflow. It helps plan, refine, and check one draft without publishing it.How does it help write a good tweet?
Choose a goal before drafting. Answer the 4 questions. Add verified context when needed. Treat source signals as viewer-specific, not universal advice.Can it supply current Twitter post ideas?
No.radarRecommendations remains an empty compatibility field. Supply
verified facts through additionalContext during Refine.
Can it match a saved Twitter writing style?
Yes. Send an analyzed username or custom style label instyleUsername. A
successful match returns cached styleTweets. Use those samples to study
sentence length, vocabulary, openings, and calls to action.
The endpoint does not rewrite the draft automatically. It also does not verify
that one style belongs to a public X username.
What happens when a draft check fails?
passed becomes false for a blank draft. The checklist suggests adding text.
intentUrl stays absent until the draft contains text.
Does the score predict likes, replies, or reposts?
No. It never predicts likes, replies, reposts, bookmarks, profile visits, or follower growth. Ranking stays viewer-specific.Can the endpoint publish the draft?
No. Use Create Tweet after review. You can also openintentUrl after the input check passes.
Research current context with Radar. Save accepted
text with Create Draft. Analyze a reference
voice with Analyze Style.
- 200
- 400
- 401
- 429
Tweet composer API with X algorithm guidance