Skip to main content

Update News

This API lets you edit an existing news article by its id.

Partial update

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

🔗Endpoint Staging

http PUT https://staging-manage.api.miniai.vn/api/external/news/{id}

🔗Endpoint Production

http PUT https://manage-api.miniap.vn/api/external/news/{id}

A note on the path

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:

HeaderValueRequired
x-api-keyminiai-partner <YOUR_API_KEY>Bắt buộc
Content-Typeapplication/jsonBắt buộc
No need to send shopId

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

ParameterTypeRequiredDescription
idstringBắt buộcID 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.

FieldTypeRequiredDescription
titlestringTùy chọnNew article title.
contentstringTùy chọnNew content, HTML supported. When changed, shortContent is regenerated.
statusstringTùy chọnactive (visible) or inactive (hidden from the Mini App).
slugstringTùy chọnNew path (see rules below). An empty string "" is allowed.
metaDescriptionstringTùy chọnSEO description of the article. An empty string "" is allowed.
imagesstring[]Tùy chọnNew list of image URLs — replaces the current image list entirely.
ctaobject[]Tùy chọnNew list of call-to-action buttons — replaces the current list entirely.
typestringTùy chọnAccepted but ignored.
shortContentstringTùy chọnAccepted but ignored — always auto-generated from content.

Each element in cta[]

FieldTypeRequiredDescription
namestringBắt buộcButton label (e.g. "Buy now")
urlstringBắt buộcButton destination. Must match https://zalo.me/s/...
CTA URL constraint

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.

categoryId is not supported

This API's body does not accept categoryId. Sending it returns a 400 error (e.g. "categoryId" is not allowed).

slug handling rules

You sendResult
slug with a valueThe 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 sentKeeps the current slug. If the article has no slug yet, one is generated from title.
{
"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."
}

Response

Success returns 200 with the updated news record in data.

{
"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

CodeCause
400Wrong data type, cta[].url not in the Zalo format, or a disallowed field was sent (e.g. categoryId)
404No news article found with the given id
401Missing x-api-key header, wrong miniai-partner prefix, or invalid API key
429Rate limit exceeded (see the Rate Limit section below)
500id is not a valid ObjectId format (24-character hex), or a system error occurred
{
"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\\/.+$/"
}
}
}

Rate Limit

100 requests / minute

Each shop can make at most 100 requests per minute across the entire External API. Exceeding this limit returns a 429 status.

Next Steps