Skip to main content
POST
Tweet composer API with X algorithm guidance
Free. This endpoint does not consume credits.
Use this guided Tweet composer to plan, refine, and validate one post draft. Its source is 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

  1. Call compose with a topic.
  2. Answer its 4 questions.
  3. Call refine with the topic, goal, and tone.
  4. Write the draft. Call score with its full text.
The guidance maps public source facts to the requested goal. Ranking stays viewer-specific. Published defaults may differ from production experiments.

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

The goal 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

Returns 10 source facts and 4 follow-up questions.
Required fields: step, topic.Optional fields:
  • goal: engagement, followers, authority, or conversation. Defaults to engagement.
  • styleUsername: An analyzed X username or saved custom style label.

Refine request context

The tone 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

Send x-api-key with an Xquik API key. OAuth clients can send a bearer token through the Authorization header instead.
string
Your Xquik API key. Generate one from the dashboard.
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.
Set true when a separate link card is attached during score.
boolean
Deprecated compatibility field. Text checks ignore it.
Unknown body fields are ignored. Send only the fields for the selected step.

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

Missing step-specific fields also return 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 between refine 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 in styleUsername. 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 open intentUrl after the input check passes.
Research current context with Radar. Save accepted text with Create Draft. Analyze a reference voice with Analyze Style.