Delete product
Permanently remove one Store product from the community that owns your API key.
- Method
- DELETE
- Path
https://api.returning.ai / v1/ products/ {productID} - Permission
- store
- Retries
- No Idempotency-Key; a repeat returns 404
When to use this
- A reward is discontinued and should never come back.
- You created a product by mistake, for example with the wrong category or price.
- You clean up test products after checking your integration.
Authentication#
- Header
Authorization: Bearer <API_KEY>- Permission
- storeShown in the dashboard as “Store”
Send a Community API key with the store permission. The key decides the community, so you can only delete products in that community. Keep the key on your server.
Behaviour#
The product is removed at once and can't be restored: Read product returns 404 from then on. Orders traders already placed for it are kept, and still appear in the order lists and order detail. Those orders can lose the product's ID and name, because the product can't be looked up any more.
Archiving keeps the product and hides it from traders. Use Update product and append vouchers with isArchived: true when you might want it back.
Request#
Path parameters#
Rule24-character hex ID
Eg66f000000000000000000101
Headers#
store.RuleBearer <API_KEY>
curl --request DELETE \
--url https://api.returning.ai/v1/products/66f000000000000000000101 \
--header 'Authorization: Bearer <API_KEY>'
Response#
A 200 returns the deleted product's ID as a string in data. Branch on the HTTP status and meta.code, never on message.
Eg{ ... }
Rulesuccess
Eg200
RulePRODUCT_DELETED
Eg"Delete product success."
Eg"66f000000000000000000101"
{
"meta": {
"status": "success",
"statusCode": 200,
"code": "PRODUCT_DELETED"
},
"message": "Delete product success.",
"data": "66f000000000000000000101"
}
Errors#
Every error carries its code in meta.code, with the reason in detail. A product in another community returns 404, the same as a missing one.
Fix the request04
VALIDATION_FAILEDFix the requestproductID isn't a 24-character hex ID. Nothing was deleted.AUTH_API_KEY_REQUIREDFix the requestAuthorization: Bearer <API_KEY>.AUTH_API_KEY_INVALIDFix the requestAUTH_PERMISSION_REQUIREDFix the requeststore. Add the permission in Settings > Integration > API Keys.Fix the data01
STORE_RESOURCE_NOT_FOUNDFix the dataRetry with backoff03
STORE_DEPENDENCY_UNAVAILABLERetry with backoffINTERNAL_ERRORRetry with backoffAUTH_API_KEY_VALIDATION_FAILEDRetry with backoff{
"meta": {
"status": "error",
"statusCode": 400,
"code": "VALIDATION_FAILED"
},
"message": "Validation failed",
"detail": {
"productID": "productID must be a valid MongoDB ObjectId string"
},
"solution": "Please check the request and try again"
}