---
title: Safe content operations
description: >-
  Use mcms-cli to inspect, validate, preview, and write microCMS content safely,
  with machine-readable checks before and after every change.
sidebar:
  order: 3
noindex: false
---
A reliable write workflow checks the destination, loads the current schema, validates the payload, previews the operation, executes it, and then reads the remote state back.

## Check the destination

Confirm the active profile, service domain, and credential source before changing content.

```bash
microcms auth status --json
microcms config doctor --json
```

Both commands should exit with status `0`, and their JSON response should contain `.ok == true`.

## Read content

```bash
microcms content list blogs --all --json
microcms content get blogs <content-id> --json
```

Using JSON output lets scripts inspect stable fields instead of parsing messages intended for people.

## Validate before creating

Pull the latest API schema and validate the payload against it.

```bash
microcms schema pull --out microcms-schema.json --json
microcms validate blogs --file payload.json --json
```

## Preview and execute a write

Run the same command with `--dry-run` first. Execute it only after the dry-run succeeds.

```bash
microcms content create blogs --file payload.json --dry-run --json
microcms content create blogs --file payload.json --json
```

The same pattern applies to update and delete operations. For multiple changes, `content bulk` can validate every payload before any request is sent.

```bash
microcms content bulk \
  --file operations.json \
  --validate-payload \
  --strict-warnings \
  --dry-run \
  --json
```

After execution, check that `.ok == true`, `data.failed == 0`, and the expected content can be read from microCMS.

## Related pages

- [Installation and authentication](/en/installation)
- [Command reference](/en/command-reference)
- [Using mcms-cli from AI and CI](/en/ai-and-ci)
