Skip to content

Wildberries API TypeScript SDK / extractBidRange

Function: extractBidRange()

ts
function extractBidRange(recommendations: BidsRecommendationsResponse): BidRange | null;

Defined in: utils/bid-validation.ts:43

Compute the effective bid range for an article from a recommendations response.

Aggregates across all returned search clusters (normQueries): min = min(reachMin.bidKopecks), max = max(reachMax.bidKopecks).

Pure and network-free. Returns null when the response carries no cluster data (e.g. a paused campaign) — treat null as "unknown range" and skip pre-validation rather than fabricating bounds.

Parameters

ParameterTypeDescription
recommendationsBidsRecommendationsResponseA getBidsRecommendations response (one advertId + nmId)

Returns

BidRange | null

The { min, max } envelope in kopecks, or null if no cluster data

Example

typescript
const reco = await sdk.promotion.getBidsRecommendations({ advertId: 1, nmId: 2 });
const range = extractBidRange(reco);
if (range) console.log(`valid range: ${range.min}–${range.max} kopecks`);

Since

3.16.0

Made with ❤️ for the Wildberries developer community