Skip to main content

imnot

imnot — stateful API mock server

CI codecov PyPI version

YAML in. Mock server out. Define external APIs in a single file, run imnot start, and get a fully functional local mock server — stateful flows, session isolation, and an Admin UI included. No code required.


Why imnot?

  • Zero code. One YAML file per external API. No JVM, no framework, no boilerplate.
  • Stateful, not just stubbed. OAuth, polling, callbacks, paginated lists, and per-test session isolation — all modeled in YAML.
  • Validation-aware. Declare field rules in YAML — imnot rejects malformed requests with realistic 422 errors before returning a mock response.
  • Rate-limit aware. Declare a requests_per_minute ceiling on fetch endpoints (and on paginated endpoints using the DRF-style page_number_url pagination) — imnot enforces it with a token bucket and returns realistic 429 responses with a Retry-After header.
  • Echoes the request. {{path.id}}, {{body.x}} or {{request_id}} inside a response or callback payload, so callbacks can be correlated with their submit.
  • Fails on demand. delay_ms and fail: {status, first_n} on any endpoint simulate a slow or flaky partner, to test timeouts and retries.
  • Records what your integration sent. Every request to a mock route lands in a journal (GET /imnot/admin/requests, secrets redacted), so a test can assert the exact body and headers your code produced.
  • Ships with your tests. Partner definitions — and, optionally, their payloads as payloads/<datapoint>.json — are version-controlled alongside the integration they test and run anywhere Docker runs.
  • Runs in a container with no storage. --stateless --strict: read-only filesystem, logs on stdout, and a broken partner stops the rollout. One instance per team, each with its own partners and key. See docs/deployment.md.

Quick start

Requires Python 3.11+.

pipx install imnot
imnot init
imnot start

pipx installs CLI tools into isolated environments. Alternatively: pip install imnot inside an existing virtual environment.

imnot init creates a partners/ directory with three working example partners that cover all six patterns: staylink (oauth + polling), bookingco (static + fetch) and ratesync (callback + paginated, with example payloads in payloads/, so it answers right away). Edit or replace them whenever you're ready.

Or skip imnot init: imnot start alone opens an empty Admin UI where you create your first partner or load the examples.


Patterns

Pattern What it mocks
oauth Client-credentials token endpoint — returns a standard JWT
static Any fixed-response endpoint — health checks, custom auth, lookup tables
fetch Synchronous GET that returns an uploaded payload
polling N-step async flow: submit → status check(s) → fetch result
callback Webhook simulation — imnot fires the outbound call after receiving a submit
paginated Paginated list endpoints (offset/limit, cursor, or page-number) sliced from an uploaded array at request time

All fetch, polling, and paginated endpoints support X-Imnot-Session for per-test isolation — parallel test runs stay independent. One session can hold payloads for several datapoints: upload each one with the same X-Imnot-Session header.

→ Full pattern reference with YAML examples


Admin UI

imnot ships an embedded Admin UI at GET /imnot/admin/ui. No setup required — it's enabled by default and auth-gated by the same Bearer token as the rest of the admin API.

From the browser you can:

  • Browse loaded partners and their datapoints
  • Create and edit partners without writing YAML (Builder), and download them as partner.yaml
  • Upload and inspect payloads (global or session-scoped)
  • Run end-to-end endpoint tests — including full polling flows
  • Manage active sessions
  • Hot-reload YAML without restarting the server
  • Run load tests against any HTTP endpoint (standalone or partner-bound)

→ Load Test reference


AI-ready

Don't want to write the YAML yourself? Paste one of these into Claude, ChatGPT, or your AI assistant:

From a description:

I use imnot to mock external APIs for integration testing.
Generate a partner.yaml file in imnot format for [service name].
Schema reference: https://github.com/edu2105/imnot/blob/main/partners/README.md
Endpoints to mock: [describe them]
Output only the YAML — no code, no explanation.

From an OpenAPI spec:

I use imnot to mock external APIs for integration testing.
Convert this OpenAPI spec into a partner.yaml file in imnot format.
Schema: https://github.com/edu2105/imnot/blob/main/partners/README.md
Output only the YAML — no code, no explanation.
[paste your spec here]

Learn more

Topic Doc
Pattern reference docs/patterns.md
Admin API reference docs/admin-api.md
Load Test docs/load-test.md
CLI & configuration docs/cli.md
Docker & deployment docs/deployment.md
Partner YAML schema partners/README.md
Contributing CONTRIBUTING.md

Limitations

  • JSON only — response bodies are always JSON, no XML support.
  • One replica per instance — state lives in each process; scale with one instance per team, not replicas.
  • Admin UI — desktop layout only; no mobile breakpoints.
  • No native TLS — use a reverse proxy (Nginx, Caddy) to terminate HTTPS.

Metadata

Release files for imnot 1.7.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 imnot 1.7.0
File Size Uploaded Provenance Actions
imnot-1.7.0.tar.gz 3.8 MB With provenance Details for imnot-1.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 3.9 MB

Release files / imnot-1.7.0.tar.gz

Download URL imnot-1.7.0.tar.gz
Size 3.8 MB
Tags Source
SHA-256 checksum
How to use checksums
8573c32517009974c5cec5e926f8e48d4927fb954169601a10a5a12624f40419
BLAKE2b-256 checksum
How to use checksums
d26c5389793e7214d4dbe619b49ae159eb443ce78bc3db7bdced2e75e2c8315e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / imnot-1.7.0-py3-none-any.whl

Download URL imnot-1.7.0-py3-none-any.whl
Size 142.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
077dd117e8ae595a65610407abf4ff83523642e3db2dff31150281ac664644de
BLAKE2b-256 checksum
How to use checksums
95064edf3a5ab0cf8d1890d256687792b3da31481dc0c1faf213bb08aaa8dca9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for imnot 1.7.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for imnot-1.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

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