Skip to Content
Tools

Create an HTTP tool

Permissiontools:createRetriesIdempotency-Key requiredAuthentication
POST
/tools

Creates a validated executable request template. URL authority is static and public; placeholders are allowed only in path/query and in documented template-bearing fields. Every referenced secret must already be active in this workspace.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Use a Voice API key or connected-app OAuth access token. Authentication.

Header Parameters

Idempotency-Key*string

Required. Reuse the same key to retry this write safely. Retries and idempotency.

Match^[A-Za-z0-9!#$%&'*+.^_`|~-]+$
Length1 <= length <= 255

Request Body

application/json
  1. body

Template expressions use {{slots.NAME}}, {{params.NAME}}, {{system.NAME}}, {{vars.NAME}}, or {{secrets.NAME}}. Rich parameter cards are the canonical automation workflow and preserve JSON scalar types in object bodies. Parameter references must be declared, secret names must exist and be active, braces must balance, and templates are forbidden in object keys. Secrets may appear only in headers or bodies and make HTTPS mandatory. The complete stored request is checked for duplicate or conflicting destinations before commit.

slug*string

Immutable public identifier.

Match^[a-z0-9_]{2,48}$
Length2 <= length <= 48
name*string
Length1 <= length <= 200
description?|
Lengthlength <= 2000
mode?string
Default"sync"
Value in"sync""async"
phase?string

When the tool runs. in_call (the default, and every tool authored before this field existed) is invoked by the model during the conversation. pre_call fires once, before the agent speaks, with no model involvement: its parameters must be static, system, or secret cards, its templates may reference only {{system.NAME}}, {{vars.NAME}}, and {{secrets.NAME}}, and its response_map names the values it publishes as {{tools.SLUG.NAME}}. pre_call additionally requires mode: sync, default_reaction: speaks, and precomputable: false, because all three describe behaviour during a conversation that has not started yet.

Default"in_call"
Value in"in_call""pre_call"
method*ToolMethod
Value in"GET""POST""PUT""PATCH""DELETE"
url*string

Absolute public HTTP(S) URL. Scheme, authority, credentials, and fragment are static. A raw {name} token is allowed only in the path when a rich path card with that exact name exists. Legacy {{scope.name}} templates remain accepted in path/query for stored compatibility, but new clients should use rich cards for component-safe percent encoding. Direct {{secrets.NAME}} URL references are always rejected.

Length1 <= length <= 4096
default_reaction?string
Default"speaks"
Value in"speaks""listens"
precomputable?boolean

Allows execution to begin while generated speech is still playing. Use only for calls that are safe to start speculatively; the HTTP method does not determine whether an operation is semantically read-only.

Defaultfalse
carry_across_calls?boolean

Declares that successful results remain valid on the timescale of a dropped-call redial. When an agent with resume enabled continues a recent call, the runtime replays this tool's latest successful result from the previous call into context. Leave false for tools returning live or per-moment data. Agents may override the value per attachment.

Defaultfalse
headers?

Header templates. Host, Content-Length, Transfer-Encoding, Connection, Proxy-Authorization, Proxy-Authenticate, Proxy-Connection, Keep-Alive, TE, Trailer, and Upgrade are transport-controlled and forbidden. Values cannot contain CR/LF.

Propertiesproperties <= 100
body?||

Templated string, templated JSON object, or null for no request body. Arrays and scalar JSON values other than strings are rejected.

parameters?array<||||>|
response_map?

Map of destination slot name to the supported tiny JSONPath syntax, such as $.customer.name or $.items.0.id.

Propertiesproperties <= 100
internal_slots?array<>

Subset of response_map slot names whose captured value is withheld from the model. The slot is still filled and still usable in templated tool fields such as a later request body or URL, but its value is never placed in the conversation the model sees, so a tool may return an account number or a policy document without that text entering the transcript or a prompt. Every entry must be a key of response_map; an unknown name is a 422. Stored canonically (sorted and deduplicated); omitted or null means an empty list.

Itemsitems <= 100
ack_response?|

Async-only agent-visible templated JSON object injected immediately while the real request continues; null disables it. It may use {{params.NAME}}, {{slots.NAME}}, {{system.NAME}}, and {{vars.NAME}}. It must never reference {{secrets.NAME}} at any nesting depth; public validation rejects the request rather than exposing a credential to the agent.

timeout_ms?integer
Range100 <= value <= 60000
Default5000
retries?integer
Range0 <= value <= 5
Default0

Response Body

HTTP tool created. The normalized complete tool is returned.

application/json
  1. response
id*string
Formatuuid
slug*string
name*string
description*string|null
mode*ToolMode
Value in"sync""async"
phase*ToolPhase

When the tool runs. in_call (the default, and every tool authored before this field existed) is invoked by the model during the conversation. pre_call fires once, before the agent speaks, with no model involvement: its parameters must be static, system, or secret cards, its templates may reference only {{system.NAME}}, {{vars.NAME}}, and {{secrets.NAME}}, and its response_map names the values it publishes as {{tools.SLUG.NAME}}. pre_call additionally requires mode: sync, default_reaction: speaks, and precomputable: false, because all three describe behaviour during a conversation that has not started yet.

Value in"in_call""pre_call"
method*ToolMethod
Value in"GET""POST""PUT""PATCH""DELETE"
url*string
default_reaction*ToolReaction
Value in"speaks""listens"
precomputable*boolean
carry_across_calls*boolean
timeout_ms*integer
retries*integer
archived_at*|
Formatdate-time
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
headers*

Header templates. Host, Content-Length, Transfer-Encoding, Connection, Proxy-Authorization, Proxy-Authenticate, Proxy-Connection, Keep-Alive, TE, Trailer, and Upgrade are transport-controlled and forbidden. Values cannot contain CR/LF.

Propertiesproperties <= 100
body*||

Templated string, templated JSON object, or null for no request body. Arrays and scalar JSON values other than strings are rejected.

parameters*array<||||>|
response_map*

Map of destination slot name to the supported tiny JSONPath syntax, such as $.customer.name or $.items.0.id.

Propertiesproperties <= 100
internal_slots*array<>

Subset of response_map slot names whose captured value is withheld from the model. The slot is still filled and still usable in templated tool fields such as a later request body or URL, but its value is never placed in the conversation the model sees, so a tool may return an account number or a policy document without that text entering the transcript or a prompt. Every entry must be a key of response_map; an unknown name is a 422. Stored canonically (sorted and deduplicated); omitted or null means an empty list.

Itemsitems <= 100
ack_response*|

Async-only agent-visible templated JSON object injected immediately while the real request continues; null disables it. It may use {{params.NAME}}, {{slots.NAME}}, {{system.NAME}}, and {{vars.NAME}}. It must never reference {{secrets.NAME}} at any nesting depth; public validation rejects the request rather than exposing a credential to the agent.

Example Request
curl -X POST 'https://api.kejue.co/v1/tools' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{  "slug": "string",  "name": "string",  "method": "GET",  "url": "string"}'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "slug": "string",  "name": "string",  "description": "string",  "mode": "sync",  "phase": "in_call",  "method": "GET",  "url": "string",  "default_reaction": "speaks",  "precomputable": true,  "carry_across_calls": true,  "timeout_ms": 0,  "retries": 0,  "archived_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z",  "headers": {    "property1": "string",    "property2": "string"  },  "body": "string",  "parameters": [    {      "name": "string",      "kind": "dynamic",      "location": "path",      "type": "string",      "description": "string",      "required": false,      "enum_values": [        "string"      ],      "properties": [        {          "name": "string",          "type": "string",          "description": "string",          "required": false,          "enum_values": [            "string"          ]        }      ],      "items": {        "type": "string",        "enum_values": [          "string"        ],        "properties": [          {            "name": "string",            "type": "string",            "description": "string",            "required": false,            "enum_values": [              "string"            ]          }        ]      }    }  ],  "response_map": {    "property1": "string",    "property2": "string"  },  "internal_slots": [    "string"  ],  "ack_response": {}}