Skip to main content
PATCH
Update lead
Change one lead. Send only the fields you want to change. Required scope: leads:manage. This is where a lead learns something between calls: a name the agent captured, a tag that moves the contact into the next campaign, or long_term_context — the note the agent reads before it speaks next time.
phone_number and source cannot be changed: the number is the lead’s identity, and the source is how it first arrived. To move a contact to a new number, create the new lead and delete the old one.

Response

200 with the whole updated lead, tags expanded, and a fresh updated_at — for a key that also holds leads:read. A key with leads:manage alone reads back only what it wrote: id, each field it sent as the lead now holds it (tag_ids reads back as tags, and metadata without the values the calls collected) and updated_at. The phone number, email, memory and collected values it did not send are Get Lead’s to show, and need leads:read.

Errors

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

Path Parameters

id
string<uuid>
required

Body

application/json
name
string | null
email
string<email> | null
long_term_context
string | null

AI memory for this lead. Injected into the agent's system prompt at call time.

metadata
object
tags
string[]

Replace all tags, by name. Names match exactly and all of them must be tags in this workspace — one that is not is 400 INVALID_TAG_NAMES, so a typo cannot silently drop a tag. An empty array clears the lead's tags.

tag_ids
string<uuid>[]

Replace all tags by UUID

Response

The updated lead, for a key that also holds leads:read. A key with leads:manage alone reads back only what it wrote: id, each field it sent as the lead now holds it (tag_ids reads back as tags; metadata without the values the calls collected) and updated_at.

id
string<uuid>
phone_number
string
Example:

"+972501234567"

name
string | null
email
string<email> | null
source
enum<string>

How the lead first appeared.

call — created from a call this workspace took or placed. The most common value by far, and written only by Yappr: a request cannot claim it. api — created through this API. manual — typed into the dashboard. csv_import — arrived in a spreadsheet.

A create may send api, manual or csv_import; any other value is refused rather than silently rewritten.

Available options:
api,
manual,
csv_import,
call
Example:

"api"

tags
object[]
long_term_context
string | null

AI memory for this lead. Injected into the agent's system prompt at call time when lead_memory_enabled is true on the agent.

extracted
object | null

What this lead's calls collected, keyed by the extraction parameter's own name, merged across every call with this person. The most recent call that answered a field wins it; a field that call never covered keeps the answer an earlier one found. Only answers are merged: unlike a call's own extracted_data on GET /calls/{id}, which carries every parameter with null for the ones that call never covered, a parameter no call has answered is absent here. Read-only and written only by the post-call pass: it is stored under the reserved metadata.extracted key, neither a create nor a PATCH can set it, and replacing metadata does not erase it. Null until a call collects something.

extracted_precision
object | null

The date parameters the latest call that answered them gave as a month and no day ("sometime in November"), keyed by parameter name, each {"precision": "month", "month": "YYYY-MM"}, with "approximate": true when the call's own extracted_data_precision has it (a month worked out from a length of time ago, such as "three months ago", rather than named). Such a field is absent from extracted, because a month is not a day; a later call that names the day moves it back to extracted and out of here. Read-only, stored under the reserved metadata.extracted_precision key like extracted, and null when no call has given a month alone. The same member is on the lead inside GET /calls/{id}.

metadata
object
created_at
string<date-time>
updated_at
string<date-time>