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.
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
Error Codes
| HTTP Status | Error Code | Description |
|---|---|---|
| 401 | api_key_required | No API key provided |
| 401 | invalid_api_key | API key is invalid or revoked |
| 403 | pro_required | Feature requires Pro plan or higher |
| 429 | quota_exceeded | Monthly record quota exceeded |
| 429 | too_many_requests | Rate limit hit (10 req/min for uploads) |
| 400 | empty_file | Uploaded file has no rows |
| 404 | not_found | Job 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
Returns your most recent jobs (up to 20).
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| limit optional | integer | Max 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
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
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
| Field | Type | Description |
|---|---|---|
| records required | array | Array of row objects (max 500 per call) |
| mapping required | object | Field mapping: {"sku":"SKU","title":"Name"} |
| check_types optional | string | Comma-separated: product,price (default: product) |
| platform optional | string | Platform 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
| Value | What it checks |
|---|---|
| product | SKU uniqueness, title length, price format, image URL, brand, availability, GTIN |
| customer | Email format, phone format, country codes, duplicate detection, disposable domains |
| shipping | HS code format, VAT number, country of origin, declared value, weight |
| inventory | Stock quantity, reorder points, expiry dates, warehouse ID |
| price | Price 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 Name | Description | Used in |
|---|---|---|
| sku | Product identifier / SKU | product, inventory, price |
| title | Product name / title | product |
| description | Product description | product |
| price | Sale price | product, price |
| compare_at_price | Original / crossed-out price | price |
| cost_price | Cost of goods (for margin calc) | price |
| currency | 3-letter ISO currency code | product, price |
| availability | in_stock / out_of_stock / preorder | product |
| image_url | Main product image URL | product |
| brand | Brand name | product |
| category | Category or product type | product |
| gtin | Barcode (EAN/UPC/ISBN) | product |
| weight | Weight in grams | shipping |
| hs_code | Harmonized System code | shipping |
| country_of_origin | ISO 2-letter country code | shipping |
| vat_number | VAT registration number | shipping |
| Customer email address | customer | |
| phone | Customer phone number | customer |
| country | Customer country (ISO 2-letter) | customer |
| stock_qty | Current inventory quantity | inventory |
| reorder_point | Min stock before reorder | inventory |
| expiry_date | Product expiry / best-before date | inventory |
| warehouse_id | Warehouse or location code | inventory |
Platform Templates
Pass a platform value to apply platform-specific validation rules (title length, required fields, image specs).
| Value | Platform | Max Title | Key requirements |
|---|---|---|---|
| shopee_tw | Shopee Taiwan | 60 chars | title, price, image_url, category, weight |
| momo | MOMO 購物 | 60 chars | title, price, image, brand, category, stock, sku |
| pchome | PChome 24h | 60 chars | sku, title, price, image, category, description, stock |
| google_merchant | Google Merchant Center | 150 chars | sku, title, description, price, image, availability, brand |
| meta_catalog | Meta / Facebook Catalog | 200 chars | sku, title, description, price, image, availability, brand |
| shopee_cross | Shopee Cross-border | 60 chars (EN only) | title, price, image, weight; English required |
| lazada | Lazada Seller Center | 255 chars | sku, title, description, price, stock, category, image |
| tokopedia | Tokopedia | 70 chars | sku, title, description, price, stock, category, image |