API Reference

API Endpoints

Complete reference for the Tork Governance REST API.

Base URL

All API requests are made to the following base URL:

text
https://api.tork.network/v1

RESTful

Standard REST conventions

Authenticated

API key required

Rate Limited

1000 req/min default

Authentication

Include your API key in the Authorization header:

bash
curl -X GET "https://api.tork.network/v1/agents" \
  -H "Authorization: Bearer tork_sk_your_api_key" \
  -H "Content-Type: application/json"

Governance

Scan and redact PII from AI agent content in real-time.

POST/governScan content for PII

Request Body

ParameterTypeRequiredDescription
contentstringYesThe text content to scan for PII (max 100KB)
options.modestringNoAction mode: "detect", "redact" (default), or "deny"
regionstring[]NoRegional PII profiles to activate (e.g. ["AU", "AE"])
industrystringNoIndustry profile to activate (e.g. "healthcare", "finance", "legal")

Available Regions: AU, AE, BR, CN, DE, FR, GB, IN, JP, KR, NG, ZA. Each region activates country-specific PII patterns like Aadhaar (IN), Emirates ID (AE), CPF (BR), and more.

Response

FieldTypeDescription
actionstring"allow", "redact", or "deny"
outputstringRedacted content (or original if no PII found)
pii_detectedarrayArray of { type, count } for each PII type found. Includes regional types (e.g. "emirates_id", "aadhaar", "cpf") when region profiles are active
latency_msnumberProcessing time in milliseconds
receiptobjectCompliance receipt with receipt_id, timestamp, content_hash, hmac_signature, and fingerprint
governance_dnaobjectGovernance DNA with fingerprint, risk level, score, and applied policies
usageobjectUsage counters: calls_used, calls_limit, calls_remaining

Example: Basic Scan

bash
curl -X POST "https://api.tork.network/v1/govern" \
  -H "Authorization: Bearer tork_sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Contact sarah@acme.com or call 555-123-4567",
    "options": { "mode": "redact" }
  }'
json
{
  "action": "redact",
  "output": "Contact [EMAIL_REDACTED] or call [PHONE_REDACTED]",
  "pii_detected": [
    { "type": "email", "count": 1 },
    { "type": "phone", "count": 1 }
  ],
  "latency_ms": 6,
  "receipt": {
    "receipt_id": "rcpt_a1b2c3d4",
    "timestamp": "2026-02-12T10:30:00.000Z",
    "policy_version": "1.0.0",
    "content_hash": "sha256:...",
    "hmac_signature": "hmac:...",
    "fingerprint": "dna:..."
  },
  "usage": {
    "calls_used": 142,
    "calls_limit": 10000,
    "calls_remaining": 9858
  }
}

Example: Regional Detection

bash
curl -X POST "https://api.tork.network/v1/govern" \
  -H "Authorization: Bearer tork_sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Patient Aadhaar is 1234 5678 9012 and Emirates ID 784-1234-1234567-1",
    "region": ["IN", "AE"],
    "industry": "healthcare"
  }'
json
{
  "action": "redact",
  "output": "Patient [AADHAAR_REDACTED] and [EMIRATES_ID_REDACTED]",
  "pii_detected": [
    { "type": "aadhaar", "count": 1 },
    { "type": "emirates_id", "count": 1 }
  ],
  "latency_ms": 8,
  "receipt": {
    "receipt_id": "rcpt_e5f6g7h8",
    "timestamp": "2026-02-12T10:31:00.000Z",
    "policy_version": "1.0.0",
    "content_hash": "sha256:...",
    "hmac_signature": "hmac:...",
    "fingerprint": "dna:..."
  },
  "usage": {
    "calls_used": 143,
    "calls_limit": 10000,
    "calls_remaining": 9857
  }
}

Agents

Manage AI agent registrations and configurations.

GET/agentsList all agents
POST/agentsRegister new agent
GET/agents/:idGet agent details
PATCH/agents/:idUpdate agent
DELETE/agents/:idDelete agent
python
# Example: Register a new agent
response = client.agents.create(
    name="Customer Support Bot",
    description="Handles customer inquiries",
    metadata={
        "team": "support",
        "environment": "production"
    }
)
print(f"Agent ID: {response.id}")

Policies

Define and manage governance policies.

GET/policiesList all policies
POST/policiesCreate policy
GET/policies/:idGet policy details
PUT/policies/:idUpdate policy
DELETE/policies/:idDelete policy
POST/policies/checkCheck policy compliance
python
# Example: Check policy compliance
result = client.policies.check(
    agent_id="agent-123",
    action_type="send_email",
    content="Email content here...",
    metadata={"recipient": "user@example.com"}
)

if result.action == "ALLOW":
    proceed_with_action()
elif result.action == "BLOCK":
    handle_blocked(result.reason)

Budgets

Manage spending limits and track costs.

GET/budgetsList all budgets
POST/budgetsCreate budget
GET/budgets/:idGet budget details
GET/budgets/:id/statusGet current status
POST/budgets/:id/checkCheck if action fits

Approvals

Human-in-the-loop approval workflows.

GET/approvalsList approval requests
GET/approvals/:idGet approval details
POST/approvals/:id/approveApprove request
POST/approvals/:id/rejectReject request

Audit Logs

Access compliance and audit records.

GET/audit/logsQuery audit logs
GET/audit/receipts/:idGet compliance receipt
POST/audit/exportExport audit data

Rate Limits: Default rate limit is 1000 requests per minute. Contact us for higher limits.

Documentation

Learn to integrate TORK

Upgrade Plan

Current: free

Support

Get help from our team