OpenAPI CLI command reference
Command group with list and get subcommands for accessing Sanity OpenAPI specifications directly from the CLI.
npx sanity openapi --helppnpm dlx sanity openapi --helpyarn dlx sanity openapi --helpbunx sanity openapi --helpCommands
get
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.yamllist
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 --webWas this page helpful?
Feedback submitted, thanks for helping us improve the docs. Have you tried these alternatives?