OneCart API - March 2024 API Endpoints
OneCart API - March 2024 API Endpoints
Introduction
OneCart is a Software-as-a-Service solution for e-commerce sellers. OneCart allows them to
manage inventory, orders, and listings, all from one unified interface.
OneCart provides an API for external partners, like ERP solution providers, to hook into OneCart
functionality from their custom-built applications. The advantages are that partners do not
need to keep up with marketplace/platform API changes, OneCart will monitor and make sure
all endpoints remain valid.
Base URL
The base url for the OneCart application and its API is https://app.getonecart.com/
You should set up your API calls to that base URL, followed by the relevant endpoint.
Responses
All responses are returned as JSON objects. See specific endpoints below for example
responses.
API versioning
The API follows standard best practices, and provides endpoints based on the specific API
version. The general format is: BASE_URL / api / :version / resource
API sandbox
An API sandbox may be available upon request. Please make a request to the Partnerships
manager, however do note that for platform connections (eg: to Shopee, Lazada, etc), you will
need to provide those yourself into your Sandbox account.
Authorisation
API users can access content in their account via an Authorisation token. This can be generated
via their OneCart seller interface.
The API key is to be included in all API requests to the server in a header that looks like the
following:
Authorization: <token>
Pagination
A variant is a base item in OneCart. It is a sellable item that the user has in their inventory, and
contains a selling price, unit costs, and quantity on hand, amongst other attributes. Variants can
also be known as “SKUs” in other systems. In OneCart, the resource is called a “Variant” which
has an attribute field called a “SKU”.
You should keep a record of the SKU + Variant ID pair for your customer’s items. OneCart’s API
requires you to use the variant ID as an identifier for API actions.
GET /api/v1/variants
Sample response:
[{"id": 2,
"sku": "P21_Shampoo",
"price": 12.0,
"quantity": 50,
"product_id": 26108,
"created_at": Fri, 02 Jul 2021 07:14:36 UTC +00:00,
"updated_at": Fri, 24 Sep 2021 04:54:34 UTC +00:00,
"option_name_1": "Volume",
"option_value_1": "200ml",
"update_listings": false,
"reserve_qty": 0,
"unit_cost_price": 0.0,
"total_inventory_value": 0.0},
{"id": 1,
"sku": "M733-18601#S",
"price": 21.0,
"quantity": 3,
"product_id": 1,
"created_at": Sat, 29 Feb 2020 08:43:31 UTC +00:00,
"updated_at": Fri, 17 Sep 2021 06:21:44 UTC +00:00,
"option_name_1": "Size",
"option_value_1": "S",
"update_listings": true,
"reserve_qty": 0,
"unit_cost_price": 12.9,
"total_inventory_value": 38.7}]
To search for a specific subset of variants, you can pass in a SKU parameter into the query
GET /api/v1/variants?sku={sku_string}
Updating a variant
You can update a variant’s quantity via the API. Note that for variants where the update_listings
attribute is toggled to true, this will push out that same quantity to all connected listings on all
shops.
PUT /api/v1/variants/:id?quantity={new_quantity}
Orders
Orders from the various shops/marketplaces are stored in a standardized format in OneCart.
GET /api/v1/orders
If you have the marketplace order number, that can also be searched for via a query parameter:
GET /api/v1/orders?order_no={order_no}
You can query a specific order based on the internal OneCart order id. This will give you the
specific order line items as well
GET /api/v1/orders/:id
Sample response
{"id": 1,
"order_no": "2342342342948234982394",
"created_at": Thu, 22 Apr 2021 15:58:27 UTC +00:00,
"updated_at": Thu, 16 Sep 2021 04:26:39 UTC +00:00,
"platform": "Shopify",
"company_id": 1,
"order_date": Thu, 22 Apr 2021 15:57:40 UTC +00:00,
"status": "pending",
"net_amt": 205.0,
"gross_amt": 205.0,
"tracking_no": null,
"warehouse_status": "picking",
"shop_id": 117,
"cancel_reason_text": null,
"order_items": [{
"variant_id": 22,
"sku": "ABC-123",
"qty": 1,
"unit_price": 205.0,
"line_total": 205.0,
}]
} Private & Confidential
For authorized OneCart Partners only
Do Not Distribute
Private & Confidential
For authorized OneCart Partners only
Do Not Distribute
order_date_start
order_date_end
updated_start
updated_end
You can query orders by when the order was placed (order_date_start), and also when the
order was updated (updated_start) in OneCart. Tracking by order updates will help you catch
any status changes, tracking number updates, and so on.
To do so, you must provide at least the start time in Unix format. If you only provide the
order_date_start param, then the query will return all orders from after that time period until
the current time. You need to paginate through the results if there are a lot of records.
If you provide both the start and end time per the format above, then you will receive the list of
orders made within that time frame. Note again that the accepted format is Unix time, so if you
want to query orders between “2021-11-11 at 1pm SG time” and “2021-11-11 2pm SG time”,
then the params needed are 1636606800 and 1636610400. You will need to convert your
params to Unix time before making your query.
Examples:
GET /api/v1/orders?order_date_start={order_start_time}
GET
/api/v1/orders?order_date_start={order_start_time}&order_date_end={order_end_
time}
GET /api/v1/orders?updated_start={order_updated_time}
You can set specific orders to ship via the API. This currently only works for Shopee, Lazada, and
Qoo10 orders.
For Lazada orders, it will set the status to “ready_to_ship”, which will trigger your 3PL to come
pick up the order.
For Shopee & Qoo10 orders, there is a time component for the pickup. When you trigger auto-
ship for these orders, the date and time pickup for Shopee is the next available day for pickup
for that order (as determined by Shopee), at the 12pm to 3pm slot. For Qoo10, it is simply the
next calendar day. These date selections are currently fixed and not editable via params,
though we may update this in the future.
PUT /api/v1/orders/:id?mark_as_shipped=true
Note that this endpoint requires the unique OneCart order ID, not the platform order number.
To obtain the unique OneCart order, you may query via the platform number first to get a
single order result, or use some of our other available queries to get the list of orders.
For certain whitelisted sellers, OneCart can provide additional information like Customer
Details. This is for sellers who are doing fulfillment via Seller Own Fleet.
For the JSON payload format for the raw_data field, please check the respective platform API
documentation:
Shopee:
https://open.shopee.com/documents/v2/v2.order.get_order_detail?module=94&type=1
Lazada:
https://open.lazada.com/apps/doc/api?path=%2Forder%2Fget