--- url: "https://asyncapi.com/docs/tools/cli/usage" titulek: "Usage | AsyncAPI Initiative for event-driven APIs" h1: "Usage" popis: "{/* This file is automatically generated from updateUsageDocs.js script. In package.json in line 158-161 lines the following steps has been executed in order to run this script successfully - gene" jazyk: "en" kanonicka: "" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 02:46:26" znaku: 30689 slov: 4141 kodovani: "utf-8" sha256: "fdbcd2327948cb1f28d78941bd1b0765034d820583ea04b7fd1bd0697f74808b" --- The AsyncAPI CLI makes it easier to work with AsyncAPI documents. # Usage ``` $ npm install -g @asyncapi/cli $ asyncapi COMMAND running command... $ asyncapi (--version|--v) @asyncapi/cli/5.0.7 darwin-arm64 node-v24.7.0 $ asyncapi --help [COMMAND] USAGE $ asyncapi COMMAND ... ``` # Commands - `asyncapi autocomplete [SHELL]` - `asyncapi bundle` - `asyncapi config` - `asyncapi config analytics` - `asyncapi config auth add PATTERN TOKEN` - `asyncapi config context` - `asyncapi config context add CONTEXT-NAME SPEC-FILE-PATH` - `asyncapi config context current` - `asyncapi config context edit CONTEXT-NAME NEW-SPEC-FILE-PATH` - `asyncapi config context init [CONTEXT-FILE-PATH]` - `asyncapi config context list` - `asyncapi config context remove CONTEXT-NAME` - `asyncapi config context use CONTEXT-NAME` - `asyncapi config versions` - `asyncapi convert [SPEC-FILE]` - `asyncapi diff OLD NEW` - `asyncapi format [SPEC-FILE]` - `asyncapi generate` - `asyncapi generate client LANGUAGE [ASYNCAPI]` - `asyncapi generate fromTemplate [ASYNCAPI] [TEMPLATE]` - `asyncapi generate models LANGUAGE FILE` - `asyncapi new` - `asyncapi new file` - `asyncapi new template` - `asyncapi optimize [SPEC-FILE]` - `asyncapi pretty SPEC-FILE` - `asyncapi start` - `asyncapi start api` - `asyncapi start preview SPEC-FILE` - `asyncapi start studio [SPEC-FILE]` - `asyncapi validate [SPEC-FILE]` ## `asyncapi autocomplete [SHELL]` Display autocomplete installation instructions. ``` USAGE $ asyncapi autocomplete [SHELL] [-r] ARGUMENTS [SHELL] (zsh|bash|powershell) Shell type FLAGS -r, --refresh-cache Refresh cache (ignores displaying instructions) DESCRIPTION Display autocomplete installation instructions. EXAMPLES $ asyncapi autocomplete $ asyncapi autocomplete bash $ asyncapi autocomplete zsh $ asyncapi autocomplete powershell $ asyncapi autocomplete --refresh-cache ``` *See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.40/src/commands/autocomplete/index.ts)* ## `asyncapi bundle` Bundle one or multiple AsyncAPI Documents and their references together. ``` USAGE $ asyncapi bundle [-h] [-o ] [-b ] [-d ] [-x] FLAGS -b, --base= Path to the file which will act as a base. This is required when some properties need to be overwritten. -d, --baseDir= One relative/absolute path to directory relative to which paths to AsyncAPI Documents that should be bundled will be resolved. -h, --help Show CLI help. -o, --output= The output file name. Omitting this flag the result will be printed in the console. -x, --xOrigin Pass this switch to generate properties "x-origin" that will contain historical values of dereferenced "$ref"s. DESCRIPTION Bundle one or multiple AsyncAPI Documents and their references together. EXAMPLES $ asyncapi bundle ./asyncapi.yaml > final-asyncapi.yaml $ asyncapi bundle ./asyncapi.yaml --output final-asyncapi.yaml $ asyncapi bundle ./asyncapi.yaml ./features.yaml $ asyncapi bundle ./asyncapi.yaml ./features.yaml --base ./main.yaml $ asyncapi bundle ./asyncapi.yaml ./features.yaml --base ./main.yaml --xOrigin $ asyncapi bundle ./asyncapi.yaml -o final-asyncapi.yaml --base ../public-api/main.yaml --baseDir ./social-media/comments-service ``` *See code: [src/commands/bundle.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/bundle.ts)* ## `asyncapi config` CLI config settings ``` USAGE $ asyncapi config DESCRIPTION CLI config settings ``` *See code: [src/commands/config/index.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/config/index.ts)* ## `asyncapi config analytics` Enable or disable analytics for metrics collection ``` USAGE $ asyncapi config analytics [-h] [-d] [-e] [-s] FLAGS -d, --disable disable analytics -e, --enable enable analytics -h, --help Show CLI help. -s, --status show current status of analytics DESCRIPTION Enable or disable analytics for metrics collection ``` *See code: [src/commands/config/analytics.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/config/analytics.ts)* ## `asyncapi config auth add PATTERN TOKEN` Add an authentication config for resolving $ref files requiring HTTP Authorization. ``` USAGE $ asyncapi config auth add PATTERN TOKEN [-a ] [-h ...] ARGUMENTS PATTERN Glob pattern for matching protected URLs (e.g. github.com/org/repo/**/*.*) TOKEN Authentication token or environment variable reference (prefix with $, e.g. $GITHUB_TOKEN) FLAGS -a, --auth-type= Authentication type (default is "Bearer") -h, --header=... Additional header in key=value format; can be used multiple times DESCRIPTION Add an authentication config for resolving $ref files requiring HTTP Authorization. ``` *See code: [src/commands/config/auth/add.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/config/auth/add.ts)* ## `asyncapi config context` Manage short aliases for full paths to AsyncAPI documents ``` USAGE $ asyncapi config context DESCRIPTION Manage short aliases for full paths to AsyncAPI documents ``` *See code: [src/commands/config/context/index.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/config/context/index.ts)* ## `asyncapi config context add CONTEXT-NAME SPEC-FILE-PATH` Add a context to the store ``` USAGE $ asyncapi config context add CONTEXT-NAME SPEC-FILE-PATH [-h] [-s] ARGUMENTS CONTEXT-NAME context name SPEC-FILE-PATH file path of the spec file FLAGS -h, --help Show CLI help. -s, --set-current Set context being added as the current context DESCRIPTION Add a context to the store ``` *See code: [src/commands/config/context/add.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/config/context/add.ts)* ## `asyncapi config context current` Shows the current context that is being used ``` USAGE $ asyncapi config context current [-h] FLAGS -h, --help Show CLI help. DESCRIPTION Shows the current context that is being used ``` *See code: [src/commands/config/context/current.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/config/context/current.ts)* ## `asyncapi config context edit CONTEXT-NAME NEW-SPEC-FILE-PATH` Edit a context in the store ``` USAGE $ asyncapi config context edit CONTEXT-NAME NEW-SPEC-FILE-PATH [-h] ARGUMENTS CONTEXT-NAME context name NEW-SPEC-FILE-PATH file path of the spec file FLAGS -h, --help Show CLI help. DESCRIPTION Edit a context in the store ``` *See code: [src/commands/config/context/edit.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/config/context/edit.ts)* ## `asyncapi config context init [CONTEXT-FILE-PATH]` Initialize context ``` USAGE $ asyncapi config context init [CONTEXT-FILE-PATH] [-h] ARGUMENTS [CONTEXT-FILE-PATH] Specify directory in which context file should be created: - current directory : asyncapi config context init .(default) - root of current repository : asyncapi config context init ./ - user's home directory : asyncapi config context init ~` FLAGS -h, --help Show CLI help. DESCRIPTION Initialize context ``` *See code: [src/commands/config/context/init.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/config/context/init.ts)* ## `asyncapi config context list` List all the stored contexts in the store ``` USAGE $ asyncapi config context list [-h] FLAGS -h, --help Show CLI help. DESCRIPTION List all the stored contexts in the store ``` *See code: [src/commands/config/context/list.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/config/context/list.ts)* ## `asyncapi config context remove CONTEXT-NAME` Delete a context from the store ``` USAGE $ asyncapi config context remove CONTEXT-NAME [-h] ARGUMENTS CONTEXT-NAME Name of the context to delete FLAGS -h, --help Show CLI help. DESCRIPTION Delete a context from the store ``` *See code: [src/commands/config/context/remove.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/config/context/remove.ts)* ## `asyncapi config context use CONTEXT-NAME` Set a context as current ``` USAGE $ asyncapi config context use CONTEXT-NAME [-h] ARGUMENTS CONTEXT-NAME name of the saved context FLAGS -h, --help Show CLI help. DESCRIPTION Set a context as current ``` *See code: [src/commands/config/context/use.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/config/context/use.ts)* ## `asyncapi config versions` Show versions of AsyncAPI tools used ``` USAGE $ asyncapi config versions [-h] FLAGS -h, --help Show CLI help. DESCRIPTION Show versions of AsyncAPI tools used ``` *See code: [src/commands/config/versions.ts](https://github.com/asyncapi/cli/blob/v5.0.7/src/commands/config/versions.ts)* ## `asyncapi convert [SPEC-FILE]` Convert asyncapi documents older to newer versions or OpenAPI documents to AsyncAPI ``` USAGE $ asyncapi convert [SPEC-FILE] -f openapi|asyncapi [-h] [-o ] [-t ] [-p client|server] [--proxyHost ] [--proxyPort ] ARGUMENTS [SPEC-FILE] spec path, url, or context-name FLAGS -f, --format=