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

# Real-time Catalog

> Learn how to expose REST API endpoints on your game backend to power personalized web shops with real-time offers. This guide covers the Catalog, Player, and Purchase APIs with protobuf-based type-safe integration.

The Stash v1 WebShop APIs enable game studios to power dynamic, player-personalized web shops with special offers. These protobuf-based APIs provide a robust, type-safe integration path that accelerates development while ensuring reliability at scale.

```mermaid theme={null}
sequenceDiagram
actor Player
participant WebShop as Stash WebShop
participant Stash as Stash Servers
participant GameBackend as Game Backend

Player->>WebShop: Visit webshop
WebShop->>Stash: Request catalog

rect rgb(220, 220, 240)
Note over Stash,GameBackend: Real-time Catalog APIs
Stash->>GameBackend: GET /api/v1/catalog
GameBackend->>Stash: Return personalized catalog
Stash->>GameBackend: GET /api/v1/player (optional)
GameBackend->>Stash: Return player profile
end

Stash->>WebShop: Deliver catalog
WebShop->>Player: Show personalized offers

Player->>WebShop: Start purchase
WebShop->>Stash: Process payment

rect rgb(220, 240, 220)
Note over Stash,GameBackend: Purchase APIs
Stash->>GameBackend: POST /api/v1/purchase/register
GameBackend->>Stash: Reserve inventory
Note over Stash: Payment processed
Stash->>GameBackend: POST /api/v1/purchase/confirm
GameBackend->>Stash: Grant items, confirm
end

Stash->>WebShop: Transaction complete
WebShop->>Player: Show success
```

## In this guide

This page covers setup, authentication, and configuration. The rest of the guide is split by topic:

> [card] [Endpoints](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md)
>
> The Catalog, Purchase, and Player API endpoints Stash calls on your backend.

> [card] [Payment Flow](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/payment-flow.md)
>
> Where the money is at each step, and why ConfirmPayment is required.

> [card] [Catalog Items and Prices](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/items-and-prices.md)
>
> Item types, prices, purchase packs, and web store bonuses.

> [card] [Free Items and Streaks](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/free-items.md)
>
> Free item claims and streaks tracked by Stash.

> [card] [Localization and Text](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/localization-and-text.md)
>
> Localized text, formatted text, and the shop banner.

> [card] [Offer Templates](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/offer-templates.md)
>
> Template and slot names for rewards, buy buttons, and text.

> [card] [Drop Rate Compliance](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/drop-rates.md)
>
> Info buttons, drop rates tooltips, and the offer details popup.

> [card] [Caching](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/caching.md)
>
> How long Stash caches your catalog response, and forcing a refresh.

## Getting Started

You can integrate the v1 APIs in two ways. Both produce the same endpoints; pick whichever fits your stack, then follow the [Integration Steps](#integration-steps) below to roll it out.

> [tab] Auto-generate clients (recommended)
>
> Clone the [proto repository](https://github.com/stashgg/public-api) and generate type-safe clients automatically:
>
> ```bash theme={null}
> # Add the public-api repo as a submodule in your backend repo
> git submodule add https://github.com/stashgg/public-api.git
> # Or just clone it locally
> git clone https://github.com/stashgg/public-api.git
>
> # Generate clients using the included script
> cd public-api
> ./gen.sh
> ```
>
> The `gen.sh` script generates clients for Go, TypeScript, and OpenAPI specs. Adapt it for your preferred language (C#, Java, Python, etc.) using standard protobuf tooling.
>
> > [!NOTE]
> >
> > **No documentation required**: The generated clients provide full type
> > definitions, so your IDE's autocomplete guides the integration.

> [tab] Hand-rolled from API reference
>
> Implement the REST endpoints described in the [API Reference](https://docs.stash.gg/api/egress.md) directly in your preferred language without code generation. This gives you maximum control over your client code at the cost of more upfront work.
>
> The [proto repository](https://github.com/stashgg/public-api) is still a useful source of truth for field types, enum values, and validation rules, even if you don't run `gen.sh`.

### Integration Steps

**1. Obtain API credentials**

Your Stash engineering partner will generate an Egress API key for you in [Stash Studio](https://studio-test.stash.gg). Set your Game Backend URL in Stash Studio to match where the APIs will be hosted. Custom API endpoint paths can be configured if needed.

**2. Generate clients or review the API reference**

Use the proto repository to generate type-safe clients, or review the [API Reference](https://docs.stash.gg/api/egress.md) for detailed endpoint documentation.

**3. Implement the required endpoints**

At minimum, implement these endpoints on your game backend:

**Required:**

* [GetCatalog](https://docs.stash.gg/api/egress/catalog/getcatalog.md): Returns the product catalog
* [ConfirmPayment](https://docs.stash.gg/api/egress/purchase/confirmpayment.md): Powers both WebShop and StashPay

**Register and cancel (on by default, optional per shop):**

Stash calls these two as a pair. Implement both, or ask your Stash engineering partner to turn them off for your shop. See [Register and cancel are optional](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#register-and-cancel-are-optional).

* [RegisterPayment](https://docs.stash.gg/api/egress/purchase/registerpayment.md): Reserves inventory across all game/shop clients
* [CancelPayment](https://docs.stash.gg/api/egress/purchase/cancelpayment.md): Releases inventory reservation locks

**Optional**:

* [GetOfferDetails](https://docs.stash.gg/api/egress/catalog/getofferdetails.md): Show extra details like drop rates for legal compliance
* [GetPlayer](https://docs.stash.gg/api/egress/players/getplayer.md): Show player-specific details like avatar, level, in-game currency balances

**4. Test with test credentials**

Test your integration with your [studio-test.stash.gg](https://studio-test.stash.gg) credentials before going live.

## API Overview

The v1 APIs are organized into three services, exposed as REST endpoints. Stash sends requests to your Game Studio's backend servers:

```mermaid theme={null}
flowchart TB
subgraph APIs[Stash WebShop APIs]
direction LR
subgraph Catalog[Catalog API]
C1[GetCatalog]
C2[GetOfferDetails]
end
subgraph Purchase[Purchase API]
P1[RegisterPayment]
P2[ConfirmPayment]
P3[CancelPayment]
end
subgraph Player[Player API]
PL1[GetPlayer]
end
end
```

All endpoints use **HMAC authentication** for secure server-to-server communication.

### JSON wire format

Stash reads your responses leniently:

* **Field names:** camelCase as shown in the API reference (`productId`) or snake\_case (`product_id`). Both are accepted, also within one response.
* **Enum values:** the value's name (`"CONTENT_ITEM_TYPE_WEB_STORE_BONUS"`) or its number (`1`). An enum name Stash does not recognize is ignored, and the field keeps its default value.
* **Unknown fields:** ignored. Extra fields in your response do not cause an error.

## Authentication

Stash authenticates outgoing requests to your game backend using a versioned HMAC-SHA256 signature in the `x-stash-hmac-signature` header:

```text theme={null}
x-stash-hmac-signature: v1;<appId>;<unixMillisTimestamp>;<base64-hmac>
```

| Field | Description |
| :- | :- |
| `v1` | Protocol version |
| `<appId>` | Your immutable App ID (Studio → Project Settings → General) |
| `<unixMillisTimestamp>` | Request timestamp in Unix milliseconds |
| `<base64-hmac>` | Standard base64-encoded HMAC-SHA256 signature |

The signature covers `"<unixMillisTimestamp>." + <body>`, where `<body>` is the exact bytes Stash transmits: empty string for GET requests, raw request body for POST requests. The HMAC key is your egress secret base64-decoded: the value shown in Studio → Project Settings → API Keys is base64-encoded; decode it before computing the HMAC (e.g. `Buffer.from(secret, 'base64')`). Reject requests where `<unixMillisTimestamp>` is more than 5 minutes from your server clock.

### Verifying the signature

For Node.js, Python, and Go implementation code, see [API Keys → HMAC Verification](https://docs.stash.gg/guides/get-started/stash-api-keys/overview.md#hmac-verification).

> [!NOTE]
>
> New shops (created on or after 2026-08-15) receive only `x-stash-hmac-signature`. The legacy unversioned `stash-hmac-signature` header is no longer emitted for them. New integrations should verify `x-stash-hmac-signature` only.

> [!WARNING]
>
> If you've implemented HMAC authentication and your game backend is still
> responding to Stash's API requests with 3xx, 4xx, or 5xx error codes, you may
> need to allowlist `test-api.stash.gg` and `api.stash.gg` on your cloud network
> firewall.

## Configuration

To configure your Real-time Catalog endpoint in Stash Studio:

**1. Navigate to game settings**

In Stash Studio, navigate to your game settings.

**2. Open App Backend**

Go to **Project Settings** → **App Backend**

**3. Set endpoint URL**

Set your Game Backend URL to match where the Catalog & Purchase APIs will be hosted.

**4. Configure authentication**

Your Stash engineering partner can configure custom API endpoint paths if needed.

## Debugging & Logs

Stash Studio provides comprehensive logging and debugging tools for your Real-time Catalog. Use these tools to monitor your catalog endpoint and troubleshoot issues:

* Check Stash Studio logs for endpoint response times
* Verify your endpoint returns valid JSON
* Ensure all required fields are present
* Test with your studio-test credentials before going live

> [accordion] Links to relocated sections
>
> [catalog api](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#catalog-api)
>
> [getcatalog](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#getcatalog)
>
> [getofferdetails](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#getofferdetails)
>
> [purchase api](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#purchase-api)
>
> [purchase flow](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#purchase-flow)
>
> [register and cancel are optional](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#register-and-cancel-are-optional)
>
> [registerpayment](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#registerpayment)
>
> [confirmpayment](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#confirmpayment)
>
> [cancelpayment](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#cancelpayment)
>
> [loyalty snapshot on purchase requests](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#loyalty-snapshot-on-purchase-requests)
>
> [player api](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#player-api)
>
> [getplayer](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#getplayer)
>
> [player level](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#player-level)
>
> [in game currency balances](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/endpoints.md#in-game-currency-balances)
>
> [key data types](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/items-and-prices.md)
>
> [catalog items](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/items-and-prices.md#catalog-items)
>
> [prices](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/items-and-prices.md#prices)
>
> [minor unit standard](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/items-and-prices.md#minor-unit-standard)
>
> [studio price lookup](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/items-and-prices.md#studio-price-lookup)
>
> [purchase packs](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/items-and-prices.md#purchase-packs)
>
> [web store bonuses](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/items-and-prices.md#web-store-bonuses)
>
> [free items and claim identity](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/free-items.md)
>
> [streaks tracked by stash](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/free-items.md#streaks-tracked-by-stash)
>
> [localization](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/localization-and-text.md#localization)
>
> [formatted text](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/localization-and-text.md#formatted-text)
>
> [shop banner](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/localization-and-text.md#shop-banner)
>
> [offer templates with named slots](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/offer-templates.md)
>
> [template choice](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/offer-templates.md#template-choice)
>
> [reward slots](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/offer-templates.md#reward-slots)
>
> [buy button slots](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/offer-templates.md#buy-button-slots)
>
> [text slots](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/offer-templates.md#text-slots)
>
> [slots on purchase packs](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/offer-templates.md#slots-on-purchase-packs)
>
> [drop rate compliance](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/drop-rates.md)
>
> [info buttons](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/drop-rates.md#info-buttons)
>
> [links in drop rates tooltips](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/drop-rates.md#links-in-drop-rates-tooltips)
>
> [enabling drop rate display](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/drop-rates.md#enabling-drop-rate-display)
>
> [example catalogpurchasableitem response](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/drop-rates.md#example-catalog-purchasableitem-response)
>
> [caching](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/caching.md)
>
> [how long are responses cached](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/caching.md#how-long-are-responses-cached)
>
> [immediate invalidation after player actions](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/caching.md#immediate-invalidation-after-player-actions)
>
> [always fresh stash side data](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/caching.md#always-fresh-stash-side-data)
>
> [force a catalog refresh](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/caching.md#force-a-catalog-refresh)
>
> [frequently asked questions](https://docs.stash.gg/guides/stash-webshop/catalog/real-time-catalog/caching.md#frequently-asked-questions)


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