An Automatic1111 Stable Diffusion WebUI extension that tracks all image generations made through the API by assigning unique 8-character alphanumeric IDs to each job.
Auto-cleanup: Jobs and images are automatically purged every 6 hours based on your retention settings.
- Job Tracking: Automatically assigns unique IDs to API requests (
/sdapi/v1/txt2imgand/sdapi/v1/img2img) - Connection Loss Recovery: Job ID is sent via HTTP header
X-Job-IDbefore generation starts, allowing image recovery even if connection is interrupted - Job Retrieval: Retrieve images later using the job ID via
/sdapi/v1/job/{id} - Auto-cleanup: Configurable retention period (30/7/3/1 days or off) with automatic purge every 6 hours
- Secure: Uses A1111's native API authentication (
--api-auth)
-
Navigate to your A1111 extensions folder:
cd stable-diffusion-webui/extensions -
Clone or copy this extension:
git clone https://github.com/FEUAZUR/API-Job-Tracker-SD-WebUI/ -
Restart A1111
- Go to the "Job Tracker" tab in A1111
- Check "Enable Tracking"
- Configure retention period if desired
This extension uses A1111's native API authentication. Configure it when launching A1111:
python launch.py --api --api-auth username:password
You can configure the Job Tracker via environment variables (useful for headless/API-only mode):
| Variable | Values | Description |
|---|---|---|
TRACKER_ENABLED |
1, true, yes, on |
Enable job tracking on startup |
TRACKER_RETENTION |
Any number (e.g., 7, 30, 365, 0 for unlimited) | Set retention period in days |
Examples:
# Linux/Mac - webui-user.sh
export TRACKER_ENABLED=1
export TRACKER_RETENTION=30
# Windows - webui-user.bat
set TRACKER_ENABLED=1
set TRACKER_RETENTION=30
# Docker/RunPod
TRACKER_ENABLED=1 TRACKER_RETENTION=30 python launch.py...Priority: Environment variables override config.json settings.
When tracking is enabled, all API requests to /sdapi/v1/txt2img and /sdapi/v1/img2img will:
- Receive a
X-Job-IDheader in the response immediately - Be logged in the tracking table
- Have their images stored with the job ID
Get a specific job:
GET /sdapi/v1/job/{job_id}
Response:
{
"id": "A3f9K2xY",
"prompt": "beautiful landscape...",
"status": "Completed",
"timestamp": 1736712000,
"images": [
"base64_encoded_png_1...",
"base64_encoded_png_2...",
"base64_encoded_png_3..."
]
}Note: The images array contains all images generated in a single batch (e.g., if batch_size=4, you'll get 4 images).
List jobs:
GET /sdapi/v1/jobs?ip=192.168.1.100&status=completed&limit=50
If your connection is interrupted during generation:
- The
X-Job-IDheader is sent BEFORE generation starts - Your client should capture this header immediately
- Use
GET /sdapi/v1/job/{id}to retrieve the image once generation completes
- Enable Tracking: Toggle API request tracking
- Retention: Auto-delete jobs older than 30/7/3/1 days (or Off) - automatic cleanup runs every 6 hours
- Purge Now: Manually trigger cleanup based on retention setting
config.json: Extension settingsjobs.json: Job metadata storageoutput: Tracked images storage (Native folder)
| Endpoint | Method | Description |
|---|---|---|
/sdapi/v1/job/{id} |
GET | Get job details and image by ID |
/sdapi/v1/jobs |
GET | List jobs with optional filters |
ip: Filter by client IPstatus: Filter by status (Pending, Processing, Completed, Failed)after: Filter jobs after timestamplimit: Maximum number of results (default: 50)
Pending: Job created, waiting to processProcessing: Image generation in progressCompleted: Image generated successfullyFailed: Generation failed
All tracked API requests include:
X-Job-ID: A3f9K2xY
- All endpoints require API authentication when configured via
--api-auth - Job IDs are 8 characters (A-Z, a-z, 0-9) with collision detection
- Jobs are only accessible with valid API credentials
- Automatic1111 Stable Diffusion WebUI
- Python 3.8+
- No external dependencies (uses Python standard library)