Pause the AI for a lead
curl --request POST \
--url https://rest.newlead.ai/v1/leads/{lead_id}/pause_ai \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"duration_minutes": 262800,
"reason": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({duration_minutes: 262800, reason: '<string>'})
};
fetch('https://rest.newlead.ai/v1/leads/{lead_id}/pause_ai', 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}/pause_ai"
payload = {
"duration_minutes": 262800,
"reason": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(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
Pause the AI for a lead
The AI stops replying to the lead, like the dashboard button. Without duration_minutes, or with 0, the pause lasts until resume_ai. Returns the lead.
POST
/
leads
/
{lead_id}
/
pause_ai
Pause the AI for a lead
curl --request POST \
--url https://rest.newlead.ai/v1/leads/{lead_id}/pause_ai \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"duration_minutes": 262800,
"reason": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({duration_minutes: 262800, reason: '<string>'})
};
fetch('https://rest.newlead.ai/v1/leads/{lead_id}/pause_ai', 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}/pause_ai"
payload = {
"duration_minutes": 262800,
"reason": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(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 lead, with ai_paused true.