Skip to content

Your API checks, in the terminal and in CI

The apigit command line lints and scores API descriptions, stops a breaking change in a pull request, previews the docs site, runs a mock, and publishes documents and mock servers. It is local-first: the work runs on your machine, from a clone, for you, your pipeline and your coding agent.

Install with npm install -g @apigit/cli. Free, no telemetry, no account needed to check a file. Node.js 20 or later.

~/orders-api (branch require-include)
$ apigit lint openapi.yamlopenapi.yaml  48:12  warn   operation-description  Operation "description" must be present and non-empty string.  (paths./orders/{orderId}.delete)  48:12  warn   operation-operationId  Operation must have "operationId".  (paths./orders/{orderId}.delete)  48:12  warn   operation-tags         Operation must have non-empty "tags" array.  (paths./orders/{orderId}.delete) 3 problems (0 errors, 3 warnings, 0 info, 0 hints)$ apigit diff main HEAD openapi.yaml3 change(s), 2 breaking. Breaking  GET /orders/{orderId}: parameter query include became required  schema Order: schema field "total" removed Not breaking  DELETE /orders/{orderId}: operation added$ apigit breaking main HEAD openapi.yaml2 change(s), 2 breaking. Breaking  GET /orders/{orderId}: parameter query include became required  schema Order: schema field "total" removederror: 2 breaking change(s) from main to HEAD

Six commands that need no account

Point them at a file in any repository. They run on your machine, for you or for the coding agent in your terminal, and your files stay there.

Lint

apigit lint openapi.yaml

The rule sets of the APIGit editor: OpenAPI and AsyncAPI best practice, OWASP API Security Top 10, URL style and documentation quality. Or your own Spectral file. A GraphQL schema is checked for syntax and schema faults.

Score

apigit score openapi.yaml

How ready the API description is for AI agents, from 0 to 100, with a line for every rule it was measured by. --min fails the run below a number you choose.

Breaking changes

apigit breaking main HEAD openapi.yaml

Only the changes that can break a client, between two commits, branches, tags or files. Exits 1 when there is one.

Diff

apigit diff main HEAD openapi.yaml

Everything that changed in the API, read as operations, parameters, response codes and schema fields rather than as lines of YAML. Breaking changes come first.

Bundle

apigit bundle openapi.yaml -o dist/openapi.yaml

One file with every external $ref resolved, as YAML or JSON, ready to hand to a tool that wants a single document.

Preview

apigit preview

The whole repository as the published site will show it, drawn by the viewer of the published pages and reloaded when you save. It downloads that viewer once, then starts without a connection.

lint also checks AsyncAPI 2.x and 3.x documents with the best-practice rules and validates GraphQL schemas. score, bundle, diff and breaking work on OpenAPI. See what lint accepts

See the site and call the mock before you commit

Both run from your working copy, uncommitted edits included, and follow the files as you save them.

Preview the docs site as it will be published

apigit preview serves the repository at 127.0.0.1:4011 with the viewer of the published pages, not a copy of it: Markdown and MDX, OpenAPI, AsyncAPI and GraphQL, the file tree, your apigit.json navigation and Try it.

  • Signed in, it shows the site settings saved for the repository: theme, colours, fonts, logo, header links, footer and banner
  • Or pick one of the seven themes and the colours by hand
  • No login needed for the default look; the local page loads no analytics
Preview, commands only
$ apigit preview                  # the whole site of this repository$ apigit preview docs/intro.md    # the same, opened on that page$ apigit preview --theme fern     # sequoia, clover, fern, cedar, juniper, birch or alder$ apigit preview --no-tryit       # as a version published without Try it

Run the mock on your machine

apigit mock serve answers as the published mock will. An OpenAPI file gets the engine of the hosted mock servers: routing, request validation, examples and generated responses. A GraphQL schema is served at /graphql. A folder with main.js runs as a code-based mock, on the same Express app and libraries as on APIGit.

  • Offline, no login, on 127.0.0.1:4010 or the port you give
  • Follows your edits without a restart
  • Locally there is no access token, quota or request log, and state lasts until you stop it
~/orders-api
$ apigit mock serve openapi.yamlMock of openapi.yaml at http://127.0.0.1:4010 (Ctrl+C to stop). 1 operation(s):  GET /orders/{orderId}GET /orders/1042 -> 200GET /orders/abc -> 422
Another terminal
$ curl http://127.0.0.1:4010/orders/1042{"id":1042,"status":"shipped","total":129.5}$ curl http://127.0.0.1:4010/orders/abc{"errors":[{"in":"path","name":"orderId","message":"must be integer"}],"type":"https://apigit.com/mock/problems/invalid-request","title":"The request does not match the API description","status":422,"detail":"The request does not match getOrder: path orderId: must be integer"}

Stop a breaking change before it merges

Run the same checks on every pull request. A failed check is exit code 1, which your pipeline already understands, and on APIGit it can be a status that a branch protection rule requires.

  • breaking fails the job when a change can break a client
  • lint --org adds your organization's governance rule sets, and --report-status posts the result on the commit
  • Findings as GitHub Actions annotations, JUnit, SARIF or JSON
  • On GitHub Actions a job can sign in with the identity token GitHub issues to it, so no secret is stored
  • Any other CI system: npx @apigit/cli with the same arguments
.github/workflows/api.yml
steps:
  - uses: actions/checkout@v4
    with:
      fetch-depth: 0
  - uses: actions/setup-node@v4
    with:
      node-version: 22

  - run: npx @apigit/cli@0.9.0 lint openapi.yaml --format github-actions
  - run: npx @apigit/cli@0.9.0 breaking origin/main HEAD openapi.yaml
Publishing from a job, with no stored secret
permissions:
  id-token: write
  contents: read
steps:
  - uses: actions/checkout@v4
  - run: npx @apigit/cli@0.9.0 auth login --github-oidc -R my-org/petstore
  - run: npx @apigit/cli@0.9.0 doc publish --version v1 -R my-org/petstore

Publish documents and mock servers from a commit

Push with git, then publish that commit as an API document, a mock server, or both. Inside a clone the CLI finds the repository from the origin remote. In a release job, the tag becomes the version.

  • Pin a version to a commit, or follow a branch on plans that include it
  • Choose who can read a version when you publish it
  • --dry-run prints what would be sent and sends nothing
  • Call a mock and read its request log without leaving the terminal
  • Sign in from the browser with a short code, or with a token on a machine without one
Publish a pushed commit, commands only
$ apigit auth login$ apigit doc publish --version 1.2.0 --access public$ apigit doc list$ apigit mock publish --name petstore --type spec --mount openapi.yaml$ apigit mock call petstore /pets$ apigit mock logs petstore$ apigit plan

Built for the agent in your editor too

Claude Code, Codex or any agent that works in a terminal can check, preview, mock and publish an API from your clone, the way you do. It can also reach your APIGit account through MCP. Either way it works with your sign-in, and no token is written to a file.

  • apigit skills install adds an Agent Skill that teaches coding agents the commands
  • --json on every command, and apigit context lists every command and option as JSON
  • apigit agent setup connects Claude Code, Cursor or VS Code through MCP, read-only unless you add --write
  • With the write tools an agent works on a branch and opens a pull request; people merge
~/orders-api
$ apigit skills installWrote .agents/skills/apigit-cli$ apigit agent setup --print.mcp.json{  "mcpServers": {    "apigit": {      "command": "apigit",      "args": [        "mcp"      ]    }  }}
~/orders-api
$ apigit score openapi.yaml --min 90openapi.yaml  76 / 100  1 of 2  Operations have an operationId  2 of 2  operationIds are unique  2 of 2  Operations have a summary  1 of 2  Operations have a description  1 of 2  Operations have a tag  1 of 2  Operations document an error response  2 of 2  Success responses have a schema  2 of 3  Parameters have a description  1 of 1  The API has a description  1 of 1  The API names a servererror: score below 90: openapi.yaml (76)

Questions about the CLI

Is the APIGit CLI free?
Yes. The CLI is free to use and sends no telemetry. Checking files needs no account; publishing uses your APIGit account and its plan.
Do I need an APIGit account to lint a file?
No. lint, score, bundle, diff, breaking and preview run on your machine and work offline (preview downloads the viewer of the published pages once). You sign in only to publish documents and mock servers or to use your organization's rule sets.
What does local-first mean for APIGit?
The work happens on your machine, in a clone of your repository. The CLI checks, previews and mocks an API there, offline, and an Agent Skill teaches a coding agent such as Claude Code or Codex the same commands, so the agent can do the whole job in your terminal. APIGit is where the result is reviewed and published; publishing is the step that needs your account.
Which rules does lint use?
The rule sets of the APIGit editor are built in. A .spectral.yaml in the working directory or a file given with --ruleset replaces them, and --org adds the governance rule sets of your APIGit organization.
Which CI systems does it work with?
Any system that can run Node.js 20 or later: run npx @apigit/cli with the same arguments. lint writes GitHub Actions annotations, JUnit, SARIF and JSON. On GitHub Actions a job can also sign in with the identity token GitHub issues, so no secret is stored.
How is the CLI different from the MCP server?
The CLI is for a terminal, a script or a CI job. The MCP server gives an AI agent the same work as tools. apigit agent setup connects a coding agent to both, and apigit skills install adds an Agent Skill that teaches agents the commands.

Check your first file in a minute

Install the CLI and lint an API description now. Create a free APIGit workspace when you want to publish it.

Free for individuals. No credit card.

$ npm install -g @apigit/cli$ apigit auth login$ apigit doc publish