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

# Top up guest wallet credits for X API reads

> Create a USD 10-250 hosted checkout to add tweet, profile, follower, reply, timeline, community, and list read credits to a guest key. It charges nothing.

<Panel>
  <Tabs defaultTabIndex={0} sync={false}>
    <Tab title="201" id="response-guest-wallets-topup-201">
      ```json theme={null}
      {
        "account_required": false,
        "amount": {
          "amount_minor": 1000,
          "currency": "usd"
        },
        "checkout_url": "https://checkout.example/guest/example",
        "credits": "66666",
        "expires_at": "2026-07-13T13:00:00.000Z",
        "instructions": "Give checkout_url to the user. They must complete payment on the hosted checkout page. Never submit payment for them. After payment, poll status_url every poll_after_seconds until latest_purchase.status is no longer pending.",
        "poll_after_seconds": 2,
        "purchase_id": "gp_example",
        "requires_user_interaction": true,
        "status": "pending"
      }
      ```
    </Tab>

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

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

    <Tab title="409" id="response-guest-wallets-topup-409">
      ```json theme={null}
      {
        "error": "idempotency_conflict",
        "message": "Reuse this Idempotency-Key only with the original request."
      }
      ```
    </Tab>

    <Tab title="410" id="response-guest-wallets-topup-410">
      ```json theme={null}
      {
        "error": "checkout_unavailable",
        "message": "Checkout unavailable. Retry with a new Idempotency-Key."
      }
      ```
    </Tab>

    <Tab title="413" id="response-guest-wallets-topup-413">
      ```json theme={null}
      {
        "error": "body_too_large",
        "message": "Request body is too large."
      }
      ```
    </Tab>

    <Tab title="415" id="response-guest-wallets-topup-415">
      ```json theme={null}
      {
        "error": "unsupported_media_type",
        "message": "Send Content-Type: application/json."
      }
      ```
    </Tab>

    <Tab title="423" id="response-guest-wallets-topup-423">
      ```json theme={null}
      {
        "error": "guest_wallet_unavailable",
        "message": "Guest wallet unavailable. Create a new wallet or contact support."
      }
      ```
    </Tab>

    <Tab title="429" id="response-guest-wallets-topup-429">
      ```json theme={null}
      {
        "error": "rate_limited",
        "message": "Try again later."
      }
      ```
    </Tab>

    <Tab title="503" id="response-guest-wallets-topup-503">
      ```json theme={null}
      {
        "error": "guest_wallets_unavailable",
        "message": "Guest wallet checkout is temporarily unavailable."
      }
      ```
    </Tab>
  </Tabs>
</Panel>

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

Add credits to an existing guest wallet. The wallet keeps the same `paid_reads` key. This endpoint creates a one-use hosted checkout only after the user confirms the amount. It does not charge the user.

<Warning>
  Never call this endpoint automatically after a `402`. Show the available option and amount, then wait for the user to confirm.
</Warning>

<CodeGroup>
  ```bash cURL theme={null}
  idempotency_key=$(uuidgen | tr '[:upper:]' '[:lower:]')
  curl -X POST https://xquik.com/api/v1/guest-wallets/topups \
    -H "Authorization: Bearer xq_your_guest_key_here" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: $idempotency_key" \
    -d '{"amount_minor": 2500, "currency": "usd"}' | jq
  ```
</CodeGroup>

Keep the current guest key and store the new `Idempotency-Key` as a secret. Give only `checkout_url` to the user. After payment, poll `status_url` every `poll_after_seconds` with the same key. Stop when `latest_purchase.status` is no longer `pending`. Use `usable` to decide whether paid reads can run.

## Headers

<ParamField header="Authorization" type="string" required>
  Send the guest key as `Bearer xq_your_guest_key_here`.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be `application/json`.
</ParamField>

<ParamField header="Idempotency-Key" type="string" required>
  A new cryptographically random UUID v4. Reuse it only for an exact retry of this top-up request.
</ParamField>

## Body

<ParamField body="amount_minor" type="integer" required>
  Confirmed USD amount in cents. Minimum `1000` and maximum `25000`.
</ParamField>

<ParamField body="currency" type="string" required>
  Must be `usd`.
</ParamField>

## Response

<ResponseField name="account_required" type="boolean">
  Always `false`.
</ResponseField>

<ResponseField name="amount" type="object">
  Confirmed amount in minor units and `usd` currency.
</ResponseField>

<ResponseField name="checkout_url" type="string">
  One-use hosted checkout URL for the user to open.
</ResponseField>

<ResponseField name="credits" type="string">
  Credits to grant after verified payment.
</ResponseField>

<ResponseField name="expires_at" type="string">
  Pending checkout expiry.
</ResponseField>

<ResponseField name="instructions" type="string">
  Required user interaction and polling guidance.
</ResponseField>

<ResponseField name="purchase_id" type="string">
  Guest purchase ID.
</ResponseField>

<ResponseField name="status_url" type="string">
  Guest wallet status URL.
</ResponseField>

<ResponseField name="poll_after_seconds" type="integer">
  Minimum polling delay. Always `2` while pending.
</ResponseField>

<ResponseField name="requires_user_interaction" type="boolean">
  Always `true`.
</ResponseField>

<ResponseField name="status" type="string">
  Initial top-up status. Normally `pending`.
</ResponseField>

<ResponseField name="wallet_id" type="string">
  Existing guest wallet ID.
</ResponseField>

<Tabs>
  <Tab title="201 Created">
    ```json theme={null}
    {
      "account_required": false,
      "amount": { "amount_minor": 2500, "currency": "usd" },
      "checkout_url": "https://checkout.example/guest/example",
      "credits": "166666",
      "expires_at": "2026-07-13T13:00:00.000Z",
      "instructions": "Give checkout_url to the user. They must complete payment on the hosted checkout page. Never submit payment for them. After payment, poll status_url every poll_after_seconds until latest_purchase.status is no longer pending.",
      "poll_after_seconds": 2,
      "purchase_id": "gp_example",
      "requires_user_interaction": true,
      "status": "pending",
      "status_url": "https://xquik.com/api/v1/guest-wallets/status",
      "wallet_id": "gw_example"
    }
    ```

    This response never returns a new API key.
  </Tab>

  <Tab title="400 Invalid input">
    Check the UUID v4 header, amount, currency, JSON, and request fields.
  </Tab>

  <Tab title="401 Unauthenticated">
    The guest key is missing or invalid.
  </Tab>

  <Tab title="409 Idempotency conflict">
    You used the same `Idempotency-Key` for a different request.
  </Tab>

  <Tab title="410 Checkout unavailable">
    The checkout expired or no longer works.
  </Tab>

  <Tab title="413 Request too large">
    Reduce the request body, then retry with the same `Idempotency-Key`.
  </Tab>

  <Tab title="415 Unsupported media type">
    Send `Content-Type: application/json`.
  </Tab>

  <Tab title="423 Wallet unavailable">
    The wallet is unavailable. Check guest wallet status before taking another action.
  </Tab>

  <Tab title="429 Rate limited">
    Wait for `Retry-After` before retrying the same request.
  </Tab>

  <Tab title="503 Checkout unavailable">
    Checkout is temporarily unavailable. Retry with the same `Idempotency-Key`.
  </Tab>
</Tabs>

The response sends `Cache-Control: no-store, private`. An exact replay also sends `Idempotent-Replayed: true`.

<Note>
  **Related.** [Guest wallet guide](/guides/guest-wallets) · [Create guest wallet](/api-reference/guest-wallets/create) · [Get guest wallet status](/api-reference/guest-wallets/status)
</Note>


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