API Reference

The CommerceOps Hub REST API lets you validate, clean, and query e-commerce data programmatically. Integrate data quality checks directly into your pipeline, CI/CD, or ERP system.

Pro plan required. API access requires a Pro, Business, or Agency plan. View pricing →

Authentication

All API requests require an X-API-Key header. Generate your API key in the Integrations tab after upgrading.

# Include in every request
X-API-Key: coh_your_key_here

# Or use Bearer token
Authorization: Bearer coh_your_key_here
Never expose your API key in client-side JavaScript. Store it in environment variables.

Error Codes

HTTP StatusError CodeDescription
401api_key_requiredNo API key provided
401invalid_api_keyAPI key is invalid or revoked
403pro_requiredFeature requires Pro plan or higher
429quota_exceededMonthly record quota exceeded
429too_many_requestsRate limit hit (10 req/min for uploads)
400empty_fileUploaded file has no rows
404not_foundJob not found or not yours

Rate Limits

Upload endpoints: 10 requests / minute. All other endpoints: 60 requests / minute. Rate limit headers are included in every response:

X-RateLimit-Limit: 10
X-RateLimit-Remaining: 9
X-RateLimit-Reset: 1716300060

List Jobs

GET /v1/jobs 🔑 API Key

Returns your most recent jobs (up to 20).

Query Parameters

ParameterTypeDescription
limit optionalintegerMax results (1–20, default 20)

Response

[
  {
    "id": "3f8a2b1c-...",
    "filename": "products_may.csv",
    "status": "done",
    "check_types": "product",
    "rows_total": 1240,
    "rows_error": 23,
    "rows_warning": 87,
    "rows_fixed": 41,
    "health_score": 78,
    "created_at": "2026-05-22T10:30:00.000Z"
  }
]

Get Job Details

GET /v1/jobs/:id 🔑 API Key

Returns full details of a specific job, including all issues found.

Response

{
  "id": "3f8a2b1c-...",
  "filename": "products_may.csv",
  "status": "done",
  "health_score": 78,
  "issues": [
    {
      "id": 1,
      "issue_row": 5,
      "severity": "error",
      "field": "price",
      "code": "INVALID_PRICE",
      "message": "Price must be a positive number",
      "original_value": "abc",
      "fixed_value": null
    }
  ]
}

Validate Records

POST /v1/validate 🔑 API Key

Validate an array of records inline, without uploading a file. Returns issues and a health score. Useful for real-time validation in your pipeline.

Request Body

FieldTypeDescription
records requiredarrayArray of row objects (max 500 per call)
mapping requiredobjectField mapping: {"sku":"SKU","title":"Name"}
check_types optionalstringComma-separated: product,price (default: product)
platform optionalstringPlatform template: shopee_tw, lazada, etc.

Example Request

curl -X POST https://hub.corestackapi.com/v1/validate \
  -H "X-API-Key: coh_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "records": [
      { "SKU": "PRD-001", "Name": "Blue T-Shirt", "Price": "590" },
      { "SKU": "",       "Name": "Red Jeans",  "Price": "abc" }
    ],
    "mapping": { "sku": "SKU", "title": "Name", "price": "Price" },
    "check_types": "product,price"
  }'

Response

{
  "stats": {
    "rows": 2,
    "errors": 2,
    "warnings": 0,
    "fixes": 0,
    "score": 60
  },
  "issues": [
    { "row": 2, "severity": "error", "field": "sku", "code": "MISSING_SKU", "message": "SKU is required" },
    { "row": 2, "severity": "error", "field": "price", "code": "INVALID_PRICE", "message": "Price must be a positive number" }
  ],
  "cleaned": [/* auto-fixed rows */]
}

Webhooks Overview

Webhooks push real-time events to your endpoint when jobs complete. Configure them in the Integrations → Webhooks section.

Webhook Payload

{
  "event": "job.complete",
  "timestamp": "2026-05-22T10:30:00.000Z",
  "jobId": "3f8a2b1c-...",
  "filename": "products_may.csv",
  "rows": 1240,
  "stats": {
    "errors": 23,
    "warnings": 87,
    "fixes": 41,
    "score": 78
  }
}

Signature Verification

If you set a webhook secret, every request includes an X-CommerceOps-Signature header with an HMAC-SHA256 signature.

# Node.js verification example
const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const expected = 'sha256=' + crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}

Check Types Reference

ValueWhat it checks
productSKU uniqueness, title length, price format, image URL, brand, availability, GTIN
customerEmail format, phone format, country codes, duplicate detection, disposable domains
shippingHS code format, VAT number, country of origin, declared value, weight
inventoryStock quantity, reorder points, expiry dates, warehouse ID
pricePrice outliers (IQR-based), compare-at price logic, margin calculation, currency format

Standard Field Names

Use these semantic field names in your mapping object. Each maps to the column name in your data.

Field NameDescriptionUsed in
skuProduct identifier / SKUproduct, inventory, price
titleProduct name / titleproduct
descriptionProduct descriptionproduct
priceSale priceproduct, price
compare_at_priceOriginal / crossed-out priceprice
cost_priceCost of goods (for margin calc)price
currency3-letter ISO currency codeproduct, price
availabilityin_stock / out_of_stock / preorderproduct
image_urlMain product image URLproduct
brandBrand nameproduct
categoryCategory or product typeproduct
gtinBarcode (EAN/UPC/ISBN)product
weightWeight in gramsshipping
hs_codeHarmonized System codeshipping
country_of_originISO 2-letter country codeshipping
vat_numberVAT registration numbershipping
emailCustomer email addresscustomer
phoneCustomer phone numbercustomer
countryCustomer country (ISO 2-letter)customer
stock_qtyCurrent inventory quantityinventory
reorder_pointMin stock before reorderinventory
expiry_dateProduct expiry / best-before dateinventory
warehouse_idWarehouse or location codeinventory

Platform Templates

Pass a platform value to apply platform-specific validation rules (title length, required fields, image specs).

ValuePlatformMax TitleKey requirements
shopee_twShopee Taiwan60 charstitle, price, image_url, category, weight
momoMOMO 購物60 charstitle, price, image, brand, category, stock, sku
pchomePChome 24h60 charssku, title, price, image, category, description, stock
google_merchantGoogle Merchant Center150 charssku, title, description, price, image, availability, brand
meta_catalogMeta / Facebook Catalog200 charssku, title, description, price, image, availability, brand
shopee_crossShopee Cross-border60 chars (EN only)title, price, image, weight; English required
lazadaLazada Seller Center255 charssku, title, description, price, stock, category, image
tokopediaTokopedia70 charssku, title, description, price, stock, category, image
Need help? Email [email protected] or join our community. Response time: Pro 12h, Business/Agency 4h SLA.