Ir al contenido

Update Lead

Ver como Markdown
PATCH
/public/v1/leads/{lead_id}
curl --request PATCH \
--url https://api.aymaragents.com/public/v1/leads/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <X-API-Key>' \
--data '{ "stageId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "quality": "example", "assignedOperatorId": "example", "notes": "example" }'

Partially update stageId/quality/assignedOperatorId/notes – the curated field set SPEC_API_PUBLICA.md §2.1 names for this endpoint (see PublicLeadUpdateRequest’s own docstring for why it is narrower than the internal PATCH).

Foreign/unknown leadId or stageId/assignedOperatorId referencing another tenant -> 404, zero persistence (resolved BEFORE any field is mutated).


Permiso necesario: tenant:leads.manage

lead_id
required
Lead Id
string format: uuid
Media typeapplication/json
PublicLeadUpdateRequest

PATCH /public/v1/leads/{id} body – all fields optional (partial update).

Curated to EXACTLY the four fields SPEC_API_PUBLICA.md §2.1 names for this endpoint (stageId/quality/assignedOperatorId/notes) – narrower than the internal PATCH /leads/{id} on purpose: a third party may move a lead through the pipeline and annotate/reassign it, never rewrite its identity/contact data (customerName/ customerPhone/etc. stay Platform-only, same curation reasoning as excluding mark-contacted/push-to-crm from this surface entirely).

object
stageId
Any of:
string format: uuid
quality
Any of:
string
assignedOperatorId
Any of:
string
notes
Any of:
string

Examplegenerated

{
"stageId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"quality": "example",
"assignedOperatorId": "example",
"notes": "example"
}

Successful Response

Media typeapplication/json
PublicLeadOut

Lead shape returned by the public list/get/create/update endpoints.

Curated subset of the internal LeadOut (schemas/leads.py): drops originChannelId/originChannelName (MCH-7 internal attribution, meaningless to a third- party integration) and the legacy stage string mirror (stageId is the single canonical field on this NEW contract – no legacy bridge to preserve here, unlike the internal shape which still serves pre-KAN consumers).

object
id
required
Id
string
customerId
Any of:
string
conversationId
Any of:
string
customerName
required
Customername
string
customerEmail
Any of:
string
customerPhone
Any of:
string
intent
required
Intent
string
quality
required
Quality
string
stageId
required
Stageid
string
budget
Any of:
PublicLeadBudgetOut

Budget range in EUR.

Either bound may be null.

object
min
Any of:
integer
max
Any of:
integer
zones
required
Zones
Array<string>
rooms
Any of:
integer
assignedOperatorId
Any of:
string
source
required
Source
string
notes
Any of:
string
createdAt
required
Createdat
string
updatedAt
required
Updatedat
string

Examplegenerated

{
"id": "example",
"customerId": "example",
"conversationId": "example",
"customerName": "example",
"customerEmail": "example",
"customerPhone": "example",
"intent": "example",
"quality": "example",
"stageId": "example",
"budget": {
"min": 1,
"max": 1
},
"zones": [
"example"
],
"rooms": 1,
"assignedOperatorId": "example",
"source": "example",
"notes": "example",
"createdAt": "example",
"updatedAt": "example"
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object

Examplegenerated

{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example",
"input": "example",
"ctx": {}
}
]
}