Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Scheduled unpublishing

Create a new scheduled unpublishing

Body parameters

type string Required

Must be exactly "scheduled_unpublishing".

attributes.unpublishing_scheduled_at date-time Required

The future date for the unpublishing

Example: "2025-02-10T11:03:42Z"
attributes.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

1
POST https://site-api.datocms.com/items/:item_id/scheduled-unpublishing HTTP/1.1
2
Authorization: Bearer YOUR-API-TOKEN
3
Accept: application/json
4
X-Api-Version: 3
5
Content-Type: application/vnd.api+json
6
7
{
8
"data": {
9
"type": "scheduled_unpublishing",
10
"attributes": {
11
"unpublishing_scheduled_at": "2025-02-10T11:03:42Z"
12
}
13
}
14
}
Terminal window
1
curl -g 'https://site-api.datocms.com/items/:item_id/scheduled-unpublishing' \
2
-X POST \
3
-H "Authorization: Bearer YOUR-API-TOKEN" \
4
-H "Accept: application/json" \
5
-H "X-Api-Version: 3" \
6
-H "Content-Type: application/vnd.api+json" \
7
--data-binary '{"data":{"type":"scheduled_unpublishing","attributes":{"unpublishing_scheduled_at":"2025-02-10T11:03:42Z"}}}'
1
await fetch(
2
"https://site-api.datocms.com/items/:item_id/scheduled-unpublishing",
3
{
4
method: "POST",
5
headers: {
6
Authorization: "Bearer YOUR-API-TOKEN",
7
Accept: "application/json",
8
"X-Api-Version": "3",
9
"Content-Type": "application/vnd.api+json",
10
},
11
body: JSON.stringify({
12
data: {
13
type: "scheduled_unpublishing",
14
attributes: { unpublishing_scheduled_at: "2025-02-10T11:03:42Z" },
15
},
16
}),
17
},
18
);
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
Cache-Control: cache-control: max-age=0, private, must-revalidate
4
X-RateLimit-Limit: 30
5
X-RateLimit-Remaining: 28
6
7
{
8
"data": {
9
"type": "scheduled_unpublishing",
10
"id": "34",
11
"attributes": {
12
"unpublishing_scheduled_at": "2025-02-10T11:03:42Z",
13
"content_in_locales": [
14
"en"
15
]
16
},
17
"relationships": {
18
"item": {
19
"data": {
20
"type": "item",
21
"id": "hWl-mnkWRYmMCSTq4z_piQ"
22
}
23
}
24
}
25
},
26
"included": [
27
{
28
"type": "item",
29
"id": "hWl-mnkWRYmMCSTq4z_piQ",
30
"relationships": {
31
"item_type": {
32
"data": {
33
"type": "item_type",
34
"id": "DxMaW10UQiCmZcuuA-IkkA"
35
}
36
}
37
},
38
"attributes": {
39
"title": "My first blog post!",
40
"content": "Lorem ipsum dolor sit amet...",
41
"category": "24",
42
"image": {
43
"alt": "Alt text",
44
"title": "Image title",
45
"custom_data": {},
46
"focal_point": null,
47
"upload_id": "20042921"
48
}
49
},
50
"meta": {
51
"created_at": "2020-04-21T07:57:11.124Z",
52
"updated_at": "2020-04-21T07:57:11.124Z",
53
"published_at": "2020-04-21T07:57:11.124Z",
54
"first_published_at": "2020-04-21T07:57:11.124Z",
55
"publication_scheduled_at": "2020-04-21T07:57:11.124Z",
56
"unpublishing_scheduled_at": "2020-04-21T07:57:11.124Z",
57
"status": "published",
58
"is_current_version_valid": true,
59
"is_published_version_valid": true,
60
"current_version": "4234",
61
"stage": null
62
}
63
}
64
]
65
}