List leads
curl --request GET \
--url https://rest.newlead.ai/v1/leads \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://rest.newlead.ai/v1/leads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://rest.newlead.ai/v1/leads"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"object": "list",
"data": [
{
"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"
}
],
"has_more": true,
"next_cursor": "<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"
}
}Leads
List leads
Leads in your subaccount, newest first, excluding test leads. Encode the + in the phone number as %2B in the URL.
GET
/
leads
List leads
curl --request GET \
--url https://rest.newlead.ai/v1/leads \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://rest.newlead.ai/v1/leads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://rest.newlead.ai/v1/leads"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"object": "list",
"data": [
{
"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"
}
],
"has_more": true,
"next_cursor": "<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