Update a lead
curl --request PATCH \
--url https://rest.newlead.ai/v1/leads/{lead_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"do_not_contact": false,
"variables": {}
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', do_not_contact: false, variables: {}})
};
fetch('https://rest.newlead.ai/v1/leads/{lead_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://rest.newlead.ai/v1/leads/{lead_id}"
payload = {
"name": "<string>",
"do_not_contact": False,
"variables": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"object": "lead",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"text_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"voice_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contact_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"phone": "<string>",
"email": "<string>",
"username": "<string>",
"channel": "whatsapp",
"status": "active",
"source": {
"type": "whatsapp",
"lead_ad": {
"form_id": "<string>",
"ad_id": "<string>",
"leadgen_id": "<string>"
}
},
"summary": "<string>",
"variables": {},
"qualification": {
"status": "not_started",
"completed_at": "2023-11-07T05:31:56Z",
"answers": [
{
"question_id": "<string>",
"question": "<string>",
"value": "<string>",
"value_label": "<string>"
}
]
},
"do_not_contact": true,
"has_replied": true,
"ai_paused": true,
"ai_paused_until": "2023-11-07T05:31:56Z",
"messaging_window_expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"last_activity_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}Leads
Update a lead
Name, status and variables (merged; null deletes a key). do_not_contact only accepts false.
PATCH
/
leads
/
{lead_id}
Update a lead
curl --request PATCH \
--url https://rest.newlead.ai/v1/leads/{lead_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"do_not_contact": false,
"variables": {}
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', do_not_contact: false, variables: {}})
};
fetch('https://rest.newlead.ai/v1/leads/{lead_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://rest.newlead.ai/v1/leads/{lead_id}"
payload = {
"name": "<string>",
"do_not_contact": False,
"variables": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"object": "lead",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"text_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"voice_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contact_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"phone": "<string>",
"email": "<string>",
"username": "<string>",
"channel": "whatsapp",
"status": "active",
"source": {
"type": "whatsapp",
"lead_ad": {
"form_id": "<string>",
"ad_id": "<string>",
"leadgen_id": "<string>"
}
},
"summary": "<string>",
"variables": {},
"qualification": {
"status": "not_started",
"completed_at": "2023-11-07T05:31:56Z",
"answers": [
{
"question_id": "<string>",
"question": "<string>",
"value": "<string>",
"value_label": "<string>"
}
]
},
"do_not_contact": true,
"has_replied": true,
"ai_paused": true,
"ai_paused_until": "2023-11-07T05:31:56Z",
"messaging_window_expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"last_activity_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}Authorizations
BearerAuthApiKeyHeader
Body
application/json
Response
The updated lead.