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

> ## Agent Instructions
> Xintel agents pay for shared report bodies only via x402 — never profile, posts, or edges.
> Preferred flow: GET /api/intel/list → GET /api/intel/reports?username= (menu) → select=all|range with X-402-Payment.
> Docs: https://docs.xintel.aispace.bot — App: https://xintel.aispace.bot — Agent playbook: /agents.md

# Auth and payment

> How Xintel agent report calls authenticate — no session; x402 Payment-Required and X-402-Payment.

# Auth and payment (x402)

**Audience:** agents integrating pay-per-report.\
**Prerequisites:** understand [Quickstart](/agent-api/quickstart).

## No session for the agent SKU

Public agent report endpoints do **not** require:

* X OAuth
* SIWE / Credits session
* `INTEL_LIBRARY_SECRET`

Those are for humans and first-party app traffic. Agents pay only when requesting report **bodies**.

## Free vs paid

| Call                                             | Auth                                            |
| ------------------------------------------------ | ----------------------------------------------- |
| `GET /api/intel/list`                            | None                                            |
| `GET /api/intel/reports?username=` (no `select`) | None                                            |
| `GET …&select=all\|range`                        | x402 settle **or** library secret (first-party) |

If the request includes a valid `Authorization: Bearer <INTEL_LIBRARY_SECRET>`, the deployment treats it as the app and returns bodies **without** charging. Agents should not use that secret; it is not part of the public product.

## 402 challenge

Missing payment on a paid select returns **402** with an x402 v2 body roughly:

```json theme={null}
{
  "x402Version": 2,
  "error": "Payment required",
  "accepts": [
    {
      "protocol": "x402",
      "version": 2,
      "network": "eip155:8453",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "amount": "10000",
      "payTo": "0x…"
    }
  ],
  "extensions": {
    "chainId": 8453,
    "tokenDecimals": 6,
    "unitPriceUsd": 0.01,
    "reportCount": 1,
    "select": "all",
    "resource": "/api/intel/reports?username=…"
  }
}
```

`amount` is USDC base units (6 decimals). Network is **Base** (`8453`).

## Payment header

Retry with one of:

* `X-402-Payment: …`
* `X-Payment: …`

Production settlement goes through the deployment’s configured **facilitator** (`X402_FACILITATOR_URL`). Insufficient amount → `402` `insufficient_payment`. Reused payment id → `409` `payment_already_used`.

## Local test mode (operators only)

For local smoke tests the server may set:

```bash theme={null}
X402_AGENT_TEST_MODE=true
X402_AGENT_TEST_WALLET=0x…
```

Then settlement verifies an EIP-3009 signature **without** broadcasting on-chain. **Never enable test mode in production.** Do not put real keys in docs or commits. Repo helper: `npm run test:agent-intel` (`scripts/test-agent-intel-x402.mjs`).

## Related

* [Pricing](/agent-api/pricing)
* [Errors](/agent-api/errors)
* [Free / BYOK / x402](/concepts/free-byok-x402)
