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

# Production integration

> Keep keys private, pace requests, and handle cached and incomplete source data.

## Use a server-side integration

Keep your XAPI China key in a server environment variable or secret manager. Your frontend calls your own backend, which makes authenticated XAPI requests. Cache or store the fields your application needs without exposing the key to visitors.

Use separate key labels for environments so you can revoke one integration independently. They still share the account's request quota and rate limit.

## Set timeouts and retry selectively

* Set connection and overall request timeouts.
* Honor `Retry-After` on throttling or temporary-service errors.
* Retry transient `502`/`503` responses with bounded backoff and jitter.
* Correct `401`, `404`, and `422` responses before trying again.
* Stop monthly-quota retries until the allowance renews or the plan changes.

Prefer a shared queue over bursts from many workers, especially on the Free plan's five requests per minute.

## Cache useful responses

The backend's default cache periods are 30 minutes for searches/catalogs, one hour for vehicle details, and one day for inspection reports. These are configurable server settings. Stale cached data may be served during upstream failures.

Cache useful results in your integration as well. Reuse the `photos` already returned in a detail response instead of making an unnecessary image request. A successful cached API response still counts against quota.

## Preserve source context

Retain listing IDs, source URLs, native fields, report provider names, dates, and coverage indicators. Listings can change or disappear, exchange rates can change, and report links can expire. Recheck price and availability when they matter to your workflow.

Keep unknown data unknown. Do not show a vehicle as accident-free merely because report data is unavailable or an insurance-event lookup returned no records.

## Monitor usage

Use [Dashboard → Usage](https://xapichina.com/dashboard/usage) for recent requests and monthly consumption. `GET /v1/me` checks your current allowance without using a data request. Rotate exposed keys promptly from the dashboard.

## Reusable examples

The [Python client example](/python-integration) and [Node.js fetch example](/javascript-integration) show timeouts, selective retries, pagination budgets, and report coverage handling. They use regular HTTP clients and the same endpoint contract as the interactive reference.


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