# edit

> Edit a data contract file in the Data Contract Editor (web UI).

# `datacontract edit`

{/* AUTOGENERATED from `datacontract --help`: do not edit by hand; regenerate with update_command_docs.py */}

Edit a data contract file in the Data Contract Editor (web UI). Starts a local web server that opens the Data Contract Editor for the given file. The editor is bundled with the CLI, so no internet access is required. Saving in the editor writes directly back to the local file. If a URL is given, you are asked whether to download a local copy, which is then edited. The server also acts as the editor's test runner: "Run test" in the editor executes the data contract tests locally against the servers defined in the data contract. Credentials for the data sources must be provided as environment variables, see https://cli.datacontract.com/#test

```bash
datacontract edit [OPTIONS] [LOCATION]
```

| Argument | Default | Description |
|---|---|---|
| `[LOCATION]` | `datacontract.yaml` | The path of the data contract yaml to edit. If the file does not exist, you are asked whether to initialize a new data contract. If a URL is given, you are asked whether to download a local copy to edit. |

| Option | Default | Description |
|---|---|---|
| `--port` | `4243` | Bind socket to this port. |
| `--host` | `127.0.0.1` | Bind socket to this host. Hint: For running in docker, set it to 0.0.0.0 |
| `--editor-version` | — | Version of the datacontract-editor npm package to load from the CDN, e.g. '0.1.9' or 'latest'. By default, the editor version bundled with the CLI is used (works offline). |
| `--editor-assets-url` | — | Base URL to load the Data Contract Editor assets (JS/CSS) from, e.g. a self-hosted editor build. Takes precedence over --editor-version. |
| `--open` / `--no-open` | `--open` | Open the editor in the default browser. |
| `--debug` / `--no-debug` | — | Enable debug logging |

```bash
datacontract edit datacontract.yaml
```

Guide: **[Edit your Contract](../editor.md)**.
