Skip to main content

Audit Trail

List Audit Events

GET /governance/audit-trail
ParameterTypeDescription
event_typestringFilter by type (e.g., agent.registered, policy.violated)
target_idstringFilter by target entity ID
fromstringStart date (ISO 8601)
tostringEnd date (ISO 8601)
pageintegerPage number
limitintegerResults per page
curl "https://api.meshai.dev/governance/audit-trail?event_type=policy.violated&limit=50" \
  -H "Authorization: Bearer msh_YOUR_API_KEY"
{
  "success": true,
  "data": [
    {
      "id": "evt_abc123",
      "event_type": "policy.violated",
      "actor": "agt_xyz789",
      "target_id": "pol_def456",
      "target_type": "policy",
      "details": {
        "policy_name": "production-model-allowlist",
        "violation": "Model gpt-3.5-turbo is not in the allowed list"
      },
      "timestamp": "2026-03-17T10:00:00Z"
    }
  ],
  "meta": { "total": 15, "page": 1, "limit": 50 }
}

Export Audit Events

GET /governance/audit-trail/export
ParameterTypeDescription
formatstringcsv or json
fromstringStart date (ISO 8601)
tostringEnd date (ISO 8601)
event_typestringFilter by type
curl "https://api.meshai.dev/governance/audit-trail/export?format=csv&from=2026-01-01" \
  -H "Authorization: Bearer msh_YOUR_API_KEY" \
  -o audit-trail.csv

Risk Classification

Get Classification

GET /agents/{agent_id}/risk-classification
curl https://api.meshai.dev/agents/agt_abc123/risk-classification \
  -H "Authorization: Bearer msh_YOUR_API_KEY"

Classify Agent

POST /agents/{agent_id}/risk-classification
curl -X POST https://api.meshai.dev/agents/agt_abc123/risk-classification \
  -H "Authorization: Bearer msh_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "risk_level": "high",
    "justification": "Agent processes employee performance data"
  }'

Get AI Suggestion

GET /agents/{agent_id}/risk-classification/suggest
curl https://api.meshai.dev/agents/agt_abc123/risk-classification/suggest \
  -H "Authorization: Bearer msh_YOUR_API_KEY"

Policies

List Policies

GET /governance/policies
curl https://api.meshai.dev/governance/policies \
  -H "Authorization: Bearer msh_YOUR_API_KEY"

Create Policy

POST /governance/policies
curl -X POST https://api.meshai.dev/governance/policies \
  -H "Authorization: Bearer msh_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "production-model-allowlist",
    "policy_type": "model_allowlist",
    "config": { "allowed_models": ["gpt-4o", "claude-sonnet-4-20250514"] },
    "scope": "global",
    "enabled": true
  }'
Policy types: model_allowlist, block_provider, require_approval, budget_limit, rate_limit, require_human_review. See Policies for config details.

Get Policy

GET /governance/policies/{policy_id}

Update Policy

PATCH /governance/policies/{policy_id}
curl -X PATCH https://api.meshai.dev/governance/policies/pol_abc123 \
  -H "Authorization: Bearer msh_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "enabled": false }'

Delete Policy

DELETE /governance/policies/{policy_id}
curl -X DELETE https://api.meshai.dev/governance/policies/pol_abc123 \
  -H "Authorization: Bearer msh_YOUR_API_KEY"

Approvals

List Approvals

GET /governance/approvals
ParameterTypeDescription
statusstringpending, approved, denied, expired
agent_idstringFilter by agent
pageintegerPage number
limitintegerResults per page
curl "https://api.meshai.dev/governance/approvals?status=pending" \
  -H "Authorization: Bearer msh_YOUR_API_KEY"

Decide Approval

POST /governance/approvals/{approval_id}/decide
curl -X POST https://api.meshai.dev/governance/approvals/apr_abc123/decide \
  -H "Authorization: Bearer msh_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "decision": "approved",
    "reason": "Agent configuration verified"
  }'
The decision field must be approved or denied.