Discard a page draft
curl --request DELETE \
--url https://studio.weaverse.io/api/v1/content/projects/{projectId}/page-drafts/{pageId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expectedHeadVersionId": "clz9drf2h4j6l8n0p2r4t6v8"
}
'const options = {
method: 'DELETE',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expectedHeadVersionId: 'clz9drf2h4j6l8n0p2r4t6v8'})
};
fetch('https://studio.weaverse.io/api/v1/content/projects/{projectId}/page-drafts/{pageId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://studio.weaverse.io/api/v1/content/projects/{projectId}/page-drafts/{pageId}"
payload = { "expectedHeadVersionId": "clz9drf2h4j6l8n0p2r4t6v8" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text){
"object": "page_draft_discarded",
"pageId": "clz7pg9k2m4n6p8r0t2v4x6z",
"studioUrl": "https://studio.weaverse.io/store/example/projects/clz7prj0a1b2c3d4e5f6g7h8?previewPath=%252F"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "STALE_PAGE",
"message": "The draft head moved since it was read; re-read and retry",
"status": 409
}Drafts and publishing
Discard a page draft
Discards the page’s current draft head. Live content stays as it is, and the draft’s version row is kept in history; only the head pointer is removed. The next GET returns live content again. studioUrl links to Studio.
Fence. Send expectedHeadVersionId with the headVersionId from GET. The discard is an exact compare-and-set:
- If another save replaced the head since your read, the response is 409
STALE_PAGEand nothing is discarded. - Only an active (unscheduled) draft can be discarded. A scheduled draft, an unknown version or a page without a draft returns 404
PAGE_NOT_FOUND. Cancel the schedule withDELETE /versions/{versionId}first.
Required scope: content:draft OR content:write
DELETE
/
projects
/
{projectId}
/
page-drafts
/
{pageId}
Discard a page draft
curl --request DELETE \
--url https://studio.weaverse.io/api/v1/content/projects/{projectId}/page-drafts/{pageId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expectedHeadVersionId": "clz9drf2h4j6l8n0p2r4t6v8"
}
'const options = {
method: 'DELETE',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expectedHeadVersionId: 'clz9drf2h4j6l8n0p2r4t6v8'})
};
fetch('https://studio.weaverse.io/api/v1/content/projects/{projectId}/page-drafts/{pageId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://studio.weaverse.io/api/v1/content/projects/{projectId}/page-drafts/{pageId}"
payload = { "expectedHeadVersionId": "clz9drf2h4j6l8n0p2r4t6v8" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text){
"object": "page_draft_discarded",
"pageId": "clz7pg9k2m4n6p8r0t2v4x6z",
"studioUrl": "https://studio.weaverse.io/store/example/projects/clz7prj0a1b2c3d4e5f6g7h8?previewPath=%252F"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "STALE_PAGE",
"message": "The draft head moved since it was read; re-read and retry",
"status": 409
}Authorizations
Body
application/json
Response
Discarded
The response is of type object.
Was this page helpful?