Contact
Create Contact
Create a new contact.
POST
JavaScript
Authorizations
Body
application/json
Response
Contact created.
JavaScript
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create a new contact.
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.create({ phone_number: '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.create(
phone_number="phone_number",
)
print(contact_response.contact_id)curl --request POST \
--url https://api.retellai.com/create-contact \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"do_not_call": true,
"contact_memory": "<string>",
"contact_tag_ids": [
"<string>"
],
"custom_fields": {}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.retellai.com/create-contact",
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([
'phone_number' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'do_not_call' => true,
'contact_memory' => '<string>',
'contact_tag_ids' => [
'<string>'
],
'custom_fields' => [
]
]),
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/create-contact"
payload := strings.NewReader("{\n \"phone_number\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"do_not_call\": true,\n \"contact_memory\": \"<string>\",\n \"contact_tag_ids\": [\n \"<string>\"\n ],\n \"custom_fields\": {}\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/create-contact")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"do_not_call\": true,\n \"contact_memory\": \"<string>\",\n \"contact_tag_ids\": [\n \"<string>\"\n ],\n \"custom_fields\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.retellai.com/create-contact")
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 \"phone_number\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"do_not_call\": true,\n \"contact_memory\": \"<string>\",\n \"contact_tag_ids\": [\n \"<string>\"\n ],\n \"custom_fields\": {}\n}"
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": "Account rate limited, please throttle your requests."
}{
"status": "error",
"message": "An unexpected server error occurred."
}Contact created.
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.create({ phone_number: '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.create(
phone_number="phone_number",
)
print(contact_response.contact_id)curl --request POST \
--url https://api.retellai.com/create-contact \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"do_not_call": true,
"contact_memory": "<string>",
"contact_tag_ids": [
"<string>"
],
"custom_fields": {}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.retellai.com/create-contact",
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([
'phone_number' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'do_not_call' => true,
'contact_memory' => '<string>',
'contact_tag_ids' => [
'<string>'
],
'custom_fields' => [
]
]),
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/create-contact"
payload := strings.NewReader("{\n \"phone_number\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"do_not_call\": true,\n \"contact_memory\": \"<string>\",\n \"contact_tag_ids\": [\n \"<string>\"\n ],\n \"custom_fields\": {}\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/create-contact")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"do_not_call\": true,\n \"contact_memory\": \"<string>\",\n \"contact_tag_ids\": [\n \"<string>\"\n ],\n \"custom_fields\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.retellai.com/create-contact")
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 \"phone_number\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"do_not_call\": true,\n \"contact_memory\": \"<string>\",\n \"contact_tag_ids\": [\n \"<string>\"\n ],\n \"custom_fields\": {}\n}"
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": "Account rate limited, please throttle your requests."
}{
"status": "error",
"message": "An unexpected server error occurred."
}