Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Model/Block

Delete a model

Query parameters

skip_menu_items_deletion boolean

Skip the deletion of the menu items linked to the model

Returns

Returns a Job ID. You can then poll for the completion of the job that will eventually return a resource object of type item_type

Examples

The response contains the ID of the asynchronous job that started:

1
DELETE https://site-api.datocms.com/item-types/:model_id_or_api_key HTTP/1.1
2
Authorization: Bearer YOUR-API-TOKEN
3
Accept: application/json
4
X-Api-Version: 3
Terminal window
1
curl -g 'https://site-api.datocms.com/item-types/:model_id_or_api_key' \
2
-X DELETE \
3
-H "Authorization: Bearer YOUR-API-TOKEN" \
4
-H "Accept: application/json" \
5
-H "X-Api-Version: 3"
1
await fetch("https://site-api.datocms.com/item-types/:model_id_or_api_key", {
2
method: "DELETE",
3
headers: {
4
Authorization: "Bearer YOUR-API-TOKEN",
5
Accept: "application/json",
6
"X-Api-Version": "3",
7
},
8
});
1
HTTP/1.1 202 Accepted
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": "job",
10
"id": "4235"
11
}
12
}

To get the asynchronous job result, poll the job result endpoint. While the task is in progress, the endpoint returns a 404 status code. When the job completes, the status changes to 200 OK:

1
GET https://site-api.datocms.com/job-results/:job_result_id HTTP/1.1
2
Authorization: Bearer YOUR-API-TOKEN
3
Accept: application/json
4
X-Api-Version: 3
Terminal window
1
curl -g 'https://site-api.datocms.com/job-results/:job_result_id' \
2
\
3
-H "Authorization: Bearer YOUR-API-TOKEN" \
4
-H "Accept: application/json" \
5
-H "X-Api-Version: 3"
1
await fetch("https://site-api.datocms.com/job-results/:job_result_id", {
2
headers: {
3
Authorization: "Bearer YOUR-API-TOKEN",
4
Accept: "application/json",
5
"X-Api-Version": "3",
6
},
7
});
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": "job_result",
10
"id": "34",
11
"attributes": {
12
"status": 200,
13
"payload": {
14
"data": {
15
"type": "item_type",
16
"id": "DxMaW10UQiCmZcuuA-IkkA",
17
"relationships": {
18
"singleton_item": {
19
"data": null
20
},
21
"fields": {
22
"data": [
23
{
24
"type": "field",
25
"id": "Pkg-oztERp6o-Rj76nYKJg"
26
}
27
]
28
},
29
"fieldsets": {
30
"data": [
31
{
32
"type": "fieldset",
33
"id": "93Y1C2sySkG4Eg0atBRIwg"
34
}
35
]
36
},
37
"title_field": {
38
"data": null
39
},
40
"image_preview_field": {
41
"data": null
42
},
43
"excerpt_field": {
44
"data": null
45
},
46
"ordering_field": {
47
"data": null
48
},
49
"workflow": {
50
"data": null
51
}
52
},
53
"attributes": {
54
"name": "Blog post",
55
"api_key": "post",
56
"singleton": false,
57
"sortable": true,
58
"modular_block": false,
59
"tree": false,
60
"ordering_direction": null,
61
"ordering_meta": "created_at",
62
"draft_mode_active": false,
63
"all_locales_required": false,
64
"collection_appearance": "compact",
65
"hint": "Blog posts will be shown in our website under the Blog section",
66
"inverse_relationships_enabled": false
67
},
68
"meta": {
69
"has_singleton_item": false
70
}
71
}
72
}
73
}
74
}
75
}