> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.governanceaicore.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.governanceaicore.com/_mcp/server.

# cURL Examples

> API examples using cURL command-line tool

# cURL Examples

Common GovernanceAI API calls using cURL.

## Evaluate Guardrails

```bash
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

```bash
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

```bash
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

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

## Generate Report

```bash
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

* **[Python Examples](/code-examples/python)** - Python code
* **[Node.js Examples](/code-examples/node-js)** - JavaScript code
* **[API Patterns](/code-examples/api-patterns)** - Common patterns