1. Home
  2. Docs
  3. Home
  4. DATA API
  5. How to use DATA API for custom e-commerce integration

How to use DATA API for custom e-commerce integration

Purpose

Use the Resico Data API to create a classic integration between Resico ERP and an external e-commerce platform.

The API is mainly used to exchange data between Resico ERP and the webshop. A typical e-commerce integration requires the following data flows:

  • Product data is periodically read from Resico ERP and sent to the webshop.
  • Product stock balances are periodically read from Resico ERP.
  • Customer data from webshop orders is created or updated in Resico ERP.
  • Orders from the webshop are created in Resico ERP as sales invoices.

This allows the webshop to display product information and availability from Resico ERP, while sending customer and order information back to Resico ERP for accounting and fulfillment.

Roles involved

  • System administrator
  • E-commerce manager
  • Developer / integration specialist
  • Implementation / support team

Preconditions

  • The Data API module must be enabled for the company.
  • API credentials must be available in Resico ERP.
  • The external webshop must be able to send and receive HTTP API requests.
  • Product SKUs must be available and consistent between Resico ERP and the webshop.
  • Customer creation and matching rules must be agreed before order import is enabled.
  • Sales invoice creation rules must be defined before webshop orders are sent to Resico ERP.

API authentication keys are available in Resico ERP under Seller Profile → API, if the API module has been purchased.

Authentication

The full Resico Data API documentation is available here: Full Data documentation

API requests must include authentication headers.

Required request headers:

Content-Type: application/json2
X-Client-Code: YOUR_CLIENT_CODE3
X-Client-Key: YOUR_CLIENT_KEY

What this means

  • X-Client-Code identifies the company/client environment.
  • X-Client-Key authorizes access to the API.
  • Content-Type: application/json tells the API that the request body is sent in JSON format.

Main Integration Flow

A standard webshop integration should be implemented in the following order:

  1. Read new and updated products from Resico ERP.
  2. Read current stock balances from Resico ERP.
  3. Create or update customers in Resico ERP when webshop orders are received.
  4. Create sales invoices in Resico ERP.
  5. Add invoice lines to the created sales invoice.

Product Data Retrieval

Product information is retrieved from Resico ERP and used to update the webshop product catalog.

The recommended approach is to request only new or updated products since the last synchronization. Full product catalog export on every request is not recommended because it creates unnecessary load and may be blocked by the system

Example request

curl --location 'https://api.resico.com/json/v1/products?limit=100&page=1&order=SKU%20desc&return=SKU,ParentSKU,Name,Unit,VAT,Price,SalePrice,Category,Active,Balance' \
--header 'Content-Type: application/json' \
--header 'X-Client-Code: YOUR_CLIENT_CODE' \
--header 'X-Client-Key: YOUR_CLIENT_KEY' \
--data '{"Updated":">2025-04-30 01:09:35"}'

What this request does:

  • This request returns products that were updated after the specified date and time.
  • The request also limits the response to selected product fields:
    • SKU
    • ParentSKU
    • Name
    • Unit
    • VAT
    • Price
    • SalePrice
    • Category
    • Active
    • Balance

Example response structure

{
  "status": "ok",
  "type": "Products",
  "fields": {
    "Updated": ">2025-04-30 01:09:35"
  },
  "Products": {
    "current_page": 1,
    "data": [
      {
        "SKU": "tset456-234",
        "Name": "Burgers extra",
        "Unit": "GB",
        "VAT": "A",
        "Price": 0,
        "SalePrice": 0,
        "Active": true,
        "Balance": {
          "Location 1": 0,
          "Totals": 0
        }
      }
    ]
  }
}

Field meaning :

  • SKU: Product code used to identify the product.
  • Name: Product name.
  • Unit: Product unit of measure.
  • VAT: VAT code configured in Resico ERP.
  • Price: Base product price.
  • SalePrice: Sale price if used.
  • Active: Indicates whether the product is active.
  • Balance: Stock balance by location and total balance.

Product Stock Balance Retrieval

Product stock balances can be retrieved in two ways:

Option 1: Product request with Balance field

This method uses the product endpoint and requests only the fields needed for stock synchronization, such as SKU and Balance. It can also filter by update date and selected SKU values.

Example request:

curl --location 'https://api.resico.com/json/v1/products?limit=100&page=1&order=SKU%20desc&return=SKU,Balance' \
--header 'Content-Type: application/json' \
--header 'X-Client-Code: YOUR_CLIENT_CODE' \
--header 'X-Client-Key: YOUR_CLIENT_KEY' \
--data '{"Updated":">2025-04-30 01:09:35", "SKU":"dog_food_12;ABAC;tset456-234"}'

What this request does

This request returns stock balances only for selected products:

  • dog_food_12
  • ABAC
  • tset456-234

Example response structure:

{
  "status": "ok",
  "type": "Products",
  "fields": {
    "Updated": ">2025-04-30 01:09:35",
    "SKU": "dog_food_12;ABAC;tset456-234"
  },
  "Products": {
    "data": [
      {
        "SKU": "dog_food_12",
        "Balance": {
          "Location 1": 24,
          "Totals": 24
        }
      },
      {
        "SKU": "ABAC",
        "Balance": {
          "Location 1": -5,
          "Totals": -5
        }
      }
    ]
  }
}

Use this method when the webshop needs to update stock balances for multiple products at once.

Option 2: Balance request for one product

This method retrieves the balance for one specific product SKU.

Example request:

curl --location 'https://api.resico.com/json/v1/products/dog_food_12/balance' \
--header 'Content-Type: application/json' \
--header 'X-Client-Code: YOUR_CLIENT_CODE' \
--header 'X-Client-Key: YOUR_CLIENT_KEY'

This request returns balance information for the product with SKU:

dog_food_12

Example response structure:

{
  "status": "ok",
  "type": "ProductsBalance",
  "fields": {
    "SKU": "dog_food_12"
  },
  "ProductsBalance": {
    "data": [
      {
        "SKU": "dog_food_12",
        "Balance": {
          "Location 1": 24,
          "Totals": 24
        },
        "BalanceDetailed": {
          "Location 1": {
            "balance": 24,
            "reserved": 0,
            "expected": 24,
            "location_id": 1,
            "location_name": "Ozolu veikals (Location 1)",
            "balance_updated": "2025-11-08 08:13:51"
          }
        }
      }
    ]
  }
}

Field meaning

  • Balance: Simple stock balance grouped by location.
  • Totals: Total stock balance across locations.
  • BalanceDetailed: Detailed balance information per location.
  • reserved: Quantity reserved for other processes.
  • expected: Expected available quantity.
  • location_id: Internal location ID.
  • location_name: Location name.
  • balance_updated: Last balance update timestamp

Customer Creation and Update

A customer must exist in Resico ERP before a sales invoice can be created. Sales invoice creation without a customer is not possible.

Customer identification depends on Resico ERP settings. Identification may be based on:

  • Email
  • Phone number

Email and phone fields are validated and must match the expected email and phone number formats.

Customer creation

A new customer is created by sending customer data in the request body.

Example request :

curl --location --request PUT 'https://api.resico.com/json/v1/customers' \
--header 'Content-Type: application/json' \
--header 'X-Client-Code: YOUR_CLIENT_CODE' \
--header 'X-Client-Key: YOUR_CLIENT_KEY' \
--data-raw '{
  "Code": "ABC123",
  "Name": "SIA TEST",
  "Address": "Tinuzu pagasts, Tornkalni 22",
  "PostCode": "LV-6789",
  "Phone": "+37111111111",
  "Email": "test@test.lv"
}'

This request creates a new customer with:

  • Customer code: ABC123
  • Name: SIA TEST
  • Address: Tinuzu pagasts, Tornkalni 22
  • Phone: +37111111111
  • Email: test@test.lv

Example response structure:

{
  "status": "ok",
  "type": "Customers",
  "Customers": {
    "data": [
      {
        "ID": 12398,
        "Code": "ABC123",
        "Name": "SIA TEST",
        "Address": "Tinuzu pagasts, Tornkalni 22",
        "PostCode": "LV-6789",
        "Phone": "+37111111111",
        "Email": "test@test.lv",
        "Created": "2026-03-20T10:42:00+02:00",
        "Updated": "2026-03-20T10:42:00+02:00"
      }
    ]
  }
}

Customer update

An existing customer is updated by specifying the customer Code in the request URL.

Example request :

curl --location --request PUT 'https://api.resico.com/json/v1/customers/ABC123' \
--header 'Content-Type: application/json' \
--header 'X-Client-Code: YOUR_CLIENT_CODE' \
--header 'X-Client-Key: YOUR_CLIENT_KEY' \
--data-raw '{
  "Name": "SIA TEST NEW",
  "Address": "Tinuzu pagasts, Tornkalni 22",
  "PostCode": "LV-6789",
  "Phone": "+37111111111",
  "Email": "test@test.lv"
}'

This request updates the customer with code:

ABC123

The updated customer data is sent in the request body.

Sales Invoice Creation

Sales invoice creation in Resico ERP is done in two steps:

  1. Create the sales invoice header.
  2. Add invoice lines to the created invoice.

Step 1: Create sales invoice header

The invoice header contains the main sales document information.

Example request :

curl --location --request PUT 'https://api.resico.com/json/v1/salesinvoice' \
--header 'Content-Type: application/json' \
--header 'X-Client-Code: YOUR_CLIENT_CODE' \
--header 'X-Client-Key: YOUR_CLIENT_KEY' \
--data '{
  "Type": "local",
  "Description": "",
  "PaymentMethod": "BANK",
  "LocationCode": "LocABC",
  "PaymentTerms": "0",
  "ApproveDate": "2026-01-28",
  "ShipmentStartDate": "2026-01-28",
  "ShipmentEndDate": "2026-01-28",
  "ShipmentAsPeriod": false,
  "PaymentDueDate": "2026-01-28",
  "Transporter": "",
  "TransporterNotes": "",
  "Notes": "",
  "Paid": true,
  "PrintoutHeader": 2,
  "ElectronicPrintout": false,
  "CustomerCode": "1",
  "CustomerDeliveryAddress": "Riga; Biekensalas iela 21, LV-1001"
}'

Field meaning

  • Type: Sales invoice type.
  • PaymentMethod: Payment method, for example BANK.
  • LocationCode: Resico location used for the document.
  • PaymentTerms: Payment term value.
  • ApproveDate: Invoice approval date.
  • ShipmentStartDate and ShipmentEndDate: Shipment period dates.
  • PaymentDueDate: Payment due date.
  • Paid: Indicates whether the invoice is already paid.
  • CustomerCode: Customer code in Resico ERP.
  • CustomerDeliveryAddress: Delivery address used for the invoice.

Example response structure :

{
  "status": "ok",
  "type": "Salesinvoice",
  "fields": {
    "ID": 365
  },
  "Salesinvoice": {
    "data": [
      {
        "ID": 365,
        "Number": "TTT-19780-000060-T",
        "DocumentType": "sales_invoice",
        "Type": "local",
        "PaymentMethod": "BANK",
        "LocationCode": "MobilePay",
        "Status": 1,
        "Paid": true,
        "Customer": {
          "Code": "1",
          "Name": "SIA TEST 13"
        },
        "Total": {
          "total_excl_vat": 0,
          "total_incl_vat": 0,
          "currency": "EUR",
          "row_count": 0
        }
      }
    ]
  }
}

Step 2: Add invoice line

Invoice lines are added separately after the sales invoice header is created. The invoice number or invoice ID must be included in the request URL.

Example request :

curl --location --request PUT 'https://api.resico.com/json/v1/salesinvoice/363/line' \
--header 'Content-Type: application/json' \
--header 'X-Client-Code: YOUR_CLIENT_CODE' \
--header 'X-Client-Key: YOUR_CLIENT_KEY' \
--data '{
  "SKU": "1000010",
  "Qty": 4,
  "Price": 10,
  "DiscountPercent": 0,
  "ActualAmount": 80,
  "VAT": "A"
}'

This request adds a product line to sales invoice:

363

The line contains:

  • SKU: 1000010
  • Quantity: 4
  • Price: 10
  • Discount percent: 0
  • VAT code: A

Example response structure :

{
  "status": "ok",
  "type": "SalesinvoiceLine",
  "fields": {
    "ID": 1323
  },
  "warning": {
    "unknown": [
      "ActualAmount"
    ]
  },
  "SalesinvoiceLine": {
    "data": [
      {
        "ID": 1323,
        "LineNo": 1,
        "SKU": "1000010",
        "Name": "Instrumentu komplekts",
        "Qty": 4,
        "Price": 10,
        "Amount": 33.06,
        "DiscountPercent": 0,
        "ActualAmount": 40,
        "VAT": "A"
      }
    ]
  }
}

Important

If the API response contains a warning, review the warning message. In the example, the response contains a warning about an unknown field:

"warning": {
  "unknown": [
    "ActualAmount"
  ]
}

This means the API accepted the request but did not recognize one of the submitted fields in the expected way.

Required Information

Before implementing the integration, the following information should be prepared:

  • API client code
  • API client key
  • Product fields required by the webshop
  • Product update frequency
  • Stock synchronization method
  • Stock location to use for webshop availability
  • Customer matching rule
  • Required customer fields
  • Sales invoice type
  • Payment method
  • Location code
  • VAT codes
  • Invoice approval logic
  • Required invoice line fields

Validation Rules

  • API requests must include valid X-Client-Code and X-Client-Key headers.
  • Product synchronization should use update filters instead of downloading the full product catalog every time.
  • Product requests should return only the fields required by the webshop.
  • SKU values must match Resico ERP product codes.
  • A customer must exist before creating a sales invoice.
  • Customer email and phone number values must use valid formats.
  • Sales invoice headers must be created before invoice lines are added.
  • VAT codes must match VAT values configured in Resico ERP.
  • Location codes must match locations configured in Resico ERP.
  • Payment method values must match supported Resico ERP payment methods.

Common Errors

  • Incorrect API client code or API key.
  • Full product catalog is requested too often.
  • Product requests do not filter by update date.
  • Required fields are missing from the product response.
  • SKU values do not match between webshop and Resico ERP.
  • Customer is not created before invoice creation.
  • Customer phone or email format is invalid.
  • Invoice line is sent to the wrong invoice ID.
  • VAT code does not exist in Resico ERP.
  • Location code does not match the intended warehouse or store.
  • The response contains warnings, but the integration does not process or log them.

Troubleshooting

  • If authentication fails, verify X-Client-Code and X-Client-Key.
  • If product synchronization is slow, check whether the webshop is requesting the full catalog too often.
  • If product data is missing, check the return parameters in the product request.
  • If stock values are incorrect, confirm whether the webshop should use Totals or a specific stock location.
  • If customer creation fails, check required customer fields and field formats.
  • If invoice creation fails, confirm that the customer exists in Resico ERP.
  • If invoice line creation fails, verify the invoice ID and SKU.
  • If totals are unexpected, review quantity, price, discount and VAT values.
  • If API responses contain warnings, log and review the warning block.

Important Notes

  • The recommended product synchronization method is incremental synchronization using the Updated filter.
  • Full catalog synchronization should be avoided unless specifically required.
  • Stock can be retrieved together with product data or separately for an individual SKU.
  • Customer data must be created or updated before sales invoices are created.
  • Sales invoices are created in two stages: header first, lines second.
  • API responses should be logged during implementation and testing.
  • Integration should first be tested with a limited product and order dataset before enabling full synchronization.

FAQ

Order Is Not Imported into Resico

  • If a order has not appeared in Resico, open the specific order and save it again. This triggers a new attempt to send the order to Resico.
  • If the order still does not appear in Resico, change the order status to Completed and save it once more. This will initiate another synchronization attempt.

Preventing Duplicate Products in the WooCommerce Integration

  • To avoid duplicate products between E-Store and Resico, ensure that each product has a unique and consistent SKU in both systems.
    • Product duplication can occur if:
      • Multiple products share the same SKU.
      • A product has been changed from a simple product to a variable product (or vice versa) without updating the related SKU mappings.
  • Before re-running the synchronization, review and correct the SKU assignments and product relationships. Once the product data is properly aligned, perform the synchronization again.