Create a lead
Creates a new lead
curl --request POST \
--url https://api.attent.app/v1/leads/create \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"firstName": "John",
"lastName": "Doe",
"phone": "+15555555555",
"customerProfile": "My Customer Profile",
"timeZone": "America/New_York",
"email": "example@gmail.com",
"outboundPhone": "+15551234567",
"scheduledImportAt": "2027-12-15T18:30:00Z",
"additionalInfo": {
"key1": "value1",
"key2": "value2"
}
}
'import requests
url = "https://api.attent.app/v1/leads/create"
payload = {
"firstName": "John",
"lastName": "Doe",
"phone": "+15555555555",
"customerProfile": "My Customer Profile",
"timeZone": "America/New_York",
"email": "example@gmail.com",
"outboundPhone": "+15551234567",
"scheduledImportAt": "2027-12-15T18:30:00Z",
"additionalInfo": {
"key1": "value1",
"key2": "value2"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
firstName: 'John',
lastName: 'Doe',
phone: '+15555555555',
customerProfile: 'My Customer Profile',
timeZone: 'America/New_York',
email: 'example@gmail.com',
outboundPhone: '+15551234567',
scheduledImportAt: '2027-12-15T18:30:00Z',
additionalInfo: {key1: 'value1', key2: 'value2'}
})
};
fetch('https://api.attent.app/v1/leads/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.attent.app/v1/leads/create",
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([
'firstName' => 'John',
'lastName' => 'Doe',
'phone' => '+15555555555',
'customerProfile' => 'My Customer Profile',
'timeZone' => 'America/New_York',
'email' => 'example@gmail.com',
'outboundPhone' => '+15551234567',
'scheduledImportAt' => '2027-12-15T18:30:00Z',
'additionalInfo' => [
'key1' => 'value1',
'key2' => 'value2'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.attent.app/v1/leads/create"
payload := strings.NewReader("{\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"phone\": \"+15555555555\",\n \"customerProfile\": \"My Customer Profile\",\n \"timeZone\": \"America/New_York\",\n \"email\": \"example@gmail.com\",\n \"outboundPhone\": \"+15551234567\",\n \"scheduledImportAt\": \"2027-12-15T18:30:00Z\",\n \"additionalInfo\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.attent.app/v1/leads/create")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"phone\": \"+15555555555\",\n \"customerProfile\": \"My Customer Profile\",\n \"timeZone\": \"America/New_York\",\n \"email\": \"example@gmail.com\",\n \"outboundPhone\": \"+15551234567\",\n \"scheduledImportAt\": \"2027-12-15T18:30:00Z\",\n \"additionalInfo\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attent.app/v1/leads/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"phone\": \"+15555555555\",\n \"customerProfile\": \"My Customer Profile\",\n \"timeZone\": \"America/New_York\",\n \"email\": \"example@gmail.com\",\n \"outboundPhone\": \"+15551234567\",\n \"scheduledImportAt\": \"2027-12-15T18:30:00Z\",\n \"additionalInfo\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "Lead created successfully."
}{
"message": "Lead already exists."
}{
"message": "Forbidden"
}{
"message": "Max leads reached for this month."
}{
"message": "Internal Server Error"
}Authorizations
Body
Lead to create. Phone number must be unique.
The first name of the lead.
The last name of the lead.
The phone number must begin with an area code (+) and can contain digits, spaces, parentheses, and hyphens (e.g. +1 (555) 555-5555)
The name of the customer profile to which this lead should belong to.
The timezone of the lead in tz database format (e.g. America/New_York, Europe/London).
The email address of the lead. Must be a valid email format (e.g. user@domain.com).
The phone number to use for outbound texts and calls to this lead. Must be a phone number configured for your organization. If not specified, the organization default phone number will be used.
An optional key-value object containing additional information to store with the lead.
Optional. If set, the lead is imported now but the first outbound message is deferred until this time.
Must be an ISO 8601 timestamp with seconds and an explicit timezone offset (e.g. 2027-12-15T18:30:00Z or 2027-12-15T13:30:00-05:00), must be strictly in the future, and must be no more than 365 days from now.
When this is provided, it overrides your organization's business-hours, allowed-days, and holiday adjustments.
"2027-12-15T18:30:00Z"
curl --request POST \
--url https://api.attent.app/v1/leads/create \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"firstName": "John",
"lastName": "Doe",
"phone": "+15555555555",
"customerProfile": "My Customer Profile",
"timeZone": "America/New_York",
"email": "example@gmail.com",
"outboundPhone": "+15551234567",
"scheduledImportAt": "2027-12-15T18:30:00Z",
"additionalInfo": {
"key1": "value1",
"key2": "value2"
}
}
'import requests
url = "https://api.attent.app/v1/leads/create"
payload = {
"firstName": "John",
"lastName": "Doe",
"phone": "+15555555555",
"customerProfile": "My Customer Profile",
"timeZone": "America/New_York",
"email": "example@gmail.com",
"outboundPhone": "+15551234567",
"scheduledImportAt": "2027-12-15T18:30:00Z",
"additionalInfo": {
"key1": "value1",
"key2": "value2"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
firstName: 'John',
lastName: 'Doe',
phone: '+15555555555',
customerProfile: 'My Customer Profile',
timeZone: 'America/New_York',
email: 'example@gmail.com',
outboundPhone: '+15551234567',
scheduledImportAt: '2027-12-15T18:30:00Z',
additionalInfo: {key1: 'value1', key2: 'value2'}
})
};
fetch('https://api.attent.app/v1/leads/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.attent.app/v1/leads/create",
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([
'firstName' => 'John',
'lastName' => 'Doe',
'phone' => '+15555555555',
'customerProfile' => 'My Customer Profile',
'timeZone' => 'America/New_York',
'email' => 'example@gmail.com',
'outboundPhone' => '+15551234567',
'scheduledImportAt' => '2027-12-15T18:30:00Z',
'additionalInfo' => [
'key1' => 'value1',
'key2' => 'value2'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.attent.app/v1/leads/create"
payload := strings.NewReader("{\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"phone\": \"+15555555555\",\n \"customerProfile\": \"My Customer Profile\",\n \"timeZone\": \"America/New_York\",\n \"email\": \"example@gmail.com\",\n \"outboundPhone\": \"+15551234567\",\n \"scheduledImportAt\": \"2027-12-15T18:30:00Z\",\n \"additionalInfo\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.attent.app/v1/leads/create")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"phone\": \"+15555555555\",\n \"customerProfile\": \"My Customer Profile\",\n \"timeZone\": \"America/New_York\",\n \"email\": \"example@gmail.com\",\n \"outboundPhone\": \"+15551234567\",\n \"scheduledImportAt\": \"2027-12-15T18:30:00Z\",\n \"additionalInfo\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attent.app/v1/leads/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"phone\": \"+15555555555\",\n \"customerProfile\": \"My Customer Profile\",\n \"timeZone\": \"America/New_York\",\n \"email\": \"example@gmail.com\",\n \"outboundPhone\": \"+15551234567\",\n \"scheduledImportAt\": \"2027-12-15T18:30:00Z\",\n \"additionalInfo\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "Lead created successfully."
}{
"message": "Lead already exists."
}{
"message": "Forbidden"
}{
"message": "Max leads reached for this month."
}{
"message": "Internal Server Error"
}
