Show examples in:
    Create a new scheduled unpublishing

    Parameters

    unpublishing_scheduled_at  date-time  Required

    The future date for the unpublishing

    content_in_locales  null, Array<string>  Optional

    List of locales whose content will be unpublished, or nil if the whole record needs to be unpublished

    Returns

    Returns a scheduled_unpublishing resource object.

    Examples

    Example code:
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const itemId = '34';
    const scheduledUnpublishing = await client.scheduledUnpublishing.create(itemId, {
    unpublishing_scheduled_at: '2025-02-10T11:03:42Z',
    content_in_locales: [
    ''
    ]
    });
    console.log(scheduledUnpublishing);
    }
    run();
    Returned output:
    {
    id: '34',
    unpublishing_scheduled_at: '2025-02-10T11:03:42Z',
    content_in_locales: [
    ''
    ],
    item: {
    type: 'item',
    id: '4235'
    }
    }