Get PatchWork running in three steps:
POST call to your error handler. That's it.POST https://api.patchwork.dev/ingest
Send error data from your application to PatchWork. Requires an API key passed in the x-api-key header.
| Field | Type | Required | Description |
|---|---|---|---|
error | string | Yes | The error message |
stack | string | Yes | Full stack trace |
env | string | No | Environment name (e.g. production) |
user | string | No | Anonymised user identifier |
route | string | No | Request path or route name |
meta | object | No | Arbitrary key-value metadata |
// In your existing error handler
app.use(async (err, req, res, next) => {
await fetch("https://api.patchwork.dev/ingest", {
method: "POST",
headers: { "x-api-key": process.env.PATCHWORK_KEY },
body: JSON.stringify({
error: err.message,
stack: err.stack,
env: process.env.NODE_ENV,
user: req.user?.id,
route: req.path,
})
});
res.status(500).json({ error: "Something went wrong" });
});
import requests, traceback
class PatchWorkMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
try:
return self.get_response(request)
except Exception as e:
requests.post(
"https://api.patchwork.dev/ingest",
headers={"x-api-key": settings.PATCHWORK_KEY},
json={
"error": str(e),
"stack": traceback.format_exc(),
"env": settings.ENVIRONMENT,
"route": request.path,
}
)
raise
| Status | Body | Meaning |
|---|---|---|
202 | {"accepted": true} | Error queued for processing |
401 | {"error": "Invalid API key"} | Missing or invalid x-api-key |
422 | {"error": "Missing field: error"} | Required field not provided |
429 | {"error": "Rate limit exceeded"} | Too many requests — back off and retry |
Once connected, PatchWork posts structured error alerts to your chosen channel. Each alert includes the error type, file location, occurrence count, and affected users.
Click Analyse with AI on any alert to trigger a root-cause analysis. PatchWork will respond in-thread with the likely cause and a suggested fix.
Click Push fix to GitHub to create a pull request with the suggested changes. The PR is created on a new branch and assigned to your team for review.
PatchWork uses the GitHub App model. Install it on the repositories you want to receive fixes for. The app requests only the permissions it needs:
The ingestion endpoint is rate-limited per API key:
If you exceed the limit, you'll receive a 429 response. Implement exponential backoff in your error handler to handle this gracefully.
Need help? Reach us at support@patchwork.dev. Team plan users get priority response within 4 hours.