Optimus Price API

Version: v1.0.0

Introduction

The Optimus Price API follows the REST standards. You can use it to upload your sales and download the recommended prices.

Authentication

To use the API you need to authenticate using a Token in the Authorization headers. This Token is provided in the profile section of your Optimus Price account.
Get Token in profile

Return codes

Error Code Error Type
200 OK Request completed successfully
202 Accepted The request has been accepted, but the previous processing has not been completed. The header Retry-After indicates the estimated time (in seconds) to finish the current operation
400 Bad Request Invalid request, e.g. input with bad format or data
401 Unauthorized Authentication or permission error, e.g. incorrect token
404 Not Found Requests to resources that don’t exist or are missing
405 Method Not Allowed A request method is not supported for the requested resource; e.g. a GET request on a only POST endpoint
500 Internal Server Error Server error

Usage

A typical call to Optimus Price consists of three steps:

  1. Upload sales data
  2. Wait until sales are processed
  3. Get price recommendations

1. Upload sales data

Uploading new sales is simple. First, generate an xls or csv file using the following instructions. Use this sample file as a template.

Request

curl -H "Authorization: Token XXXXX" -X POST -F "file=@my_sales_data.xls" https://app.optimusprice.ai/api/v1/sales

Input data

file: the xls or csv file with the sales

Response

Status: 200
Body: empty

2. Wait until sales are processed

After the upload, Optimus Price needs time to process and calculate the new prices recommendations. You can get an estimation of the remaining time using the same endpoint you use to get the prices.

When price recommendations are ready, a call to /api/v1/prices will return the prices and a 200 status code.

While Optimus Price is still working, the HTTP status code will be 202. You can check the remaining time in the response header Retry-After (in seconds)

Request

curl -H "Authorization: Token XXXXX" https://app.optimusprice.ai/api/v1/prices?output_format=csv

Input data

(empty)

Response

Status: 202
Retry-After (in headers): Time in seconds
Body: empty

3. Get price recommendations

When Optimus Price is finished you will get the prices using the same call, and an HTTP status code of 200.

Request

curl -H "Authorization: Token XXXXX" https://app.optimusprice.ai/api/v1/prices?output_format=csv

Input data

(empty)

Response

Status: 200
Body (text/csv):

SKU;NAME;NEW PRICE
100022;Skim fresh milk Puleva 1,5L;2,03
1998834;Shampoo TRESemmé Ondas (Im)perfectas;5,51
6116764;Iberian sausage Campofrío 200g;3,99
77126434;Iberian ham 80g hand cut;12,11

create_user

get_master_token

prices

sales

update_user