Skip to content

Documentation

JavaScript SDK: Wildberries: products and regions

ctx.wildberries() is for scenarios built from the ready-made solution. Local methods read settings; network methods retrieve product data.

Each example is a separate fragment inside async function run(ctx). Use await only for methods whose signature returns a Promise.

Methods

products

ctx.wildberries().products() → Array<string>

Returns product ID strings from scenario settings. This method makes no network request.

const result = ctx.wildberries().products();

regions

ctx.wildberries().regions() → Array<{ id: string, name: string, code: number }>

Returns configured regions as { id, name, code } objects. Pass id, not code, to network methods.

const result = ctx.wildberries().regions();

cards

ctx.wildberries().cards(ids, regionId) → Promise<Array<object>>

Fetches up to 50 product cards per call for the selected region. Returns an array; a price may be null, and missing cards are omitted.

const region = ctx.wildberries().regions()[0];
if (!region) ctx.abort('Select a collection region');
const result = await ctx.wildberries().cards(ctx.wildberries().products(), region.id);

categoryQuery

ctx.wildberries().categoryQuery() → string

Returns the category search phrase from scenario settings. No network request is made.

const result = ctx.wildberries().categoryQuery();

maxPages

ctx.wildberries().maxPages() → number

Returns the selected crawl depth, clamped to 1–20 pages.

const result = ctx.wildberries().maxPages();

search

ctx.wildberries().search(regionId, page) → Promise<object>

Fetches a category search page. The result contains cards, total, and page; the search phrase comes from scenario settings.

const region = ctx.wildberries().regions()[0];
if (!region) ctx.abort('Select a collection region');
const result = await ctx.wildberries().search(region.id, 1);

analogs

ctx.wildberries().analogs(regionId) → Promise<object>

Discovers new similar products and returns an object with own_id, ids, new_ids, found_now, and query. Call it on every repeated collection.

const region = ctx.wildberries().regions()[0];
if (!region) ctx.abort('Select a collection region');
const result = await ctx.wildberries().analogs(region.id);

details

ctx.wildberries().details(id) → Promise<object>

Retrieves a product description and characteristics by product ID. A temporarily unavailable card causes an error.

const result = await ctx.wildberries().details('12345678');

detailsMany

ctx.wildberries().detailsMany(ids) → Promise<object>

Fetches details for up to 50 product IDs in one call. Returns an object keyed by product ID; temporarily unavailable cards may be missing.

const result = await ctx.wildberries().detailsMany(['12345678']);

title

ctx.wildberries().title(card) → string

Returns the title of a card already fetched. No network request is made.

const result = ctx.wildberries().title({ title: 'Product' });

characteristics

ctx.wildberries().characteristics(card) → object

Returns the characteristics object of an already fetched card. Call details(id) first for full characteristics.

const result = ctx.wildberries().characteristics({ characteristics: { size: 'M' } });