---
title: Catalog service
slug: commerce-connect-15/service-api/catalog-service
docTags: 
createdAt: 2026-07-22T14:38:28.000Z
---

The Optimizely Service API supports the bulk import of catalog data into Optimizely Commerce.

## Catalog bulk import and export

In the following we describe the methods to use when importing and exporting catalog files.

### Generate the catalog XML file

For the catalog import and export to work as described here, you need to generate an XML file named *catalog.xml* and place it at the root of a zip file to be uploaded. See [Catalog service XML](docId\:Lx118D15ugb3MyMO6wOXY) for how to generate the XML file used when importing and exporting catalog data.

### Bulk import with file

| POST | post/episerverapi/commerce/import/catalog | When using this method you receive a backwards-compatible catalog file that will import the content into Commerce. |
| ---- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |

C# code sample

```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", "Catalog.zip");
  var response = client.PostAsync("/episerverapi/commerce/import/catalog", 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\""
```

### Bulk import with file upload identifier

The file to be used is based of the **upload identifier** of a file previously updated using /episerverapi/commerce/import/upload/chunk and /episerverapi/commerce/import/upload/commit, see [Chunk upload of large files](docId\:L-jtTKj9e1aQ4B4x5AZ7c).

| POST | post/episerverapi/commerce/import/catalog/`{uploadId}` | When using this method you receive a backwards-compatible catalog file that will import the content into Commerce. |
| ---- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |

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.PostAsync(String.Format("episerverapi/commerce/import/catalog/{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\""
```

### Bulk export

| GET | get/episerverapi/commerce/export/catalog/`{catalogName}` | This method returns a zip file of the exported content of the catalog specified in the name parameter. |
| --- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |

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/catalog/{name}").Result;
  if (response.StatusCode == HttpStatusCode.OK)
  {
    var zip = response.Content.ReadAsStreamAsync().Result;
    zip.CopyTo(File.Create("output.zip"));
  }
}
```
