Skip to main content
POST
/
v4
/
forms
/
{form_id}
/
subscribers
/
{id}
Add subscriber to form
curl --request POST \
  --url https://api.kit.com/v4/forms/{form_id}/subscribers/{id} \
  --header 'Content-Type: application/json' \
  --header 'X-Kit-Api-Key: <api-key>' \
  --data '
{
  "referrer": "https://mywebsite.com/bfpromo/?utm_source=facebook&utm_medium=cpc&utm_campaign=black_friday&utm_term=car_owners&utm_content=get_10_off"
}
'
require 'uri'
require 'net/http'

url = URI("https://api.kit.com/v4/forms/{form_id}/subscribers/{id}")

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 \"referrer\": \"https://mywebsite.com/bfpromo/?utm_source=facebook&utm_medium=cpc&utm_campaign=black_friday&utm_term=car_owners&utm_content=get_10_off\"\n}"

response = http.request(request)
puts response.read_body
const options = {
method: 'POST',
headers: {'X-Kit-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
referrer: 'https://mywebsite.com/bfpromo/?utm_source=facebook&utm_medium=cpc&utm_campaign=black_friday&utm_term=car_owners&utm_content=get_10_off'
})
};

fetch('https://api.kit.com/v4/forms/{form_id}/subscribers/{id}', 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/forms/{form_id}/subscribers/{id}"

payload := strings.NewReader("{\n \"referrer\": \"https://mywebsite.com/bfpromo/?utm_source=facebook&utm_medium=cpc&utm_campaign=black_friday&utm_term=car_owners&utm_content=get_10_off\"\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/forms/{form_id}/subscribers/{id}",
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([
'referrer' => 'https://mywebsite.com/bfpromo/?utm_source=facebook&utm_medium=cpc&utm_campaign=black_friday&utm_term=car_owners&utm_content=get_10_off'
]),
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/forms/{form_id}/subscribers/{id}"

payload = { "referrer": "https://mywebsite.com/bfpromo/?utm_source=facebook&utm_medium=cpc&utm_campaign=black_friday&utm_term=car_owners&utm_content=get_10_off" }
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
{
  "subscriber": {
    "id": 760,
    "first_name": "Alice",
    "email_address": "alice@convertkit.dev",
    "state": "active",
    "created_at": "2023-02-17T11:43:55Z",
    "added_at": "2023-02-17T11:43:55Z",
    "fields": {},
    "referrer": "https://mywebsite.com/bfpromo/?utm_source=facebook&utm_medium=cpc&utm_campaign=black_friday&utm_term=car_owners&utm_content=get_10_off",
    "referrer_utm_parameters": {
      "source": "facebook",
      "medium": "cpc",
      "campaign": "black_friday",
      "term": "car_owners",
      "content": "get_10_off"
    }
  }
}
{
"subscriber": {
"id": 762,
"first_name": "Alice",
"email_address": "alice@convertkit.dev",
"state": "active",
"created_at": "2023-02-17T11:43:55Z",
"added_at": "2023-02-17T11:43:55Z",
"fields": {},
"referrer": "https://mywebsite.com/bfpromo/?utm_source=facebook&utm_medium=cpc&utm_campaign=black_friday&utm_term=car_owners&utm_content=get_10_off",
"referrer_utm_parameters": {
"source": "facebook",
"medium": "cpc",
"campaign": "black_friday",
"term": "car_owners",
"content": "get_10_off"
}
}
}
{
"errors": [
"The access token is invalid"
]
}
{
"errors": [
"Not Found"
]
}

Authorizations

X-Kit-Api-Key
string
header
required

Authenticate API requests via an API Key

Path Parameters

form_id
integer
required
id
integer
required

Body

application/json
referrer
string
required

Response

Returns a 200 when the subscriber has already been added to the form

subscriber
object
required