# Publish a game in the store

URL: https://docs.spacerun.co/docs/platform/guides/store-publishing

> Create a draft game, configure runtime mappings and artwork, publish, and verify the public catalog.

Prerequisites: `store.read` and `store.write`, existing lookup records as needed, a configured runtime app, and [apiRequest](https://docs.spacerun.co/docs/platform/guides/quickstart). This workflow changes catalog data; it does not provision a playable runtime app by itself.

## Create a draft and configure launch mappings

```ts
const game = await apiRequest("/v1/admin/store/games", {
  method: "POST",
  body: JSON.stringify({ slug: "example-game", title: "Example Game", status: "draft" }),
});
await apiRequest(`/v1/admin/store/games/${game.id}/runtime-apps`, {
  method: "PUT",
  body: JSON.stringify({ apps: [{ runtime_app_id: runtimeAppId, is_enabled: true, is_default: true }] }),
});
```

`runtimeAppId` is an existing ID from the runtime app list. [createStoreGame](https://docs.spacerun.co/docs/platform/reference/store-games/createStoreGame) returns the saved game. [replaceStoreGameRuntimeApps](https://docs.spacerun.co/docs/platform/reference/store-runtime-apps/replaceStoreGameRuntimeApps) replaces the mapping list; use [saveStoreGameRuntimeApp](https://docs.spacerun.co/docs/platform/reference/store-runtime-apps/saveStoreGameRuntimeApp) for a single mapping. Disabled mappings cannot be the default, duplicate runtime IDs are rejected, and there is at most one enabled default.

Genre/developer/publisher arrays use numeric IDs from [listStoreLookup](https://docs.spacerun.co/docs/platform/reference/store-lookups/listStoreLookup). Game IDs are numeric; runtime IDs are opaque strings and mapping IDs can be UUIDs. Do not substitute one kind of ID for another.

## Add artwork and publish

Follow [Uploads and media](https://docs.spacerun.co/docs/platform/guides/uploads-and-media) for artwork slots and screenshots. Update descriptive fields using [updateStoreGame](https://docs.spacerun.co/docs/platform/reference/store-games/updateStoreGame). Set publication status with [setStoreGameStatus](https://docs.spacerun.co/docs/platform/reference/store-games/setStoreGameStatus):

```ts
await apiRequest(`/v1/admin/store/games/${game.id}/status`, {
  method: "PATCH", body: JSON.stringify({ status: "published" }),
});
```

Verify anonymously using [getPublicStoreGame](https://docs.spacerun.co/docs/platform/reference/public-store/getPublicStoreGame) with the slug, or [listPublicStoreGames](https://docs.spacerun.co/docs/platform/reference/public-store/listPublicStoreGames). Public reads are cached for 60 seconds, so allow for cache expiry before diagnosing stale content. Draft/hidden records do not become publicly visible simply because a staff detail endpoint returns them.

If launching fails with `app_not_found`, check enabled mappings. `plan_required`, credit eligibility and pool configuration are separate launch prerequisites; publishing a game does not grant eligibility. Changing the game to `hidden` removes public visibility. Catalog achievement and referral-rule endpoints have separate schemas and should be configured only when that feature is needed.
