Skip to main content
POST
/
v1
/
subscriber_list
/
{list_id}
/
version
/
{version_id}
/
subscriber
/
add
/
Add Users to Draft List
curl --request POST \
  --url https://hub.suprsend.com/v1/subscriber_list/{list_id}/version/{version_id}/subscriber/add/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "distinct_ids": [
    "user1"
  ]
}
'
import requests

url = "https://hub.suprsend.com/v1/subscriber_list/{list_id}/version/{version_id}/subscriber/add/"

payload = { "distinct_ids": ["user1"] }
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({distinct_ids: ['user1']})
};

fetch('https://hub.suprsend.com/v1/subscriber_list/{list_id}/version/{version_id}/subscriber/add/', 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://hub.suprsend.com/v1/subscriber_list/{list_id}/version/{version_id}/subscriber/add/",
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([
'distinct_ids' => [
'user1'
]
]),
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://hub.suprsend.com/v1/subscriber_list/{list_id}/version/{version_id}/subscriber/add/"

payload := strings.NewReader("{\n \"distinct_ids\": [\n \"user1\"\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://hub.suprsend.com/v1/subscriber_list/{list_id}/version/{version_id}/subscriber/add/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"distinct_ids\": [\n \"user1\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://hub.suprsend.com/v1/subscriber_list/{list_id}/version/{version_id}/subscriber/add/")

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 \"distinct_ids\": [\n \"user1\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "affected_count": 0
}
{
"code": 404,
"error_code": "not_found",
"type": "NotFound",
"message": "version_id 01JR6PCW8H9K3H40XZV4 not found for list_id 123",
"detail": "version_id 01JR6PCW8H9K3H40XZV4 not found for list_id 123"
}

Authorizations

Authorization
string
header
required

Pass as Bearer <API_KEY>. Get API Key from SuprSend dashboard Developers -> API Keys section.

Path Parameters

list_id
string
default:_list_id_
required

Unique string identifier of the list to which user needs to be updated

version_id
string
default:__version_id__
required

Unique string identifier of the draft version of the list to which user needs to be updated

Body

application/json
distinct_ids
string[]

Array of subscriber_ids, uniquely identifying the subscribers to be added to the list.

Response

201

success
boolean

Indicates whether the operation was successful.

Example:

true

affected_count
integer

Number of subscribers affected by the operation.

Example:

2