inFlow’s API
For apps and services that aren’t integrated with inFlow, your team’s developers can use the API to read or write data from inFlow’s database.
What is an API?
APIs act as the “front door” for applications to access data or functionality from your inFlow database. This can allow developers or people with knowledge of web development a way to access inFlow’s data from outside the program.
The inFlow Inventory API allows you to read and write data to inFlow Inventory. Like most modern APIs, it’s organized around REST and JSON. This can open a whole world of possibilities for what you can do with that data. This could mean creating your own custom reports or building something like your own integration with other software.
The inFlow support team isn’t able to assist with specific API questions. However, we can direct questions to the development team if help is needed!
API Documentation
The documentation for the API can be found here: https://www.inflowstaging.com/api
How can I access the API?
To gain access to inFlow’s API, you will need an active inFlow Inventory subscription and the API add-on. You can do that from the Account page in inFlow.
Then, you can go to inFlow’s Integration page and generate an API key. To create a new API key, click “Add new API key” and give it a name. Once it’s created, you’ll be given your API key to access your inFlow Inventory account (until revoked), so please keep it safe! You will also need your ‘companyId’, an identifier for your inFlow Inventory account, which can be found on the integration page as well with your API keys.
Sample API Requests
Getting started with any API can be tricky. Here are a few examples of some common requests to get back useful information. Replace {{companyId}} with your actual company ID.
Filtering
https://cloudapi.inflowinventory.com/{{companyId}}/sales-orders?filter[orderDate]={“fromDate“:“2021-03-01“,“toDate“:“2021-04-03“}&filter[isActive]=true&filter[smart]=18
Filtering is a great way to only return the information you want. Most requests can be filtered using various different filters. The documentation shows which filter can be applied to each request.
In this example, we request sales orders from March 1st, 2021, to April 3rd, 2021, but only to return active or non-canceled orders and any containing the number 18.
filter[orderDate]={“fromDate”:“2021-03-01“,“toDate“:“2021-04-03“} is a good example of how to create and use a date object when filtering. You specify the starting and ending dates, and inFlow will return the results between these dates.
filter[smart]=18 is a special filter that will search across multiple fields. In the case of sales orders, this will search both the order number and the customer name for the number 18 and give results based on that. The smart filter will search different fields based on which endpoint you are calling, and check the documentation for fields it searches across.
Include & Pagination
https://cloudapi.inflowinventory.com/{{companyId}}/products?include=cost,defaultPrice,vendorItems,inventoryLines&count=50
To keep things as fast as possible, the API returns small chunks of data rather than everything that is available. This comes in 2 forms, pagination and includes.
Pagination limits the number of results that are returned at one time. By default, the API will return 20 results at one time. You can increase this amount, or specify where in the results to return by telling the API to return results before or after a certain entityId. The above example uses count=50, to return 50 results instead of the default 20. You can find more about pagination in the documentation by clicking on the word request under Query Parameters in each section.
Includes statements are extremely powerful with inFlow’s API. Because so much information is linked to each other inside inFlow, by default the API will return only the basic information of what you request. To get more information or related data to what you are requesting, you will need to use the includes parameter. Adding this will return the object you specify in the includes request.
In the example above, we are requesting a list of products, but we are including several objects of extra information as well. include=cost,defaultPrice,vendorItems,inventoryLines We are requesting to also include the product’s cost, default price, Vendors it’s listed under and the inventory lines which returns information like the quantity on hand and the location of that stock. You can find all the different objects you can include in your requests in the documentation.
These include statements can also be linked to getting even more information
https://cloudapi.inflowinventory.com/{{companyId}}/sales-orders?include=lines.product.category
Here include=lines.product.category, not only is returning the individual product lines on the sales order (include=lines), but it is also returning the product information (include=lines.product) like product name, item type, barcode etc. Going one step further, adding the .category also returns the category object that this product belongs to!
Questions/Support
If you have any questions about using the API or run into any issues, get in touch with the inFlow team.
0 Comments