Send an Event
Send events to Hardal using the Events API.
curl -X POST "https://demo-signal.usehardal.com/push/hardal" \
-H "Content-Type: application/json" \
-d '{
"type": "event",
"payload": {
"website": "demo",
"name": "page_view",
"url": "https://yourstore.com/products",
"title": "Products",
"device_type": "desktop",
"language": "en-US",
"platform": "web",
"data": {}
}
}'
import requests
import json
url = "https://demo-signal.usehardal.com/push/hardal"
headers = {
"Content-Type": "application/json"
}
data = {
"type": "event",
"payload": {
"website": "demo",
"name": "page_view",
"url": "https://yourstore.com/products",
"title": "Products",
"device_type": "desktop",
"language": "en-US",
"platform": "web",
"data": {}
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://demo-signal.usehardal.com/push/hardal", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"type": "event",
"payload": {
"website": "demo",
"name": "page_view",
"url": "https://yourstore.com/products",
"title": "Products",
"device_type": "desktop",
"language": "en-US",
"platform": "web",
"data": {}
}
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"type": "event",
"payload": {
"website": "demo",
"name": "page_view",
"url": "https://yourstore.com/products",
"title": "Products",
"device_type": "desktop",
"language": "en-US",
"platform": "web",
"data": {}
}
}`)
req, err := http.NewRequest("POST", "https://demo-signal.usehardal.com/push/hardal", 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://demo-signal.usehardal.com/push/hardal')
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 = '{
"type": "event",
"payload": {
"website": "demo",
"name": "page_view",
"url": "https://yourstore.com/products",
"title": "Products",
"device_type": "desktop",
"language": "en-US",
"platform": "web",
"data": {}
}
}'
response = http.request(request)
puts response.body
{
"ok": true
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
POST
/push/hardal
POST
Base URLstring
Target server for requests. Edit to use your own host.
Content-Typestring
RequiredThe media type of the request body
Options: application/json
typestring
RequiredRequest type. Use event for tracking events, identify for user identification.
Options: event, identify
Request Preview
Response
Response will appear here after sending the request
Body
application/json
typestring
RequiredRequest type. Use event for tracking events, identify for user identification.
Allowed values:
eventidentifypayloadobject
Requirednamestring
RequiredEvent name. E.g. purchase, page_view, add_to_cart, generate_lead, distinct.
Example:
purchaseurlstring
RequiredPage URL or screen identifier where the event fired.
Example:
https://yourstore.com/checkout/confirmationdataobject
Event-specific parameters. Structure depends on the event name. Select an example above to see the full payload for each event.
Example:
{"transaction_id":"ORD-20250421-8831","value":328.99,"currency":"USD"}Responses
okboolean
Invalid request — missing required field or malformed payload.
Invalid Signal ID.
Was this page helpful?