---
title: Export database
slug: dxp/cms12-docs/export-database
docTags: 
createdAt: 2026-06-01T17:39:49.387Z
---

You can export the Optimizely Content Management System (CMS) or Optimizely Customized Commerce database to a `bacpac` file using the API or using the PaaS portal. See also [Export the Database to Bacpac File](docId\:ltk8lWjvQOqSxcRo3z9lm) to use the UI.

When you export a database, it triggers an export job for the requested database. The export job copies the requested database from the requested environment to a new database in the Integration environment to avoid performance issues in the production environment when the export runs. After this, it exports to a `bacpac` file from the copied database, and stores the `bacpac` on BLOB storage.

:::hint{type="info"}
**Note**
The Export Database process can take from a few hours to several days (in extreme cases). You can export only one database at a time.
:::

The following sections describe operations to export the database to a `.bacpac` file using the API.

## Export database

### Request

`POST api/v1.0/projects/{projectId}/environments/{environment}/databases/{databaseName}/exports`

### Parameters

|   |
| - |

```javascript
  <th>
    Type
  </th>

  <th>
    Description
  </th>
</tr>
```

\| databaseName |

```javascript
  <td>
    string
  </td>

  <td>
    The name of the requested database  

    Valid names: epicms, epicommerce
  </td>
</tr>

<tr>
  <td>
    environment
  </td>

  <td>
    string
  </td>

  <td>
    The name of the environment of the requested database
  </td>
</tr>

<tr>
  <td>
    projectId
  </td>

  <td>
    Guid
  </td>

  <td>
    The identifier of the project of the requested database
  </td>
</tr>
```

### Body

```csharp
{
  retentionHours : 12             
}
```

| Name           | Type | Description                                                                                    |
| -------------- | ---- | ---------------------------------------------------------------------------------------------- |
| retentionHours | int  | Total hours that the `bacpac` is retained in the `bacpacs` container. The default value is 24. |

### Response

```csharp
{
  Id           : guid,
  projectId    : guid,
  environment  : string,
  databaseName : string,
  status       : string,
  downloadLink : string                                                         
}
```

## Get export database

This API gets the information about the export job triggered by an export database operation.

### Request

`GET api/v1.0/projects/{projectId}/environments/{environment}/databases/{databaseName}/exports/id`

### Parameter

| Name | Type | Description                      |
| ---- | ---- | -------------------------------- |
| id   | Guid | The identifier of the export job |

### Response

(Same as a response for Export database operation.)

```csharp
{
  Id           : guid,
  projectId    : guid,
  environment  : string,
  databaseName : string,
  status       : string,
  downloadLink : string                                                         
}
```

## Test tools

- Postman
- Epicloud
  - Start-EpiDatabaseExport
  - Get-EpiDatabaseExport
- Swagger
  - swagger/ui/index
