---
title: "Purchase Item"
method: POST
path: "/api/gamification/items/purchase"
tags: ["gamification"]
---

# Purchase Item

`POST /api/gamification/items/purchase`

Purchase an item with tokens.

- **item_key**: The unique key of the item to purchase (e.g., 'theme_ocean', 'frame_gold')

This endpoint validates the user's token balance, deducts the tokens,
and grants the item to the user. Returns the new balance and item details.

## Query parameters

- `pricing_variant` 'default' | 'paid_tokens' — Which shop pricing to apply. Cohort bucketing for the paid_token_exp experiment happens client-side (see paid_token_exp_treatment_allocation / paid_token_exp_legacy_cutoff_timestamp in /api/config), so the client tells the backend which price column applies for a given request.

## Headers

- `x-user-id` string, nullable

## Request body

- ItemActionRequest — Request for item actions (purchase/unlock).
  - `item_key` string, required — The unique key of the item

## Response `200`

Successful Response

- ItemActionResponse — Item action response (purchase/unlock).
  - `success` boolean, required
  - `message` string, required
  - `item` ItemResponse — Item response model for shop display.
    - `id` string, required
    - `key` string, required
    - `name` string, required
    - `description` string, nullable
    - `item_type` string, required
    - `unlock_type` 'free' | 'purchasable' | 'premium' | 'special', required — Item unlock types.
    - `token_price` integer, nullable
    - `available_from` string, date-time, nullable
    - `available_until` string, date-time, nullable
    - `sort_order` integer
    - `created_at` string, date-time, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/usecreed/apis/creed-api.md) · [All operations](https://skmtc.net/usecreed/apis/creed-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/usecreed/creed-api/revisions/523833f9e819/schema)
