Record Reader Events
First-party audience events from the public site, batched up to 20
per request. Only send these for readers who consented to tracking,
and only when the workspace's audience_tracking_enabled is true —
events are dropped otherwise. Always returns 204. Rate limited to 60
requests per minute per IP.
curl -X POST "https://app.nashra.ai/api/v1/tenants/example_string/events" \
-H "Content-Type: application/json" \
-d '{
"visitor_id": "123e4567-e89b-12d3-a456-426614174000",
"events": [
{
"name": "page_view",
"properties": {}
}
]
}'
import requests
import json
url = "https://app.nashra.ai/api/v1/tenants/example_string/events"
headers = {
"Content-Type": "application/json"
}
data = {
"visitor_id": "123e4567-e89b-12d3-a456-426614174000",
"events": [
{
"name": "page_view",
"properties": {}
}
]
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://app.nashra.ai/api/v1/tenants/example_string/events", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"visitor_id": "123e4567-e89b-12d3-a456-426614174000",
"events": [
{
"name": "page_view",
"properties": {}
}
]
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"visitor_id": "123e4567-e89b-12d3-a456-426614174000",
"events": [
{
"name": "page_view",
"properties": {}
}
]
}`)
req, err := http.NewRequest("POST", "https://app.nashra.ai/api/v1/tenants/example_string/events", 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/events')
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 = '{
"visitor_id": "123e4567-e89b-12d3-a456-426614174000",
"events": [
{
"name": "page_view",
"properties": {}
}
]
}'
response = http.request(request)
puts response.body
{}
{
"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
}
POST
/tenants/{slug}/eventsPOST
Base URLstring
Target server for requests. Edit to use your own host.
path
slugstring
RequiredTenant's subdomain slug, or its verified custom domain
Content-Typestring
RequiredThe media type of the request body
Options: application/json
visitor_idstring
RequiredThe visitor ID set after the reader consents to tracking
Format: uuid
Request Preview
Response
Response will appear here after sending the request
Path Parameters
slugstring
RequiredTenant's subdomain slug, or its verified custom domain
Body
application/json
visitor_idstring
RequiredThe visitor ID set after the reader consents to tracking
Responses
Was this page helpful?