Subscribe to Newsletter
Subscribe an email address to the workspace's list from its public site — the Hub and Publishing Home subscribe forms. Rate limited to 10 requests per minute per IP, and 10 attempts per 10 minutes for the same email address. Returns only an outcome, never the subscriber record, since the endpoint is unauthenticated.
Signups that look like spam still get a success response: the most blatant are dropped silently, and likely spam is saved with a risk mark that Audience's spam cleanup takes into account.
curl -X POST "https://app.nashra.ai/api/v1/tenants/example_string/subscribe" \
-H "Content-Type: application/json" \
-d '{
"email": "reader@example.com",
"name": "Jamie",
"phone": "+966501234567",
"phone_country": "SA",
"tags": [
"newsletter-widget"
],
"visitor_id": "123e4567-e89b-12d3-a456-426614174000",
"website": "example_string"
}'
import requests
import json
url = "https://app.nashra.ai/api/v1/tenants/example_string/subscribe"
headers = {
"Content-Type": "application/json"
}
data = {
"email": "reader@example.com",
"name": "Jamie",
"phone": "+966501234567",
"phone_country": "SA",
"tags": [
"newsletter-widget"
],
"visitor_id": "123e4567-e89b-12d3-a456-426614174000",
"website": "example_string"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://app.nashra.ai/api/v1/tenants/example_string/subscribe", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"email": "reader@example.com",
"name": "Jamie",
"phone": "+966501234567",
"phone_country": "SA",
"tags": [
"newsletter-widget"
],
"visitor_id": "123e4567-e89b-12d3-a456-426614174000",
"website": "example_string"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"email": "reader@example.com",
"name": "Jamie",
"phone": "+966501234567",
"phone_country": "SA",
"tags": [
"newsletter-widget"
],
"visitor_id": "123e4567-e89b-12d3-a456-426614174000",
"website": "example_string"
}`)
req, err := http.NewRequest("POST", "https://app.nashra.ai/api/v1/tenants/example_string/subscribe", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
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/tenants/example_string/subscribe')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request.body = '{
"email": "reader@example.com",
"name": "Jamie",
"phone": "+966501234567",
"phone_country": "SA",
"tags": [
"newsletter-widget"
],
"visitor_id": "123e4567-e89b-12d3-a456-426614174000",
"website": "example_string"
}'
response = http.request(request)
puts response.body
{
"data": {
"subscribed": true,
"reader_number": 1284
},
"message": "Successfully subscribed to newsletter",
"meta": {}
}
{
"error": "Not Found",
"message": "The requested resource was not found",
"code": 404
}
{
"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"
}
]
}
{
"error": "Too Many Requests",
"message": "Rate limit exceeded. Please try again later",
"code": 429,
"retryAfter": 3600
}
/tenants/{slug}/subscribeTarget server for requests. Edit to use your own host.
Tenant's subdomain slug, or its verified custom domain
The media type of the request body
Stored as the subscriber's first name
Optional WhatsApp number. Send a full international number
(+9665…), or a national number together with phone_country.
Stored in E.164 format.
Two-letter country code used to read a national-format phone
The consented first-party visitor ID, so the visitor's earlier activity joins the new subscriber's journey
Spam trap — leave it out or empty. A request with a value here gets a normal-looking success, but no subscriber is created.
Request Preview
Response
Response will appear here after sending the request
Path Parameters
Tenant's subdomain slug, or its verified custom domain
Body
reader@example.comOptional WhatsApp number. Send a full international number
(+9665…), or a national number together with phone_country.
Stored in E.164 format.
+966501234567The consented first-party visitor ID, so the visitor's earlier activity joins the new subscriber's journey
Spam trap — leave it out or empty. A request with a value here gets a normal-looking success, but no subscriber is created.