Skip to content
Product Documentation

Deleting a Document

The purpose of this guide is to demonstrate how to completely delete a document from Arc XP.

Before We Begin

Before we begin learning how to Delete a Document in Arc, a quick warning.

In some cases, this may be what you’re looking for, in which case, please keep reading. However, if you wish to retain the document but just remove it from one or more websites, please see our guides on Unpublishing and Decirculating Documents instead. These actions are far less dangerous and can be easily reversed.

Once you Delete a Document in Arc, there is no way to recover the Document or any of its metadata, revisions, or circulations.

Requirements

  • You are familiar with the basic usage of the API (HTTP, Authentication, etc).
  • If you have not used the API before, or need a refresher, please refer back to The Introductory Guide.
  • You have a Document in Draft API that is ready to be deleted.

Existing document

First, let’s ensure we have a Document to Delete.

curl --request GET \
--header 'Authorization: Bearer <TOKEN>' \
--url https://api.{{org}}.arcpublishing.com/draft/v1/story/OFJYP3CTPBERHEKX2I7B3S5WKQ
# RESPONSE
{
"id": "OFJYP3CTPBERHEKX2I7B3S5WKQ",
"type": "STORY",
"created_at": "2020-07-31T17:36:06.648Z",
"first_published_at": "2020-07-31T17:37:03.565Z",
"last_published_at": "2020-07-31T17:37:16.58Z",
"draft_revision_id": "Z25U4G4ODJHQTJOWXQXPYOT5ZY",
"published_revision_id": "GGLDQNUJQJHJ5N57RTK3XQJ52M"
}

As we can see from the above response, our document OFJYP3CTPBERHEKX2I7B3S5WKQ exists! It also is currently published, and with a quick API call we can see that it’s circulated.

curl --request GET \
--header 'Authorization: Bearer <TOKEN>' \
--url https://api.{{org}}.arcpublishing.com/draft/v1/story/OFJYP3CTPBERHEKX2I7B3S5WKQ/circulation
# RESPONSE
{
"circulations": [
{
"document_id": "OFJYP3CTPBERHEKX2I7B3S5WKQ",
"website_id": "the-herald",
"website_url": "/news/exciting-headline",
"website_primary_section": {
"type": "reference",
"referent": {
"type": "section",
"id": "/news",
"website": "the-herald"
}
},
"website_sections": [
{
"type": "reference",
"referent": {
"type": "section",
"id": "/news",
"website": "the-herald"
}
}
]
}
]
}

Deleting our Document

Deleting a Document in Draft API is pretty straightforward. To delete a full document and all its Revision and Circulation information, simply use our DELETE endpoint:

curl --request DELETE \
--header 'Authorization: Bearer <TOKEN>' \
--url https://api.{{org}}.arcpublishing.com/draft/v1/story/OFJYP3CTPBERHEKX2I7B3S5WKQ
# RESPONSE
{
"id": "OFJYP3CTPBERHEKX2I7B3S5WKQ",
"type": "STORY",
"created_at": "2020-07-31T17:36:06.648Z",
"first_published_at": "2020-07-31T17:37:03.565Z",
"last_published_at": "2020-07-31T17:37:16.58Z",
"draft_revision_id": "Z25U4G4ODJHQTJOWXQXPYOT5ZY",
"published_revision_id": "GGLDQNUJQJHJ5N57RTK3XQJ52M"
}

Now, when we go looking for the document, we see this error instead, which let’s us know that this document no longer exists in Draft API.

curl --request GET \
--header 'Authorization: Bearer <TOKEN>' \
--url https://api.{{org}}.arcpublishing.com/draft/v1/story/OFJYP3CTPBERHEKX2I7B3S5WKQ
# RESPONSE
{
"request_id": "1-5f245dad-f5ebbe201c099edfae644084",
"error_message": "document OFJYP3CTPBERHEKX2I7B3S5WKQ not found",
"error_code": "ErrNotFound"
}