Update a webhook endpoint
curl --request PATCH \
--url https://rest.newlead.ai/v1/webhook_endpoints/{webhook_endpoint_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://n8n.example.com/webhook/newlead",
"events": [],
"description": "<string>",
"active": true
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://n8n.example.com/webhook/newlead',
events: [],
description: '<string>',
active: true
})
};
fetch('https://rest.newlead.ai/v1/webhook_endpoints/{webhook_endpoint_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://rest.newlead.ai/v1/webhook_endpoints/{webhook_endpoint_id}"
payload = {
"url": "https://n8n.example.com/webhook/newlead",
"events": [],
"description": "<string>",
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"object": "webhook_endpoint",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"events": [
"call.started"
],
"text_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"voice_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"active": true,
"last_success_at": "2023-11-07T05:31:56Z",
"last_failure_at": "2023-11-07T05:31:56Z",
"consecutive_failures": 1,
"created_at": "2023-11-07T05:31:56Z",
"secret": "<string>"
}{
"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"
}
}Webhooks
Update a webhook endpoint
URL, events, description or active. The agent cannot change: to move an endpoint to another agent, delete it and create a new one. Reactivating an endpoint when the agent already has 3 active returns 409 webhook_endpoint_limit_reached.
PATCH
/
webhook_endpoints
/
{webhook_endpoint_id}
Update a webhook endpoint
curl --request PATCH \
--url https://rest.newlead.ai/v1/webhook_endpoints/{webhook_endpoint_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://n8n.example.com/webhook/newlead",
"events": [],
"description": "<string>",
"active": true
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://n8n.example.com/webhook/newlead',
events: [],
description: '<string>',
active: true
})
};
fetch('https://rest.newlead.ai/v1/webhook_endpoints/{webhook_endpoint_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://rest.newlead.ai/v1/webhook_endpoints/{webhook_endpoint_id}"
payload = {
"url": "https://n8n.example.com/webhook/newlead",
"events": [],
"description": "<string>",
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"object": "webhook_endpoint",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"events": [
"call.started"
],
"text_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"voice_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"active": true,
"last_success_at": "2023-11-07T05:31:56Z",
"last_failure_at": "2023-11-07T05:31:56Z",
"consecutive_failures": 1,
"created_at": "2023-11-07T05:31:56Z",
"secret": "<string>"
}{
"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
Minimum array length:
1call.* events belong to voice agents; the others belong to text agents. What each event carries and how to verify the signature are at https://docs.newlead.ai/webhook-events.
Available options:
call.started, call.rejected, call.ended, call.analyzed, lead.created, lead.qualified, lead.appointment_booked, lead.handoff, follow_up.sent, message.received, message.failed Response
The updated endpoint.
call.* events belong to voice agents; the others belong to text agents. What each event carries and how to verify the signature are at https://docs.newlead.ai/webhook-events.
Available options:
call.started, call.rejected, call.ended, call.analyzed, lead.created, lead.qualified, lead.appointment_booked, lead.handoff, follow_up.sent, message.received, message.failed