---
title: Content import service for Optimizely CMS
slug: commerce-connect-15/service-api/cms-content-import-service
docTags: 
createdAt: 2026-07-22T14:38:28.000Z
---

The Optimizely Content Management System (CMS) content import service imports content through an *episerverdata* file, the format for data used for exports from CMS (see [Service API Developer Guide](doc\:optimizely-service-api)).

## CMS import methods

### CMS site bulk import with file

| POST | `post/episerverapi/commerce/import/cms/site/{siteName}/{hostname}/{culture}` | The culture is an optional parameter if you want to set the culture for the hostname of the site. |
| ---- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |

```csharp
using (var client = new HttpClient())
{
  client.BaseAddress = new Uri("https://mysite.com/");
  client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
  var content = new MultipartFormDataContent();
  var filestream = new FileStream(path, FileMode.Open);
  content.Add(new StreamContent(filestream), "file", "Import.episerverdata");
  var response = client.PostAsync("/episerverapi/commerce/import/cms/site/{siteName}/{hostname}/{culture}", content).Result;
  if (response.StatusCode == HttpStatusCode.OK)
  {
    var returnString = response.Content.ReadAsStringAsync().Result;
    returnString = returnString.Replace("\"", "");
    Guid taskId = Guid.Empty;
    Guid.TryParse(returnString, out taskId);
  }
}
```

Response

```csharp
"\"9e4bd26f-b263-488c-a5d3-3e4c9f87ac4f\""
```

### CMS site bulk import with file upload identifier

For this method to work, you need a valid upload identifier of the *episerverdata* file previously uploaded using the chunked upload methods, see [Chunk upload of large files](docId\:zDAmb16ZxzNJoOPPT66Yy).

| POST | `post/episerverapi/commerce/import/cms/site/{siteName}/{hostname}/{uploadId}/{culture}` | The culture is an optional parameter if you want to set the culture for the hostname of the site. |
| ---- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |

```csharp
using (var client = new HttpClient())
{
  client.BaseAddress = new Uri("https://mysite.com/");
  client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
  var response = client.PostAsync(String.Format("episerverapi/commerce/import/cms/{siteName}/{hostname}/{0}/{culture}", uploadId), new FormUrlEncodedContent(new List<KeyValuePair<String, String>>())).Result;
  if (response.StatusCode == HttpStatusCode.OK)
  {
    var returnString = response.Content.ReadAsStringAsync().Result;
    returnString = returnString.Replace("\"", "");
    Guid taskId = Guid.Empty;
    Guid.TryParse(returnString, out taskId);
  }
}
```

Response

```csharp
"\"9e4bd26f-b263-488c-a5d3-3e4c9f87ac4f\""
```

### CMS asset bulk import with file

| POST | `post/episerverapi/commerce/import/cms/assetglobalroot` | Use this method if you have exported your assets into an *episerverdata* file using the export assets tool. This puts your assets under the global assets root. |
| ---- | ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |

```csharp
using (var client = new HttpClient())
{
  client.BaseAddress = new Uri("https://mysite.com/");
  client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

  var content = new MultipartFormDataContent();
  var filestream = new FileStream(path, FileMode.Open);
  content.Add(new StreamContent(filestream), "file", "Import.episerverdata");
  var response = client.PostAsync("/episerverapi/commerce/import/cms/assetglobalroot", 
  content).Result;

  if (response.StatusCode == HttpStatusCode.OK)
  {
    var returnString = response.Content.ReadAsStringAsync().Result;
    returnString = returnString.Replace("\"", "");
    Guid taskId = Guid.Empty; 
    Guid.TryParse(returnString, out taskId);  
  }
}
```

Response

```csharp
"\"9e4bd26f-b263-488c-a5d3-3e4c9f87ac4f\""
```

### CMS asset bulk import with file upload identifier

For this method to work, you need to a valid upload identifier of an *episerverdata* file previously uploaded using the chunked upload methods, see [Chunk upload of large files](https://world.optimizely.com/documentation/developer-guides/Optimizely-Service-API/working-with-bulk-operations-using-tasks/chunk-upload-of-large-files/).

| POST | `post/episerverapi/commerce/import/cms/assetglobalroot/{uploadId}` | Use this method if you exported your assets into an *episerverdata* file using the export assets tool. This puts your assets under the global assets root. |
| ---- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |

```csharp
using (var client = new HttpClient())
{
  client.BaseAddress = new Uri("https://mysite.com/");
  client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
  var response = client.PostAsync(String.Format("episerverapi/commerce/import/cms/assetglobalroot/{0}", uploadId),
    new FormUrlEncodedContent(new List<KeyValuePair<String, String>>())).Result;

  if (response.StatusCode == HttpStatusCode.OK)
  {
    var returnString = response.Content.ReadAsStringAsync().Result;
    returnString = returnString.Replace("\"", "");

    Guid taskId = Guid.Empty;

    Guid.TryParse(returnString, out taskId);
  }
}
```

Response

```csharp
"\"9e4bd26f-b263-488c-a5d3-3e4c9f87ac4f\""
```

## CMS bulk export methods

### CMS bulk export

| GET | `get/episerverapi/commerce/export/site/{siteName}` | This method returns an *episerverdata* file of the exported contents of the site specified in the site name. If the site is not found, it exports from the root. |
| --- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |

C# code sample

```csharp
using (var client = new HttpClient())
{
  client.BaseAddress = new Uri("https://mysite.com/");
  client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
  var response = client.GetAsync("/episerverapi/commerce/export/site/{siteName}").Result;
  if (response.StatusCode == HttpStatusCode.OK)
  {
    var episerverdata = response.Content.ReadAsStreamAsync().Result;
    episerverdata.CopyTo(File.Create("output.episerverdata"));
  }
}
```
