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.
$ 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 HEADSix 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.yamlThe 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.yamlHow 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.yamlOnly 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.yamlEverything 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.yamlOne file with every external $ref resolved, as YAML or JSON, ready to hand to a tool that wants a single document.
Preview
apigit previewThe 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
$ 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 itRun 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
$ 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$ 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.
breakingfails the job when a change can break a clientlint --orgadds your organization's governance rule sets, and--report-statusposts 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/cliwith the same arguments
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.yamlpermissions:
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/petstorePublish 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-runprints 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
$ 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 planBuilt 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 installadds an Agent Skill that teaches coding agents the commands--jsonon every command, andapigit contextlists every command and option as JSONapigit agent setupconnects 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
$ apigit skills installWrote .agents/skills/apigit-cli$ apigit agent setup --print.mcp.json{ "mcpServers": { "apigit": { "command": "apigit", "args": [ "mcp" ] } }}$ 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?
Do I need an APIGit account to lint a file?
What does local-first mean for APIGit?
Which rules does lint use?
Which CI systems does it work with?
How is the CLI different from the MCP server?
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