Contact
Get Contact by Phone
Retrieve a contact by phone number. At most one contact exists per phone number in an organization.
GET
JavaScript
Authorizations
Path Parameters
Response
Contact found.
JavaScript
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Retrieve a contact by phone number. At most one contact exists per phone number in an organization.
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: process.env['RETELL_API_KEY'], // This is the default and can be omitted
});
const contactResponse = await client.contact.getByPhone('phone_number');
console.log(contactResponse.contact_id);import os
from retell import Retell
client = Retell(
api_key=os.environ.get("RETELL_API_KEY"), # This is the default and can be omitted
)
contact_response = client.contact.get_by_phone(
"phone_number",
)
print(contact_response.contact_id)curl --request GET \
--url https://api.retellai.com/get-contact-by-phone/{phone_number} \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.retellai.com/get-contact-by-phone/{phone_number}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.retellai.com/get-contact-by-phone/{phone_number}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.retellai.com/get-contact-by-phone/{phone_number}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.retellai.com/get-contact-by-phone/{phone_number}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"contact_id": "<string>",
"org_id": "<string>",
"phone_number": "<string>",
"created_timestamp": 123,
"first_name": "<string>",
"last_name": "<string>",
"do_not_call": true,
"contact_memory": "<string>",
"external_id": "<string>",
"contact_tags": [
{
"id": "<string>",
"label": "<string>"
}
],
"custom_fields": {},
"conversation_count": 123,
"last_conversation_timestamp": 123,
"user_modified_timestamp": 123
}{
"status": "error",
"message": "Invalid request format, please check API reference."
}{
"status": "error",
"message": "API key is missing or invalid."
}{
"status": "error",
"message": "The requested resource was not found."
}{
"status": "error",
"message": "Account rate limited, please throttle your requests."
}{
"status": "error",
"message": "An unexpected server error occurred."
}Contact found.
Was this page helpful?
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: process.env['RETELL_API_KEY'], // This is the default and can be omitted
});
const contactResponse = await client.contact.getByPhone('phone_number');
console.log(contactResponse.contact_id);import os
from retell import Retell
client = Retell(
api_key=os.environ.get("RETELL_API_KEY"), # This is the default and can be omitted
)
contact_response = client.contact.get_by_phone(
"phone_number",
)
print(contact_response.contact_id)curl --request GET \
--url https://api.retellai.com/get-contact-by-phone/{phone_number} \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.retellai.com/get-contact-by-phone/{phone_number}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.retellai.com/get-contact-by-phone/{phone_number}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.retellai.com/get-contact-by-phone/{phone_number}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.retellai.com/get-contact-by-phone/{phone_number}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"contact_id": "<string>",
"org_id": "<string>",
"phone_number": "<string>",
"created_timestamp": 123,
"first_name": "<string>",
"last_name": "<string>",
"do_not_call": true,
"contact_memory": "<string>",
"external_id": "<string>",
"contact_tags": [
{
"id": "<string>",
"label": "<string>"
}
],
"custom_fields": {},
"conversation_count": 123,
"last_conversation_timestamp": 123,
"user_modified_timestamp": 123
}{
"status": "error",
"message": "Invalid request format, please check API reference."
}{
"status": "error",
"message": "API key is missing or invalid."
}{
"status": "error",
"message": "The requested resource was not found."
}{
"status": "error",
"message": "Account rate limited, please throttle your requests."
}{
"status": "error",
"message": "An unexpected server error occurred."
}