Skip to main content
POST
Crear una funcion de webhook
Creates a webhook tool. You describe what it does and which arguments it takes; the model decides when to call it and with what. Placeholders written {{name}} in the path, the query string or the body are filled at call time from the arguments the model chose, so https://erp.example.com/stock/{{sku}} with a sku parameter is the normal shape. Not in the host — read why.

Endpoint

Required scope

agents:write

Headers

Body

Example request

Response

201 Created

The tool, same shape as GET /v1/tools/{id}, with the header values already masked.

400 Bad Request

A missing required field, a field over its limit, or an unknown property. Two specific codes:
  • FUNCTION_URL_NOT_ALLOWED — the URL failed validation. details.reason names the rule; see the table.
  • FUNCTION_TIMEOUT_NOT_ALLOWEDtimeout outside 1–30 seconds.

401 Unauthorized

Missing, invalid, revoked, or expired token.

403 Forbidden

The token does not have the agents:write scope.

409 Conflict

A tool with that name already exists in the company.

502 Bad Gateway

The agent service is unreachable.

Operational notes

  • description is a prompt, not documentation. It is the only thing the model reads when deciding whether to call the tool, so say when to use it and when not to. “Devuelve el stock. Usar antes de prometer disponibilidad” beats “Endpoint de stock”.
  • A tool_params entry with no matching placeholder is still passed to the model, which will supply it and see it go nowhere. Keep the two in sync.
  • name is unique per company, not per project. A 409 can come from a tool created under a different project.
  • Creating a tool does not attach it to anything. An agent can only call the tools whose ids it holds; add it with PATCH /v1/agents/{id}.
  • type is forced to webhook. Sending anything else is rejected: the calendar and ecommerce tools are generated by Keebai and cannot be created through this API.

Authorizations

Authorization
string
header
required

Personal Access Token con prefijo kbai_pk_. Generar desde el portal con permiso developer.manage_tokens.

Body

application/json
name
string
required

Nombre tecnico, unico por company. Es el nombre con el que el modelo invoca la herramienta.

Maximum string length: 100
Example:

"consultar_stock"

display_name
string
required
Maximum string length: 200
Example:

"Consultar stock"

description
string
required

Para que sirve la herramienta. Es lo que lee el modelo para decidir cuando llamarla.

Maximum string length: 1000
Example:

"Devuelve el stock disponible de un SKU en el ERP."

context
object
required
tool_params
object[]
Maximum array length: 30
tags
string[]
Maximum array length: 20
is_active
boolean
default:true

Response

201 - application/json
tool
object
required