Spec0docs

Getting started

Publish your first API spec and spin up a mock — five minutes, zero infrastructure.

This is the fastest path from "I have an openapi.yaml" to a live mock URL your services can hit.

Prerequisites

  • Node.js 20+ (for the CLI)
  • A Spec0 account (sign up at spec0.io)
  • An OpenAPI spec — any version, YAML or JSON

1. Install the CLI

npm install -g @spec0/cli
spec0 --version

2. Authenticate

spec0 auth login

A browser tab opens; approve and return to the terminal.

3. Publish a spec

From a directory containing your openapi.yaml:

spec0 init                                # writes .spec0.yaml
spec0 lint openapi.yaml --min-score 80    # optional quality gate
spec0 publish openapi.yaml --semver       # auto-bumps based on diff

--semver diffs your spec against the last published version and bumps patch / minor / major automatically.

4. Spin up a mock

spec0 mock create --api my-api
spec0 mock url my-api
# https://mocks.spec0.io/m/abc123

Hit any path defined in your spec — you get realistic responses generated from the schema.

5. Wire it into CI

.github/workflows/spec0-publish.yml
name: Spec0
on:
  push:
    branches: [main]
    paths: ['openapi.yaml']
jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: '20' }
      - run: npm install -g @spec0/cli
      - run: spec0 publish openapi.yaml --semver
        env:
          SPEC0_TOKEN: ${{ secrets.SPEC0_TOKEN }}
          SPEC0_ORG_ID: ${{ secrets.SPEC0_ORG_ID }}

Full GitHub Actions guide — exit codes, change detection, ruleset uploads.

What's next

  • Concepts — the mental model: registry, specs, mocks, governance.
  • Mock server — variants, schema validation, CEL expressions.
  • AI agents — let an agent run this flow on your behalf.

On this page