SWATGenX Developer API
Generate SWAT+ watershed models programmatically by USGS station or HUC8.
The SWATGenX Model Creation API lets researchers, agencies, and technical teams submit SWAT+ model-generation requests through HTTP using a USGS streamgage ID or HUC8 watershed code. SWATGenX handles watershed delineation, national data preparation, model construction, queueing, and delivery of the completed model package.
Create from code
Submit a USGS station ID or HUC8 watershed code, track the model-generation task, and download the completed SWAT+ workspace when the run finishes.
Submit a station ID and generate a station-centered SWAT+ watershed model.
Generate whole-basin SWAT+ models for HUC8 watersheds. HUC8 creation requires Pro access.
Check order status, monitor task progress, and download completed model ZIP files through secure token links.
Workflow
Create an account and generate an API key from the Subscription page.
Use Python, Jupyter, curl, or any HTTP client.
Poll task status and model-order endpoints while SWATGenX builds the model.
Use the completion email or dashboard token link to download the completed SWAT+ workspace.
Example request
Minimal requests call to queue a station model (see the public repo for polling, HUC8, and downloads).
import 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",
}
payload = {
"site_no": "05580950",
"ls_resolution": 250,
"dem_resolution": 30,
}
r = requests.post(
"https://www.swatgenx.com/api/model-settings",
headers=headers,
json=payload,
timeout=120,
)
print(r.json())What the API exposes
Full authentication, tier rules, and request bodies are documented in the GitHub repo — this table is a quick map only.
Access levels
Suitable for testing station-based model creation. Includes limited daily model orders and watershed-size limits.
Designed for repeated technical use, HUC8 model creation, larger quotas, and advanced modeling workflows.
Start with the public examples
Use the Jupyter notebook or Python scripts to submit your first model request, inspect task status, and download the completed SWAT+ package.
Model Creation API examples (Jupyter + Python): GitHub.