Postman Setup Guide
This guide helps you import and use the GitHub Backup API collection and environment in Postman.
Prerequisites
- Postman installed (download from postman.com)
- GitHub Backup backend service running on your machine or server
- Default configuration:
http://localhost:8080
Quick Start
1. Import the Collection
- Open Postman
- Click on the Import button (top-left)
- Select Upload Files
- Choose
docs/postman/GitHub-Backup-API.postman_collection.json - Click Import
The collection will appear in your sidebar with all API endpoints organized by category.
2. Import the Environment
- Click the Settings icon in the top-right corner
- Navigate to Environments
- Click Import
- Select
docs/postman/GitHub-Backup-Environment.postman_environment.json - Close the settings panel
3. Select Environment
- In the top-right corner, find the environment dropdown (currently showing "No environment")
- Select "GitHub Backup API - Local Development"
4. Set Your Credentials
Every /api route acts for one account and needs credentials (API_REQUIRE_AUTH defaults to true). The collection's pre-request script sends, from the environment:
api_token: a personal access token (ghb_pat_…) you create in the dashboard under Settings → Tokens, sent asAuthorization: Bearer. Recommended: it reads your own account's data.- Otherwise
internal_secret: the API'sINTERNAL_SECRET, sent asX-Internal-Secrettogether withX-Account-Id: {{account_id}}(default1, the deployment owner). WithoutX-Account-Idthe API answers400 ACCOUNT_REQUIRED.
Both are secret variables, so Postman masks them. Without either, every request returns 401 UNAUTHORIZED. /health and /ready never need them.
You're now ready to make API calls!
Making Your First Request
Example: Get Latest Backup
- In the Backups folder, click on "Get Latest Backup"
- Click the blue Send button
- You should see the response in the bottom panel
If you get a connection error, verify:
- The backend service is running on port 8080
- Update
base_urlin the environment if running on a different port
If you get 401 UNAUTHORIZED, set api_token or internal_secret (step 4).
Configuration
Updating the Environment
To use a different backend URL:
- Click the environment dropdown in the top-right
- Select "GitHub Backup API - Local Development" → Edit
- Update the values:
base_url: HTTP API endpoint (e.g.,api.example.com:8080)base_url_ws: WebSocket endpoint (e.g.,api.example.com:8080)api_token: a personal access token of that deployment (orinternal_secret: itsINTERNAL_SECRET)
- Save the changes
Creating Environments for Different Deployments
You can create separate environments for development, staging, and production:
- Click the environment dropdown → + Create New
- Name it (e.g., "GitHub Backup API - Production")
- Add variables:
base_url: Your production API endpointbase_url_ws: Your production WebSocket endpointapi_token: a personal access token of yours on production, as a secret variable
- Save
Now you can easily switch between environments using the dropdown.
API Endpoints Overview
Backups
- List Backup Runs — Paginated list with filtering
- Get Latest Backup — Most recent backup
- Get Backup Run Details — Full run data including results
Dashboard & Metrics
- Get Dashboard Statistics — Aggregated metrics and stats
- Get Metrics — Time-series data for specified period
Analytics
- List Analytics History — All analytics snapshots
- Get Latest Analytics — Most recent snapshot
- Get Analytics for Specific Run — Analytics for a run ID
Repositories
- Get Tracked Repositories — List of tracked repos
Logs
- Get Execution Logs — Filtered execution logs
The collection has no WebSocket or SSE request; see Live Logs for connecting by hand.
Advanced Usage
Scripting Tests
Each request includes built-in test scripts that validate the response. To view:
- Open any request
- Click the Tests tab
- The tests check for:
- Correct HTTP status codes
- Required response fields
- Data structure integrity
Run all tests in a collection:
- Click the → (Run) button next to the collection name
- Click Run GitHub Backup API
- The test runner shows results for all requests
Using Variables
You can create custom variables for common values:
- Open the environment editor
- Add a new variable (e.g.,
run_id: "1") - In requests, reference it with
{{run_id}}
Example:
GET /api/backups/{{run_id}}
Building a Workflow
Chain multiple requests using pre-request and test scripts:
Example: Get latest backup, then fetch its details
- In the "Get Latest Backup" test script, add:
var run = pm.response.json().run; // null before the first run
if (run) { pm.environment.set("latest_run_id", run.id); }
- In the "Get Backup Run Details" URL, use:
{{base_url}}/api/backups/{{latest_run_id}}
Live Logs
The collection does not include a live stream request. Two endpoints stream new execution_logs rows; both take the same credentials as the other data routes (a personal access token, as below, or the dashboard session):
- SSE
GET {{base_url}}/api/logs/streamwithAuthorization: Bearer {{api_token}}(the dashboard reads it through its proxy). Each event isevent: logwith a row of your account as JSON indata. - WebSocket
ws://{{base_url_ws}}/ws/livewithAuthorization: Bearer {{api_token}}, for example as a Postman WebSocket request you create by hand. Browsers cannot send that header, so they use the SSE endpoint.
Both send one message per log row:
{
"type": "log",
"id": 1042,
"level": "info",
"message": "Backed up octocat/Hello-World",
"repository": "octocat/Hello-World",
"timestamp": "2026-09-24T10:30:00Z"
}
Troubleshooting
"Unable to connect" Error
Solution: Verify the backend is running:
# From the repository root
go run ./src/backend/github-backup-api/cmd/github-backup-api
Check the configured port matches your environment's base_url.
"Rate limit exceeded" (429 Response)
The API enforces rate limiting. If you receive 429 errors:
- Wait before retrying
- Reduce request frequency
- Implement exponential backoff
WebSocket connection fails
- Ensure
base_url_wsmatches the backend's WebSocket endpoint - Keep
base_url_wsa bare host and port (localhost:8080); the request above adds thews://scheme - Verify the backend accepts WebSocket upgrades on that port
Missing Response Data
If responses are incomplete:
- Verify your PostgreSQL connection in the backend
- Check backend logs for database errors
- Ensure migrations have run successfully
API Response Examples
Successful Backup Run
{
"id": 42,
"started_at": "2024-06-17T10:30:00Z",
"completed_at": "2024-06-17T10:45:30Z",
"status": "completed",
"duration_ms": 870000,
"total_repos": 45,
"successful": 42,
"failed": 2,
"skipped": 1,
"error_message": ""
}
Dashboard Statistics
{
"total_runs": 150,
"total_repos": 1250,
"success_rate": 94.4,
"avg_duration_ms": 900000,
"total_size_bytes": 536870912
}
Documentation
For detailed API documentation, see:
- API_REFERENCE.md — Full endpoint documentation
- ARCHITECTURE.md — System architecture overview
- ../README.md — Project overview
Support
For issues or questions:
- Check the Troubleshooting section
- Review API_REFERENCE.md for endpoint details
- Check backend logs for errors
Tips
- Use Collections to organize related requests
- Save Responses for reference and testing
- Use Variables to avoid hardcoding values
- Write Tests to validate responses
- Use Environments to switch between deployments
- Monitor Live Logs using WebSocket for real-time insights