Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docusaurus/docs/cms/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,10 @@ The exported file is automatically named using the format `export_YYYYMMDDHHMMSS
| `-k`, <br/>`--key` | string | Passes the encryption key as part of the `export` command. <br/> The `--key` option can't be combined with `--no-encrypt`. |
| `-f`, <br/>`--file` | string | Specifies the export filename (tar) or output directory path (dir). Do not include a file extension for tar exports. |
| `--format` | string | Export format: `tar` (default) or `dir`. Directory exports require `--no-encrypt`. |
| `--exclude` | string | Exclude data using comma-separated data types. The available types are: `content`, `files`, and `config`. |
| `--exclude` | string | Exclude data using comma-separated data types. The available types are: `content`, `files`, `config`, and `media-library` (excludes both upload binaries and upload content type records). |
| `--only` | string | Include only these data. The available types are: `content`, `files`, and `config`. |
| `--exclude-content-types` | string | Comma-separated list of content-type UIDs to exclude from the export. Both entity records and relation links are excluded. |
| `--only-content-types` | string | Comma-separated list of content-type UIDs to include in the export. |
| `-h`, <br/>`--help` | - | Displays help for the `strapi export` command. |

**Examples**
Expand Down Expand Up @@ -265,6 +267,8 @@ The command accepts archives generated by `strapi export` (`.tar`, `.tar.gz`, `.
| -------------- | ------ | ------------------------------------------------------------------------------------- |
| `-k,` `--key` | string | Provide the encryption key in the command instead of a subsequent prompt. |
| `-f`, `--file` | string | Path to a `.tar[.gz][.enc]` archive or to an unpacked export directory. |
| `--exclude-content-types` | string | Comma-separated list of content-type UIDs to exclude from the import. Excluded types are preserved on the destination. |
| `--only-content-types` | string | Comma-separated list of content-type UIDs to include in the import. |
| `-h`, `--help` | - | Display the `strapi import` help commands. |

**Examples**
Expand Down Expand Up @@ -296,8 +300,10 @@ The destination Strapi instance should be running with the `start` command and n
| `--from [sourceURL]` | Full URL of the `/admin` endpoint of the remote Strapi instance to pull data from<br />(e.g., `--from https://my-beautiful-strapi-website/admin`) |
| `‑‑from‑token` | Transfer token from the Strapi source instance. |
| `--force` | Automatically answer "yes" to all prompts, including potentially destructive requests, and run non-interactively. |
| `--exclude` | Exclude data using comma-separated data types. The available types are: `content`, `files`, and `config`. |
| `--exclude` | Exclude data using comma-separated data types. The available types are: `content`, `files`, `config`, and `media-library` (excludes both upload binaries and upload content type records). |
| `--only` | Include only these data. The available types are: `content`, `files`, and `config`. |
| `--exclude-content-types` | Comma-separated list of content-type UIDs to exclude. Both entity records and relation links are excluded. |
| `--only-content-types` | Comma-separated list of content-type UIDs to include. Only entity records and relation links for the listed types are transferred. |
| `-h`, `--help` | Displays the commands for `strapi transfer`. |

:::caution
Expand Down
74 changes: 74 additions & 0 deletions docusaurus/docs/cms/data-management/export.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,78 @@ npm run strapi export -- --exclude files,content

</Tabs>

## Filter content types during export

<VersionBadge version="5.50.3" />

The `--exclude-content-types` and `--only-content-types` options let you scope an export to specific content types. Both options accept a comma-separated list of content-type UIDs (for example, `api::article.article`). Unknown UIDs are validated against the Strapi schema at startup. Both entity records and any relation links touching an excluded type are skipped automatically.

### Exclude specific content types

<Tabs groupId="yarn-npm">

<TabItem value="yarn" label="yarn">

```bash
yarn strapi export --exclude-content-types api::article.article
```

</TabItem>

<TabItem value="npm" label="npm">

```bash
npm run strapi export -- --exclude-content-types api::article.article
```

</TabItem>

</Tabs>

### Export only specific content types

<Tabs groupId="yarn-npm">

<TabItem value="yarn" label="yarn">

```bash
yarn strapi export --only-content-types api::article.article,api::category.category
```

</TabItem>

<TabItem value="npm" label="npm">

```bash
npm run strapi export -- --only-content-types api::article.article,api::category.category
```

</TabItem>

</Tabs>

### Exclude the entire media library

To exclude both the upload binaries and the upload content type records, pass `media-library` to the `--exclude` flag. This is equivalent to combining `--exclude files` with `--exclude-content-types plugin::upload.file,plugin::upload.folder`:

<Tabs groupId="yarn-npm">

<TabItem value="yarn" label="yarn">

```bash
yarn strapi export --no-encrypt --exclude media-library
```

</TabItem>

<TabItem value="npm" label="npm">

```bash
npm run strapi export -- --no-encrypt --exclude media-library
```

</TabItem>

</Tabs>

<FeedbackPlaceholder />
55 changes: 55 additions & 0 deletions docusaurus/docs/cms/data-management/import.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,4 +278,59 @@ npm strapi import -- -f /path/to/my/file/export_20221213105643.tar.gz.enc --only

</Tabs>

## Filter content types during import

<VersionBadge version="5.50.3" />

The `--exclude-content-types` and `--only-content-types` options let you scope an import to specific content types. Both options accept a comma-separated list of content-type UIDs (for example, `api::article.article`). Unknown UIDs are validated against the Strapi schema at startup.

:::warning Restore behavior
- When you use `--exclude-content-types`, data for the excluded types is **preserved** on the destination — the import does not wipe those records before restoring.
- When you use `--only-content-types`, the pre-import wipe is scoped to only the listed UIDs, leaving all other content in place.
:::

### Exclude specific content types from import

<Tabs groupId="yarn-npm">

<TabItem value="yarn" label="yarn">

```bash
yarn strapi import -f export_20221213105643.tar.gz.enc --exclude-content-types api::article.article
```

</TabItem>

<TabItem value="npm" label="npm">

```bash
npm run strapi import -- -f export_20221213105643.tar.gz.enc --exclude-content-types api::article.article
```

</TabItem>

</Tabs>

### Import only specific content types

<Tabs groupId="yarn-npm">

<TabItem value="yarn" label="yarn">

```bash
yarn strapi import -f export_20221213105643.tar.gz.enc --only-content-types api::article.article,api::category.category
```

</TabItem>

<TabItem value="npm" label="npm">

```bash
npm run strapi import -- -f export_20221213105643.tar.gz.enc --only-content-types api::article.article,api::category.category
```

</TabItem>

</Tabs>

<FeedbackPlaceholder />
63 changes: 62 additions & 1 deletion docusaurus/docs/cms/data-management/transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ The CLI command consists of the following arguments:
| `--from` | Full URL of the `/admin` endpoint of the remote Strapi instance to pull data from (e.g., `--from https://my-beautiful-strapi-website/admin`) |
| `‑‑from‑token` | Transfer token from the Strapi source instance. |
| `--force` | Automatically answer "yes" to all prompts, including potentially destructive requests, and run non-interactively. |
| `--exclude` | Exclude data using comma-separated data types. The available types are: `content`, `files`, and `config`. |
| `--exclude` | Exclude data using comma-separated data types. The available types are: `content`, `files`, `config`, and `media-library` (excludes both upload binaries and upload content type records). |
| `--only` | Include only these data. The available types are: `content`, `files`, and `config`. |
| `--exclude-content-types` | Comma-separated list of content-type UIDs to exclude. Both entity records and relation links touching an excluded type are skipped. |
| `--only-content-types` | Comma-separated list of content-type UIDs to include. Only entity records and relation links for the listed types are transferred. |
| `--throttle` | Time in milliseconds to inject an artificial delay between the "chunks" during a transfer. |
| `--no-checksums` | Disable end-to-end SHA-256 checksum verification for assets. Checksum verification is enabled by default when both the source and destination instances support it. |
| `--verbose` | Enable verbose logs. |
Expand Down Expand Up @@ -243,6 +245,65 @@ npm run strapi transfer -- --to https://example.com/admin --exclude files
Any types excluded from the transfer will be deleted in your destination instance. For example, if you exclude `config` the project configuration in your destination instance will be deleted.
:::

## Filter content types during transfer

<VersionBadge version="5.50.3" />

The `--exclude-content-types` and `--only-content-types` options let you scope a transfer to specific content types. Both options accept a comma-separated list of content-type UIDs (for example, `api::article.article`). Unknown UIDs are validated against the Strapi schema at startup. Both entity records and any relation links touching an excluded type are skipped automatically.

:::warning Restore behavior
- When you use `--exclude-content-types`, data for the excluded types is **preserved** on the destination — they are not wiped before the transfer.
- When you use `--only-content-types`, the pre-transfer wipe is scoped to only the listed UIDs, leaving all other content on the destination in place.
:::

### Exclude specific content types from transfer

<Tabs groupId="yarn-npm">

<TabItem value="yarn" label="yarn">

```bash
yarn strapi transfer --to https://example.com/admin --to-token my-transfer-token \
--exclude-content-types api::article.article
```

</TabItem>

<TabItem value="npm" label="npm">

```bash
npm run strapi transfer -- --to https://example.com/admin --to-token my-transfer-token \
--exclude-content-types api::article.article
```

</TabItem>

</Tabs>

### Transfer only specific content types

<Tabs groupId="yarn-npm">

<TabItem value="yarn" label="yarn">

```bash
yarn strapi transfer --to https://example.com/admin --to-token my-transfer-token \
--only-content-types api::article.article,api::category.category
```

</TabItem>

<TabItem value="npm" label="npm">

```bash
npm run strapi transfer -- --to https://example.com/admin --to-token my-transfer-token \
--only-content-types api::article.article,api::category.category
```

</TabItem>

</Tabs>

## Manage data transfer with environment variables

The environment variable `STRAPI_DISABLE_REMOTE_DATA_TRANSFER` is available to disable remote data transfer. In addition to the [RBAC permissions](/cms/features/rbac#plugins-and-settings) in the admin panel this can help you secure your Strapi application. To use `STRAPI_DISABLE_REMOTE_DATA_TRANSFER` you can add it to your `.env` file or preface the `start` script. See the following example:
Expand Down
Loading