# import openapi

> Import a data contract from the responses of GET or POST operations in an OpenAPI 3.x document.

# `datacontract import openapi`

```bash
datacontract import openapi [OPTIONS]
```

| Option | Default | Description |
|---|---|---|
| `--source` | — | Path to the OpenAPI 3.x document (YAML or JSON). |
| `--operation` | — | The GET or POST operation to import, by operationId, method and path, or a GET operation's path (e.g. listOrders, 'POST /orders/search', or /orders). Repeat for several operations, each becoming a schema served by its own endpoint. Without it, a terminal asks which operations to import; otherwise it is required unless the document has exactly one GET operation. |
| `--output` | — | File path where the Data Contract will be saved. If not provided, it will be printed to stdout. |
| `--owner` | — | The owner or team responsible for managing the data contract. |
| `--id` | — | The identifier for the data contract. |
| `--debug` / `--no-debug` | — | Enable debug logging |

```bash
datacontract import openapi --source openapi.yaml --operation listCustomers --operation listOrders --output datacontract.yaml
```

Guide: **[Import: OpenAPI](https://cli.datacontract.com/imports/openapi.md)**.
