Skip to main content
PATCH
Update tool
Requires tools:update. For a workflow-owned tool, send name, a workflow object with its kind, what that kind is built from and the fields you are changing, and expected_head_revision_id and expected_head_generation from the latest GET — or, to change only an HTTP tool’s name or description, the revision tokens and that field alone (below). Any field you leave out keeps its value — what an update changes lists which is which. Include an Idempotency-Key and explicit x-company-id. A change is answered 200 once it is the tool’s current revision, and 202 while it is still being built or promoted: workflow.status is then accepted, claimed, queued, compiling or ready, the new revision is under workflow.candidate, and workflow.current is still the old one. Poll Get tool until workflow.status is current. The two revision tokens are read under one name and sent under another — the GET calls them workflow.head_revision_id and workflow.head_generation, and they go back as top-level expected_head_revision_id and expected_head_generation, not nested under workflow. See the table on Get tool.

What an update changes

A PATCH changes what it sends and nothing else. Every field you leave out keeps the value the tool already has — description, effect, timeout_ms, configuration.method, include_call_context, an app tool’s fixed_inputs, a transfer tool’s announce_transfer and announce_message. Send a field only to change it. That includes the call package: a tool with include_call_context: false stays that way until a change sends "include_call_context": true — leaving the key out keeps it off. (description is what an agent picks this tool by, so an empty one is a real change: send "description": "" to clear it deliberately, and leave the key out to keep what is there.) A transfer tool’s own transfer code is kept the same way: transfer_method, pbx_feature_code and pbx_feature_code_hangup_after_secs keep their values unless you send them, and what you send is checked together with what is kept. "transfer_method": "auto" removes all three, so the extension endpoint’s code applies again; null as pbx_feature_code_hangup_after_secs removes only the hang-up time. A kept code lapses when a new destination no longer names an extension a keypad can dial. What a change that sends workflow cannot leave out is what names the tool and what its kind is built from: name, workflow.kind, the two revision tokens, and for an HTTP tool input_schema, output_schema and configuration ({} is enough when the endpoint itself is not changing), for an app tool metadata_id and connection_id, for a transfer tool destination. Leave one of those out and the change is refused with a 422 that names it; so is a description sent under workflow, at /workflow/description. The one exception is the next paragraph: a change to an HTTP tool’s name or description alone sends no workflow, and may leave name out too. The revision tokens are always required. Changing only the name or the description of an HTTP tool: leave workflow out altogether. The tool keeps what it does — its schemas, address, headers and every setting — and name, when you leave it out too, keeps its value. It is still a change like any other: it answers 202 with the change queued, and makes a new revision of the tool (its revision number goes up by one), which the steps that follow the tool’s current revision pick up once it is promoted. Read the tool again for the new revision tokens before the next change. description is top-level, beside name, never under workflow:
Two fields have rules of their own, because their stored values are never handed back to you: configuration.url and configuration.headers. Both are described below. For HTTP updates, omit workflow.configuration.url to retain the exact private saved URL. Never copy url_display back into url: it is non-executable display text with the private query removed. Supplying a URL replaces it completely; legitimate business query parameters remain supported.

Changing one header without retyping the values you were never shown

headers is the complete set of headers the tool will send. A stored name you leave out of a headers you did send is removed — that is how a header is deleted, and it is also how a credential gets deleted by accident, because the natural way to change one header is to send only that one. Send every header you want to keep: stored values are never returned, but null under a name stands in for the value you cannot see, so nothing has to be retyped. Sending no headers key at all is the safe way to change something else about the tool: every stored header is kept untouched. null is refused outright on create (POST /tools), where nothing is stored yet, with a WORKFLOW_TOOL_REQUEST_INVALID issue pointing at /workflow/configuration/headers/<name>. On update the request itself is accepted and the check happens while the revision is built, so null under a name that has no stored value fails differently: the 422 answers WORKFLOW_TOOL_NOT_BUILT: the tool object with workflow.status: "failed" and workflow.error_code: "tool_contract_invalid", plus error and one issues[] entry of that code at /workflow (the build does not say which header). Treat a failed workflow.status on the response as the refusal; the old head is untouched either way. The names to use are the ones GET /tools/{id} returns in configuration.configured_header_names; matching is exact, so renaming a header means sending its value again.

Rotating a leaked credential: what the new value actually reaches

Header values live on the revision they were saved with, so a rotation is only finished when every binding is resolving to the new revision. A binding resolves one of two ways, and tool_revision_policy on the binding decides which: A leaked key is not rotated while a pinned binding still names the old revision. Read GET /tools/{id}/bindings — it lists every agent that references the tool with rotation_reaches per binding, so the holdouts are one call away rather than a workspace-wide search. For each of them, save the binding back to follow_current (a whole-document save) or rebind it, then publish that agent. While the promotion worker is still validating, a follow-current agent’s call is refused with WORKFLOW_TOOL_PROMOTION_REQUIRED rather than placed on the superseded revision — a rotation never leaves a window where the old value is quietly still in use on a following binding. The candidate is immutable. Existing agents keep the old current revision while the durable promotion worker validates every affected follow-current workflow. Only a successful full-set/freshness check updates the head and affected effective artifacts atomically. Explicit pins and accepted runs remain unchanged. Concurrent publications are rechecked before commit; a failed or conflicting job applies no partial update. Each compile case has a 1 MiB technical input budget. Oversized input fails visibly without changing the old head; this is not a cap on the number of affected workflows. Poll GET /tools/{id} for the current/candidate state and safe failure code. Same-key retries preserve the original request. A 409 requires reloading and deliberately submitting a new change; it is not permission to overwrite another author’s head.

A tool whose creation failed

A create that failed — workflow.status: "failed" with workflow.current: null, typically connection_unavailable because the account was not connected yet — never had a head, so there is nothing to put in expected_head_revision_id or expected_head_generation. Fix what it failed on, then send the whole tool again, exactly as you would create it, with neither expected-head field and a new Idempotency-Key:
It is built under the same id: 200 once it has a current revision, 202 while it is being built, 422 with workflow.error_code if it fails again. Because this builds the tool, a key needs tools:create as well as tools:update. GET /tools/{id} on a failed creation shows what it asked for under workflow.requested (for an app tool: metadata_id, connection_id, toolkit, action, version, fixed_inputs; for a transfer tool: the destination and announcement; for an http tool: everything but its credentials - the address without its query as url_display, the method, effect, timeout, schemas and header names - so the full address and the header values are sent again), so a retry can start from it. Sending an expected-head field is refused with 422 and a message saying why. A creation still being built answers 409 WORKFLOW_TOOL_CONFLICT; one you removed answers 404. To give up on it instead, archive it.

An archived tool

A tool archived with DELETE /tools/{id} cannot be changed: a PATCH on it answers 404 WORKFLOW_TOOL_ARCHIVED before the body is read, and nothing is saved. Restore it first with POST /tools/{id}/restore, read the revision tokens again with GET /tools/{id}, then send the change. GET /tools?workflow=true&status=archived lists the archived tools with their ids.

A tool an integration runs

A tool whose GET /tools/{id} carries integration runs one action of a connected account for an integration, and belongs to it. A PATCH on it answers 409 INTEGRATION_ACTION_MANAGED and nothing is saved:
Choose which actions an agent uses with PATCH /agents/{id}/integrations/{integration_id}. The integration rebuilds the tool itself when the account is reconnected or renamed.

Temporary legacy migration boundary

For existing legacy tools, config still replaces the complete webhook configuration under the legacy rules, with one exception: config.headers is applied per header, by exactly the table above, because a read never returns the values. So omitting headers keeps every stored one, {} clears them all, a string sets one, null keeps the value stored under that exact name, and a stored name left out of a headers you did send is removed. A null under a name with nothing stored is refused with 400 and a sentence naming configured_header_names, not a 422 — a legacy tool has no revision to fail while it is built. Reading a tool and sending its config straight back is therefore safe: configured_header_names is dropped on the way in and the stored headers are kept. It cannot bypass workflow ownership or mutate a workflow’s accepted revision.

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).

Headers

Idempotency-Key
string

Required for workflow tools; exact same-body retry only.

Pattern: ^[A-Za-z0-9_-]{16,128}$

Path Parameters

id
string<uuid>
required

Body

application/json
name
string
required

A legacy type/config body has its name normalized to camelCase before it is stored, the same way POST /tools does. Read the stored name back from the response.

Required string length: 1 - 200
workflow
object
required
expected_head_revision_id
string<uuid>
required
expected_head_generation
integer
required
Required range: x >= 1
description
string

What an agent picks this tool by. Omitted on create: empty. Omitted on update: keeps the stored value; send an empty string to clear it.

Maximum string length: 10000
config
object
is_active
boolean

Response

Updated tool - for a workflow tool, the change is its current revision.

Temporary legacy webhook/function migration boundary. New tools use the workflow variant.

id
string<uuid>
required
type
enum<string>
required
Available options:
webhook,
function
name
string

Normalized to camelCase (e.g. 'capture_lead' → 'captureLead')

description
string | null
config
object

Webhook configuration. Request header values are never returned: a read omits config.headers entirely and reports the names in config.configured_header_names. Writes are per header, the same rule a workflow tool follows — omitting headers keeps every stored header, an explicit empty object clears them all, a string sets one, null keeps the value already stored under that exact name, and a stored name you leave out of a headers you did send is removed. On POST /tools nothing is stored yet, so null is refused with 400. A legacy transfer tool (made in the dashboard) carries destination, announce_transfer and announce_message, and may carry transfer_method, pbx_feature_code and pbx_feature_code_hangup_after_secs: the same keys, values and rules as on a flow's TransferNode, with destination in place of transfer_to.

is_active
boolean
created_at
string<date-time>
updated_at
string<date-time>