What are API keys used for?
API keys serve two distinct authentication roles: Ingress secrets authenticate requests your game backend makes to Stash APIs. Your App ID is in Studio → Project Settings → General; your ingress secret is in Studio → Project Settings → API Keys:- Stash Pay: Generating checkout links, Quick Pay URLs, and querying payment status
- Stash Launcher: Managing build artifacts and authentication token flows
x-stash-hmac-signature header on each inbound request:
- Real-time Catalog: Stash signs every outbound request to your catalog endpoint
- Webhooks: Stash signs every webhook delivery to your endpoint
Creating API Keys
2
Create a New API Key
Click Create API Key.
3
Name Your Key and Choose Its Type
Enter a descriptive name (e.g., “Production Backend”, “Test Environment”) to help identify the purpose of each key, choose Ingress for requests your backend sends to Stash or Egress for requests Stash sends to your backend, and create the key.
4
Copy the Secret
Open the key from the list, reveal its Secret field, and copy the value. It is base64-encoded. You can open the key and copy the secret again at any time.
Security Notes
- Use descriptive names to identify the purpose of each key
- Create separate keys for different environments (test, staging, production)
- Store keys securely using your secret manager and least-privilege access policies
HMAC Signing
Use your ingress secret (Studio → Project Settings → API Keys) to sign requests your backend makes to Stash APIs. Base64-decode the secret before using it as the HMAC key.
The signature covers
"<unixMillisTimestamp>." + <body>, where <body> is the exact JSON bytes you send in a POST or PUT. Sign what you transmit; Stash verifies against the bytes received for bodies up to 18 KiB (18,432 bytes), and may reject a larger body with 401 even when it is correctly signed. Requests where <unixMillisTimestamp> is more than 5 minutes from the server clock are rejected.
- Node.js
- Python
- Go
sign-request.js
HMAC Verification
Use your egress key (Studio → Project Settings → API Keys) to verify signed inbound requests from Stash: webhooks and real-time catalog requests. Base64-decode the key before using it as the HMAC key. For GET requests (real-time catalog), the body is an empty string.
Reject requests where
<unixMillisTimestamp> is more than 5 minutes from your server clock.
When you activate a different egress key in Studio, Stash starts signing requests with it within 5 minutes, so keep accepting the previous key until then.
- Node.js
- Python
- Go
verify-signature.js
Migrating from Legacy Auth
No new API secrets are required to migrate. The same API key works with the versioned HMAC header.Before you migrate: update your stored secret (optional, recommended)
This step applies to any API auth migration:
X-Stash-Api-Key ingress auth and legacy stash-hmac-signature egress auth for APIs such as real-time catalog. It does not apply to webhook migration: webhook secrets have always been base64-encoded.
From X-Stash-Api-Key header
ReplaceX-Stash-Api-Key: <secret> with a versioned HMAC signature. Your App ID is in Studio → Project Settings → General:
From legacy HMAC (stash-hmac-signature)
Update your webhook listener and real-time catalog request handler to verifyx-stash-hmac-signature instead of stash-hmac-signature. The same egress key is used; the change is adding the timestamp and App ID to the signed message. Your App ID is in Studio → Project Settings → General:
Migration rollout strategy
Test the new HMAC signing and verification in your test shop before releasing to production. All shop environments already send the versionedx-stash-hmac-signature header on egress APIs and webhooks and validate it on all SDK ingress APIs. You can start sending and checking the new header at any time without coordinating with Stash.
If you did the optional preparation step (you updated your stored secret to the base64-encoded value):
Recommended sequence:
- Add the base64-encoded secret as a new column or row in your secret store (keep the raw value).
- Deploy the new HMAC signing and verification code in your test environment. Point it at the base64-encoded value.
- Verify auth works end-to-end in your test shop.
- Deploy to production. Verify auth works.
- Remove the raw secret from your secret store.
Next Steps
- HMAC Signing: sign your backend calls to Stash (ingress)
- HMAC Verification: verify Stash’s signed requests to your backend (egress)
- Stash Pay → Authentication: Stash Pay checkout link signing
- Stash Launcher Integration: apply ingress auth in launcher backend flows
- Real-time Catalog → Authentication: verify Stash’s signed catalog requests
- Webhook Listener: implement HMAC Verification for incoming webhooks