SWATGenXAutomated U.S. watershed modeling
Programmatic SWAT+ Model Generation
Generate SWAT+ watershed model packages programmatically for USGS gages, HUC12 outlets, and HUC8 basins using the same NHDPlus-HR and national-dataset pipeline behind the web app.
- REST jobs for SWAT+ packages
- HUC12, USGS gage, or HUC8
- Same pipeline as the web app
- Copy-paste Python snippets

What the API does
The SWATGenX API lets you submit watershed model-generation jobs from code instead of the map interface. You can request SWAT+ packages for USGS gages, HUC12 outlet watersheds, or full HUC8 basins, then track the job and download the completed model package.
The API is designed for repeatable watershed modeling workflows: batch requests, research pipelines, evaluation studies, and integration with external notebooks or decision-support tools.
Model-generation entry points
Generate a SWAT+ model for a gage-centered watershed using site_no.
Generate a SWAT+ model from a selected WBD HUC12 outlet watershed.
Generate a whole-basin SWAT+ model for an eight-digit HUC8 watershed. Available on Pro.
Why this API matters
Every request uses the same SWATGenX model-generation pipeline: NHDPlus-HR hydrography, national weather, land cover, soils, crop, terrain, and optional water-use inputs assembled into a downloadable SWAT+ project structure.
Start with a minimal Python request
Choose the watershed type, copy the request, and replace the identifier with your USGS gage, HUC12 outlet, or HUC8 code. Full polling and download examples are available on GitHub.
requests.post bodyimport os
import requests
API_KEY = os.environ["SWATGENX_API_KEY"]
headers = {
"Authorization": f"Bearer {API_KEY}",
"X-SWATGenX-Api-Key": API_KEY,
"Content-Type": "application/json",
}
# 12-digit WBD outlet HUC12 — catalog watershed from Watershed Explorer
payload = {
"outlet_huc12": "070500020602",
"ls_resolution": 250,
"dem_resolution": 30,
}
r = requests.post(
"https://www.swatgenx.com/api/model-settings/explorer-watershed",
headers=headers,
json=payload,
timeout=120,
)
print(r.json())Workflow
Request → build → track → download. Same model-generation engine as the web app — error handling and advanced options are covered in the GitHub examples.
Create an account and generate an API key from your access page.
Send a USGS gage, HUC12 outlet, or HUC8 basin request to the model-generation endpoint.
Poll task and order endpoints while SWATGenX delineates the watershed, assembles model inputs, and builds the SWAT+ package.
When the job completes, download the ZIP package and continue in SWAT+ Editor or your calibration workflow.
Core API routes
These are the main routes for creating, tracking, and downloading SWAT+ model packages. Full request bodies and examples are maintained in the GitHub repository.
Access levels
Programmatic SWAT+ model generation for supported USGS gage and HUC12 outlet workflows within starter limits.
Adds HUC8 whole-basin model generation, higher-volume workflows, and optional cloud calibration support.
GitHub examples & support
Notebooks and scripts show polling, downloads, and tier-aware requests. Review completed SWAT+ examples before submitting jobs. For keys and access updates, use your access page.
Model Creation API examples (Jupyter + Python): GitHub.