# OpenAPI CLI command reference

**CLI output**

```sh
npx sanity openapi --help
```

## Commands

### `get`

**CLI output**

```sh
USAGE
  $ sanity openapi get SLUG [--web] [--format <value>]

ARGUMENTS
  SLUG  Slug of the OpenAPI specification to retrieve

FLAGS
  -w, --web             Open in web browser
      --format=<value>  Output format: yaml (default), json

DESCRIPTION
  Get an OpenAPI specification by slug

EXAMPLES
  Get a specification (YAML format, default)

    $ sanity openapi get query

  Get specification in JSON format

    $ sanity openapi get query --format=json

  Open specification in browser

    $ sanity openapi get query --web

  Pipe to file

    $ sanity openapi get query > query-api.yaml
```

### `list`

**CLI output**

```sh
USAGE
  $ sanity openapi list [--web] [--json]

FLAGS
  -w, --web   Open HTTP Reference in web browser
      --json  Output JSON

DESCRIPTION
  List all available OpenAPI specifications

EXAMPLES
  List all available OpenAPI specs

    $ sanity openapi list

  List with JSON output

    $ sanity openapi list --json

  Open HTTP Reference in browser

    $ sanity openapi list --web
```

