Remove Related Products from News
This API lets you detach one or more related products from a news article. Only the link between the product and the article is removed — the product itself is not deleted from the system.
Endpoint
http DELETE https://staging-manage.api.miniai.vn/api/external/news/{id}/items
http DELETE https://manage-api.miniap.vn/api/external/news/{id}/items
The news API sits directly under /api/external/news, without the /v1 prefix used by the product and order APIs.
Authentication
Every request must include your API key in the header:
| Header | Value | Required |
|---|---|---|
x-api-key | miniai-partner <YOUR_API_KEY> | Bắt buộc |
Content-Type | application/json | Bắt buộc |
The system automatically determines your shop (shopId) from your API key and assigns it to the request.
So you don't need to send shopId in the body.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Bắt buộc | ID of the news article to detach products from (24-character hex ObjectId) |
Request Body
This is a DELETE request with a JSON body — unlike the convention of some HTTP libraries.
For example, with axios, the body of a DELETE must be placed in config.data:
axios.delete(url, { headers, data: { newsIds: [...] } }).
With fetch or curl, send the body just like a regular POST request.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
newsIds | string[] | Bắt buộc | List of product IDs to detach from the article (see note below) |
Despite its name, newsIds accepts product IDs, not news article IDs —
same as the Add Related Products to News API.
If a product ID isn't in the article's related list, the system ignores it and still returns success (idempotent). You can call this API repeatedly without causing an error.
- Request Body
- cURL (Staging)
- cURL (Production)
- Axios
{
"newsIds": [
"68c93dba802d36826bc45d01",
"68c93dba802d36826bc45d02"
]
}
curl -X DELETE 'https://staging-manage.api.miniai.vn/api/external/news/68c93dba802d36826bc45c9c/items' \
-H 'x-api-key: miniai-partner <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"newsIds": [
"68c93dba802d36826bc45d01",
"68c93dba802d36826bc45d02"
]
}'
curl -X DELETE 'https://manage-api.miniap.vn/api/external/news/68c93dba802d36826bc45c9c/items' \
-H 'x-api-key: miniai-partner <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"newsIds": [
"68c93dba802d36826bc45d01",
"68c93dba802d36826bc45d02"
]
}'
await axios.delete(
'https://staging-manage.api.miniai.vn/api/external/news/68c93dba802d36826bc45c9c/items',
{
headers: {
'x-api-key': 'miniai-partner <YOUR_API_KEY>',
'Content-Type': 'application/json',
},
data: {
newsIds: ['68c93dba802d36826bc45d01', '68c93dba802d36826bc45d02'],
},
},
);
Response
Success returns 200. The response only contains the success flag — no article data is included.
To see the remaining products, call Get News List
and check the article's items field.
- Response
{
"success": true
}
Common Errors
| Code | Cause |
|---|---|
400 | Missing newsIds, or newsIds is not an array of strings |
404 | No news article found with the given id |
401 | Missing x-api-key header, wrong miniai-partner prefix, or invalid API key |
429 | Rate limit exceeded (see the Rate Limit section below) |
500 | id or an element in newsIds is not a valid ObjectId format, or a system error occurred |
- 400 Error - Validation
- 404 Error - Not Found
- 429 Error - Rate Limited
{
"statusCode": 400,
"error": "Bad Request",
"message": "Validation failed",
"validation": {
"body": {
"source": "body",
"keys": ["newsIds"],
"message": "\"newsIds\" is required"
}
}
}
{
"error": "Resource not found",
"message": "không tìm thấy tin tức"
}
{
"error": "Too many requests, limit to 100 requests per minute"
}
Rate Limit
Each shop can make at most 100 requests per minute across the entire External API.
Exceeding this limit returns a 429 status.
Next Steps
- Get News List — check the article's
itemsfield after removing - Add Related Products to News — re-attach a removed product
- Delete News — permanently delete the article from the system