Skip to navigation

cURL Examples

cURL Examples

Common GovernanceAI API calls using cURL.

Evaluate Guardrails

curl -X POST https://api.governanceai.com/v1/guardrails/evaluate \
-H "Authorization: Bearer $GOVERNANCEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
],
"context": {
"org_id": "org_123",
"user_id": "user_456"
}
}'

Create Guardrail

curl -X POST https://api.governanceai.com/v1/guardrails \
-H "Authorization: Bearer $GOVERNANCEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Block PII",
"rule_type": "block_pii",
"severity": "high"
}'

Run Scan

curl -X POST https://api.governanceai.com/v1/scans \
-H "Authorization: Bearer $GOVERNANCEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"scan_type": "code_scan",
"repositories": ["repo_123"]
}'

Get Audit Logs

curl -H "Authorization: Bearer $GOVERNANCEAI_API_KEY" \
'https://api.governanceai.com/v1/audit/logs?start_date=2024-01-01'

Generate Report

curl -X POST https://api.governanceai.com/v1/reports/generate \
-H "Authorization: Bearer $GOVERNANCEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "compliance",
"frameworks": ["SOC2"],
"format": "pdf"
}' \
--output report.pdf

Tips

  • Use -H for headers
  • Use -d for JSON body
  • Set Content-Type: application/json
  • Always include Authorization header
  • Use $GOVERNANCEAI_API_KEY environment variable
  • Use --output to save response to file

Next Steps