Bulk Upsert Subscribers
Create or update up to 100 subscribers in a single request. Existing subscribers are matched by email and updated; new emails create subscribers. Tags are merged, not replaced.
curl -X POST "https://app.nashra.ai/api/v1/subscribers/bulk" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"subscribers": [
{
"email": "user@example.com",
"first_name": "John Doe",
"last_name": "John Doe",
"tags": [
"example_string"
],
"extra_attributes": {}
}
]
}'
import requests
import json
url = "https://app.nashra.ai/api/v1/subscribers/bulk"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"subscribers": [
{
"email": "user@example.com",
"first_name": "John Doe",
"last_name": "John Doe",
"tags": [
"example_string"
],
"extra_attributes": {}
}
]
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://app.nashra.ai/api/v1/subscribers/bulk", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"subscribers": [
{
"email": "user@example.com",
"first_name": "John Doe",
"last_name": "John Doe",
"tags": [
"example_string"
],
"extra_attributes": {}
}
]
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"subscribers": [
{
"email": "user@example.com",
"first_name": "John Doe",
"last_name": "John Doe",
"tags": [
"example_string"
],
"extra_attributes": {}
}
]
}`)
req, err := http.NewRequest("POST", "https://app.nashra.ai/api/v1/subscribers/bulk", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://app.nashra.ai/api/v1/subscribers/bulk')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"subscribers": [
{
"email": "user@example.com",
"first_name": "John Doe",
"last_name": "John Doe",
"tags": [
"example_string"
],
"extra_attributes": {}
}
]
}'
response = http.request(request)
puts response.body
{
"data": {
"created": 8,
"updated": 11,
"failed": 1
},
"message": "8 created, 11 updated, 1 failed.",
"meta": {}
}
{
"error": "Unprocessable Entity",
"message": "The request was well-formed but contains semantic errors",
"code": 422,
"details": [
{
"field": "password",
"message": "Password must be at least 8 characters long"
}
]
}
POST
/subscribers/bulk
POST
Bearer Token
Bearer Tokenstring
RequiredAPI token generated in Settings > API Tokens
API token generated in Settings > API Tokens
Content-Typestring
RequiredThe media type of the request body
Options: application/json
Request Preview
Response
Response will appear here after sending the request
Authentication
header
Authorizationstring
RequiredBearer token. API token generated in Settings > API Tokens
Body
application/json
Responses
dataobject
createdinteger
updatedinteger
failedinteger
messagestring
metaobject
Validation error
Was this page helpful?
Last updated today
Built with Documentation.AI