---
title: Managing documents using REST
related:
  - https://docs.kentico.com/k8/integrating-3rd-party-systems/kentico-rest-service/authenticating-rest-requests.md
  - https://docs.kentico.com/k8/integrating-3rd-party-systems/kentico-rest-service/manipulating-data-using-rest/managing-objects-using-rest.md
  - https://docs.kentico.com/k8/integrating-3rd-party-systems/kentico-rest-service/getting-data-using-rest.md
  - https://docs.kentico.com/k8/integrating-3rd-party-systems/kentico-rest-service/sending-rest-requests-from-code.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

The REST service allows you to manipulate the data of documents on Kentico websites. Send requests using the **POST**, **PUT** or **DELETE** [HTTP method](http://en.wikipedia.org/wiki/HTTP#Request_methods) to the appropriate URL — append the  _**resource paths**_  described below to the _**base URL**_ of your REST service.

The base URL of the Kentico REST service is **/rest**. For example, if your site is running at  _http://localhost/Kentico_, use  _http://localhost/Kentico/rest_  as the base URL of the service.

## Creating documents

HTTP method: **POST**

Resource format:

- **/content/currentsite//document/** - creates a new document in the given culture for the site running on the domain in the base URL.
- **/content/site///document/** - creates a new document in the given culture on the specified site.

Use the [alias path](https://docs.kentico.com/k8/configuring-kentico/configuring-page-urls/setting-document-aliases.md) to identify the _**parent document**_ under which you want to create the new document.

Set the name and other fields of the new document in the data of the POST request. Both [XML](http://en.wikipedia.org/wiki/XML) and [JSON](http://en.wikipedia.org/wiki/JSON) formats are supported for the data.

> **Info:** **Important**:
>
> - When creating new documents, always set the **NodeClassID** field. To find the _NodeClassID_ value for a document type, [get a document of the given type](https://docs.kentico.com/k8/integrating-3rd-party-systems/kentico-rest-service/getting-data-using-rest.md) using the REST service and check the data or view the _ClassID_ column in the _CMS\_Class_ database table.
> - The request data must contain values for **all fields that are set as required** for the given [document type](https://docs.kentico.com/k8/developing-websites/defining-website-data-structure/document-types.md).
> - The service automatically sets the system fields of the new document (such as the ID and timestamp fields).
> - Creating multiple documents in a single request is not supported. You need to send a separate POST request for each document.

> **Info:** **Creating language versions of documents**
>
> You can use POST requests to create new [language versions](https://docs.kentico.com/k8/multilingual-websites/editing-the-content-of-multilingual-websites.md) of existing documents:
>
> - Use the culture code in the resource path to set the desired language.
> - Identify the document using the [alias path](https://docs.kentico.com/k8/configuring-kentico/configuring-page-urls/setting-document-aliases.md).
> - Specify the **NodeID** of the existing document in the request data. Do NOT manually set a _DocumentID_ for the new language version.
> - Set any other required data for the document language version.

### Examples

**Creates a _New service_ document (CMS.MenuItem type) under the _Services_ document**

| XML                                                                                                                                                                                                                                                       | JSON                                                                                                                                                                                  |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **URL**: _\~/rest/content/currentsite/en-us/document/Services_<br>**Data**:<br>`  <CMS_MenuItem>   <NodeClassID>4114</NodeClassID>   <DocumentName>New service</DocumentName>   <DocumentPageTemplateID>23438</DocumentPageTemplateID> </CMS_MenuItem>
 ` | **URL**: _\~/rest/content/currentsite/en-us/document/Services?format=json_<br>**Data**:<br>` 
{
"NodeClassID":4114,
"DocumentName":"New service",
"DocumentPageTemplateID":23438
}
 ` |

**Creates a _News article_ document (CMS.News type) under the _News_ document**

| XML                                                                                                                                                                                                                                                                                                             | JSON                                                                                                                                                                                                                                      |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **URL**: _\~/rest/content/currentsite/en-us/document/News_<br>**Data**:<br>`  <CMS_News>   <NodeClassID>4112</NodeClassID>   <NewsTitle>News article</NewsTitle>   <NewsReleaseDate>2014-06-05T00:00:00+02:00</NewsReleaseDate>   <NewsSummary>Summary</NewsSummary>   <NewsText>Text</NewsText> </CMS_News>
 ` | **URL**: _\~/rest/content/currentsite/en-us/document/News_?format=json\*\*<br>**Data**:<br>` 
{
"NodeClassID":4112,
"NewsTitle":"News article",
"NewsReleaseDate":"2014-06-05T00:00:00Z",
"NewsSummary":"Summary",
"NewsText":"Text"
}
 ` |

**Creates a _French_ version of the existing _Services_ document on the sample Corporate site**

| XML                                                                                                                                                                                            | JSON                                                                                                                                                           |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **URL**: _\~/rest/content/site/CorporateSite/fr-fr/document/Services_<br>**Data**:<br>`  <CMS_MenuItem>   <NodeID>5</NodeID>   <DocumentName>French Services</DocumentName> </CMS_MenuItem>
 ` | **URL**: **\~/rest/content/site/CorporateSite/fr-fr/document/Services**?format=json\*\*<br>**Data**:<br>` 
{
"NodeID":5,
"DocumentName":"French Services"
}
 ` |

## Updating existing documents

HTTP method: **PUT**

### Updating document data

Resource format:

- **/content/currentsite//document/** - updates the data of an existing document on the site running on the domain in the base URL.
- **/content/site///document/** - updates the data of an existing document on the specified site.

Use the [alias path](https://docs.kentico.com/k8/configuring-kentico/configuring-page-urls/setting-document-aliases.md) to identify the document that you want to update. Updating multiple documents in a single request is not supported. You need to send a separate PUT request for each document.

Update the values of the document's fields using the data of the PUT request. Both [XML](http://en.wikipedia.org/wiki/XML) and [JSON](http://en.wikipedia.org/wiki/JSON) formats are supported for the data.

> **Info:** **Updating document names**
>
> Many [document types](https://docs.kentico.com/k8/developing-websites/defining-website-data-structure/document-types.md) have a unique field that serves as the source for the document name (instead of the default _DocumentName_ field). When updating the names of such document types, always set the new value for both the **DocumentName** field and the dedicated document type name field to ensure consistency.

Examples:

**Updates the name of the _Services_ document on the sample Corporate site**

| XML                                                                                                                                                                                                                          | JSON                                                                                                                                                                                   |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **URL**: _\~/rest/content/site/CorporateSite/en-us/document/Services_<br>**Data**:<br>`  <CMS_MenuItem>   <DocumentName>Services MODIFIED</DocumentName>   <MenuItemName>Services MODIFIED</MenuItemName> </CMS_MenuItem>
 ` | **URL**: **_\~/rest/content/site/CorporateSite/en-us/document/Services_?format=json**<br>**Data**:<br>` 
{
"DocumentName":"Services MODIFIED",
"MenuItemName":"Services MODIFIED"
}
 ` |

**Updates the title, release date and summary of a news article on the sample Corporate site**

| XML                                                                                                                                                                                                                                                                                                                                                    | JSON                                                                                                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **URL**\*: \~/rest/content/site/CorporateSite/en-us/document/News/New-Consulting-Services\*<br>**Data**:<br>`  <CMS_News>   <DocumentName>Consulting available</DocumentName>   <NewsTitle>Consulting available</NewsTitle>   <NewsReleaseDate>2014-07-04T00:00:00+02:00</NewsReleaseDate>   <NewsSummary>Updated summary</NewsSummary> </CMS_News>
 ` | **URL**: **_\~/rest/content/site/CorporateSite/en-us/document/News/New-Consulting-Services_?format=json**<br>**Data**:<br>` 
{
"DocumentName":"Consulting available",
"NewsTitle":"Consulting available",
"NewsReleaseDate":"2014-07-04T00:00:00Z",
"NewsSummary":"Updated summary"
}
 ` |

### Workflow actions

You can also use PUT requests to move documents through the [workflow](https://docs.kentico.com/k8/managing-website-content/configuring-the-environment-for-content-editors/configuring-workflows.md) life cycle, or check documents in and out when using [content locking](https://docs.kentico.com/k8/managing-website-content/configuring-the-environment-for-content-editors/configuring-and-using-document-versioning/content-locking.md).

Resource format:

- **/content/currentsite///** - performs the given workflow action for the specified document on the site running on the domain in the base URL.
- **/content/site////** - performs the given workflow action for the given document on the specified site.

| Workflow action    | Description                                                                                                                                                                                                                                                           |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| publish            | Publishes the document.                                                                                                                                                                                                                                               |
| checkout           | Performs check-out for the document. The document is checked out under the user account specified by the REST request's [authentication](https://docs.kentico.com/k8/integrating-3rd-party-systems/kentico-rest-service/authenticating-rest-requests.md) information. |
| checkin            | Performs check-in for the document.                                                                                                                                                                                                                                   |
| archive            | Archives the document.                                                                                                                                                                                                                                                |
| movetonextstep     | Moves the document to the next workflow step.                                                                                                                                                                                                                         |
| movetopreviousstep | Moves the document to the previous workflow step.                                                                                                                                                                                                                     |

Use the [alias path](https://docs.kentico.com/k8/configuring-kentico/configuring-page-urls/setting-document-aliases.md) to identify the document for which you want to perform the workflow action. Do not submit any data when sending workflow action requests.

**URL example**: _\~/rest/content/currentsite/en-us/checkout/Home_

## Deleting documents

HTTP method: **DELETE**

Resource format:

- **/content/currentsite//document/** - deletes the given [language version](https://docs.kentico.com/k8/multilingual-websites/editing-the-content-of-multilingual-websites.md) of the document for the site running on the domain in the base URL.
- **/content/site///document/** - deletes the given language version of the document on the specified site.

Use the [alias path](https://docs.kentico.com/k8/configuring-kentico/configuring-page-urls/setting-document-aliases.md) to identify the document that you want to delete. Deleting multiple documents in a single request is not supported. You need to send a separate DELETE request for each document.

### Document deletion parameters

When deleting documents via REST, you can append the following query string parameters to the request URL:

| Parameter         | Value (default bold) | Description                                                                                                                                                                                                                                                                                                                               |
| ----------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| deleteallcultures | true/**false**       | Indicates if the request also deletes all [language versions](https://docs.kentico.com/k8/multilingual-websites/editing-the-content-of-multilingual-websites.md) of the specified document.<br>To delete all language versions of a document, append _?deleteallcultures=true_ to the request URL.                                        |
| destroyhistory    | true/**false**       | Indicates if the request also deletes the document's [version history](https://docs.kentico.com/k8/managing-website-content/configuring-the-environment-for-content-editors/configuring-and-using-document-versioning.md).<br>To delete the version history together with the document, append _?destroyhistory=true_ to the request URL. |
| deleteproduct     | true/**false**       | Indicates if the request also deletes the [e-commerce product](https://docs.kentico.com/k8/e-commerce-features/configuring-and-managing-your-store/products.md) associated with the specified product document.<br>To delete e-commerce products along with documents, append _?deleteproduct=true_ to the request URL.                   |
