Create a subscriber
curl --request POST \
--url https://api.kit.com/v4/subscribers \
--header 'Content-Type: application/json' \
--header 'X-Kit-Api-Key: <api-key>' \
--data '
{
"first_name": "Alice",
"email_address": "alice@convertkit.dev",
"state": "active",
"fields": {
"last_name": "Lamarr",
"birthday": "Feb 17",
"source": "landing page",
"role": "Software developer",
"company": "Convertkit",
"postal_code": "83702",
"website": "convertkit.com",
"social_media": "https://www.linkedin.com/company/convertkit",
"how_did_you_hear_about_us": "Social media",
"interests": "Monetization",
"coupon": "",
"phone_number": "555-555-5555",
"enrolled_in_coaching": "true",
"lead_score": "87"
}
}
'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/subscribers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Kit-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"Alice\",\n \"email_address\": \"alice@convertkit.dev\",\n \"state\": \"active\",\n \"fields\": {\n \"last_name\": \"Lamarr\",\n \"birthday\": \"Feb 17\",\n \"source\": \"landing page\",\n \"role\": \"Software developer\",\n \"company\": \"Convertkit\",\n \"postal_code\": \"83702\",\n \"website\": \"convertkit.com\",\n \"social_media\": \"https://www.linkedin.com/company/convertkit\",\n \"how_did_you_hear_about_us\": \"Social media\",\n \"interests\": \"Monetization\",\n \"coupon\": \"\",\n \"phone_number\": \"555-555-5555\",\n \"enrolled_in_coaching\": \"true\",\n \"lead_score\": \"87\"\n }\n}"
response = http.request(request)
puts response.read_bodyconst options = {
method: 'POST',
headers: {'X-Kit-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
first_name: 'Alice',
email_address: 'alice@convertkit.dev',
state: 'active',
fields: {
last_name: 'Lamarr',
birthday: 'Feb 17',
source: 'landing page',
role: 'Software developer',
company: 'Convertkit',
postal_code: '83702',
website: 'convertkit.com',
social_media: 'https://www.linkedin.com/company/convertkit',
how_did_you_hear_about_us: 'Social media',
interests: 'Monetization',
coupon: '',
phone_number: '555-555-5555',
enrolled_in_coaching: 'true',
lead_score: '87'
}
})
};
fetch('https://api.kit.com/v4/subscribers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kit.com/v4/subscribers"
payload := strings.NewReader("{\n \"first_name\": \"Alice\",\n \"email_address\": \"alice@convertkit.dev\",\n \"state\": \"active\",\n \"fields\": {\n \"last_name\": \"Lamarr\",\n \"birthday\": \"Feb 17\",\n \"source\": \"landing page\",\n \"role\": \"Software developer\",\n \"company\": \"Convertkit\",\n \"postal_code\": \"83702\",\n \"website\": \"convertkit.com\",\n \"social_media\": \"https://www.linkedin.com/company/convertkit\",\n \"how_did_you_hear_about_us\": \"Social media\",\n \"interests\": \"Monetization\",\n \"coupon\": \"\",\n \"phone_number\": \"555-555-5555\",\n \"enrolled_in_coaching\": \"true\",\n \"lead_score\": \"87\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Kit-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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kit.com/v4/subscribers",
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([
'first_name' => 'Alice',
'email_address' => 'alice@convertkit.dev',
'state' => 'active',
'fields' => [
'last_name' => 'Lamarr',
'birthday' => 'Feb 17',
'source' => 'landing page',
'role' => 'Software developer',
'company' => 'Convertkit',
'postal_code' => '83702',
'website' => 'convertkit.com',
'social_media' => 'https://www.linkedin.com/company/convertkit',
'how_did_you_hear_about_us' => 'Social media',
'interests' => 'Monetization',
'coupon' => '',
'phone_number' => '555-555-5555',
'enrolled_in_coaching' => 'true',
'lead_score' => '87'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Kit-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.kit.com/v4/subscribers"
payload = {
"first_name": "Alice",
"email_address": "alice@convertkit.dev",
"state": "active",
"fields": {
"last_name": "Lamarr",
"birthday": "Feb 17",
"source": "landing page",
"role": "Software developer",
"company": "Convertkit",
"postal_code": "83702",
"website": "convertkit.com",
"social_media": "https://www.linkedin.com/company/convertkit",
"how_did_you_hear_about_us": "Social media",
"interests": "Monetization",
"coupon": "",
"phone_number": "555-555-5555",
"enrolled_in_coaching": "true",
"lead_score": "87"
}
}
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"subscriber": {
"id": 357,
"first_name": "Alice",
"email_address": "alice@convertkit.dev",
"state": "inactive",
"created_at": "2023-02-17T11:43:55Z",
"fields": {}
}
}{
"subscriber": {
"id": 353,
"first_name": "Alice",
"email_address": "alice@convertkit.dev",
"state": "active",
"created_at": "2023-02-17T11:43:55Z",
"fields": {
"birthday": "Feb 17",
"last_name": "Lamarr",
"source": "landing page"
}
}
}{
"subscriber": {
"id": 355,
"first_name": "Alice",
"email_address": "alice@convertkit.dev",
"state": "active",
"created_at": "2023-02-17T11:43:55Z",
"fields": {
"company": null,
"coupon": null,
"enrolled_in_coaching": null,
"how_did_you_hear_about_us": null,
"interests": null,
"lead_score": null,
"phone_number": null,
"postal_code": null,
"role": null,
"social_media": null,
"website": null
}
}
}{
"errors": [
"The access token is invalid"
]
}{
"errors": [
"Email address is invalid"
]
}Subscribers
Create a subscriber
Behaves as an upsert. If a subscriber with the provided email address does not exist, it creates one with the specified first name and state. If a subscriber with the provided email address already exists, it updates the first name.
If you include a custom field key that does not exist on your account, the request returns an error. Use List custom fields to retrieve existing keys, or Create a custom field to add new fields before setting them for subscribers.
NOTE: Updating the subscriber state with this endpoint is not supported at this time.
NOTE: We support creating/updating a maximum of 140 custom fields at a time.
POST
/
v4
/
subscribers
Create a subscriber
curl --request POST \
--url https://api.kit.com/v4/subscribers \
--header 'Content-Type: application/json' \
--header 'X-Kit-Api-Key: <api-key>' \
--data '
{
"first_name": "Alice",
"email_address": "alice@convertkit.dev",
"state": "active",
"fields": {
"last_name": "Lamarr",
"birthday": "Feb 17",
"source": "landing page",
"role": "Software developer",
"company": "Convertkit",
"postal_code": "83702",
"website": "convertkit.com",
"social_media": "https://www.linkedin.com/company/convertkit",
"how_did_you_hear_about_us": "Social media",
"interests": "Monetization",
"coupon": "",
"phone_number": "555-555-5555",
"enrolled_in_coaching": "true",
"lead_score": "87"
}
}
'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/subscribers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Kit-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"Alice\",\n \"email_address\": \"alice@convertkit.dev\",\n \"state\": \"active\",\n \"fields\": {\n \"last_name\": \"Lamarr\",\n \"birthday\": \"Feb 17\",\n \"source\": \"landing page\",\n \"role\": \"Software developer\",\n \"company\": \"Convertkit\",\n \"postal_code\": \"83702\",\n \"website\": \"convertkit.com\",\n \"social_media\": \"https://www.linkedin.com/company/convertkit\",\n \"how_did_you_hear_about_us\": \"Social media\",\n \"interests\": \"Monetization\",\n \"coupon\": \"\",\n \"phone_number\": \"555-555-5555\",\n \"enrolled_in_coaching\": \"true\",\n \"lead_score\": \"87\"\n }\n}"
response = http.request(request)
puts response.read_bodyconst options = {
method: 'POST',
headers: {'X-Kit-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
first_name: 'Alice',
email_address: 'alice@convertkit.dev',
state: 'active',
fields: {
last_name: 'Lamarr',
birthday: 'Feb 17',
source: 'landing page',
role: 'Software developer',
company: 'Convertkit',
postal_code: '83702',
website: 'convertkit.com',
social_media: 'https://www.linkedin.com/company/convertkit',
how_did_you_hear_about_us: 'Social media',
interests: 'Monetization',
coupon: '',
phone_number: '555-555-5555',
enrolled_in_coaching: 'true',
lead_score: '87'
}
})
};
fetch('https://api.kit.com/v4/subscribers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kit.com/v4/subscribers"
payload := strings.NewReader("{\n \"first_name\": \"Alice\",\n \"email_address\": \"alice@convertkit.dev\",\n \"state\": \"active\",\n \"fields\": {\n \"last_name\": \"Lamarr\",\n \"birthday\": \"Feb 17\",\n \"source\": \"landing page\",\n \"role\": \"Software developer\",\n \"company\": \"Convertkit\",\n \"postal_code\": \"83702\",\n \"website\": \"convertkit.com\",\n \"social_media\": \"https://www.linkedin.com/company/convertkit\",\n \"how_did_you_hear_about_us\": \"Social media\",\n \"interests\": \"Monetization\",\n \"coupon\": \"\",\n \"phone_number\": \"555-555-5555\",\n \"enrolled_in_coaching\": \"true\",\n \"lead_score\": \"87\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Kit-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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kit.com/v4/subscribers",
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([
'first_name' => 'Alice',
'email_address' => 'alice@convertkit.dev',
'state' => 'active',
'fields' => [
'last_name' => 'Lamarr',
'birthday' => 'Feb 17',
'source' => 'landing page',
'role' => 'Software developer',
'company' => 'Convertkit',
'postal_code' => '83702',
'website' => 'convertkit.com',
'social_media' => 'https://www.linkedin.com/company/convertkit',
'how_did_you_hear_about_us' => 'Social media',
'interests' => 'Monetization',
'coupon' => '',
'phone_number' => '555-555-5555',
'enrolled_in_coaching' => 'true',
'lead_score' => '87'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Kit-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.kit.com/v4/subscribers"
payload = {
"first_name": "Alice",
"email_address": "alice@convertkit.dev",
"state": "active",
"fields": {
"last_name": "Lamarr",
"birthday": "Feb 17",
"source": "landing page",
"role": "Software developer",
"company": "Convertkit",
"postal_code": "83702",
"website": "convertkit.com",
"social_media": "https://www.linkedin.com/company/convertkit",
"how_did_you_hear_about_us": "Social media",
"interests": "Monetization",
"coupon": "",
"phone_number": "555-555-5555",
"enrolled_in_coaching": "true",
"lead_score": "87"
}
}
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"subscriber": {
"id": 357,
"first_name": "Alice",
"email_address": "alice@convertkit.dev",
"state": "inactive",
"created_at": "2023-02-17T11:43:55Z",
"fields": {}
}
}{
"subscriber": {
"id": 353,
"first_name": "Alice",
"email_address": "alice@convertkit.dev",
"state": "active",
"created_at": "2023-02-17T11:43:55Z",
"fields": {
"birthday": "Feb 17",
"last_name": "Lamarr",
"source": "landing page"
}
}
}{
"subscriber": {
"id": 355,
"first_name": "Alice",
"email_address": "alice@convertkit.dev",
"state": "active",
"created_at": "2023-02-17T11:43:55Z",
"fields": {
"company": null,
"coupon": null,
"enrolled_in_coaching": null,
"how_did_you_hear_about_us": null,
"interests": null,
"lead_score": null,
"phone_number": null,
"postal_code": null,
"role": null,
"social_media": null,
"website": null
}
}
}{
"errors": [
"The access token is invalid"
]
}{
"errors": [
"Email address is invalid"
]
}Authorizations
API KeyOAuth2
Body
application/json
Was this page helpful?