> ## 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.

# X account connection status API & login challenges

> Poll a tracked X account connection until it succeeds, fails, or requests an email verification code. Wait for Retry-After between checks. Polling is free.

<Panel>
  <Tabs defaultTabIndex={0} sync={false}>
    <Tab title="200" id="response-x-accounts-connection-attempt-200">
      ```json theme={null}
      {
        "object": "x_account_connection_attempt",
        "id": "xatt_0123456789abcdef0123456789abcdef",
        "status": "pending",
        "pollAfterMs": 3000
      }
      ```
    </Tab>

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

    <Tab title="401" id="response-x-accounts-connection-attempt-401">
      ```json theme={null}
      {
        "error": "unauthenticated",
        "message": "Authentication required. Provide a valid API key or bearer token."
      }
      ```
    </Tab>

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

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

<Callout icon="circle-check" color="#16a34a">
  **Free.** This endpoint does not consume credits.
</Callout>

<Info>
  Check this endpoint after the connect response's `Retry-After` delay. You can
  call other Xquik routes while the connection continues. Do not send the credentials again
  while `status` is `pending`.
</Info>

<CodeGroup>
  ```bash cURL theme={null}
  curl https://xquik.com/api/v1/x/account-connection-attempts/xatt_0123456789abcdef0123456789abcdef \
    -H "x-api-key: xq_YOUR_KEY_HERE" | jq
  ```

  ```javascript Node.js theme={null}
  const attemptId = "xatt_0123456789abcdef0123456789abcdef";
  const response = await fetch(
    `https://xquik.com/api/v1/x/account-connection-attempts/${attemptId}`,
    {
      headers: {
        "x-api-key": "xq_YOUR_KEY_HERE",
      },
    },
  );
  const data = await response.json();
  ```

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

  attempt_id = "xatt_0123456789abcdef0123456789abcdef"
  response = requests.get(
      f"https://xquik.com/api/v1/x/account-connection-attempts/{attempt_id}",
      headers={"x-api-key": "xq_YOUR_KEY_HERE"},
  )
  data = response.json()
  ```

  ```go Go theme={null}
  package main

  import (
      "encoding/json"
      "fmt"
      "net/http"
  )

  func main() {
      attemptID := "xatt_0123456789abcdef0123456789abcdef"
      url := "https://xquik.com/api/v1/x/account-connection-attempts/" + attemptID
      req, err := http.NewRequest("GET", url, nil)
      if err != nil {
          panic(err)
      }
      req.Header.Set("x-api-key", "xq_YOUR_KEY_HERE")

      resp, err := http.DefaultClient.Do(req)
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()

      var data map[string]interface{}
      if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
          panic(err)
      }
      fmt.Println(data)
  }
  ```
</CodeGroup>

## Headers

<ParamField header="x-api-key" type="string" required>
  Your API key. Session cookie authentication is also supported. Generate a key
  from the [dashboard](https://xquik.com/dashboard).
</ParamField>

## Path

<ParamField path="id" type="string" required>
  Connection attempt ID from the `202 pending` connect response.
</ParamField>

## Response

Every `200` response includes `Cache-Control: no-store`.

### 200 Pending

<ResponseField name="object" type="string">
  Always `x_account_connection_attempt`.
</ResponseField>

<ResponseField name="id" type="string">
  Connection attempt ID.
</ResponseField>

<ResponseField name="status" type="string">
  Always `pending`.
</ResponseField>

<ResponseField name="pollAfterMs" type="integer">
  Milliseconds to wait before checking again.
</ResponseField>

```json theme={null}
{
  "object": "x_account_connection_attempt",
  "id": "xatt_0123456789abcdef0123456789abcdef",
  "status": "pending",
  "pollAfterMs": 3000
}
```

The response includes `Retry-After: 3`. Wait, then check the same attempt.

### 200 Success

<ResponseField name="object" type="string">
  Always `x_account_connection_attempt`.
</ResponseField>

<ResponseField name="id" type="string">
  Connection attempt ID.
</ResponseField>

<ResponseField name="status" type="string">
  Always `success`.
</ResponseField>

```json theme={null}
{
  "object": "x_account_connection_attempt",
  "id": "xatt_0123456789abcdef0123456789abcdef",
  "status": "success"
}
```

The account is ready. Call [List X Accounts](/api-reference/x-accounts/list)
if you need its account ID.

### 200 Email code required

<ResponseField name="object" type="string">
  Always `x_account_connection_challenge`.
</ResponseField>

<ResponseField name="id" type="string">
  Challenge ID, not the attempt ID.
</ResponseField>

<ResponseField name="status" type="string">
  Always `requires_email_code`.
</ResponseField>

<ResponseField name="expiresAt" type="string">
  ISO 8601 challenge expiration time.
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable next step.
</ResponseField>

<ResponseField name="username" type="string">
  X username being connected.
</ResponseField>

```json theme={null}
{
  "object": "x_account_connection_challenge",
  "id": "xch_8vGd8Y9JvH6dV0xA",
  "status": "requires_email_code",
  "expiresAt": "2026-05-08T12:10:00Z",
  "message": "Enter the email verification code to continue.",
  "username": "your_x_username"
}
```

Submit the newest code to [Submit X Account Email Code](/api-reference/x-accounts/submit-challenge).

### 200 Failed

<ResponseField name="object" type="string">
  Always `x_account_connection_attempt`.
</ResponseField>

<ResponseField name="id" type="string">
  Connection attempt ID.
</ResponseField>

<ResponseField name="status" type="string">
  Always `failed`.
</ResponseField>

<ResponseField name="error" type="string">
  Stable public error code.
</ResponseField>

<ResponseField name="reason" type="string">
  More specific reason when available.
</ResponseField>

<ResponseField name="retryable" type="boolean">
  Whether you can attempt another connect request.
</ResponseField>

```json theme={null}
{
  "object": "x_account_connection_attempt",
  "id": "xatt_0123456789abcdef0123456789abcdef",
  "status": "failed",
  "error": "service_unavailable",
  "retryable": true
}
```

Stop checking this attempt. Start a new connection only when `retryable` is `true`.

### 400 Invalid input

```json theme={null}
{ "error": "invalid_input", "message": "Invalid connection attempt ID. Check the path parameter." }
```

The attempt ID is malformed, unavailable, or belongs to another account.
Xquik does not keep attempts forever. Save the final result.

### 401 Unauthenticated

```json theme={null}
{ "error": "unauthenticated", "message": "Missing or invalid API key" }
```

The API key is missing or invalid.

### 429 Rate limited

```json theme={null}
{
  "error": "rate_limit_exceeded",
  "message": "Too many requests. Try again later.",
  "retryAfter": 1
}
```

Wait for `Retry-After` before checking again.

<Note>
  **Related.** [Connect X Account](/api-reference/x-accounts/connect) starts the
  attempt. [Submit X Account Email Code](/api-reference/x-accounts/submit-challenge)
  completes an email challenge.
</Note>


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