Content Management API > Scheduled unpublishing
Create a new scheduled unpublishing
Body parameters
unpublishing_scheduled_at date-time Required
The future date for the unpublishing
Example:
"2025-02-10T11:03:42Z"
content_in_locales Optional
List of locales whose content will be unpublished, or nil if the whole record needs to be unpublished
Type:
null, Array<string>
Returns
Returns a resource object of type scheduled_unpublishing
Examples
import { buildClient } from "@datocms/cma-client-node";
async function run() { const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const itemId = "34";
const scheduledUnpublishing = await client.scheduledUnpublishing.create( itemId, { unpublishing_scheduled_at: "2025-02-10T11:03:42Z" }, );
// Check the 'Returned output' tab for the result ☝️ console.log(scheduledUnpublishing);}
run();
{ id: "34", unpublishing_scheduled_at: "2025-02-10T11:03:42Z", content_in_locales: ["en"], item: { type: "item", id: "hWl-mnkWRYmMCSTq4z_piQ" },}