Create contact
Add one contact, optionally to a list and with tags.
Scope: contacts:write.
POST
/
contacts
Create contact
curl --request POST \
--url https://app.telaven.com/api/v1/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "0712345678",
"name": "Jane Wanjiku",
"email": "jane@example.com",
"listId": "c51e…",
"tags": [
"vip",
"nairobi"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone: '0712345678',
name: 'Jane Wanjiku',
email: 'jane@example.com',
listId: 'c51e…',
tags: ['vip', 'nairobi']
})
};
fetch('https://app.telaven.com/api/v1/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.telaven.com/api/v1/contacts"
payload = {
"phone": "0712345678",
"name": "Jane Wanjiku",
"email": "jane@example.com",
"listId": "c51e…",
"tags": ["vip", "nairobi"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.telaven.com/api/v1/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([
'phone' => '0712345678',
'name' => 'Jane Wanjiku',
'email' => 'jane@example.com',
'listId' => 'c51e…',
'tags' => [
'vip',
'nairobi'
]
]),
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;
}using RestSharp;
var options = new RestClientOptions("https://app.telaven.com/api/v1/contacts");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"phone\": \"0712345678\",\n \"name\": \"Jane Wanjiku\",\n \"email\": \"jane@example.com\",\n \"listId\": \"c51e…\",\n \"tags\": [\n \"vip\",\n \"nairobi\"\n ]\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"success": true,
"data": {
"id": "d4c1…",
"phone": "0712345678",
"name": "Jane Wanjiku",
"tags": [
"vip",
"nairobi"
]
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Headers
Body
application/json
Response
Success
⌘I
Create contact
curl --request POST \
--url https://app.telaven.com/api/v1/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "0712345678",
"name": "Jane Wanjiku",
"email": "jane@example.com",
"listId": "c51e…",
"tags": [
"vip",
"nairobi"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone: '0712345678',
name: 'Jane Wanjiku',
email: 'jane@example.com',
listId: 'c51e…',
tags: ['vip', 'nairobi']
})
};
fetch('https://app.telaven.com/api/v1/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.telaven.com/api/v1/contacts"
payload = {
"phone": "0712345678",
"name": "Jane Wanjiku",
"email": "jane@example.com",
"listId": "c51e…",
"tags": ["vip", "nairobi"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.telaven.com/api/v1/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([
'phone' => '0712345678',
'name' => 'Jane Wanjiku',
'email' => 'jane@example.com',
'listId' => 'c51e…',
'tags' => [
'vip',
'nairobi'
]
]),
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;
}using RestSharp;
var options = new RestClientOptions("https://app.telaven.com/api/v1/contacts");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"phone\": \"0712345678\",\n \"name\": \"Jane Wanjiku\",\n \"email\": \"jane@example.com\",\n \"listId\": \"c51e…\",\n \"tags\": [\n \"vip\",\n \"nairobi\"\n ]\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"success": true,
"data": {
"id": "d4c1…",
"phone": "0712345678",
"name": "Jane Wanjiku",
"tags": [
"vip",
"nairobi"
]
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}