import Retell from 'retell-sdk';
const client = new Retell({
apiKey: process.env['RETELL_API_KEY'], // This is the default and can be omitted
});
const contacts = await client.contact.list();
console.log(contacts.has_more);import os
from retell import Retell
client = Retell(
api_key=os.environ.get("RETELL_API_KEY"), # This is the default and can be omitted
)
contacts = client.contact.list()
print(contacts.has_more)curl --request POST \
--url https://api.retellai.com/list-contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"limit": 50,
"skip": 0,
"sort_order": "desc",
"pagination_key": "<string>",
"filter_criteria": {
"external_id": {
"type": "string",
"value": "<string>"
},
"last_conversation_timestamp": {
"type": "number",
"value": 123
},
"custom_fields": [
{
"type": "string",
"value": "<string>",
"key": "<string>"
}
]
},
"search_query": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.retellai.com/list-contacts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'limit' => 50,
'skip' => 0,
'sort_order' => 'desc',
'pagination_key' => '<string>',
'filter_criteria' => [
'external_id' => [
'type' => 'string',
'value' => '<string>'
],
'last_conversation_timestamp' => [
'type' => 'number',
'value' => 123
],
'custom_fields' => [
[
'type' => 'string',
'value' => '<string>',
'key' => '<string>'
]
]
],
'search_query' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.retellai.com/list-contacts"
payload := strings.NewReader("{\n \"limit\": 50,\n \"skip\": 0,\n \"sort_order\": \"desc\",\n \"pagination_key\": \"<string>\",\n \"filter_criteria\": {\n \"external_id\": {\n \"type\": \"string\",\n \"value\": \"<string>\"\n },\n \"last_conversation_timestamp\": {\n \"type\": \"number\",\n \"value\": 123\n },\n \"custom_fields\": [\n {\n \"type\": \"string\",\n \"value\": \"<string>\",\n \"key\": \"<string>\"\n }\n ]\n },\n \"search_query\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.retellai.com/list-contacts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"limit\": 50,\n \"skip\": 0,\n \"sort_order\": \"desc\",\n \"pagination_key\": \"<string>\",\n \"filter_criteria\": {\n \"external_id\": {\n \"type\": \"string\",\n \"value\": \"<string>\"\n },\n \"last_conversation_timestamp\": {\n \"type\": \"number\",\n \"value\": 123\n },\n \"custom_fields\": [\n {\n \"type\": \"string\",\n \"value\": \"<string>\",\n \"key\": \"<string>\"\n }\n ]\n },\n \"search_query\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.retellai.com/list-contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"limit\": 50,\n \"skip\": 0,\n \"sort_order\": \"desc\",\n \"pagination_key\": \"<string>\",\n \"filter_criteria\": {\n \"external_id\": {\n \"type\": \"string\",\n \"value\": \"<string>\"\n },\n \"last_conversation_timestamp\": {\n \"type\": \"number\",\n \"value\": 123\n },\n \"custom_fields\": [\n {\n \"type\": \"string\",\n \"value\": \"<string>\",\n \"key\": \"<string>\"\n }\n ]\n },\n \"search_query\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"contact_id": "<string>",
"org_id": "<string>",
"phone_number": "<string>",
"created_timestamp": 123,
"first_name": "<string>",
"last_name": "<string>",
"do_not_call": true,
"external_id": "<string>",
"custom_fields": {},
"conversation_count": 123,
"last_conversation_timestamp": 123,
"user_modified_timestamp": 123
}
],
"pagination_key": "<string>",
"has_more": true,
"total": 123
}{
"status": "error",
"message": "Invalid request format, please check API reference."
}{
"status": "error",
"message": "API key is missing or invalid."
}{
"status": "error",
"message": "Account rate limited, please throttle your requests."
}{
"status": "error",
"message": "An unexpected server error occurred."
}List Contacts
List contacts, newest conversation first by default, with the total count of matches alongside the page. Page through results with pagination_key; skip is available for offset-style paging but is slower on large contact sets and can repeat or miss rows as contacts are updated.
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: process.env['RETELL_API_KEY'], // This is the default and can be omitted
});
const contacts = await client.contact.list();
console.log(contacts.has_more);import os
from retell import Retell
client = Retell(
api_key=os.environ.get("RETELL_API_KEY"), # This is the default and can be omitted
)
contacts = client.contact.list()
print(contacts.has_more)curl --request POST \
--url https://api.retellai.com/list-contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"limit": 50,
"skip": 0,
"sort_order": "desc",
"pagination_key": "<string>",
"filter_criteria": {
"external_id": {
"type": "string",
"value": "<string>"
},
"last_conversation_timestamp": {
"type": "number",
"value": 123
},
"custom_fields": [
{
"type": "string",
"value": "<string>",
"key": "<string>"
}
]
},
"search_query": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.retellai.com/list-contacts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'limit' => 50,
'skip' => 0,
'sort_order' => 'desc',
'pagination_key' => '<string>',
'filter_criteria' => [
'external_id' => [
'type' => 'string',
'value' => '<string>'
],
'last_conversation_timestamp' => [
'type' => 'number',
'value' => 123
],
'custom_fields' => [
[
'type' => 'string',
'value' => '<string>',
'key' => '<string>'
]
]
],
'search_query' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.retellai.com/list-contacts"
payload := strings.NewReader("{\n \"limit\": 50,\n \"skip\": 0,\n \"sort_order\": \"desc\",\n \"pagination_key\": \"<string>\",\n \"filter_criteria\": {\n \"external_id\": {\n \"type\": \"string\",\n \"value\": \"<string>\"\n },\n \"last_conversation_timestamp\": {\n \"type\": \"number\",\n \"value\": 123\n },\n \"custom_fields\": [\n {\n \"type\": \"string\",\n \"value\": \"<string>\",\n \"key\": \"<string>\"\n }\n ]\n },\n \"search_query\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.retellai.com/list-contacts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"limit\": 50,\n \"skip\": 0,\n \"sort_order\": \"desc\",\n \"pagination_key\": \"<string>\",\n \"filter_criteria\": {\n \"external_id\": {\n \"type\": \"string\",\n \"value\": \"<string>\"\n },\n \"last_conversation_timestamp\": {\n \"type\": \"number\",\n \"value\": 123\n },\n \"custom_fields\": [\n {\n \"type\": \"string\",\n \"value\": \"<string>\",\n \"key\": \"<string>\"\n }\n ]\n },\n \"search_query\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.retellai.com/list-contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"limit\": 50,\n \"skip\": 0,\n \"sort_order\": \"desc\",\n \"pagination_key\": \"<string>\",\n \"filter_criteria\": {\n \"external_id\": {\n \"type\": \"string\",\n \"value\": \"<string>\"\n },\n \"last_conversation_timestamp\": {\n \"type\": \"number\",\n \"value\": 123\n },\n \"custom_fields\": [\n {\n \"type\": \"string\",\n \"value\": \"<string>\",\n \"key\": \"<string>\"\n }\n ]\n },\n \"search_query\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"contact_id": "<string>",
"org_id": "<string>",
"phone_number": "<string>",
"created_timestamp": 123,
"first_name": "<string>",
"last_name": "<string>",
"do_not_call": true,
"external_id": "<string>",
"custom_fields": {},
"conversation_count": 123,
"last_conversation_timestamp": 123,
"user_modified_timestamp": 123
}
],
"pagination_key": "<string>",
"has_more": true,
"total": 123
}{
"status": "error",
"message": "Invalid request format, please check API reference."
}{
"status": "error",
"message": "API key is missing or invalid."
}{
"status": "error",
"message": "Account rate limited, please throttle your requests."
}{
"status": "error",
"message": "An unexpected server error occurred."
}Authorizations
Authentication header containing API key (find it in dashboard). The format is "Bearer YOUR_API_KEY"
Body
Maximum number of contacts to return.
1 <= x <= 1000Number of records to skip for offset-based pagination.
x >= 0Sort contacts by last_conversation_timestamp in ascending or descending order. Contacts that have never been contacted sort as if their timestamp were 0.
asc, desc Base64url-encoded pagination key from a previous response.
Filter criteria for contacts. All conditions are implicitly connected with AND. first_name and last_name are not filterable here; use search_query to match on those.
Show child attributes
Show child attributes
Case-insensitive substring match against phone number, first name, last name, external ID, and custom field values. This is the only way to match on a contact's name.
Was this page helpful?

