Loading SDK samples
Ready-to-use code for common API workflows. Every sample is available in cURL, Node.js, and Python. Copy, paste, and customize for your integration.
Start a governance scan on a repository and poll until it completes.
# Trigger the scan
SCAN=$(curl -s -X POST https://api.govnu.dev/v1/scans \
-H "Authorization: Bearer $GOVNU_API_KEY" \
-H "Content-Type: application/json" \
-d '{"repositoryId": "repo_abc123", "branch": "main"}')
SCAN_ID=$(echo $SCAN | jq -r '.id')
# Poll until complete
while true; do
STATUS=$(curl -s https://api.govnu.dev/v1/scans/$SCAN_ID \
-H "Authorization: Bearer $GOVNU_API_KEY" | jq -r '.status')
echo "Status: $STATUS"
[ "$STATUS" = "completed" ] || [ "$STATUS" = "failed" ] && break
sleep 5
done
# Fetch violations
curl -s https://api.govnu.dev/v1/scans/$SCAN_ID/violations \
-H "Authorization: Bearer $GOVNU_API_KEY" | jq .Retrieve completed scans and aggregate violations by severity.
# List completed scans
curl -s "https://api.govnu.dev/v1/scans?status=completed&pageSize=10" \
-H "Authorization: Bearer $GOVNU_API_KEY" | jq '.data[] | {id, score, totalViolations}'Set up a webhook to receive real-time notifications when scans finish.
# Register webhook
curl -s -X POST https://api.govnu.dev/v1/webhooks \
-H "Authorization: Bearer $GOVNU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/hooks/govnu",
"events": ["scan.completed", "scan.failed"]
}' | jq .
# Save the "secret" field — you need it to verify payloadsSend a code-generation task to an external agent and wait for results.
# Dispatch the task
TASK=$(curl -s -X POST https://api.govnu.dev/v1/agents/dispatch \
-H "Authorization: Bearer $GOVNU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sessionId": "AQ12",
"planId": "plan-uuid-here",
"orgId": "org-uuid-here",
"adapterType": "devin",
"requirements": "Create a settings page for agent integrations",
"blastRadius": ["src/app/settings/agent-integrations/"]
}')
TASK_ID=$(echo $TASK | jq -r '.data.taskId')
# Poll until terminal state
while true; do
RESULT=$(curl -s https://api.govnu.dev/v1/agents/tasks/$TASK_ID \
-H "Authorization: Bearer $GOVNU_API_KEY")
STATUS=$(echo $RESULT | jq -r '.data.status')
echo "Status: $STATUS"
case $STATUS in completed|failed|cancelled|timed_out) break;; esac
sleep 10
doneSubmit a code snippet for governance validation. Available on all tiers.
curl -s -X POST https://api.govnu.dev/v1/governance/validate \
-H "Authorization: Bearer $GOVNU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "console.log(\"hello\");\nconst x = 1;",
"filePath": "src/lib/utils.ts",
"language": "typescript"
}' | jq '.data.summary'https://api.govnu.dev/v1Authorization: Bearer <API_KEY>application/json