---
title: "Register Demand"
method: POST
path: "/v1/products/{product_id}/demand"
tags: ["Products"]
---

# Register Demand

`POST /v1/products/{product_id}/demand`

## Request

- Base URL: `http://localhost:8000`
- URL: `http://localhost:8000/v1/products/{product_id}/demand`
- Auth: HTTP bearer

Register "I need this" against a tentative listing.

Open to anonymous visitors on purpose: the whole value of a demand probe
is the count, and putting a signup in front of the button would measure
willingness to register rather than willingness to buy. An anonymous
caller is identified by the `session_id` their client sends.

Pressing twice is not an error — the second press returns the same count
with `already_registered: true`, so a retry or a double click cannot
inflate the number. Optional coordinates say *where* the demand is,
which is what tells a seller whether it is within their delivery range.

## Path parameters

- `product_id` integer, required

## Headers

- `X-API-Key` string, nullable

## Request body

- ProductDemandIn: Body of POST /v1/products/{id}/demand.
  - `session_id` string, nullable: Opaque per-browser id, required when nobody is signed in. It only exists to count one anonymous visitor once; send a random string you keep in localStorage, not anything identifying.
  - `lat` number, nullable: Optional latitude of the interested buyer, so the seller can see whether demand is within reach.
  - `lon` number, nullable: Optional longitude, paired with lat.

## Response `201`

Successful Response

- ProductDemandOut: Result of registering demand.
  - `product_id` integer, required
  - `demand_count` integer, required: Total people who have registered interest, including this caller.
  - `already_registered` boolean, required: True when this caller had already registered — the count is unchanged, and this is not an error.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/rubenayla/apis/partle-api.md) · [All operations](https://skmtc.dev/rubenayla/apis/partle-api/llms.txt) · [OpenAPI document](https://skmtc.dev/rubenayla/apis/partle-api/revisions/628cce2acee5?raw)
