Skip to content

Item prices#1431

Draft
anhthang wants to merge 6 commits intoPokeAPI:masterfrom
anhthang:item-prices
Draft

Item prices#1431
anhthang wants to merge 6 commits intoPokeAPI:masterfrom
anhthang:item-prices

Conversation

@anhthang
Copy link
Contributor

@anhthang anhthang commented Mar 7, 2026

Add ItemPrice model and exposes per-version item pricing data

  • Populate item prices from a new CSV source: ‎data/v2/csv/item_prices.csv
  • Remove the old ‎Item.cost field in favor of the new structured pricing model.

Closes #1406

Example REST API response

GET /api/v2/item/305/
{
    "id": 305,
    "name": "some-item-name",
    "fling_power": null,
    "fling_effect": null,
    "category": {
        "name": "held-items"
    },
    "prices": [
        {
            "is_purchasable": true,
            "purchase_price": 3000,
            "sell_price": 1500,
            "version_group": {
                "name": "red-blue",
                "url": "https://pokeapi.co/api/v2/version-group/1/"
            }
        },
        {
            "is_purchasable": false,
            "purchase_price": null,
            "sell_price": 1500,
            "version_group": {
                "name": "ruby-sapphire",
                "url": "https://pokeapi.co/api/v2/version-group/3/"
            }
        }
    ]
}

Example GraphQL queries

v1beta: item with prices

query ItemWithPrices {
  pokemon_v2_item_by_pk(id: 305) {
    id
    name
    pokemon_v2_itemprices {
      is_purchasable
      purchase_price
      sell_price
      pokemon_v2_versiongroup {
        id
        name
      }
    }
  }
}

v1beta2: item with itemprice relation

query ItemWithItemprice {
  pokemon_v2_item_by_pk(id: 305) {
    id
    name
    itemprices {
      is_purchasable
      purchase_price
      sell_price
      versiongroup {
        id
        name
      }
    }
  }
}
{
    "data": {
        "item": [
            {
                "id": 305,
                "name": "tm01",
                "cost": null,
                "itemnames": [
                    {
                        "name": "TM01"
                    }
                ],
                "itemprices": [
                    {
                        "is_purchasable": true,
                        "purchase_price": 3000,
                        "sell_price": 1500,
                        "versiongroup": {
                            "id": 1,
                            "name": "red-blue",
                        }
                    },
                    {
                        "is_purchasable": false,
                        "purchase_price": null,
                        "sell_price": 1500,
                        "versiongroup": {
                            "id": 5,
                            "name": "ruby-sapphire",
                        }
                    }
                ]
            }
        ]
    }
}

@anhthang anhthang marked this pull request as draft March 7, 2026 16:21
@anhthang
Copy link
Contributor Author

anhthang commented Mar 8, 2026

Hi @Naramsim! Could you share your thoughts on the new ItemPrice model and the prices API shape? I'd like to confirm this is the right direction.

@anhthang anhthang force-pushed the item-prices branch 2 times, most recently from 3e366e5 to 0d594ce Compare March 9, 2026 06:56
@anhthang anhthang marked this pull request as ready for review March 9, 2026 10:23
@anhthang anhthang marked this pull request as draft March 9, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Item.cost actually varies between versions

1 participant