Skip to main content
POST https://xquik.com/api/v1/x/analysis/classify
2 credits per analyzed post · All plans from $0.00012/credit · Supports guest paid reads
Classify posts reads each post with AI. It answers the questions you write. The endpoint is POST /api/v1/x/analysis/classify. Without analysis.questions, it answers the sentiment questions.
The snippets list posts that ask for a recommendation, with their urgency. They also print the count per request type. They do not print the full response.

Write a question

Each question needs an id, a type, a version, and instructions. Write the instructions as you would brief a careful reader.
  • A choice adds categories. Each name maps to a short description or null. Add a category such as other or unclear for posts that fit none.
  • A score adds levels. List 2 to 10 descriptions, lowest first. The answer is the level’s index, from 0. It can have decimals, such as 1.4.
  • A probability can add criteria, with what counts as yes and as no.
Write question IDs and category names in lower case, with digits or underscores. An example is feature_request. A name with spaces or capitals returns 400 invalid_input with the name to fix.

Classify topics

A topic classifier is 1 choice question whose categories are your topics. Add other for posts outside them. analysisSummary.questions.<id>.shares holds each topic’s share of posts.

Version your questions

version is yours. Change it whenever you change a question’s instructions, categories, or levels. Each answer carries questionVersion, so stored rows show which wording produced them.

Use a preset

Set analysis.preset instead of questions for a ready set, at the same price.

Pick the posts to analyze

Send tweetIds, texts, a page, or a search, never more than 1. See pick the posts to analyze for each source.

Compare with an earlier answer

Send the results of an earlier call as baseline to see what changed. The comparison costs nothing extra. See compare with an earlier answer for an example.

Budget the analysis

Each analyzed post costs 2 credits. Each text in texts costs the same. Posts in unanalyzed cost nothing. See budget the analysis for each reason.

Body

See body parameters for every field. Common ones are tweetIds, texts, query, username, and limit.

Headers

Response

200 OK

400 Invalid input

{ "error": "invalid_input", "message": "Rename \"Feature Request\". Write question IDs & category names in lower case without hyphens, such as feature_request." } The body names no posts or names more than 1 source. A body with an invalid field gets the same error. The message says what to send instead. The request costs nothing.

401 Unauthenticated

Anonymous requests get WWW-Authenticate: Bearer and a guest wallet checkout action. This is not a Payment challenge. Missing or invalid API key. Check the x-api-key header value.

402 Payment required

Full account keys can receive no_subscription, subscription_inactive, no_credits, or insufficient_credits with account payment options. Guest keys receive only the guest top-up action. The failed request creates no checkout. Ask the user to confirm before calling any checkout or top-up route.

403 Protected account

{ "error": "x_account_protected" } A search that needs a protected author returns this. Choose a public account. The request costs nothing.

502 X API unavailable

The read service returned an error. Retry after a short delay.

503 Service busy

Xquik is busy. Wait for the Retry-After header, then send the request again. The request costs nothing.

429 Rate limit exceeded

You exceeded your tier rate limit. Wait for the Retry-After header before retrying.

424 Dependency failed

The normalized v1 response contract can return 424 when the read service is unavailable.

Tweet classification API questions

How do I classify tweets by topic?

Send 1 choice question whose categories are your topics, with other for the rest. Each row’s answers holds the topic, and the summary counts posts per topic.

How many questions and categories can I use?

As many questions as fit in 8,000 bytes together. A choice takes 2 to 255 categories, and a score 2 to 10 levels. The price stays 2 credits per post.

Can I set my own confidence threshold?

Yes. results[].analysis.answers gives each answer’s confidence and the probability of every category or level. Keep the rows above your threshold.

Can I classify my own texts, such as support tickets?

Yes. Send your texts in texts. Xquik reads nothing from X for them.

How much does classification cost?

Each analyzed post costs 2 credits, whatever the number of questions. Posts in unanalyzed and refused requests cost nothing.

Does this replace X’s official API?

No. This page documents Xquik, an independent third-party service. It does not document X’s official API.
Next steps. Brand mentions answers ready brand questions, or Viral score rates how posts read.

Response examples

  • 400 { "error": "invalid_input", "message": "Invalid input. Check the request body." }
  • 401 { "error": "unauthenticated", "message": "Authentication required." }
  • 402 { "error": "insufficient_credits", "message": "Insufficient credits. Top up or subscribe to continue." }
  • 403 { "error": "api_key_paused", "message": "This API key is paused. Resume it at dashboard.xquik.com/api-keys to use it again." }
  • 424 { "error": "x_api_unavailable", "message": "X data source temporarily unavailable. Try again later." }
  • 429 { "error": "rate_limit_exceeded", "message": "Too many requests. Try again later.", "retryAfter": 60 }
  • 502 { "error": "x_api_unavailable", "message": "X data source temporarily unavailable. Try again later." }
  • 503 { "error": "x_api_unavailable", "message": "Xquik is busy right now. Retry shortly." }