Skip to content

Tools API Reference

Complete documentation of /v1/tools/* endpoints for managing the tool registry.

Endpoint: POST /v1/tools

Create a new tool or update an existing tool in your registry (same name + scope_id).

Terminal window
curl -X POST https://api.onceonly.tech/v1/tools \
-H "Authorization: Bearer once_live_xxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "send_email",
"scope_id": "global",
"url": "https://api.example.com/v1/send-email",
"auth": {
"type": "hmac_sha256",
"secret": "your_shared_secret_key"
},
"timeout_ms": 15000,
"max_retries": 2,
"enabled": true,
"description": "Send transactional emails via SMTP service"
}'
FieldTypeRequiredDescription
namestringTool name (alphanumeric + _, ., :, -)
scope_idstringScope: "global" or "agent:agent_id"
urlstringTool endpoint URL
auth.typestringAlways "hmac_sha256"
auth.secretstringShared secret (min 8 chars)
timeout_msinteger-Timeout (250-120000, default: 15000)
max_retriesinteger-Retry count (0-10, default: 2)
enabledboolean-Active status (default: true)
descriptionstring-Tool description (max 512 chars)
{
"name": "send_email",
"scope_id": "global",
"url": "https://api.example.com/v1/send-email",
"timeout_ms": 15000,
"max_retries": 2,
"enabled": true,
"description": "Send transactional emails via SMTP service",
"has_secret": true,
"secret_id": "sec_a1b2c3d4",
"secret_mask": "***key"
}

Endpoint: GET /v1/tools

List all tools in a scope.

Terminal window
curl -H "Authorization: Bearer once_live_xxxxxxxxxxxxx" \
"https://api.onceonly.tech/v1/tools?scope_id=global"
ParameterTypeDescription
scope_idstringScope to list (default: "global")
[
{
"name": "send_email",
"scope_id": "global",
"url": "https://api.example.com/v1/send-email",
"enabled": true,
"has_secret": true,
"secret_id": "sec_a1b2c3d4",
"secret_mask": "***key"
},
{
"name": "create_ticket",
"scope_id": "global",
"url": "https://api.example.com/v1/tickets",
"enabled": true
}
]

Endpoint: GET /v1/tools/{name}

Get details for a specific tool.

Terminal window
curl -H "Authorization: Bearer once_live_xxxxxxxxxxxxx" \
"https://api.onceonly.tech/v1/tools/send_email?scope_id=global"
ParameterDescription
nameTool name
ParameterDescription
scope_idScope (default: "global")
{
"name": "send_email",
"scope_id": "global",
"url": "https://api.example.com/v1/send-email",
"timeout_ms": 15000,
"max_retries": 2,
"enabled": true,
"description": "Send emails",
"has_secret": true,
"secret_id": "sec_a1b2c3d4",
"secret_mask": "***key"
}

To update a tool, call POST /v1/tools again with the same name + scope_id and the new fields.


Endpoint: POST /v1/tools/{name}/toggle

Enable or disable a tool.

Terminal window
curl -X POST https://api.onceonly.tech/v1/tools/send_email/toggle \
-H "Authorization: Bearer once_live_xxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"enabled": false}'
FieldTypeRequired
enabledboolean
{
"name": "send_email",
"enabled": false
}

Endpoint: DELETE /v1/tools/{name}

Remove tool from registry.

Terminal window
curl -X DELETE https://api.onceonly.tech/v1/tools/send_email?scope_id=global \
-H "Authorization: Bearer once_live_xxxxxxxxxxxxx"
ParameterDescription
scope_idScope (default: "global")
{
"ok": true,
"deleted": "send_email",
"scope_id": "global"
}

{
"detail": "Missing Authorization Bearer token"
}
{
"detail": "Invalid API key"
}
{
"detail": {
"error": "feature_not_available",
"feature": "tools_registry",
"plan": "free",
"required_plan": "pro"
}
}
{
"detail": {
"error": "tool_not_found",
"name": "nonexistent_tool",
"scope_id": "global"
}
}
{
"detail": [
{
"type": "missing",
"loc": ["body", "name"],
"msg": "Field required",
"input": {}
}
]
}

DO:

  • Validate URL format before creating
  • Use descriptive tool names
  • Document secret handling
  • Test tool endpoints before registering
  • Monitor tool usage metrics
  • Update stale endpoints

DON’T:

  • Expose secrets in logs
  • Change tool URL without testing
  • Delete tools in use by policies
  • Create duplicate tools with different names
  • Use unreliable endpoints

import os
from onceonly import OnceOnly
def register_sendgrid():
client = OnceOnly(api_key=os.environ["ONCEONLY_API_KEY"])
return client.gov.create_tool({
"name": "sendgrid_email",
"scope_id": "global",
"url": "https://api.sendgrid.com/v3/mail/send",
"auth": {
"type": "hmac_sha256",
"secret": os.environ["SENDGRID_WEBHOOK_SECRET"],
},
"timeout_ms": 10000,
"max_retries": 2,
"description": "SendGrid email delivery",
})
import os
from onceonly import OnceOnly
def list_all_tools():
client = OnceOnly(api_key=os.environ["ONCEONLY_API_KEY"])
return client.gov.list_tools(scope_id="global")
import os
from onceonly import OnceOnly
def disable_tool(tool_name: str):
client = OnceOnly(api_key=os.environ["ONCEONLY_API_KEY"])
return client.gov.toggle_tool(tool_name, enabled=False, scope_id="global")

See also: Tools Concepts