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: `syncOrders`

This endpoint is used to synchronize order records and their statuses, including details of selected variants and modifiers.
Endpoint: POST /v1/syncOrders

Request Payload#

KeyTypeDescription
commandstringThe action to perform: "create" or "update".
infoobjectThe full Order data object. When creating, include detailed ordered_items with variant_combination_sku.
Sample Request Body (Creating an order with variants/modifiers)#
{
  "orders": [
    {
      "command": "create",
      "info": {
        "id": "ord_shirt_123",
        "customer_id": "cus_a1b2c3d4",
        "merchant_id": "mer_fashion_store",
        "order_number": "Sanal-10030",
        "ordered_items": [
          {
            "product_id": "prod_shirt_custom",
            "item_id": "item_basic_shirt",
            "variant_combination_sku": "SHIRT-M-BLU",
            "purchase_product_name": "Basic Shirt - Medium / Blue",
            "purchase_unit_price": 87.00,
            "quantity": 1,
            "selected_modifiers": []
          }
        ],
        "subtotal": 87.00,
        "delivery_fee": 15.00,
        "taxes": 13.05,
        "total_amount": 115.05,
        "currency": "SAR",
        "status": "pending_confirmation",
        "delivery_address": { 
          "tag": "Home", 
          "house_number": "123",
          "building_name": "Al-Fahad Tower",
          "street": "Olaya Street", 
          "area": "Olaya",
          "city": "Riyadh",
          "postal_code": "12345",
          "country": "SA",
          "location": { "latitude": 24.7136, "longitude": 46.6753 },
          "delivery_instructions": "Ring the doorbell twice, leave at front door if no answer",
          "recipient_name": "Fatima Al-Fahad",
          "recipient_phone": "+966551234567"
        },
        "payment_method": "credit_card",
        "payment_status": "pending",
        "updated_at": "2025-10-18T18:00:00Z"
      }
    }
  ]
}

Response Payload#

Reports only on failed operations.
Sample Error Response#
{
  "status": "partial_failure",
  "errors": [
    {
      "id": "ord_shirt_123", // Corresponds to the ID sent in the request's info object
      "error": {
        "code": "INVALID_VARIANT_SKU",
        "message": "Ordered item variant_combination_sku 'SHIRT-M-BLU' is invalid or out of stock for product_id 'prod_shirt_custom'."
      }
    }
    // Succeeded order creations/updates are not listed
  ]
}
Previous
API: `syncCustomers`
Built with