CLI Reference

Every command in the APIMatic CLI (@apimatic/cli), grouped by what it works on.

Install or update the APIMatic CLI with npm:

npm i -g @apimatic/cli@beta

Commands overview

The APIMatic CLI groups its commands into these topics:

  • Quickstart: Set up your first developer portal or SDK.
  • Portal commands: Generate and serve developer portals.
  • API commands: Validate and transform API definitions.
  • SDK commands: Generate SDKs in C#, Python, and TypeScript, and publish them.
  • Plugin commands: Generate and publish Context Plugins for your published SDKs (Claude Code, Cursor, VS Code, Codex).
  • Publishing commands: List the publishing profiles you publish SDKs with.
  • Auth commands: Sign in, sign out, and check your sign-in status.

Run apimatic --help to see all topics and commands.

Quickstart

apimatic quickstart

Interactive guide that sets up your first API portal or SDK. No prior setup needed.

Portal commands

portal generate

Generates a static API documentation portal from your src directory.

apimatic portal generate
FlagWhat it does
-i, --inputPath to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./.
-d, --destinationWhere to write the generated portal. Defaults to <input>/portal.
-f, --forceOverwrite changes without asking for your consent.
--zipDownload the portal as a ZIP.
-k, --auth-keyOverride the current authentication state with an API key.

portal serve

Builds the portal and serves it locally with hot reload.

apimatic portal serve --open
FlagWhat it does
-i, --inputPath to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./.
-p, --portPort for the local server. Defaults to 23513.
-o, --openOpen the portal in your browser.
-k, --auth-keyOverride the current authentication state with an API key.

API commands

api validate

Checks the syntax and semantics of an API definition.

apimatic api validate
apimatic api validate --file=<path>
apimatic api validate --url=<url>

With no flags, it validates the API definition in the src directory of the current folder. Use --input to point to another folder that contains src, or --file or --url to validate a single file.

FlagWhat it does
-i, --inputPath to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./.
--filePath to the API definition file to validate.
--urlURL of the API definition file to validate. The file must be publicly accessible.
-k, --auth-keyOverride the current authentication state with an API key.

api transform

Converts an API definition between formats such as OpenAPI, RAML, WSDL, and Postman.

apimatic api transform --format=<format> --file=<path>
FlagWhat it does
--formatRequired. Format to convert to. See output formats for the values.
--filePath to the API definition file to transform.
--urlURL of the API definition file to transform. The file must be publicly accessible.
-d, --destinationDirectory where the transformed file is saved.
-f, --forceOverwrite changes without asking for your consent.
-k, --auth-keyOverride the current authentication state with an API key.

SDK commands

sdk generate

Generates an SDK in the language you choose.

apimatic sdk generate --language=<language>

Supported values for --language: csharp, python, typescript.

FlagWhat it does
-l, --languageRequired. SDK language: csharp, python, or typescript.
-i, --inputPath to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./.
-d, --destinationWhere to write the SDK. Defaults to <input>/sdk/<language>.
--api-versionAPI version to generate for, when the project has versioned builds.
--codegen-versionCode generator version. v4 is the only value and the default, so you can leave it out.
--stabilitystable or beta. Defaults to the level the language offers.
-f, --forceOverwrite changes without asking for your consent.
-k, --auth-keyOverride the current authentication state with an API key.
--zipDownload the SDK as a ZIP instead of a folder.

sdk publish

Publishes an SDK to package registries (NuGet, PyPI, npm) and GitHub using a publishing profile. Run it with no flags for guided mode, or pass flags for CI/CD. When you pass flags, --profile-id, --language, --version, and --publish-type are required.

apimatic sdk publish
apimatic sdk publish --profile-id=<id> --language=<lang> --version=<version> --publish-type=<type>
FlagWhat it does
-p, --profile-idID of the publishing profile to use. Run apimatic publishing profile list to find it.
-l, --languageSDK language: csharp, python, or typescript.
-v, --versionVersion to publish, in semantic versioning (MAJOR.MINOR.PATCH, for example 1.0.0).
--publish-typepackage (NuGet, PyPI, or npm) or sourcecode (GitHub). Pass it twice to publish both.
-i, --inputPath to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./.
-d, --destinationWhere the generated SDK is saved locally. Defaults to <input>/sdk.
--codegen-versionCode generator version. v4 is the only value and the default, so you can leave it out.
--stabilitystable or beta. Defaults to the level the language offers.
--dry-runGenerate the SDK locally for review without publishing it.
-f, --forceOverwrite changes without asking for your consent.

Plugin commands

plugin generate

Creates a Context Plugin for AI coding agents from your SDKs.

apimatic plugin generate
FlagWhat it does
-i, --inputPath to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./.
-d, --destinationWhere to write the plugin. Defaults to <input>/plugin.
-f, --forceOverwrite changes without asking for your consent.
-k, --auth-keyOverride the current authentication state with an API key.

Note: Publish your SDKs with source code first (--publish-type=sourcecode) for the best results. Without published SDKs, the command builds a local plugin that you can preview.

plugin publish

Prints the git commands to publish your plugin to GitHub. It doesn't run them, so you can review what becomes public first.

apimatic plugin publish
FlagWhat it does
-i, --inputPath to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./.
-d, --destinationPath where the plugin was generated. Defaults to <input>/plugin.

The plugin-config.json file

apimatic sdk publish and apimatic plugin generate both read and write a plugin-config.json file in your src directory. Each command owns a different part of it:

  • sdk publish records each published SDK: its language, source repository, package configuration, and code generator version. In guided mode, it asks before recording a language.
  • plugin generate records the plugin's own identity: its ID, display name, and version. It creates the file if it doesn't exist.

plugin generate covers the SDKs recorded in this file. Unrecognized fields aren't removed, so a hand-edited file keeps whatever you added to it.

Publishing commands

publishing profile list

Lists your publishing profiles with their IDs and enabled languages.

apimatic publishing profile list

Auth commands

auth login

Signs the APIMatic CLI in to your APIMatic account.

apimatic auth login

Flags: -k, --auth-key

auth logout

Clears your local credentials.

apimatic auth logout

auth status

Shows whether you're signed in and as whom.

apimatic auth status

Help

apimatic help <command>
apimatic <command> --help

Flags: -n, --nested-commands

On this page