POSThttps://api.spirestock.com/api/v1/imports/preview/{type}#
Check a product-variant, scheme or variant-price sheet before importing it; nothing is saved. type is product-variants, schemes or rate-list. Headers are matched to the template's columns (case, spacing and text in brackets are ignored). Every row is validated, including that the product, variant or SKU exists. rows holds the first 200 rows as text; valid_rows, invalid_rows and errors (first 100 failing rows) cover the whole file. A missing required column is reported in missing_required, and POST /imports/{type} then answers 400. Upload as multipart/form-data, field file (.xlsx or .csv, max 10 MB). Other file types answer 400 and files over 10 MB answer 413.
Access: API key write scope; staff need Product and Variant Management (17) or Upload Rate List (18) or Upload Free Scheme List (32) — add.
Request body
filefilerequired- The workbook (.xlsx or .csv)
curl -X POST https://api.spirestock.com/api/v1/imports/preview/schemes \
-H "X-API-Key: YOUR_API_KEY" \
-F "[email protected]"{
"response_code": 200,
"message": "1 row(s) have errors and will be skipped",
"data": {
"type": "schemes",
"file": { "name": "schemes.xlsx", "size": 6692 },
"sheet": { "name": "Schemes", "total_rows": 2, "total_columns": 6 },
"columns": [
{ "index": 0, "header": "Name", "key": "name", "label": "Name" },
{ "index": 1, "header": "Scheme Type (1=Free,2=Flat,3=Bulk,4=Quantitative)", "key": "scheme_type", "label": "Scheme Type (1=Free,2=Flat,3=Bulk,4=Quantitative)" }
],
"missing_required": [],
"unknown_columns": [],
"valid_rows": 1,
"invalid_rows": 1,
"rows": [
{ "row": 2, "cells": ["Summer Offer", "2", "2026-04-01", "2026-06-30", "Toned Milk 1L", "2.5"], "errors": [] },
{ "row": 3, "cells": ["Winter Offer", "9", "", "", "", ""], "errors": ["Scheme Type must be at most 4"] }
],
"preview_truncated": false,
"errors": [{ "row": 3, "errors": ["Scheme Type must be at most 4"] }]
}
}