Bulk Predict
Predict the pricing of many products in one request. Each item takes the same parameters as a single prediction, and the response holds one prediction per item, in the same order.
apiKeyAuthorizationBearer <token>Your Bencha API key.
application/json- body
items*array<>The products to predict, each with its own settings.
One prediction per item, in the order of items.
application/json- response
[index: integer]?curl -X POST 'https://api.bencha.io/v1/price/predict/bulk' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{ "items": [ { "query": { "brand": "newbie", "category": "tops", "condition": "very_good" } }, { "query": { "brand": "newbie", "category": "jackets", "month": 11 }, "currency": "EUR" } ]}'[ { "id": "prediction_01JAMTTKZDYZF4SDWCACZAN87Z", "created_at": "2024-10-20T13:26:00.685292+02:00", "query": { "brand": { "search_score": 1, "id": "brand_01JAMA6HRRJT8958ZAF8JMSN0D", "name": "Newbie" }, "category": { "search_score": 1, "id": "category_01JAMAZ0C11EPHQCN3SJ0FJ7NH", "name": "apparel.tops", "name_en": "Tops", "name_se": "Överdelar" }, "condition": "very_good" }, "model": "spot-5-turbo", "prediction": { "price": 9.5, "lower_bound": 9.5, "upper_bound": 9.5, "score": 1, "currency": "EUR", "autocompleted_fields": [], "execution_time_ms": 96 } }]How items are predicted
Every item is predicted with its own settings, so items in one request can use different models, currencies and formatting options. Items that don't set model use spot-5-turbo.
Send as many items per request as you can rather than many single requests:
items for spot-4-turbo and spot-5-turbo are predicted together, one batch
per model. A request body can be at most 24 MB.
If any item fails, for example because its brand or category can't be found, the whole request fails with that item's error and no predictions are returned.
Differences from single predictions
- When a brand and category combination is unknown to the model, a single prediction retries with the parent category. Bulk predictions don't.
- Bulk predictions don't normalize brand spellings for
spot-3-turbothe way single predictions do.