Skip to main content

Update Stock

This endpoint used for update product stock. You can update up to 100 products or SKUs in a single request to this endpoint.

Path

post

/inventory/v1/fs/:fs_id/stock/update?shop_id={{shop_id}}

Request Parameters

ParameterTypeRequiredLocationDescription
fs_id
Integer
Required
path
Fulfillment service unique identifier
shop_id
Integer
Required
query
Shop unique identifier
bypass_update_product_status
Boolean
Optional
query
Use to bypass update product status flow when overwrite stock to 0 (empty) or restock
warehouse_id
Integer
Optional
query
Warehouse unique identifer
sku
String
Required if product_id not inputted
body
SKU of products that will be updated. Maximum characters allowed is 50
product_id
Integer
Required if sku not inputted
body
Product ID to update
new_stock
Integer
Required
body
New stock to be set

Example Request

curl -X POST \
'https://fs.tokopedia.net/inventory/v1/fs/13004/stock/update?shop_id=479573' \
-H 'Authorization: Bearer avK2WV5pSda4HlxC5mLrFA' \
-H 'Content-Type: application/json' \
-d '[
{
"sku": "YS1234",
"new_stock": 20
},
{
"sku": "ABC1234",
"new_stock": 30
},
{
"product_id": 15123699,
"new_stock": 40
}
]'

Response Parameters

NameTypeDemo ValueDescription
failed_rows
Integer
2
Failed Row Count
failed_rows_data
Object Array
succeed_rows
Integer
0
Succeed Row Count

Success Response Examples

{
"header": {
"process_time": 0.045122173,
"messages": "Your request has been processed successfully"
},
"data": {
"failed_rows": 0,
"failed_rows_data": [],
"succeed_rows": 3
}
}

Error Response Examples

{
"header": {
"process_time": 0.045122173,
"messages": "Your request has been processed successfully"
},
"data": {
"failed_rows": 3,
"failed_rows_data": [
{
"product_id": 151231699,
"sku": "",
"product_url": "",
"new_stock": 40,
"message": "Invalid Product ID."
},
{
"sku": "ABC12314",
"product_url": "",
"new_stock": 30,
"message": "Invalid SKU."
},
{
"sku": "YS11234",
"product_url": "",
"new_stock": 20,
"message": "Invalid SKU."
}
],
"succeed_rows": 0
}
}

Error Codes

Error CodeError MessageDescription
PRD_GRPC_001
Failed Send GRPC Request
Failed sending request to upstream
PRD_GRPC_002
There Are Error From Ext Service
Failed getting response from upstream
PRD_API_007
Failed Marshalling JSON
Error on processing data
PRD_DB_001
Failed To Query DB Data
Failed getting data from database
PRD_DB_002
Failed To Scan DB Data
Failed getting data from database
PRD_DB_003
Data Not Found
Failed getting data from database
PRD_USC_009
Warehouse is not owned by toko cabang
PRD_USC_010
Warehouse is owned by toko cabang
PRD_USC_011
Partner ID not found
Failed to get Partner ID
PRD_USC_012
Shop ID Not Match
Shop ID did not match with warehouse data
PRD_USC_013
FS Type cannot use warehouse
Failed to precess data
PRD_USC_021
Warehouse Data Not Found
Warehouse ID not found
PRD_USC_029
Warehouse ID Information Not Found
Failed to get warehouse information
PRD_DLV_001
fs_id cannot be empty
fs_id field is empty, please check again
PRD_DLV_002
invalid fs_id format
fs_id is in the wrong format, please check again
PRD_DLV_003
invalid shop_id format
shop_id is in the wrong format, please check again
PRD_DLV_015
failed read body request
Failed reading the body request
PRD_DLV_016
shop_id cannot be empty
shop_id field is empty, please check agai
PRD_DLV_018
Max allowed products per-update are %d products
The request has exceed the max allowed product price edit per request
PRD_DLV_019
invalid warehouse_id format
warehouse_id is in the wrong format, please check again
PRD_DLV_042
Invalid field %s format, value %v should be %s
There is something wrong with the request body
PRD_DLV_052
warehouse_id cannot be empty
warehouse_id is empty, please check again
SHP_GRPC_001
Failed Send GRPC Request
Failed sending request to upstream
SHP_GRPC_003
Data Not Found
Failed finding data from upstream

Have a feedback?