Integrate Magento data to optimized your inventory with Lokad

Analytics and Inventory Forecasting for Magento

Lokad can be seen as an add-on for Magento. We deliver advance inventory forecasting, commerce analytics and pricing optimization. Lokad is an app, like Magento, with a monthly subscription. Magento-powered merchants typically get started with Lokad to optimize their inventory, that is, increase service levels while reducing inventory levels in the same time. Don't hesitate to request a free demo; while we strive to make Lokad as simple as possible, optimizing inventory tends to be inherently complex.

The data from Magento can be imported in just a few clicks into Lokad thanks to a native integration that leverages the Magento REST API. In this page, we details how to make the most of this native Magento integration.

Magento authorization

In order to import your Magento data into Lokad, you need a Lokad account. If it's not already done, you can get one at no cost in 60s. Then, when you log into your Lokad account for the first time, you will be proposed to establish a connection with multiple data sources, Magento being one of them. At this point, a bit of preparation is needed within the admin section of Magento.

  • Go to System » Web Services » REST OAuth Consumers (the path should be https://mystore//index.php/admin/oauth_consumer). Here, we will create the entry that defines Lokad as an authorized third party consumer of the API.
  • Click Add new. In the form, enter Lokad for the Name and for the callback URL. Copy and paste both the key and the secret somewhere, you will need those two settings later.
  • Enter your admin password and validate. The REST consumer is created.
  • Go to System » Web Services » REST Roles. Here, we will grant the proper rights to this role.
  • Click Add Admin Role, then go to Role API resources on the left. At this point, you should defines the rights to be granted to Lokad. On the right, select Resource Access: Custom.
  • In the tree of options that expands below, check all the boxes named Retrieve. This will grant a read-only access to Lokad to those resources. Image
  • Click Role Users on the left, and add your own user (it's typically admin) to the list.
  • Finally, click the Save role button at the top.
  • Go to System » Web Services » REST Attributes and select the user type associated with your user.
  • In the Resource Access dropdown, select Custom, and then, as the tree of options appear, check all the Read checkboxes. This will grant a read-only access to those attributes. Image
  • Finally, click the Save button at the top.

Now the back-office setup is done within Magento. Go back to your Lokad account, and click Connect Data Souces. In the list, there is an entry for Magento, select it. Then, Lokad asks you for the URL of your store. Once this is done, you should enter the key and secret as obtained from Magento in the process detailed above. Paste those values here, and click on Next to proceed. You are redirected to your Magento store where you should give a final confirmation that you grant the rights to Lokad. Once this is done, you are redirected to Lokad where Magento is now listed as a data source in your Lokad account.

Two remarks:
  • our data retrieval logic is read-only. Your Magento data will not be modified in any way by Lokad. If you follow the setup outlined here above, Lokad won't even have the right to write anything to your Magento account.
  • your company remains the sole owner of your data. By default, we treat this data as if an NDA was in place between your company and Lokad. If you want an actual NDA to be signed, just .


When Lokad fails are retrieving the data from Magento, it's most frequently a problem with the Magento configuration. First, we suggest to to use a recent version of Magento, ideally 1.9+ or above. Many bugs have been fixed in Magento over time within the REST API, so using a recent version is significantly easier than using an old version.

Second, you should make sure that your REST API is properly working. We suggest to check this tutorial to manually test your REST API endpoints. In particular, you should be able to enumerate your products and your sales orders. If the operation fails, then the Lokad data import will most likely fail for the same reason.

Data retrieved from Magento

Lokad retrieves extensive data from Magento which include:
  • All products with the category, the brand, the stock on hand.
  • The sales order history with the quantity, the net amount, the tax amount, the client.


The file Lokad_Items.tsv contains the columns:
  • Id: the product identifier
  • Name: the name of the product
  • Variant: the options of the variant
  • StockAvailable: the quantity of stock available


The file Lokad_Orders.tsv contains the columns:
  • Id: identifier combining the outlet ID and the product ID
  • Date: the creation date of the order
  • Quantity: the quantity of the order line
  • NetAmount: the total charged for this order line, tax excluded
  • TaxAmount: the total tax charged for this order line
  • Currency: the currency code
  • Channel: the source of the order
  • Client: the identifier of the client
  • OrderId: the identifier of the order