> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# iagctl db export

Export resources and services to a file.

The `iagctl db export` command exports services and resources to a file. Use this command to move services and resources from one gateway instance to another.

## Syntax

```bash
iagctl db export [flags]
```

## Examples

### Export to the terminal

The following example exports all services and resources and displays the output in the terminal:

```bash
iagctl db export
```

### Export in a specific format

Use the `-f` flag to switch between JSON and YAML output. YAML is the default format:

```bash
iagctl db export -f json
```

### Export to a file

Use the `--file` flag to save the output to a file:

```bash
iagctl db export --file ./services.yaml
```

### Service file format

The following example shows the structure of an exported service file:

```yml
decorators:
  - name: ansible-xr
    schema:
      $id: https://example.com/device.schema.json
      $schema: https://json-schema.org/draft/2020-12/schema
      properties:
        device_type:
          description: The type of device
          enum:
            - ios
            - eos
            - nxos
          type: string
        host:
          description: The hostname or IP address of the device
          type: string
      title: Network Device
      type: object
repositories:
  - name: xr-resources
    description: XR Resources for testing
    url: git@gitlab.com:jh/xr/resources.git
    reference: main
    tags:
      - cisco
      - xr
    private-key-name: xr-gitlab-private
services:
  - name: Ansible-Example
    type: ansible-playbook
    description: An ansible playbook to say hello-world
    playbooks:
      - hello-world.yml
    working-directory: ./
    repository: xr-resources
    decorator: ansible-xr
    tags:
      - xr
      - cisco
    runtime:
      check: true
      diff: true
      skip-tags: example-tag
      inventory:
        - ./inventory.ini
      verbose-level: 6
  - name: Hello-World
    type: python-script
    description: A simple hello-world script
    filename: hello-world.py
    working-directory: python-scripts
    repository: xr-resources
    decorator: my-special-decorator
```

## Options

```bash
  --file string       File path to save the exported service configuration.
  -f, --format string Output format for the export: json or yaml. (default "yaml")
  -h, --help          Help for export
```

## Options inherited from parent commands

```bash
  --profile string   Specify the client profile to use (case-insensitive, defaults to [client] section)
  --config string   Path to the configuration file
  --raw             Display the result of the command in raw format
  --verbose         Enable verbose output
```