Postman collections, generated from your Django, Flask & FastAPI code.
routeman reads the routes, serializers and models your Python API already has, then writes a complete Postman collection: request bodies, authentication, environments and a login request that saves the token. One command. No OpenAPI schema.
$ pip install routeman
$ routeman generate
✓ django: 10 requests (4 POST, 3 GET, 1 PUT, 1 PATCH, 1 DELETE)
✓ auth: bearer (login: POST /api/v1/auth/token/)
✓ wrote postman/shop-api.postman_collection.json
✓ wrote postman/shop-api.local.postman_environment.json
done in 0.26s - import the files in Postman (File → Import)
$ routeman routes | head -4
GET /api/v1/ 🔒
POST /api/v1/auth/token/ json: username, password
POST /api/v1/auth/token/refresh/ json: refresh
GET /api/v1/products/ 🔒
- Auth
- POSTToken obtain pair saves token
- POSTToken refresh
- Shop
- GETList products ?page&search
- POSTCreate product form-data
- GETGet product
- PUTUpdate product
- PATCHPartially update product
- DELDelete product
- POSTPublish
01 How it works
From codebase to collection in under a minute.
No annotations, no spec to maintain, no documentation library. routeman runs in the virtualenv your project already uses and loads the app the way your server does.
Install
Add routeman to your project's virtualenv. It has no dependencies, apart from tomli on Python < 3.11.
$ pip install routeman
Generate
The framework, app, auth scheme and login route are detected automatically, and .env is loaded for you.
$ cd your-project
$ routeman generate
Import & send
In Postman, choose File → Import, drop both files, select the environment and send Login.
postman/
├─ shop-api.postman_collection.json
└─ shop-api.local.postman_environment.json
02 The output
A collection you can actually send requests with.
Most generated collections are a list of URLs. routeman fills in everything you would otherwise type by hand, so the first Send works.
Every route, organised
One folder per Django app, Flask blueprint or FastAPI tag, with sub-folders per resource. Admin and static routes are left out.
Bodies that pass validation
JSON, form-urlencoded or multipart with file pickers. Example values respect choices, ranges, lengths, patterns and field names, so an email field gets user@example.com.
Auth detected, login automated
Bearer/JWT, DRF Token, Knox, Basic, API key or session. The login request stores access_token and refresh_token for every other request.
Path & query parameters
{{product_id}}-style variables typed from your models, plus pagination, search, ordering and filters. Optional parameters are added but switched off.
Smoke tests built in
Every request asserts the response is not a 5xx, so the Collection Runner or Newman can check your whole API in CI.
Environments per server
One file each for local, staging and production, with tokens and passwords marked as secrets.
Docs inside every request
The view's docstring and a field table (type, required, allowed values) appear in each request's description.
Stable ids, clean re-imports
Regenerate whenever the API changes. Ids don't change, so re-importing replaces the collection instead of duplicating it.
Read-only and offline
routeman never touches your database, never sends requests and never uploads your code. It writes two JSON files.
03 Under the hood
It reads your code, not a schema.
routeman works from what your code already declares. When a view declares nothing, it reads the view's source, for example request.data.get('email'), and marks the request as inferred.
| Framework | Routes from | Bodies & parameters from |
|---|---|---|
| Django REST framework | URLconf: routers, ViewSets, @action, APIViews, @api_view | Serializers (nested, many=True, relations, choices, files), pagination, SearchFilter, OrderingFilter, django-filter, permission and authentication classes |
| Django | URLconf: path, re_path, include, CBVs and FBVs | form_class, ModelForms, require_http_methods, request.POST/GET/FILES, json.loads(request.body) |
| Flask | app.url_map: blueprints, MethodView, Flask-RESTful | request.json, get_json(), form, args, files, marshmallow, flask-smorest, Pydantic, @jwt_required, @login_required, Flask-HTTPAuth |
| FastAPI | FastAPI's built-in OpenAPI plus include_in_schema=False routes | Pydantic models, Query, Form, File, Header, Depends() security (OAuth2, HTTP Bearer, API key) |
04 Why routeman
Compared with the usual ways.
Hand-written requests drift from the code. An OpenAPI import needs a working schema setup first. routeman starts from the code you already have. Read the full comparison →
| routeman | OpenAPI → Postman import | Hand-written | |
|---|---|---|---|
| Needs a schema library (drf-spectacular, flasgger…) | No | Yes, for Django/Flask | No |
| Bodies from serializers / forms / view code | Yes | Only what the schema declares | Typed by hand |
| Login request that stores the token | Yes | No | Written by hand |
| Environments per server | Yes | Partly (from servers) | By hand |
| Smoke test on every request | Yes | No | By hand |
| Stays in sync with code | Re-run one command | Re-export and re-import | Manual upkeep |
05 Who it's for
Built for teams that ship Python APIs.
One generated collection serves everyone who touches the API, from the engineer who wrote the view to the pipeline that deploys it.
Backend engineers
Ship a complete, working collection with every pull request instead of a list of URLs in a chat message.
Frontend & mobile
Get example bodies, auth and environment switching without reading Django or Flask code.
QA & testers
Start exploratory and regression testing straight away, then build on the generated tests.
DevOps & CI
Generate in the pipeline and run with Newman as a 5xx smoke test after every deploy.
06 Journal
Guides from the blog.
Practical walkthroughs for DRF, Django, FastAPI and Flask, plus Postman auth and Newman in CI. All articles →
How to generate a Postman collection from Django REST framework
Step-by-step: turn a Django REST framework API into a ready-to-use Postman collection with bodies, JWT login and environments, without drf-spectacular or drf-yasg.
FastAPI to Postman: better than importing openapi.json
Importing /openapi.json gives you URLs. Here's how to generate a FastAPI Postman collection with a working OAuth2 login, saved tokens, valid Pydantic examples and environments.
Flask API to Postman collection without Swagger
Create a Postman collection from a Flask app with blueprints and flask-jwt-extended, without flasgger, apispec or YAML docstrings. Real output included.
Export every Django URL to Postman, including forms and CSRF
How to turn a plain Django project (function views, class-based views, ModelForms, JsonResponse) into a Postman collection, and make CSRF work in Postman.
How do I generate a Postman collection from a Django, Flask or FastAPI project?
Install routeman in the virtualenv your project runs in and run one command from the project folder: pip install routeman then routeman generate. It writes postman/<name>.postman_collection.json and a local environment file. Import both in Postman with File → Import.
Do I need OpenAPI, Swagger, drf-spectacular or drf-yasg?
No. routeman reads your application's real routes and its serializers, forms and models directly. You don't need an OpenAPI schema or any documentation library. For FastAPI it uses the OpenAPI document that FastAPI already builds in memory, and it also picks up routes hidden with include_in_schema=False.
Is routeman free?
Yes. routeman is open source under the MIT licence and free for personal and commercial use. It is published on PyPI as routeman.
Does routeman send requests to my API or touch my database?
No. routeman imports your app to read its URL configuration, the same way manage.py or your WSGI/ASGI server does. It never runs queries, migrations or HTTP requests. The output is two JSON files on disk.
Which frameworks and versions are supported?
Django 3.2 to 6, Django REST framework 3.12+, Flask 2.0 to 3.x (including blueprints, MethodView, Flask-RESTful and flask-smorest) and FastAPI 0.95+ with Pydantic v1 or v2. routeman itself needs Python 3.9 or newer.
How does routeman handle authentication like JWT or DRF tokens?
It detects the scheme from your code: Bearer/JWT (SimpleJWT, flask-jwt-extended, OAuth2 in FastAPI), DRF Token and Knox, Basic, API key headers and session auth. It sets collection-level auth, marks public endpoints as No Auth and adds a test script to the login request that saves access_token and refresh_token into the environment automatically.
Stop writing Postman requests by hand.
Install routeman, run one command, import the result. Your whole API is ready to send requests within a minute.