The Inventory Planner APIs (beta) provide realtime access to data in your Inventory Planner account and is intended to be used by developers. Please note that the APIs are currently in beta and subject to change.

In this article:

APIs available

  • Stock Orders API

    • Primarily used to sync purchase order information with a platform that is not connected to Inventory Planner, typically a 3PL. Detail about purchase orders created in Inventory Planner can be pulled via the API, then receiving information can be pushed back to Inventory Planner.

  • Reports API

    • Commonly employed to pull data in order to create custom dashboards or reports. Inventory Planner has over 200 metrics available. These can be queried to create a report outside of Inventory Planner.

Authorization

To access Inventory Planner API, first you need an API authorization key. The key is user-specific and ONLY works for users with full access to the account. To obtain the key:

  • Log in to Inventory Planner using web browser

  • Go to Account, Settings, API tab

  • Use Generate key to generate API key

  • Save generated key

Use 'Delete key' if you would like to remove the key.

To authorize using API key, add the following two headers to HTTP requests:

Authorization: <API_key>
Account: <account_id>

Note that you can also access the API from the browser using existing Inventory Planner session. This may be useful for making manual requests with browser.

Making Requests

Requests that modify (POST, PUT, PATCH), set Content-Type: application/json header. We also recommend to set Accept: application/json header.

Resource URLs

There are two kinds of resources: entity collection resource (list of items) and single entity resource (single item). Every entity also has two names: singular name and plural name (usually obtained by adding 's'). The URL for single entity resource is normally the child of corresponding collection resource with entity id appended. Additionally, if the entity has a collection field, corresponding collection resource is the child of the entity resource, with field name appended.
The base URL for API is https://app.inventory-planner.com/

Here is an example:

  • Singular name is purchase-order , plural name is purchase-orders .

  • api/v1/purchase-orders is the collection resource.

  • api/v1/purchase-orders/12345 is the single entity resource for the purchase order id 12345.

  • api/v1/purchase-orders/12345/items is the collection resource for items for the purchase order id 12345.

  • api/v1/purchase-orders/12345/items/987 is the single entity resource for item id 987 for the purchase order id 12345.

Request and response structure

The response optionally contains result document with the following fields:

  • status - status of operation (success or error )

  • message - human-readable message describing the operation (optional)

{
    "result": {
        "status": "success",
        "message": "Updated variant 12345"
    },
    ...

Timestamp fields in response/request use RFC822 format (for example, "2018-03-15T10:00:00+01:00")

GET (collection resource) 

GET on a collection resource returns entity list in JSON format. The response contains two fields:

meta is a document with information about result set with the following fields: 

  • name - entity name

  • total - total number of items

  • count - number of items in this response

  • limit - limit for this response (if paging)

<entity_plural_name> in the response is the list of entity values. See description of particular API endpoint for more information.

{
    "meta": {
        "name": "variants",
        "total": 13,
        "limit": "20",
        "page": 0
    },
    "variants": [
        {
            "id": 17948565252,
            ...
        }
    ]
}

GET (single resource)

GET on single item resource returns the entity in JSON format. In the response, entity_singular_name field contains the entity fields.

{
    "variant": {
        "id": 17948565252,
        ...
    }
}

PATCH (single resource)

PATCH on single item resource partially modifies the entity using update contained in the body of request in JSON format. In the request, entity_singular_name should contain the updated fields. In the response, entity_singular_name will return all of the entity fields after update.
Only writable fields can be modified. Read-only and unknown fields in the request are ignored. See the description of particular API endpoint for information about fields.

PATCH request example:

PATCH /api/v1/variants/17948565252
{
    "variant": {
        "lead_time": 7,
        "review_period": 21
    }
}

PATCH response example:

{
    "variant": {
        "id": 17948565252,
        "sku": "SKU1",
        "lead_time": 7,
        "review_period": 21,
        ...
    }
}

PUT (single resource)

This request creates or fully updates entity with id provided in the URL based on request contents. PUT is only available on some resources. 

POST (collection resource)

This request creates new collection item based on request contents. In the request, entity_singular_name should contain the item fields. In the response, entity_singular_name will contain all of the new entity fields after creation.

Restricting fields

fields  parameter contains comma-separated list of fields to return. For example, fields=id,sku,replenishment returns 3 fields.

We recommend to always specify fields parameter to reduce bandwidth usage.

Paging

Paging is controlled by two parameters: limit - the number of results to return and page - page number. The maximum value for limit is 1000.

Filtering

You can filter by a field by using parameter with same name. You can also use field name and operator (separated by '_').
The following operators are available:

  • eq (default) - equal

  • eqi  - equal ignoring case

  • ne - not equal

  • gt , gte , lt , lte - greater than, greater than or equal, less then, less than or equal

  • range - match numeric value in range (separated by dash), for example, 5-10

  • match - match regular expression

  • in - equal on (comma-separated) values 

Here are some examples:

  • sku=SKU1 or sku_eq=SKU1 to retrieve variant with given SKU

  • replenishment_gt=0 (or replenishment_gte=1 ) to retrieve variants with non-zero replenishment number

Removed variants are not returned by default. To retrieve them, use removed=true parameter.

Sorting

Add <field>_sort parameter with possible values asc/desc or 1/-1 . For example, use replenishment_sort=desc or replenishment_sort=-1 to sort by replenishment field in descending order.

Misc

You can pretty print JSON output by adding pretty=1 parameter to the request

Endpoints

See specific API documentation for relevant endpoints:

  • Stock Orders API

    • Purchase Orders

    • Transfers and Assembly Orders

    • Purchase Order Items

    • Purchase Order Connections

    • Purchase Order Stock Updates

Did this answer your question?