Sanal AI
  1. API Requirements
Sanal AI
  • Introduction
    • ๐Ÿš€ Sanal AI - Encore Data
    • ๐Ÿ› ๏ธ Getting Started
    • ๐Ÿค The Approach / Model
  • Data Structures
    • ๐Ÿ“ Data Layout
    • ๐Ÿช Merchants
    • ๐Ÿ“‚ Categories
    • ๐Ÿท๏ธ Items
    • ๐Ÿ›’ Products
    • ๐Ÿ“ฆ Inventory
    • ๐Ÿ‘ค Customers
    • ๐Ÿงพ Orders
    • ๐Ÿงพ Variants & Combinations
  • API Requirements
    • ๐Ÿ”Œ API Requirements
    • API: `syncMerchants`
    • API: `syncCategories`
    • API: `syncItems`
    • API: `syncProducts`
    • API: `syncInventory`
    • API: `syncCustomers`
    • API: `syncOrders`
  1. API Requirements

API: `syncProducts`

This endpoint is used to synchronize merchant-specific Product offers, including the detailed variant_groups and variant_combinations structures.
Endpoint: POST /v1/syncProducts

Request Payload#

KeyTypeDescription
commandstringThe action to perform: "create", "update", or "delete".
infoobjectThe full Product data object, including variant_groups and variant_combinations. For delete, only id is required.
Sample Request Body (Creating a product with variants)#
{
  "products": [
    {
      "command": "create",
      "info": {
        "id": "prod_new_shirt_456",
        "item_id": "item_polo_shirt",
        "merchant_id": "mer_fashion_store",
        "price": 120.00,
        "currency": "SAR",
        "sku": "POLO-BASE",
        "variant_groups": [
          {
            "id": "vargrp_polo_size", "name": "Size", "selection_type": "single",
            "variants": [
              { "id": "v_polo_m", "name": "Medium", "price_adjustment": 0.00 },
              { "id": "v_polo_l", "name": "Large", "price_adjustment": 10.00 }
            ]
          },
           {
            "id": "vargrp_polo_color", "name": "Color", "selection_type": "single",
            "variants": [
              { "id": "v_polo_blk", "name": "Black", "price_adjustment": 0.00 },
              { "id": "v_polo_nvy", "name": "Navy", "price_adjustment": 0.00 }
            ]
          }
        ],
        "variant_combinations": [
          {
            "sku": "POLO-M-BLK",
            "price": 120.00,
            "options": [
              { "group_id": "vargrp_polo_size", "variant_id": "v_polo_m" },
              { "group_id": "vargrp_polo_color", "variant_id": "v_polo_blk" }
            ]
          },
          {
            "sku": "POLO-M-NVY",
            "price": 120.00,
            "options": [
              { "group_id": "vargrp_polo_size", "variant_id": "v_polo_m" },
              { "group_id": "vargrp_polo_color", "variant_id": "v_polo_nvy" }
            ]
          },
          {
            "sku": "POLO-L-BLK",
            "price": 130.00,
            "options": [
              { "group_id": "vargrp_polo_size", "variant_id": "v_polo_l" },
              { "group_id": "vargrp_polo_color", "variant_id": "v_polo_blk" }
            ]
          },
          {
            "sku": "POLO-L-NVY",
            "price": 130.00,
            "options": [
              { "group_id": "vargrp_polo_size", "variant_id": "v_polo_l" },
              { "group_id": "vargrp_polo_color", "variant_id": "v_polo_nvy" }
            ]
          }
        ],
        "modifier_groups": [],
        "is_active": true,
        "updated_at": "2025-10-18T17:00:00Z"
      }
    }
  ]
}

Response Payload#

Reports only on failed operations.
Sample Error Response#
{
  "status": "partial_failure",
  "errors": [
    {
      "id": "prod_new_shirt_456", // Corresponds to the ID sent in the request's info object
      "error": {
        "code": "DUPLICATE_VARIANT_SKU",
        "message": "The variant combination SKU 'POLO-L-BLK' already exists or is duplicated within the request."
      }
    }
    // Succeeded product creations/updates are not listed
  ]
}
Previous
API: `syncItems`
Next
API: `syncInventory`
Built with