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@betaCommands 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 quickstartInteractive 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| Flag | What it does |
|---|---|
-i, --input | Path to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./. |
-d, --destination | Where to write the generated portal. Defaults to <input>/portal. |
-f, --force | Overwrite changes without asking for your consent. |
--zip | Download the portal as a ZIP. |
-k, --auth-key | Override the current authentication state with an API key. |
portal serve
Builds the portal and serves it locally with hot reload.
apimatic portal serve --open| Flag | What it does |
|---|---|
-i, --input | Path to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./. |
-p, --port | Port for the local server. Defaults to 23513. |
-o, --open | Open the portal in your browser. |
-k, --auth-key | Override 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.
| Flag | What it does |
|---|---|
-i, --input | Path to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./. |
--file | Path to the API definition file to validate. |
--url | URL of the API definition file to validate. The file must be publicly accessible. |
-k, --auth-key | Override 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>| Flag | What it does |
|---|---|
--format | Required. Format to convert to. See output formats for the values. |
--file | Path to the API definition file to transform. |
--url | URL of the API definition file to transform. The file must be publicly accessible. |
-d, --destination | Directory where the transformed file is saved. |
-f, --force | Overwrite changes without asking for your consent. |
-k, --auth-key | Override 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.
| Flag | What it does |
|---|---|
-l, --language | Required. SDK language: csharp, python, or typescript. |
-i, --input | Path to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./. |
-d, --destination | Where to write the SDK. Defaults to <input>/sdk/<language>. |
--api-version | API version to generate for, when the project has versioned builds. |
--codegen-version | Code generator version. v4 is the only value and the default, so you can leave it out. |
--stability | stable or beta. Defaults to the level the language offers. |
-f, --force | Overwrite changes without asking for your consent. |
-k, --auth-key | Override the current authentication state with an API key. |
--zip | Download 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>| Flag | What it does |
|---|---|
-p, --profile-id | ID of the publishing profile to use. Run apimatic publishing profile list to find it. |
-l, --language | SDK language: csharp, python, or typescript. |
-v, --version | Version to publish, in semantic versioning (MAJOR.MINOR.PATCH, for example 1.0.0). |
--publish-type | package (NuGet, PyPI, or npm) or sourcecode (GitHub). Pass it twice to publish both. |
-i, --input | Path to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./. |
-d, --destination | Where the generated SDK is saved locally. Defaults to <input>/sdk. |
--codegen-version | Code generator version. v4 is the only value and the default, so you can leave it out. |
--stability | stable or beta. Defaults to the level the language offers. |
--dry-run | Generate the SDK locally for review without publishing it. |
-f, --force | Overwrite changes without asking for your consent. |
Plugin commands
plugin generate
Creates a Context Plugin for AI coding agents from your SDKs.
apimatic plugin generate| Flag | What it does |
|---|---|
-i, --input | Path to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./. |
-d, --destination | Where to write the plugin. Defaults to <input>/plugin. |
-f, --force | Overwrite changes without asking for your consent. |
-k, --auth-key | Override 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| Flag | What it does |
|---|---|
-i, --input | Path to the parent directory that contains src, with your API definitions and configuration files. Defaults to ./. |
-d, --destination | Path 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 publishrecords each published SDK: its language, source repository, package configuration, and code generator version. In guided mode, it asks before recording a language.plugin generaterecords 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 listAuth commands
auth login
Signs the APIMatic CLI in to your APIMatic account.
apimatic auth loginFlags: -k, --auth-key
auth logout
Clears your local credentials.
apimatic auth logoutauth status
Shows whether you're signed in and as whom.
apimatic auth statusHelp
apimatic help <command>
apimatic <command> --helpFlags: -n, --nested-commands