ToolFence
Docs Pricing Suite Open Gate

API reference

The ToolFence Gate REST API: evaluate tool calls, hold them for bound human clearance, then complete — fail-closed.

Prefer the SDK or MCP when you can. Use these routes for custom clients.

Base URL

https://app.toolfence.ai

Self-host / local: http://127.0.0.1:8000 (or your Gate host).

OpenAPI (when enabled on the server): /openapi.json · Swagger UI /docs · ReDoc /redoc

Authentication

Send a session or service key on every /v1/* request when auth is required:

Header When
Authorization: Bearer <token> Operator session from login / signup
X-API-Key: <key> Service / agent key from Controls → Rotate API key
curl -s https://app.toolfence.ai/v1/auth/me \
  -H "X-API-Key: $TOOLFENCE_API_KEY"

The main flow

Step Endpoint
Propose a tool call POST /v1/evaluate
List / poll pending GET /v1/approvals?pending_only=true · GET /v1/approvals/{id}
Human clears POST /v1/approvals/{id}/decide
Agent finishes POST /v1/approvals/{id}/complete (bound fingerprint)
POST /v1/evaluate
        │
        ├─ allow  → run tool → optional /complete
        ├─ deny   → stop
        └─ require_approval → Inbox/Slack → /decide → /complete

Endpoints


Evaluate

POST/v1/evaluate

Ask Gate whether a tool call may run. Creates a pending approval when policy requires clearance.

Body

tool_name string required
Tool identifier (e.g. refund.create).
arguments object required
Canonical args — hashed into bound_fingerprint.
risk string
low · medium · high · critical (policy default if omitted).
tags string[]
Routing / list matching.
agent_id string
Which agent is calling.
session_id string
Optional session correlation.
project_id string
Org project for metering / Inbox filter.
Request
{
  "tool_name": "refund.create",
  "arguments": { "order": "NW-8812", "amount": 189 },
  "risk": "high",
  "tags": ["payments"],
  "agent_id": "support-bot"
}
Response (paused)
{
  "policy": {
    "decision": "require_approval",
    "reason": "high risk"
  },
  "approval": {
    "id": "appr_…",
    "status": "pending",
    "bound_fingerprint": "fp_…"
  }
}
policy.decision Meaning
allow Run the tool (optionally /complete after)
deny Stop — do not execute
require_approval Wait for Inbox / Slack; then /decide → /complete

List approvals

GET/v1/approvals

Inbox list. Use pending_only=true for open clearances.

Query

pending_only boolean
Only pending items when true.
agent_id string
Filter by agent.
project_id string
Filter by project.
curl -s "https://app.toolfence.ai/v1/approvals?pending_only=true" \
  -H "X-API-Key: $TOOLFENCE_API_KEY"

Get approval

GET/v1/approvals/{id}

Poll status and read bound_fingerprint before complete.


Decide

POST/v1/approvals/{id}/decide

Human (or Slack) Approve / Deny / Respond. Edit-on-approve recomputes the bind.

Body

approved boolean required*
true approve · false deny (*unless respond).
expected_fingerprint string
Must match evaluate bind (recommended).
edited_arguments object
Edit-then-approve; fingerprint recomputed.
note string
Auditor note.
respond boolean
Human answers as the tool — no execute.
response_text string
Payload when respond: true.
reject_reason_code string
Optional structured deny reason.
Request (approve)
{
  "approved": true,
  "note": "ok under policy",
  "expected_fingerprint": "fp_…"
}
Request (deny)
{
  "approved": false,
  "reject_reason_code": "policy_violation",
  "note": "amount too high"
}

Complete

POST/v1/approvals/{id}/complete

Agent reports execution after Approve. Bound check is mandatory.

Body

expected_fingerprint string required
Must equal approval.bound_fingerprint.
success boolean
Whether the tool run succeeded.
result_summary string
Short audit line.
Request
{
  "success": true,
  "result_summary": "Refunded $189",
  "expected_fingerprint": "fp_…"
}
Errors
409  fingerprint mismatch — do not treat as cleared

Mismatch → 409. Do not execute if decide was deny / timeout / respond.


Other approval actions

POST/v1/approvals/{id}/extend

Add timeout seconds.

POST/v1/approvals/{id}/assign

Route to an assignee.

POST/v1/approvals/batch-decide

Multi-select decide.

GET/v1/reject-reasons

Structured deny codes.


Policy

GET/v1/policy
PUT/v1/policy

Risk map, allow/deny lists, per-tool overrides, routing.

POST/v1/policy/dry-run

What-if evaluate without creating an approval.


MCP

GET / PUT/v1/mcp/config

Catalog / default agent / per-tool risk. Not a live upstream proxy.

POST/v1/mcp/tools/call

MCP-shaped gated call — same pause / clear / continue rules.

{
  "name": "send_refund",
  "arguments": { "customer_id": "c1", "amount": 49.99 },
  "risk": "high",
  "agent_id": "mcp-gate"
}

Audit & controls

GET/v1/audit

Filterable trail.

GET/v1/audit/export?format=json|csv

Export.

POST/v1/audit/prune

Retention prune.

GET / POST/v1/kill-switch

Block agent / session.

GET/v1/notify/channels

Channel status.

PUT/v1/notify/config

Channel credentials (admin).

POST/v1/notify/digest

Pending summary fan-out.


Auth

GET/v1/auth/info

Auth required? SSO?

POST/v1/auth/signup

User + Free workspace.

POST/v1/auth/login

Session token.

GET/v1/auth/me

Current user + key meta.

POST/v1/auth/rotate-api-key

New personal agent key.

GET/v1/cloud/info

Hosted mode, plans, marketing URL.


Fingerprint rules

  1. Evaluate stores bound_fingerprint over tool_name + canonical args
  2. Decide may update the bind when args are edited
  3. Complete must send matching expected_fingerprint
  4. A different call (e.g. different amount) → different fingerprint — approvals are not reusable

See Security.

Clients

Client Doc
Python / TypeScript SDK SDK
MCP / Claude Code Agent setup · MCP
Full docs index llms.txt
ToolFence docs Marketing · Login