> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xquik.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Twitter engagement rate API for X profiles

> Get a Twitter or X profile's engagement rate, average likes, replies, reposts and views per post, posting rate, and top post from its recent posts. 1 credit.

<Panel>
  <Tabs defaultTabIndex={0} sync={false}>
    <Tab title="200" id="response-x-user-engagement-insights-200">
      ```json theme={null}
      {
        "insights": {
          "userId": "11348282",
          "userName": "NASA",
          "followers": 92376187,
          "following": 115,
          "posts": 74336
        }
      }
      ```
    </Tab>

    <Tab title="400" id="response-x-user-engagement-insights-400">
      ```json theme={null}
      {
        "error": "invalid_input",
        "message": "Invalid input. Check the request body."
      }
      ```
    </Tab>

    <Tab title="401" id="response-x-user-engagement-insights-401">
      ```json theme={null}
      {
        "error": "unauthenticated",
        "message": "Authentication required."
      }
      ```
    </Tab>

    <Tab title="402" id="response-x-user-engagement-insights-402">
      ```json theme={null}
      {
        "error": "insufficient_credits",
        "message": "Insufficient credits. Top up or subscribe to continue."
      }
      ```
    </Tab>

    <Tab title="404" id="response-x-user-engagement-insights-404">
      ```json theme={null}
      {
        "error": "user_not_found",
        "message": "X user not found. Check the username."
      }
      ```
    </Tab>

    <Tab title="424" id="response-x-user-engagement-insights-424">
      ```json theme={null}
      {
        "error": "x_api_unavailable",
        "message": "X data source temporarily unavailable. Try again later."
      }
      ```
    </Tab>

    <Tab title="429" id="response-x-user-engagement-insights-429">
      ```json theme={null}
      {
        "error": "rate_limit_exceeded",
        "message": "Too many requests. Try again later.",
        "retryAfter": 60
      }
      ```
    </Tab>

    <Tab title="502" id="response-x-user-engagement-insights-502">
      ```json theme={null}
      {
        "error": "x_api_unavailable",
        "message": "X data source temporarily unavailable. Try again later."
      }
      ```
    </Tab>

    <Tab title="503" id="response-x-user-engagement-insights-503">
      ```json theme={null}
      {
        "error": "x_api_unavailable",
        "message": "Xquik is busy right now. Retry shortly."
      }
      ```
    </Tab>
  </Tabs>
</Panel>

<blockquote className="agent-llms-directive">
  For the complete documentation index, see <a href="/llms.txt">llms.txt</a>.
</blockquote>

<Callout icon="coins" color="#5c3327">
  **1 credit per report**, whatever it reads · A user X doesn't know is free · [All plans](https://xquik.com/#pricing) from \$0.00012/credit · Supports [guest paid reads](/guides/guest-wallets)
</Callout>

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://xquik.com/api/v1/x/users/nasa/insights" \
    -H "x-api-key: xq_your_api_key_here" | jq
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://xquik.com/api/v1/x/users/nasa/insights", {
    headers: { "x-api-key": "xq_your_api_key_here" },
  });
  const body = await response.json();
  if (!response.ok) throw new Error(JSON.stringify(body));

  const { insights } = body;
  console.log(
    `@${insights.userName}: ${insights.engagementRate}% engagement, ${insights.postsPerDay} posts a day`,
  );
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://xquik.com/api/v1/x/users/nasa/insights",
      headers={"x-api-key": "xq_your_api_key_here"},
  )
  body = response.json()
  if not response.ok:
      raise RuntimeError(body)

  insights = body["insights"]
  print(f'@{insights["userName"]}: {insights["engagementRate"]}% engagement, {insights["postsPerDay"]} posts a day')
  ```
</CodeGroup>

## A profile's engagement at a glance

Use `GET /x/users/{id}/insights` to size up an account before you work with it. Name the user by user ID, username, or
profile URL.

The report reads the profile's counts and its last 20 posts. Reposts and the pinned post stay out of the averages, so
they describe the account's own recent posts. Engagements are likes, replies, reposts, and quotes.

A rate is `null` when nothing divides it, such as a profile without posts of its own.

A protected account's posts are private. Its report has its counts and account age, `postsPrivate: true`, and a
`message` that says so, at the same 1 credit.

## Path parameters

<ParamField path="id" type="string" required>
  User ID, username with or without `@`, or URL-encoded profile URL, such as `x.com/nasa`. See
  [path IDs](/api-reference/overview#path-ids).
</ParamField>

## Headers

<ParamField header="x-api-key" type="string">
  Full account key. Sessions and OAuth also work.
</ParamField>

<ParamField header="Authorization" type="string">
  `Bearer xq_your_guest_key_here` for `paid_reads`.
</ParamField>

## Response

### 200 OK

<ResponseField name="insights" type="object">
  <ResponseField name="userId" type="string">
    ID of the profile.
  </ResponseField>

  <ResponseField name="userName" type="string">
    Username of the profile.
  </ResponseField>

  <ResponseField name="followers" type="number">
    Followers.
  </ResponseField>

  <ResponseField name="following" type="number">
    Accounts the user follows.
  </ResponseField>

  <ResponseField name="posts" type="number">
    Posts the user has made.
  </ResponseField>

  <ResponseField name="accountAgeDays" type="number | null">
    Whole days since the account joined X.
  </ResponseField>

  <ResponseField name="postsPrivate" type="boolean">
    `true` when only the account's followers see its posts. The report then has its counts only.
  </ResponseField>

  <ResponseField name="sample" type="object">
    The posts the averages read: `posts`, and when the `oldestAt` and `newestAt` of them went up.
  </ResponseField>

  <ResponseField name="averages" type="object | null">
    Likes, replies, reposts, quotes, bookmarks, views, and engagements per post. `null` without posts.
  </ResponseField>

  <ResponseField name="engagementRate" type="number | null">
    Average engagements per post, as a percent of followers.
  </ResponseField>

  <ResponseField name="engagementPerView" type="number | null">
    Engagements as a percent of views across the sample.
  </ResponseField>

  <ResponseField name="postsPerDay" type="number | null">
    Sampled posts per day, from the oldest one until now.
  </ResponseField>

  <ResponseField name="topPostId" type="string | null">
    The sampled post with the most engagements.
  </ResponseField>
</ResponseField>

<ResponseField name="message" type="string">
  Says why the report has counts only, for a protected account.
</ResponseField>

### 400 Invalid input

```json theme={null}
{ "error": "invalid_user_id" }
```

Send a user ID, a username, or a profile URL.

### 404 User not found

```json theme={null}
{ "error": "user_not_found", "message": "X user not found. Check the username." }
```

A user X doesn't know is free.

### 401 Unauthenticated

Anonymous requests get `WWW-Authenticate: Bearer` and a guest wallet checkout action. This is not a Payment challenge.

```json theme={null}
{ "error": "unauthenticated" }
```

### 402 Payment required

Account keys get account options. Guest keys get guest top-up only.
No checkout starts automatically. Confirm any payment action.

### 502 X API unavailable

```json theme={null}
{ "error": "x_api_unavailable" }
```

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

<Note>
  **Related.** [Tweet engagement insights](/api-reference/x/tweet-engagement-insights) · [Get user](/api-reference/x/twitter-profile-lookup) · [User timeline](/api-reference/x/user-tweets)
</Note>

<div className="related-api-links">
  <Accordion title="Related follower, list & community APIs" icon="link">
    * Profiles: [Search users](/api-reference/x/search-users) · [Search autocomplete](/api-reference/x/search-autocomplete) · [Get user](/api-reference/x/twitter-profile-lookup) · [Batch users](/api-reference/x/batch-users)
    * Followers: [Followers](/api-reference/x/followers) · [Following](/api-reference/x/following) · [Follower IDs](/api-reference/x/follower-ids) · [Following IDs](/api-reference/x/following-ids) · [Creator subscriptions](/api-reference/x/user-subscriptions) · [Affiliates](/api-reference/x/user-affiliates) · [Similar accounts](/api-reference/x/user-similar) · [Translate bio](/api-reference/x/user-bio-translation) · [User insights](/api-reference/x/user-engagement-insights) · [Verified followers](/api-reference/x/verified-followers) · [Followers you know](/api-reference/x/followers-you-know) · [Check follower](/api-reference/x/check-follower)
    * Lists: [Search lists](/api-reference/x/search-lists) · [User lists](/api-reference/x/user-lists) · [List memberships](/api-reference/x/user-list-memberships) · [List details](/api-reference/x/list-details) · [List members](/api-reference/x/list-members) · [List followers](/api-reference/x/list-followers)
    * Communities: [Find](/api-reference/x/community-find) · [Popular](/api-reference/x/community-popular) · [Topics](/api-reference/x/community-topics) · [Suggested](/api-reference/x/community-suggested) · [Details](/api-reference/x/community-info) · [Members](/api-reference/x/community-members) · [Member search](/api-reference/x/community-member-search) · [Moderators](/api-reference/x/community-moderators) · [Timeline](/api-reference/x/community-tweets) · [Media](/api-reference/x/community-media) · [Keyword search](/api-reference/x/community-search) · [Tweets search](/api-reference/x/community-tweets-search)
  </Accordion>
</div>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.