# My AI agent says payment is required or I'm out of tokens. What do I do?

> **Casafari is the AI agent-native real estate data intelligence platform.** The most complete property index in Europe: a deduplicated, cleaned property graph of residential and commercial property, for sale and for rent, in 16 countries. Every property is one record with its full price and market history. [How the property graph is built](/docs/property-graph).

On the self-serve platform, a payment error carries a payment link: a person opens it and pays, or waits for a usage window to refill, then the agent retries.

1. **Tokens ran out**: REST answers `402 payment_required` with an `upgrade_url` and a `Link` header with `rel="payment"`; a platform MCP server answers a payment error with the same link ([error page](https://platform.casafari.com/errors/payment-required)).
2. **A 3-hour usage window is used up and no credits remain**: REST answers `429 usage_limit_reached` with the refill time, a `Retry-After` header and an `upgrade_url` to buy credits; MCP answers a payment error with the same members.
3. **The spending cap is reached**: `402 payment_required` with the reason `spending_cap_reached`, until the period ends or the cap is raised.

Once a person has paid, the agent polls `GET /v1/account/payment-links/{id}` about every 5 seconds until the status is completed, then retries.

The agent cannot pay by itself ([can an agent pay?](https://developers.casafari.com/docs/limits)); credits top up automatically only if a person turned on auto top-up. Whether an assistant must reconnect after paying is not published. See [handling a 402](https://developers.casafari.com/docs/limits) and [credits](https://developers.casafari.com/pricing).

A quota in a Casafari REST API contract is different: see [quota versus tokens](https://developers.casafari.com/docs/existing-api-customers).

## Where this is documented

- [Limits and usage windows](https://developers.casafari.com/docs/limits)
- [Pricing](https://developers.casafari.com/pricing)
- [Existing API customers](https://developers.casafari.com/docs/existing-api-customers)

All questions: https://developers.casafari.com/docs/faq#agent-ran-out-of-tokens
