You can add/update special prices by REST API in Magento with V1/products/<SKU> endpoint.
If you want to give offers/discounts to the products over a specific period of days, you can give it with the help of REST API.
Endpoint URL: <BASE_URL>/rest/V1/products/<SKU> (Example: https://magento245.test/rest/default/V1/products/my-sku)
Action: PUT
Header: Authorization: Bearer <ADMIN_TOKEN>
Payload:
{
"product": {
"price": 49.00,
"custom_attributes": [
{
"attribute_code": "special_price",
"value": 45
},
{
"attribute_code": "special_from_date",
"value": "2023-02-17 00:00:00"
},
{ "attribute_code": "special_to_date",
"value": "2023-03-20 00:00:00"
}
]
}
}
If you want to keep the special price lifetime, you can set the special_to_date value as null which means you can keep the special price for this item’s lifetime.
{
"attribute_code": "special_to_date",
"value": null
}
Response:
Product Data with updated special price.
