How to Import & Export Postman Collection Data: 3 Methods (2026)
Three reliable ways to manage, share, and back up your Postman collections
Start Building with Hypereal
Access Kling, Flux, Sora, Veo & more through a single API. Free credits to start, scale to millions.
No credit card required • 100k+ developers • Enterprise ready
How to Import & Export Postman Collection Data: 3 Methods (2026)
Postman collections are one of the most common ways to organize, document, and share API requests. Whether you are moving collections between teams, creating backups, migrating to a new workspace, or sharing API examples with developers, knowing how to reliably import and export collection data is essential.
This guide covers three methods: the Postman app GUI, the Postman CLI (Newman), and the Postman API. Each method has different strengths, and we will cover when to use which.
Quick Comparison
| Method 1: Postman App | Method 2: Newman CLI | Method 3: Postman API | |
|---|---|---|---|
| Best for | Manual sharing, one-off exports | CI/CD pipelines, automation | Programmatic access, backups |
| Format | JSON (v2.1) | JSON (v2.1) | JSON (v2.1) |
| Bulk operations | Limited | Good with scripts | Excellent |
| Automation | No | Yes | Yes |
| Requires login | Yes | No (for local files) | Yes (API key) |
Method 1: Using the Postman App (GUI)
This is the most straightforward method and works well for manual, one-off exports and imports.
Exporting a Collection
- Open Postman and navigate to your workspace
- Find the collection in the left sidebar
- Click the three-dot menu (...) next to the collection name
- Select Export
- Choose the format:
- Collection v2.1 (recommended): The current standard format
- Collection v2.0: Legacy format for older tools
- Click Export and choose a save location
The exported file will be a JSON file like this:
{
"info": {
"_postman_id": "abc123-def456",
"name": "My API Collection",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Get Users",
"request": {
"method": "GET",
"header": [
{
"key": "X-API-Key",
"value": "{{api_key}}"
}
],
"url": {
"raw": "{{base_url}}/api/v1/users",
"host": ["{{base_url}}"],
"path": ["api", "v1", "users"]
}
}
}
]
}
Exporting an Environment
Environments contain variables like API keys, base URLs, and tokens. Export them separately:
- Click the Environments tab in the sidebar
- Click the three-dot menu next to the environment
- Select Export
- Save the JSON file
An exported environment looks like this:
{
"id": "env-123",
"name": "Production",
"values": [
{
"key": "base_url",
"value": "https://api.example.com",
"type": "default",
"enabled": true
},
{
"key": "api_key",
"value": "sk_live_abc123",
"type": "secret",
"enabled": true
}
]
}
Security warning: Exported environment files include secret values in plaintext. Never commit these files to version control without removing sensitive values first.
Importing a Collection
- Click the Import button in the top-left of Postman
- Choose your import source:
- File: Upload a JSON file from your computer
- Folder: Import all collection files from a directory
- Link: Paste a URL to a hosted collection JSON
- Raw text: Paste JSON directly
- Code repository: Import from GitHub, GitLab, or Bitbucket
- Review the import preview
- Click Import
Postman supports importing from multiple formats:
| Format | Support |
|---|---|
| Postman Collection v2.1 | Full |
| Postman Collection v2.0 | Full |
| OpenAPI 3.x (Swagger) | Full |
| OpenAPI 2.0 (Swagger) | Full |
| GraphQL | Full |
| cURL commands | Full |
| RAML | Partial |
| HAR | Full |
| WSDL | Partial |
Importing from a URL
This is useful for sharing collections via a public link:
- Click Import > Link
- Paste the URL, for example:
https://raw.githubusercontent.com/your-org/api-docs/main/collection.json - Postman will fetch and import the collection
Method 2: Using Newman (CLI)
Newman is Postman's command-line collection runner. It is particularly useful for CI/CD pipelines and automated testing, but it also works well for managing collection files.
Install Newman
npm install -g newman
Run a Collection from a File
newman run my-collection.json -e production-environment.json
Run a Collection from a URL
newman run https://api.example.com/docs/collection.json
Export Run Results
Newman can export test results in multiple formats:
# JSON report
newman run collection.json -r json --reporter-json-export results.json
# HTML report
npm install -g newman-reporter-html
newman run collection.json -r html --reporter-html-export report.html
# JUnit XML (for CI/CD)
newman run collection.json -r junit --reporter-junit-export results.xml
Using Newman in CI/CD
Here is a GitHub Actions example that imports a collection and runs tests:
# .github/workflows/api-tests.yml
name: API Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Newman
run: npm install -g newman
- name: Run API tests
run: |
newman run ./postman/collection.json \
-e ./postman/test-environment.json \
--reporters cli,junit \
--reporter-junit-export results.xml
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: api-test-results
path: results.xml
Converting Between Formats
You can use Newman with additional tools to convert collections:
# Convert OpenAPI spec to Postman collection
npm install -g openapi-to-postmanv2
# Convert an OpenAPI 3.0 spec to a Postman collection
openapi2postmanv2 -s openapi.yaml -o collection.json -p
Method 3: Using the Postman API
The Postman API gives you programmatic access to all your collections, environments, and workspaces. This is the best method for automated backups and bulk operations.
Get Your Postman API Key
- Go to web.postman.co/settings/me/api-keys
- Click Generate API Key
- Name your key and copy it
List All Collections
curl -s "https://api.getpostman.com/collections" \
-H "X-Api-Key: PMAK-your-postman-api-key" | python3 -m json.tool
Response:
{
"collections": [
{
"id": "abc123-def456",
"name": "My API Collection",
"uid": "12345678-abc123-def456"
},
{
"id": "ghi789-jkl012",
"name": "Payment API",
"uid": "12345678-ghi789-jkl012"
}
]
}
Export a Single Collection
curl -s "https://api.getpostman.com/collections/COLLECTION_UID" \
-H "X-Api-Key: PMAK-your-postman-api-key" \
-o my-collection.json
Import (Create) a Collection
curl -X POST "https://api.getpostman.com/collections" \
-H "X-Api-Key: PMAK-your-postman-api-key" \
-H "Content-Type: application/json" \
-d @collection-file.json
Bulk Export Script (Python)
Here is a Python script that backs up all your collections:
import requests
import json
import os
from datetime import datetime
POSTMAN_API_KEY = os.environ["POSTMAN_API_KEY"]
BACKUP_DIR = f"postman-backup-{datetime.now().strftime('%Y%m%d')}"
BASE_URL = "https://api.getpostman.com"
headers = {"X-Api-Key": POSTMAN_API_KEY}
os.makedirs(BACKUP_DIR, exist_ok=True)
# Get all collections
response = requests.get(f"{BASE_URL}/collections", headers=headers)
collections = response.json()["collections"]
print(f"Found {len(collections)} collections")
for collection in collections:
uid = collection["uid"]
name = collection["name"]
# Fetch full collection data
detail = requests.get(f"{BASE_URL}/collections/{uid}", headers=headers)
# Save to file
safe_name = name.replace("/", "-").replace(" ", "_")
filepath = os.path.join(BACKUP_DIR, f"{safe_name}.json")
with open(filepath, "w") as f:
json.dump(detail.json(), f, indent=2)
print(f"Exported: {name} -> {filepath}")
# Also export environments
response = requests.get(f"{BASE_URL}/environments", headers=headers)
environments = response.json()["environments"]
for env in environments:
uid = env["uid"]
name = env["name"]
detail = requests.get(f"{BASE_URL}/environments/{uid}", headers=headers)
safe_name = name.replace("/", "-").replace(" ", "_")
filepath = os.path.join(BACKUP_DIR, f"env_{safe_name}.json")
with open(filepath, "w") as f:
json.dump(detail.json(), f, indent=2)
print(f"Exported environment: {name} -> {filepath}")
print(f"\nBackup complete. {len(collections)} collections and {len(environments)} environments saved to {BACKUP_DIR}/")
Schedule Automatic Backups
Add the backup script to a cron job or CI/CD schedule:
# Run daily at 2 AM
0 2 * * * cd /path/to/backup && python3 backup_postman.py
Handling Common Issues
Import Fails with "Invalid Format"
This usually means the JSON structure does not match the expected schema. Verify:
# Check if the file is valid JSON
python3 -m json.tool < collection.json > /dev/null
# Check the schema version
python3 -c "
import json
with open('collection.json') as f:
data = json.load(f)
if 'info' in data:
print('Schema:', data['info'].get('schema', 'Not found'))
elif 'collection' in data:
print('Schema:', data['collection']['info'].get('schema', 'Not found'))
"
Variables Not Resolving After Import
Make sure you import both the collection and the corresponding environment. Variables like {{base_url}} require an active environment.
Large Collections Timeout on Export
For very large collections (100+ requests), the Postman API may time out. Break the export into smaller chunks or use the app GUI for the initial export.
Conclusion
All three methods serve different needs: use the Postman app for quick manual operations, Newman CLI for CI/CD integration and testing, and the Postman API for automated backups and programmatic management. For most teams, combining Method 1 for day-to-day work with Method 3 for automated backups provides the best coverage.
If you are building and testing APIs that involve AI-powered media generation, Hypereal AI provides well-documented API endpoints that you can easily import into Postman. The API follows standard REST conventions with X-API-Key authentication, making it straightforward to add to your existing API testing workflow.
Related Articles
Start Building Today
Get 35 free credits on signup. No credit card required. Generate your first image in under 5 minutes.
