Common tasks

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:

  1. Check the HTTP status in export.headers before you treat prices.json as a successful export.
  2. Check generated_at in the file and the X-Export-Generated-At header. 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

ParameterUse
sideThe default is ask. all includes the other sides and the available valuations. mid returns only the CSCP valuations, which is a much smaller file.
currencyUSD, 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

  1. Save the ETag value from the response headers.
  2. Send that exact value in If-None-Match on the next request.
  3. 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 seeWhat to do
404Check app_id. The app is unknown.
503Retry after a minute. The first snapshot has not been built yet.

The Range header is ignored.

Next steps