Update News
This API lets you edit an existing news article by its id.
You only need to send the fields you want to change — fields you don't send keep their current value.
This is also the API used to hide/show an article (via status) and to set slug and metaDescription
— fields that cannot be set when creating news.
Endpoint
http PUT https://staging-manage.api.miniai.vn/api/external/news/{id}
http PUT https://manage-api.miniap.vn/api/external/news/{id}
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. If you do send it, that value will be overwritten
with the shop matching your API key.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Bắt buộc | ID of the news article to update (24-character hex ObjectId, e.g. 68c93dba802d36826bc45c9c) |
Request Body
Parameters
All fields are optional — only send the fields you want to change.
| Field | Type | Required | Description |
|---|---|---|---|
title | string | Tùy chọn | New article title. |
content | string | Tùy chọn | New content, HTML supported. When changed, shortContent is regenerated. |
status | string | Tùy chọn | active (visible) or inactive (hidden from the Mini App). |
slug | string | Tùy chọn | New path (see rules below). An empty string "" is allowed. |
metaDescription | string | Tùy chọn | SEO description of the article. An empty string "" is allowed. |
images | string[] | Tùy chọn | New list of image URLs — replaces the current image list entirely. |
cta | object[] | Tùy chọn | New list of call-to-action buttons — replaces the current list entirely. |
type | string | Tùy chọn | Accepted but ignored. |
shortContent | string | Tùy chọn | Accepted but ignored — always auto-generated from content. |
Each element in cta[]
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Bắt buộc | Button label (e.g. "Buy now") |
url | string | Bắt buộc | Button destination. Must match https://zalo.me/s/... |
cta[].url only accepts Zalo Mini App links in the format https://zalo.me/s/<app-id>/<path>.
Any other URL will be rejected with a 400 error.
This API's body does not accept categoryId. Sending it returns a 400 error
(e.g. "categoryId" is not allowed).
slug handling rules
| You send | Result |
|---|---|
slug with a value | The slug is normalized (Vietnamese diacritics stripped, joined with -) and made unique per shop — if it collides, a suffix -2, -3, ... is appended. |
slug: "" (empty string) | Keeps the current slug. If the article has no slug yet, one is generated from title. |
slug not sent | Keeps the current slug. If the article has no slug yet, one is generated from title. |
- Request Body
- cURL (Staging)
- cURL (Production)
- Hide article
{
"title": "October Promotion - Extended to 11/15",
"content": "<p>The 50% <strong>off</strong> promotion has been extended to 11/15.</p>",
"status": "active",
"slug": "october-promotion-extended",
"metaDescription": "October promotion extended to 11/15, 50% off everything."
}
curl -X PUT 'https://staging-manage.api.miniai.vn/api/external/news/68c93dba802d36826bc45c9c' \
-H 'x-api-key: miniai-partner <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"title": "October Promotion - Extended to 11/15",
"content": "<p>The 50% <strong>off</strong> promotion has been extended to 11/15.</p>",
"status": "active",
"slug": "october-promotion-extended",
"metaDescription": "October promotion extended to 11/15, 50% off everything."
}'
curl -X PUT 'https://manage-api.miniap.vn/api/external/news/68c93dba802d36826bc45c9c' \
-H 'x-api-key: miniai-partner <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"title": "October Promotion - Extended to 11/15",
"content": "<p>The 50% <strong>off</strong> promotion has been extended to 11/15.</p>",
"status": "active",
"slug": "october-promotion-extended",
"metaDescription": "October promotion extended to 11/15, 50% off everything."
}'
{
"status": "inactive"
}
Response
Success returns 200 with the updated news record in data.
- Response
{
"success": true,
"data": {
"_id": "68c93dba802d36826bc45c9c",
"type": "news",
"title": "October Promotion - Extended to 11/15",
"slug": "october-promotion-extended",
"shortContent": "The 50% off promotion has been extended to 11/15.",
"content": "<p>The 50% <strong>off</strong> promotion has been extended to 11/15.</p>",
"metaDescription": "October promotion extended to 11/15, 50% off everything.",
"status": "active",
"shopId": "64204a17a5a97a86f12e1f0a",
"images": [
"https://dmcl0k8mc5oht.cloudfront.net/64204a17a5a97a86f12e1f0a/e888246f-2647-42f1-9d89-53eacdb7bf64.webp"
],
"cta": [
{
"name": "Buy now",
"url": "https://zalo.me/s/1234567890/products"
}
],
"itemIds": [],
"createdAt": "2025-09-16T10:36:42.809Z",
"updatedAt": "2025-09-16T11:02:15.331Z",
"__v": 0,
"id": "68c93dba802d36826bc45c9c"
},
"meta": {}
}
Common Errors
| Code | Cause |
|---|---|
400 | Wrong data type, cta[].url not in the Zalo format, or a disallowed field was sent (e.g. categoryId) |
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 is not a valid ObjectId format (24-character hex), 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": ["cta.0.url"],
"message": "\"cta[0].url\" with value \"https://example.com\" fails to match the required pattern: /^https:\\/\\/zalo\\.me\\/s\\/.+$/"
}
}
}
{
"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 — verify the article after updating
- Add Related Products to News — attach products to the article
- Delete News — permanently delete the article from the system