curl --request POST \
--url https://api.indiepitcher.com/v1/contacts/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "john@acme.com",
"userId": "1234567",
"avatarUrl": "https://example.com/avatar.jpg",
"name": "John Doe",
"languageCode": "en_US",
"updateIfExists": true,
"ignoreListSubscriptionsWhenUpdating": true,
"subscribedToLists": [
"onboarding",
"newsletter"
],
"customProperties": {
"company": "Acme",
"age": 35
}
}
'import requests
url = "https://api.indiepitcher.com/v1/contacts/create"
payload = {
"email": "john@acme.com",
"userId": "1234567",
"avatarUrl": "https://example.com/avatar.jpg",
"name": "John Doe",
"languageCode": "en_US",
"updateIfExists": True,
"ignoreListSubscriptionsWhenUpdating": True,
"subscribedToLists": ["onboarding", "newsletter"],
"customProperties": {
"company": "Acme",
"age": 35
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'john@acme.com',
userId: '1234567',
avatarUrl: 'https://example.com/avatar.jpg',
name: 'John Doe',
languageCode: 'en_US',
updateIfExists: true,
ignoreListSubscriptionsWhenUpdating: true,
subscribedToLists: ['onboarding', 'newsletter'],
customProperties: {company: 'Acme', age: 35}
})
};
fetch('https://api.indiepitcher.com/v1/contacts/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.indiepitcher.com/v1/contacts/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([
'email' => 'john@acme.com',
'userId' => '1234567',
'avatarUrl' => 'https://example.com/avatar.jpg',
'name' => 'John Doe',
'languageCode' => 'en_US',
'updateIfExists' => true,
'ignoreListSubscriptionsWhenUpdating' => true,
'subscribedToLists' => [
'onboarding',
'newsletter'
],
'customProperties' => [
'company' => 'Acme',
'age' => 35
]
]),
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.indiepitcher.com/v1/contacts/create"
payload := strings.NewReader("{\n \"email\": \"john@acme.com\",\n \"userId\": \"1234567\",\n \"avatarUrl\": \"https://example.com/avatar.jpg\",\n \"name\": \"John Doe\",\n \"languageCode\": \"en_US\",\n \"updateIfExists\": true,\n \"ignoreListSubscriptionsWhenUpdating\": true,\n \"subscribedToLists\": [\n \"onboarding\",\n \"newsletter\"\n ],\n \"customProperties\": {\n \"company\": \"Acme\",\n \"age\": 35\n }\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.indiepitcher.com/v1/contacts/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"john@acme.com\",\n \"userId\": \"1234567\",\n \"avatarUrl\": \"https://example.com/avatar.jpg\",\n \"name\": \"John Doe\",\n \"languageCode\": \"en_US\",\n \"updateIfExists\": true,\n \"ignoreListSubscriptionsWhenUpdating\": true,\n \"subscribedToLists\": [\n \"onboarding\",\n \"newsletter\"\n ],\n \"customProperties\": {\n \"company\": \"Acme\",\n \"age\": 35\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.indiepitcher.com/v1/contacts/create")
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 \"email\": \"john@acme.com\",\n \"userId\": \"1234567\",\n \"avatarUrl\": \"https://example.com/avatar.jpg\",\n \"name\": \"John Doe\",\n \"languageCode\": \"en_US\",\n \"updateIfExists\": true,\n \"ignoreListSubscriptionsWhenUpdating\": true,\n \"subscribedToLists\": [\n \"onboarding\",\n \"newsletter\"\n ],\n \"customProperties\": {\n \"company\": \"Acme\",\n \"age\": 35\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"email": "john@acme.com",
"userId": 123456,
"name": "John Doe",
"avatarUrl": "https://example.com/profile_pictures/123456",
"languageCode": "en-US",
"hardBouncedAt": "2024-04-23T18:25:43.511Z",
"subscribedToLists": [
"onboarding",
"newsletter"
],
"customProperties": {
"company": "Acme",
"age": 35
}
}
}Add a new contact
Add a new contact to the mailing list, or update an existing one if updateIfExists is set to true.
curl --request POST \
--url https://api.indiepitcher.com/v1/contacts/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "john@acme.com",
"userId": "1234567",
"avatarUrl": "https://example.com/avatar.jpg",
"name": "John Doe",
"languageCode": "en_US",
"updateIfExists": true,
"ignoreListSubscriptionsWhenUpdating": true,
"subscribedToLists": [
"onboarding",
"newsletter"
],
"customProperties": {
"company": "Acme",
"age": 35
}
}
'import requests
url = "https://api.indiepitcher.com/v1/contacts/create"
payload = {
"email": "john@acme.com",
"userId": "1234567",
"avatarUrl": "https://example.com/avatar.jpg",
"name": "John Doe",
"languageCode": "en_US",
"updateIfExists": True,
"ignoreListSubscriptionsWhenUpdating": True,
"subscribedToLists": ["onboarding", "newsletter"],
"customProperties": {
"company": "Acme",
"age": 35
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'john@acme.com',
userId: '1234567',
avatarUrl: 'https://example.com/avatar.jpg',
name: 'John Doe',
languageCode: 'en_US',
updateIfExists: true,
ignoreListSubscriptionsWhenUpdating: true,
subscribedToLists: ['onboarding', 'newsletter'],
customProperties: {company: 'Acme', age: 35}
})
};
fetch('https://api.indiepitcher.com/v1/contacts/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.indiepitcher.com/v1/contacts/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([
'email' => 'john@acme.com',
'userId' => '1234567',
'avatarUrl' => 'https://example.com/avatar.jpg',
'name' => 'John Doe',
'languageCode' => 'en_US',
'updateIfExists' => true,
'ignoreListSubscriptionsWhenUpdating' => true,
'subscribedToLists' => [
'onboarding',
'newsletter'
],
'customProperties' => [
'company' => 'Acme',
'age' => 35
]
]),
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.indiepitcher.com/v1/contacts/create"
payload := strings.NewReader("{\n \"email\": \"john@acme.com\",\n \"userId\": \"1234567\",\n \"avatarUrl\": \"https://example.com/avatar.jpg\",\n \"name\": \"John Doe\",\n \"languageCode\": \"en_US\",\n \"updateIfExists\": true,\n \"ignoreListSubscriptionsWhenUpdating\": true,\n \"subscribedToLists\": [\n \"onboarding\",\n \"newsletter\"\n ],\n \"customProperties\": {\n \"company\": \"Acme\",\n \"age\": 35\n }\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.indiepitcher.com/v1/contacts/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"john@acme.com\",\n \"userId\": \"1234567\",\n \"avatarUrl\": \"https://example.com/avatar.jpg\",\n \"name\": \"John Doe\",\n \"languageCode\": \"en_US\",\n \"updateIfExists\": true,\n \"ignoreListSubscriptionsWhenUpdating\": true,\n \"subscribedToLists\": [\n \"onboarding\",\n \"newsletter\"\n ],\n \"customProperties\": {\n \"company\": \"Acme\",\n \"age\": 35\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.indiepitcher.com/v1/contacts/create")
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 \"email\": \"john@acme.com\",\n \"userId\": \"1234567\",\n \"avatarUrl\": \"https://example.com/avatar.jpg\",\n \"name\": \"John Doe\",\n \"languageCode\": \"en_US\",\n \"updateIfExists\": true,\n \"ignoreListSubscriptionsWhenUpdating\": true,\n \"subscribedToLists\": [\n \"onboarding\",\n \"newsletter\"\n ],\n \"customProperties\": {\n \"company\": \"Acme\",\n \"age\": 35\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"email": "john@acme.com",
"userId": 123456,
"name": "John Doe",
"avatarUrl": "https://example.com/profile_pictures/123456",
"languageCode": "en-US",
"hardBouncedAt": "2024-04-23T18:25:43.511Z",
"subscribedToLists": [
"onboarding",
"newsletter"
],
"customProperties": {
"company": "Acme",
"age": 35
}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The email of the contact.
"john@acme.com"
The user id of the contact.
"1234567"
The avatar url of the contact.
"https://example.com/avatar.jpg"
The full name of the contact.
"John Doe"
The language code of the contact.
"en_US"
If a contact with the provided email already exists, update the contact with the new data.
Whether to ignore subscribedToLists field if the contact already exists and updateIfExists is set to true. Useful to avoid accidentally resubscribing a contact to lists they unsubscribed before. Default value is true.
The array of mailing lists the contact is subscribed to.
["onboarding", "newsletter"]
The custom properties set for this contact.
Show child attributes
Show child attributes
{ "company": "Acme", "age": 35 }
