Skip to main content
POST https://xquik.com/api/v1/x/analysis/sentiment
2 credits per analyzed post · All plans from $0.00012/credit · Supports guest paid reads
Sentiment analysis reads each post with AI and answers 4 questions about it. The endpoint is POST /api/v1/x/analysis/sentiment.
The snippets build 1 row per analyzed post and print the totals. They do not print the full response.

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.Your own texts come back with the IDs text:1, text:2, and so on.

Read the sentiment answers

results[].answers holds each decision by question ID. Store it beside the post.Upbeat deals, ads, and giveaways that state no opinion count as neutral. intensity judges wording, emphasis, and emoji, not engagement counts. It can have decimals, such as 1.4 between measured and emphatic. sarcasm is high when the literal wording contradicts the intended attitude. emotion names the main emotion the author expresses. Quoted people’s emotions don’t count. It is none when the post states facts or asks a question without emotion. analysisSummary.questions.emotion counts each emotion across the page. results[].analysis.answers adds the confidence of each answer. It also adds the probability of each category or level. Use it to set your own thresholds.

Judge the attitude toward a brand

Name the brand, person, or product in analysis.targets, with its aliases. The AI then judges the attitude toward that target. Without targets, it judges the attitude toward the post’s main subject. analysisSummary.targets counts each target’s mentions and sentiment categories. It also lists the most engaged posts per category.

Track sentiment over time

analysisSummary.questions.sentiment counts posts per category. shares holds each category’s share of posts, and engagementShares its share of engagement. Store both per run to chart a trend. To read 1 day, send sinceTime and untilTime with the search. Send username to follow 1 account’s posts.

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.

Ask your own questions

Send analysis.questions to ask questions of your own. They replace the 3 sentiment questions, and the price stays the same. A choice picks 1 category, and a score picks 1 level. A probability answers yes or no. Write question IDs and category names in lower case without hyphens, such as feature_request.

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": "Send only 1 of tweetIds, texts & a search such as query or username." } 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.

Twitter sentiment analysis API questions

How do I analyze the sentiment of tweets?

Send a search in query, or post IDs in tweetIds, to this endpoint. Each row in results holds the post and its sentiment, intensity, and sarcasm answers.

Can I measure the sentiment toward my brand?

Yes. Name the brand in analysis.targets, with its product names as aliases. The AI judges the attitude toward the brand, and analysisSummary.targets counts its mentions.

Does it detect sarcasm?

Yes. sarcasm is the probability that the literal wording contradicts the intended attitude. It runs from 0 to 1. Read it beside sentiment before you act on a post.

Can I check a draft before I post it?

Yes. Send the draft in texts. Xquik reads nothing from X, and each text costs 2 credits.

How much does sentiment analysis cost?

Each analyzed post costs 2 credits. 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. Market signals reads stock and crypto stances. Search Tweets previews the posts a query returns.

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." }