Export prices
Download the price snapshot of a whole game as one file and skip the download when the snapshot has not changed.
Use GET /prices/export when you need the prices of a whole game. It returns a prebuilt JSON document compressed with gzip.
Before you begin, complete Your first request. The command below uses the CSCHEAP_API_KEY environment variable set there. Check Request costs before you run repeated requests.
Download the snapshot
curl --compressed --get 'https://api.cs.cheap/prices/export' \
--header "Authorization: Bearer $CSCHEAP_API_KEY" \
--data-urlencode 'app_id=730' --data-urlencode 'side=all' \
--dump-header export.headers --output prices.json--compressed decompresses the response. To verify the download:
- Check the HTTP status in
export.headersbefore you treatprices.jsonas a successful export. - Check
generated_atin the file and theX-Export-Generated-Atheader. The server rebuilds the snapshot every few minutes, not at download time.
The document has no data envelope. Billing metadata is in the response headers.
Choose the side and currency
| Parameter | Use |
|---|---|
side | The default is ask. all includes the other sides and the available valuations. mid returns only the CSCP valuations, which is a much smaller file. |
currency | USD, CNY, or RUB. It sets the currency of the converted amounts and of the CSCP quotes. |
currency defaults to the base currency of your account, and to USD when no base currency is set. Each currency is a separate file with its own ETag.
For all constraints, see the Export all item prices reference.
Avoid downloading unchanged data
- Save the
ETagvalue from the response headers. - Send that exact value in
If-None-Matchon the next request. - On
304, keep your previous file. Do not replace it with the empty output.
A 304 has no body and costs no credits. Rate limiting still applies. Every 200 follows normal export billing, even if the file is unchanged.
Handle exceptions
| What you see | What to do |
|---|---|
404 | Check app_id. The app is unknown. |
503 | Retry after a minute. The first snapshot has not been built yet. |
The Range header is ignored.
Next steps
- Polling and retries to refresh the export regularly.