Skip to main content
POST
Attach tool to agent
This endpoint cannot give a tool to an agent you created through this API. Every agent POST /agents makes is a workflow agent, and every tool POST /tools makes with a workflow body is a workflow tool, so both sides are workflow-owned and this endpoint answers 409 WORKFLOW_TOOL_OWNER_REQUIRED every time. Use workflow bindings instead — it is four calls, written out below.
Requires tools:update. It exists only for agents and tools that predate workflow ownership and have not been migrated. Its refusals:
  • 409 WORKFLOW_TOOL_OWNER_REQUIRED — the agent or the tool is a workflow one. Bind the tool with PUT /agents/{id}/workflow and publish with POST /agents/{id}/workflow/publish; the message says so.
  • 409 WORKFLOW_AGENT_BUSY — the agent is being changed right now. Reload it and retry.
  • 409 WORKFLOW_BINDINGS_REQUIRED — the agent has moved to workflow tool selection. Edit the workflow instead.
  • 404 — the agent (AGENT_NOT_FOUND) or the tool (WORKFLOW_NOT_FOUND, the answer every tool route gives) is not in this workspace.
  • 400 TOOL_ATTACHMENT_REQUEST_INVALID — the body carries a field other than agent_id, tool_id, execution_order and config_override (a misspelt executionOrder used to be dropped and the tool attached at position 0), or the address carries a query parameter; agent_id or tool_id is missing; execution_order is not a whole number of 0 or more. The message names it, and nothing was attached.
GET /tools?agent_id={id} is the read half of the same retired mechanism: it lists legacy attachments, so a workflow agent with tools actively bound and published answers {"data":[]}. That empty list is not a broken read and not an agent without tools — read GET /agents/{id}/workflow and look at draft.document.bindings.

The way that works: bindings

A workflow agent names its tools in its own document. A binding is one entry in document.bindings saying which tool revision to call and where each of its arguments comes from; a step or a conversation node then names that binding’s id. 1. Pick the tool revision. For a tool you know — one you just made, or one GET /tools?name= found — read GET /tools/{id}: workflow.current.revision_id is the tool_revision_id a binding points at, beside the input_schema whose field names the binding must map and the allowed_channels / allowed_phases saying where it may sit. POST /tools answers the same object, so a tool you created is already in hand. To browse instead, GET /tools/workflow-catalog?limit=20 returns current revisions with the same fields — in tool-id order, not newest first, so a new tool can be on any page. 2. Read the draft and its version.
draft.version is the expected_version of the next save, and draft.document is the document to edit and send back whole. 3. Add the binding and name it from a step. The complete minimal document is in Save workflow draft — two edits to the draft you just read: one entry in bindings, and that entry’s id in the conversation node’s available_binding_ids. 4. Check, then publish.
{"valid":true,…} means the binding is wired correctly. Publish the same version with POST /agents/{id}/workflow/publish; nothing reaches a live call until you do. See Error Codes.

Authorizations

Authorization
string
header
required

Your Yappr API key (e.g. ypr_live_...). Generate one in the dashboard under Settings → API Keys. No key is 401 MISSING_KEY; a key that is not one of ours, or is revoked, is 401 INVALID_KEY; an expired one is 401 EXPIRED_KEY. A valid key without the scope an operation needs is 403 INSUFFICIENT_SCOPE on every operation, and the message names the scope. Every response, a 401 included, carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a minute per API key. Every 429, whatever its code, carries Retry-After (whole seconds, never zero): the per-key budget's RATE_LIMIT asks for what is left of the minute, a route's daily cap (RATE_LIMITED) for the time until that cap resets. All four headers are listed in Access-Control-Expose-Headers, so a browser can read them. A path the API does not serve (an unknown sub-path, an id left empty) is 404 ROUTE_NOT_FOUND, and a method a served path does not take is 405 METHOD_NOT_ALLOWED with an Allow header; both are answered before any scope check, and nothing is read or changed. A trailing slash is ignored where it cannot be an id left empty (POST /calls/ is POST /calls) and refused where it can (GET /calls/). A doubled slash inside a path is merged into one before the request reaches the API (GET //calls is GET /calls).

Body

application/json
agent_id
string<uuid>
required
tool_id
string<uuid>
required
execution_order
integer
default:0
config_override
object

Per-attachment config overrides (merges with tool's base config)

Response

Tool attached