https://github.com/apimatic/apimatic-cli
A CLI for APIMatic to validate and transform API specs and to create client libraries.
https://github.com/apimatic/apimatic-cli
Last synced: 6 months ago
JSON representation
A CLI for APIMatic to validate and transform API specs and to create client libraries.
- Host: GitHub
- URL: https://github.com/apimatic/apimatic-cli
- Owner: apimatic
- Created: 2016-09-06T06:20:08.000Z (almost 10 years ago)
- Default Branch: alpha
- Last Pushed: 2025-03-17T08:04:47.000Z (over 1 year ago)
- Last Synced: 2025-03-28T11:06:29.540Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://www.apimatic.io/
- Size: 989 KB
- Stars: 88
- Watchers: 2
- Forks: 17
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
@apimatic/cli
=============
apimatic is in Alpha.
The official CLI for APIMatic.
[](https://oclif.io)
[](https://npmjs.org/package/@apimatic/cli)
[](https://npmjs.org/package/@apimatic/cli)
[](https://github.com/apimatic/apimatic-cli/blob/master/package.json)
# Getting Started
To get started with APIMatic's CLI using a step by step wizard, run the following command:
```sh-session
$ apimatic portal:quickstart
```
* [Usage](#usage)
* [Commands](#commands)
# Usage
```sh-session
$ npm install -g @apimatic/cli
$ apimatic COMMAND
running command...
$ apimatic (--version)
@apimatic/cli/0.0.0-alpha.0 win32-x64 node-v20.18.3
$ apimatic --help [COMMAND]
USAGE
$ apimatic COMMAND
...
```
# Commands
* [`apimatic api:transform`](#apimatic-apitransform)
* [`apimatic api:validate`](#apimatic-apivalidate)
* [`apimatic auth:login`](#apimatic-authlogin)
* [`apimatic auth:logout`](#apimatic-authlogout)
* [`apimatic auth:status`](#apimatic-authstatus)
* [`apimatic autocomplete [SHELL]`](#apimatic-autocomplete-shell)
* [`apimatic help [COMMAND]`](#apimatic-help-command)
* [`apimatic portal:generate`](#apimatic-portalgenerate)
* [`apimatic portal:quickstart`](#apimatic-portalquickstart)
* [`apimatic portal:serve`](#apimatic-portalserve)
* [`apimatic sdk:generate`](#apimatic-sdkgenerate)
## `apimatic api:transform`
Transform API specifications from one format to another. Supports [10+ different formats](https://www.apimatic.io/transformer/#supported-formats) including OpenApi/Swagger, RAML, WSDL and Postman Collections.
```
USAGE
$ apimatic api:transform --format [--file ] [--url ] [--destination ] [-f]
[--auth-key ]
FLAGS
-f, --force overwrite if same file exist in the destination
--auth-key=auth-key override current authentication state with an authentication key
--destination=destination [default: /home/runner/work/apimatic-cli/apimatic-cli/cli] directory to download
transformed file to
--file=file path to the API specification file to transform
--format=format (required) specification format to transform API specification into
APIMATIC|WADL2009|WSDL|SWAGGER10|SWAGGER20|SWAGGERYAML|OAS3|OPENAPI3YAML|APIBLUEPRINT|RAML|
RAML10|POSTMAN10|POSTMAN20|GRAPHQLSCHEMA
--url=url URL to the API specification file to transform. Can be used in place of the --file option
if the API specification is publicly available.
DESCRIPTION
Transform API specifications from one format to another. Supports [10+ different
formats](https://www.apimatic.io/transformer/#supported-formats) including OpenApi/Swagger, RAML, WSDL and Postman
Collections.
EXAMPLES
$ apimatic api:transform --format="OpenApi3Json" --file="./specs/sample.json" --destination="D:/"
Success! Your transformed file is located at D:/Transformed_OpenApi3Json.json
$ apimatic api:transform --format=RAML --url="https://petstore.swagger.io/v2/swagger.json" --destination="D:/"
Success! Your transformed file is located at D:/swagger_raml.yaml
```
_See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/transform.ts)_
## `apimatic api:validate`
Validate the syntactic and semantic correctness of an API specification
```
USAGE
$ apimatic api:validate [--file ] [--url ] [--auth-key ]
FLAGS
--auth-key=auth-key override current authentication state with an authentication key
--file=file Path to the API specification file to validate
--url=url URL to the specification file to validate. Can be used in place of the --file option if the API
specification is publicly available.
DESCRIPTION
Validate the syntactic and semantic correctness of an API specification
EXAMPLES
$ apimatic api:validate --file="./specs/sample.json"
Specification file provided is valid
$ apimatic api:validate --url=https://petstore.swagger.io/v2/swagger.json
Specification file provided is valid
```
_See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/validate.ts)_
## `apimatic auth:login`
Login using your APIMatic credentials or an API Key
```
USAGE
$ apimatic auth:login [--auth-key ]
FLAGS
--auth-key=auth-key Set authentication key for all commands
DESCRIPTION
Login using your APIMatic credentials or an API Key
EXAMPLES
$ apimatic auth:login
Please enter your registered email: apimatic-user@gmail.com
Please enter your password: *********
You have successfully logged into APIMatic
$ apimatic auth:login --auth-key=xxxxxx
Authentication key successfully set
```
_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/login.ts)_
## `apimatic auth:logout`
Clear local login credentials
```
USAGE
$ apimatic auth:logout
DESCRIPTION
Clear local login credentials
EXAMPLES
$ apimatic auth:logout
Logged out
```
_See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/logout.ts)_
## `apimatic auth:status`
View current authentication state
```
USAGE
$ apimatic auth:status
DESCRIPTION
View current authentication state
EXAMPLES
$ apimatic auth:status
Currently logged in as apimatic-client@gmail.com
```
_See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/status.ts)_
## `apimatic autocomplete [SHELL]`
Display autocomplete installation instructions.
```
USAGE
$ apimatic autocomplete [SHELL] [-r]
ARGUMENTS
SHELL shell type
FLAGS
-r, --refresh-cache Refresh cache (ignores displaying instructions)
DESCRIPTION
Display autocomplete installation instructions.
EXAMPLES
$ apimatic autocomplete
$ apimatic autocomplete bash
$ apimatic autocomplete zsh
$ apimatic autocomplete --refresh-cache
```
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/main/src/commands/autocomplete/index.ts)_
## `apimatic help [COMMAND]`
Display help for apimatic.
```
USAGE
$ apimatic help [COMMAND]
ARGUMENTS
COMMAND command to show help for
DESCRIPTION
Display help for apimatic.
```
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/main/src/commands/help.ts)_
## `apimatic portal:generate`
Generate and download a static API Documentation portal. Requires an input directory containing API specifications, a config file and optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/build-file-reference)
```
USAGE
$ apimatic portal:generate [--folder ] [--destination ] [-f] [--zip] [--auth-key ]
FLAGS
-f, --force overwrite if a portal exists in the destination
DESCRIPTION
Generate and download a static API Documentation portal. Requires an input directory containing API specifications, a
config file and optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platfo
rm-api/#/http/guides/generating-on-prem-api-portal/build-file-reference)
EXAMPLES
$ apimatic portal:generate --folder="./portal/" --destination="D:/"
Your portal has been generated at D:/
```
_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/generate.ts)_
## `apimatic portal:quickstart`
Create your first API Portal using APIMatic’s Docs as Code offering.
```
USAGE
$ apimatic portal:quickstart
DESCRIPTION
Create your first API Portal using APIMatic’s Docs as Code offering.
EXAMPLES
$ apimatic portal:quickstart
```
_See code: [src/commands/portal/quickstart.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.11/src/commands/portal/quickstart.ts)_
## `apimatic portal:serve`
Generate and deploy a Docs as Code portal with hot reload.
```
USAGE
$ apimatic portal:serve [-p ] [-d ] [-s ] [-o] [--no-reload] [-i ] [--auth-key ]
FLAGS
-d, --destination= [default: ./api-portal] Directory to store and serve the generated portal.
-i, --ignore= Comma-separated list of files/directories to ignore.
-o, --open Open the portal in the default browser.
-p, --port= [default: 3000] Port to serve the portal.
-s, --source= [default: ./] Source directory containing specs, content, and build file. By default, the
current directory is used.
--auth-key= Override current authentication state with an authentication key.
--no-reload Disable hot reload.
DESCRIPTION
Generate and deploy a Docs as Code portal with hot reload.
EXAMPLES
$ apimatic portal:serve --source="./" --destination="./api-portal" --port=3000 --open --no-reload
```
_See code: [src/commands/portal/serve.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.11/src/commands/portal/serve.ts)_
## `apimatic sdk:generate`
Generate SDK for your APIs
```
USAGE
$ apimatic sdk:generate --platform [--file ] [--url ] [--destination ] [-f] [--zip] [--auth-key ]
FLAGS
-f, --force overwrite if an SDK already exists in the destination
--auth-key=auth-key override current authentication state with an authentication key
--destination=destination [default: /home/runner/work/apimatic-cli/apimatic-cli/cli] directory to download the
generated SDK to
--file=file path to the API specification to generate SDKs for
--platform=platform (required) language platform for sdk
Simple: CSHARP|JAVA|PYTHON|RUBY|PHP|TYPESCRIPT
Legacy: CS_NET_STANDARD_LIB|CS_PORTABLE_NET_LIB|CS_UNIVERSAL_WINDOWS_PLATFORM_LIB|
JAVA_ECLIPSE_JRE_LIB|PHP_GENERIC_LIB|PYTHON_GENERIC_LIB|RUBY_GENERIC_LIB|
TS_GENERIC_LIB
--url=url URL to the API specification to generate SDKs for. Can be used in place of the --file
option if the API specification is publicly available.
--zip download the generated SDK as a .zip archive
DESCRIPTION
Generate SDK for your APIs
EXAMPLES
$ apimatic sdk:generate --platform="CSHARP" --file="./specs/sample.json"
Generating SDK... done
Downloading SDK... done
Success! Your SDK is located at swagger_sdk_csharp
$ apimatic sdk:generate --platform="CSHARP" --url=https://petstore.swagger.io/v2/swagger.json
Generating SDK... done
Downloading SDK... done
Success! Your SDK is located at swagger_sdk_csharp
```
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/sdk/generate.ts)_