DEV Community

Alex Spinov
Alex Spinov

Posted on

Postman Has a Free API — Run Collections and Monitor APIs Programmatically

Postman Is Not Just a GUI

Postman has a free API that lets you run collections, manage environments, and monitor APIs programmatically. Your existing Postman collections become automated test suites.

Setup

Get your API key from go.postman.co/settings/me/api-keys.

import requests

API_KEY = "your_postman_api_key"
HEADERS = {"X-Api-Key": API_KEY}
BASE = "https://api.getpostman.com"
Enter fullscreen mode Exit fullscreen mode

List Your Collections

def list_collections():
    r = requests.get(f"{BASE}/collections", headers=HEADERS)
    return [{"name": c["name"], "id": c["uid"]} 
            for c in r.json()["collections"]]

for c in list_collections():
    print(f"{c[name]}{c[id]}")
Enter fullscreen mode Exit fullscreen mode

Get Collection Details

def get_collection(collection_id):
    r = requests.get(f"{BASE}/collections/{collection_id}", headers=HEADERS)
    collection = r.json()["collection"]
    items = collection["item"]

    requests_list = []
    for item in items:
        if "request" in item:
            req = item["request"]
            requests_list.append({
                "name": item["name"],
                "method": req["method"],
                "url": req["url"]["raw"] if isinstance(req["url"], dict) else req["url"]
            })
    return requests_list

reqs = get_collection("your_collection_id")
for r in reqs:
    print(f"{r[method]:6} {r[url][:60]}{r[name]}")
Enter fullscreen mode Exit fullscreen mode

List Environments

def list_environments():
    r = requests.get(f"{BASE}/environments", headers=HEADERS)
    return [{"name": e["name"], "id": e["uid"]} 
            for e in r.json()["environments"]]
Enter fullscreen mode Exit fullscreen mode

Create a Monitor

def create_monitor(name, collection_id, environment_id=None, schedule_cron="0 */6 * * *"):
    data = {
        "monitor": {
            "name": name,
            "collection": collection_id,
            "schedule": {"cron": schedule_cron}
        }
    }
    if environment_id:
        data["monitor"]["environment"] = environment_id

    r = requests.post(f"{BASE}/monitors", headers=HEADERS, json=data)
    return r.json()
Enter fullscreen mode Exit fullscreen mode

Real Use Cases

  1. CI/CD integration — run API tests as part of your pipeline
  2. Uptime monitoring — schedule collection runs every hour
  3. Environment management — sync variables across team
  4. Documentation — auto-generate API docs from collections
  5. Backup — export all collections programmatically

Free Plan Limits

  • 1000 API calls per month
  • 3 shared collections
  • 1000 collection runs per month
  • 10 monitors

Enough for personal projects and small teams.


More API tutorials | GitHub


More from me: 10 Dev Tools I Use Daily | 77 Scrapers on a Schedule | 150+ Free APIs


Need web scraping or data extraction? I've built 77+ production scrapers. Email spinov001@gmail.com — quote in 2 hours. Or try my ready-made Apify actors — no code needed.

Top comments (0)