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.

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.


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
  • 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.
  • Single-node — SQLite session store is not shared across instances.
  • 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.6.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.6.0
File Size Uploaded Provenance Actions
imnot-1.6.0.tar.gz 3.7 MB With provenance Details for imnot-1.6.0.tar.gz

Built distribution (wheel)

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

Total release size: 3.9 MB

Release files / imnot-1.6.0.tar.gz

Download URL imnot-1.6.0.tar.gz
Size 3.7 MB
Tags Source
SHA-256 checksum
How to use checksums
2ea1b7a690fee888f83ea5ca345c206644133b4848bf3e084dfa31b11fda5d96
BLAKE2b-256 checksum
How to use checksums
b93b925748d72232181b3edcb030083c2952ae0dea646a1736cb513e35ee7dcb
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 18, 2026.

Transparency log

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

Download URL imnot-1.6.0-py3-none-any.whl
Size 134.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a53156e989c8a5af35badf023cb3bcc1e4c98ed1f860aa634084382f51692bee
BLAKE2b-256 checksum
How to use checksums
9c925605c5bdf3d3fa902672184d37404ee09531fc45b192dbd686982870b74e
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 18, 2026.

Transparency log

Security for imnot 1.6.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.6.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 18, 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