---
title: "Odds API price IDs and selection IDs"
description: "Design an odds API price store with price_id, selection_id and event_id; handle updates, removals and event merges."
url: https://valueoddsapi.com/guides/odds-api-price-identity/
---

VALUEODDSAPI / BUYER GUIDES

# How should you key odds API prices in your database?

Use price_id for each quote, selection_id for mapped cross-bookmaker comparison, and event_id for the fixture join.

Published by ValueOddsAPI · 30 November 2026

Use `price_id` for the current quote and `selection_id` for a mapped cross-bookmaker comparison. This is a schema diagram; the labels are documented fields, not sample odds.

## In 30 seconds

- Key the quote by `price_id`. The v2 contract states that this ID is shared by REST, streaming and history.
- Use `selection_id` for comparison. It is shared across bookmakers for a mapped selection and can be null when unmapped.
- Keep the event reference. Store `event_id` and handle `merged_into` when an event is consolidated.
- Test mutations. A suspended or removed price is a row-state change, not a new selection.

## Which ID identifies one bookmaker quote?

The [v2 PriceRow schema](https://valueoddsapi.com/api-contract.json) describes `price_id` as the same identifier in REST, streaming and history. It is the natural key for an application’s current-price row. A change for that ID should update the row’s price, status and observation time. Do not key a quote only by `event_id`: one event can have many bookmakers, markets, lines and outcomes.

`selection_id` has a different job. The schema says it is the same across bookmakers and null when the price is unmapped. Compare mapped quotes for the same selection, but retain `price_id` as the identity of each bookmaker quote. See the [mapping guide](https://valueoddsapi.com/guides/market-mapping-odds-api/) for semantic checks before publishing a comparison.

## What should a price-store schema retain?

Keys and state for a current-price table
| Field | Documented role | Suggested client use |
|---|---|---|
| `price_id` | Same ID in REST, stream and history | Primary upsert key for the current quote. |
| `event_id` | Reference to the event | Join to sport, teams, start time and phase. |
| `selection_id` | Cross-bookmaker selection; nullable if unmapped | Group only comparable mapped prices. |
| `bookmaker`, `market`, `line`, `outcome` | Source and selection dimensions | Audit what the quote represents before display. |
| `status`, `price`, `checked_at` | Availability, last value and observation time | Separate stored row from current actionable offer. |

The contract defines the fields and nullability. The storage pattern is a recommendation; no particular database engine is required.

## How do updates and removals affect the key?

The [change-feed description](https://valueoddsapi.com/api-contract.json) says writes include new prices, status changes, removals and mapping changes. Keep the row keyed by `price_id` while applying those states. A removed row may carry `price: null`; treating null as decimal zero or leaving the old price in an actionable display would misrepresent availability.

Apply the documented change cursor in order and design for at-least-once delivery. An upsert keyed by `price_id` makes replay safe for your current-state table, provided you also preserve the ordering semantics documented for your chosen endpoint. After a cursor failure, rebuild from a fresh snapshot; the [pagination guide](https://valueoddsapi.com/guides/odds-api-pagination/) explains complete snapshot reads.

## What if an event is merged?

The [Event schema](https://valueoddsapi.com/api-contract.json) has `merged_into` and `previous_ids`. Keep an alias from an old event ID to the surviving event ID when those fields are present. That lets an application join historical references without pretending that two event records are independent fixtures. Do not infer a merge solely from similar team names or kickoff time.

In a pilot, select actual entitled events. Record each event ID and the number of distinct price IDs before and after a snapshot refresh. Count duplicate current rows, unresolved event aliases and unmapped selection IDs as separate measures. Publish the denominator and observation window; do not turn a local sample into a general coverage claim.

## Frequently asked questions

**Can event_id be the primary key of an odds table? **

Not for individual quotes. An event can contain many bookmakers, markets, lines and outcomes; price_id identifies a quote row in the v2 schema.

**Is selection_id always present? **

No. The v2 PriceRow schema permits null for an unmapped price.

**Should a removed price be deleted immediately? **

You may retain it for audit, but do not display it as an open offer. The change feed marks removal and the current price can be null.

ValueOddsAPI provides odds data, not betting advice. Betting involves risk of loss and is for adults (18+) only. If gambling stops being fun, contact your local support service, such as StopSpillet in Denmark.

## Validate the row model

Compare your current-price table with an entitled [v2 REST response](https://valueoddsapi.com/docs/), one change-feed replay and a fresh snapshot. Measure duplicate and missing `price_id` values before selecting a production storage design.
