# CS2 Screenshot API

WOK renders supported CS2 weapon and knife skins locally from game materials.
No external screenshot provider, Steam request or residential proxy is used.

- `POST /v1/cs2/screenshots` creates or reuses a render.
- `GET /v1/cs2/screenshots/{job_id}` retrieves it with the same WOK API key.
- `GET /steam/api/screenshot` accepts equivalent query parameters for integrations migrating from a similar interface. Use Bearer authentication.
- Existing `/v1/cs2/screenshot` and `/steam/api/float/screenshot` remain **inspect data cards**, with their existing response and access rules.

The new image renderer is available with active Free and paid WOK keys. Creating
or retrying a screenshot request consumes one ordinary API request. Polling an
existing job does not spend additional API credits. Retrievals have a separate
per-minute limit matching the key rate (capped at 1,500). PNG retrieval supports
`If-None-Match` / `304` to avoid sending an unchanged image again. It does not spend the separate
3D viewer allowance. Queue and rate limits still apply.

## First request

```bash
curl 'https://woksteamapi.com/v1/cs2/screenshots' \
  -H "Authorization: Bearer $WOK_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"def_index":7,"paint_index":282,"float_value":0.21,"paint_seed":582,"mode":"both"}'
```

For an actual item, send `{"inspect_link":"YOUR_SELF_CONTAINED_INSPECT_LINK"}` instead
of manual item parameters. A hex `certificate` or `url` alias is also accepted.
Old S/M links requiring a Game Coordinator lookup are explicitly rejected; there
is no guessed AK-47 fallback. Gloves and unavailable weapon/paint pairs return errors.

A cold request returns **202 JSON** containing `job_id`, `result_url`, `status`,
`expires_at`, `item`, `limitations`, `unrendered_details`, and
`exact_item_rendered: false`. Wait for the `Retry-After` delay, then fetch
`result_url` with the same Authorization header. A ready result is **200 image/png**.
Always check status and Content-Type before saving the body as an image.

```bash
curl 'https://woksteamapi.com/v1/cs2/screenshots/JOB_ID?format=download' \
  -H "Authorization: Bearer $WOK_API_KEY" -D response-headers.txt -o screenshot-response
```

Repeating the same visual request with the same key reuses its job. Equivalent
requests from different customers share the render, but each customer's job is
protected by their API key. Save successful images in your own storage.

## Options

| Parameter | Default | Values |
| --- | --- | --- |
| `mode` | `both`, or `front` with transparent view | `front`, `back`, `both` |
| `view` | Omitted | `transparent` removes the background and info panel |
| `width` | 1280 | Integer 256–2048 pixels |
| `background_color` | `#191817` | Hex `#RRGGBB`; incompatible with transparent view |
| `with_float` | true at widths ≥960, otherwise false; false for transparency | Boolean; info panel requires width ≥960 |
| `item_name`, `paint_name` | Game catalog names | Optional labels, up to 64 characters each |
| `format` | `screen` | `download` for an attachment; `base64` for JSON containing metadata and a PNG data URL |
| `strict` | false | Reject items with currently unsupported applied attachments or StatTrak geometry |

Both-side transparent PNGs are supported. Height scales with width and number of
sides; a float panel adds 110 pixels. URLs for remote backgrounds are not accepted.

## Visual fidelity

The image contains the weapon geometry with its composited skin, float and seed.
Game lighting and pearlescence may differ. **Applied stickers, charms and StatTrak
geometry are not rendered yet.** Their decoded values are reported in JSON
`unrendered_details`; `strict=true` rejects such requests. PNG metadata and response
headers identify this as a WOK material render, with `X-Wok-Exact-Item-Rendered: false`.
This is not a screenshot captured inside a running CS2 game client.

## Limits and errors

One render worker runs independently of inventory/price handling, with a bounded
16-job queue and at most two pending jobs per key. Identical requests do not create
additional renders. Results are retained for up to three hours; the shared cache
is limited to 256 MiB / 256 renders and may evict older results earlier.

- `401/403`: key invalid, inactive or expired.
- `404`: unsupported weapon/paint, unknown job or evicted result.
- `410`: expired image/session.
- `422`: invalid options or details rejected by strict mode.
- `429`: account quota/rate limit or two pending jobs already exist.
- `503`: render queue full or rendering failed; respect `Retry-After`.

The queue does not increase the request timeout on inventory endpoints. There is
no unlimited local archive of skins, float values or pattern permutations.

## Specialist subscriptions

Screenshot creation is included in Free and all-purpose subscriptions. Specialist Inventory, Prices and Players keys include their published endpoint list and browser 3D with branding, but do not include server screenshot generation. Use `GET /v1/key` to read the scope before integration; an excluded method returns HTTP 403 without spending quota.
