🛠️API Integration
Step 1: Creating your organisation
If you don't already have an organisation, please reach out to info@paqtana.com for an access code and support. Alternatively, your Supply Chain team members might already have created an organisation.
Step 2: Admin access
To configure API access, you will need admin access to the organisation. If you're not the org owner or don't have admin access, please contact an admin for the required permissions. Admin permissions can be granted by navigating to: 1. Settings (gear icon) -> Admin Console -> Manage Users -> Add Users 2. Copy link and share with user 3. Once user has registered, grant admin permissions with: 4. Manage Users -> Select the Admin box in that user's row
Step 3: Auth token
To be able to send data to our API, you will need a token, which grants access to use all Integration API endpoints on behalf of your organisation. Follow these steps:
1. Settings (gear icon) -> Admin Console -> Integration API Configuration v2 2. Select: Generate New Token 3. Store this token securely. You can revoke tokens by selecting the "revoke" option. The token will not automatically expire. We recommend periodically swapping the token for a new one. Extra (not required): for more details on non-automatically-expiring tokens and how to best manage them, please read the relevant OAuth 2.0 documentation.
Step 4: Org & Workspace codes
To prepare for step 5, you will also need your org and workspace codes from the Admin Console. This allows you to direct your API requests to the correct org and workspaces. You or other Paqtana users in your organisation will need to create workspaces according to the setup that they have designed. After this is confirmed, you can get the codes following these steps: 1. Settings (gear icon) -> Admin Console -> Manage Workspaces 2. Note the Organization Code above the Workspace table 3. Note the Code column value for each Workspace.
Step 5: Prepare JSON payloads
For the most straightforward implementation, we recommend using only two endpoints from our API:
PUT api.paqtana.com/v2/org/{org}/master_inventory
POST api.paqtana.com/v2/org/{org}/historical_demand
The first endpoint receives master inventory data. Every request sent, will replace the entire data for the previous payload (a standard PUT endpoint).
The second endpoint (POST) receives historical demanda data. This can be sent in segments and the stored data will be combined. If the same day and item (location+code) is sent again, the new data will replace the previous value for that specific day/item. Other data that is not replaced will remain the same. A common scenario is to send 1 or more initial historical demand data batches that covers, for example, a year. After this, it's common to only send for the last day/days as needed.
Please review the JSON structures for each of these endpoints in our API Reference. Note: these endpoints are designed to target all workspaces at once. Therefore, workspace codes are to be placed in the workspaceCode parameters in the JSON payloads, as can be seen in the reference.
Step 6: Send data
Tip: A full example of the basic implementation we recommend can be found in our Postman Example. To finish the integration, you will basically need the token for auth, the JSON data, and your Paqtana organisation ready with workspaces. There are many implementation options to send data, but the following steps are for the basic implementation that we recommend for most cases:
Include the token in the header of all requests as such:
Authorization: Bearer <token>
Send your master inventory data. Remember, this should be all your master inventory data, which will replace the previous endpoint's resource data. Make sure {org} is replaced with your org code in both requests.
Send your historical demanda data. Remember, you can send your initial data in larger batches, before setting up a smaller regular update. The maximum payload size is 32MB. As this is the last endpoint in this example, make sure you include auto_calculate=True as a parameter (query string) to see order suggestions after sending the data as so:
api.paqtana.com/v2/org/{org}/historical_demand?auto_calculate=True
Step 7: Review result and automate process
Now you can go back to Paqtana's UI and see the results in the order table. Bear in mind the supply chain planner will want to configure the groups, calendar events, and other options in Paqtana before becoming fully operational.
Now you can automate the processing of sending data from your ERP, BI, or independent process. We recommend sending the data early once per day, whenever is optimal for your organisation.
Additional Resources:
Last updated