package main
import (
"context"
"fmt"
"log"
"time"
"github.com/AhaSend/ahasend-go"
"github.com/AhaSend/ahasend-go/api"
"github.com/AhaSend/ahasend-go/models/requests"
"github.com/google/uuid"
)
func main() {
// Create API client with authentication
client := api.NewAPIClient(
api.WithAPIKey("aha-sk-your-64-character-key"),
)
accountID := uuid.New()
// Create context for the API call
ctx := context.Background()
fromTime := time.Now().Add(-time.Hour * 24 * 30)
// Call the ping endpoint
response, httpResp, err := client.StatisticsAPI.GetDeliveryTimeStatistics(
ctx,
accountID,
requests.GetDeliveryTimeStatisticsParams{
FromTime: &fromTime,
SenderDomain: ahasend.String("example.com"),
RecipientDomains: ahasend.String("gmail.com"),
GroupBy: ahasend.String("week"),
},
)
if err != nil {
log.Fatalf("Error getting delivery time statistics: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Delivery time statistics: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}import { AhaSendClient } from "@ahasend/sdk";
const client = AhaSendClient.fromEnv();
const statistics = await client.statistics.deliveryTimes({
from_time: "2026-01-01T00:00:00Z",
to_time: "2026-01-02T00:00:00Z",
});
console.log("Delivery-time statistics loaded.", { buckets: statistics.data.length });
curl --request GET \
--url https://api.ahasend.com/v2/accounts/{account_id}/statistics/transactional/delivery-time \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ahasend.com/v2/accounts/{account_id}/statistics/transactional/delivery-time"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ahasend.com/v2/accounts/{account_id}/statistics/transactional/delivery-time",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.ahasend.com/v2/accounts/{account_id}/statistics/transactional/delivery-time")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ahasend.com/v2/accounts/{account_id}/statistics/transactional/delivery-time")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "list",
"data": [
{
"from_timestamp": "2023-11-07T05:31:56Z",
"to_timestamp": "2023-11-07T05:31:56Z",
"avg_delivery_time": 123,
"delivered_count": 123,
"delivery_times": [
{
"recipient_domain": "<string>",
"delivery_time": 123,
"count": 123
}
]
}
]
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}Delivery Time Statistics
Returns transactional delivery time statistics grouped by recipient domain
The global statistics role can query all sender domains. A
domain-scoped key is limited to authorized domains and must authorize
every comma-separated value supplied in sender_domain.
Query Parameters:
from_time: Filter statistics after this date (RFC3339 format)to_time: Filter statistics before this date (RFC3339 format)sender_domain: Filter by sender domainrecipient_domains: Filter by recipient domainstags: Filter by tags (comma-separated)group_by: Group by time period (hour, day, week, month)
package main
import (
"context"
"fmt"
"log"
"time"
"github.com/AhaSend/ahasend-go"
"github.com/AhaSend/ahasend-go/api"
"github.com/AhaSend/ahasend-go/models/requests"
"github.com/google/uuid"
)
func main() {
// Create API client with authentication
client := api.NewAPIClient(
api.WithAPIKey("aha-sk-your-64-character-key"),
)
accountID := uuid.New()
// Create context for the API call
ctx := context.Background()
fromTime := time.Now().Add(-time.Hour * 24 * 30)
// Call the ping endpoint
response, httpResp, err := client.StatisticsAPI.GetDeliveryTimeStatistics(
ctx,
accountID,
requests.GetDeliveryTimeStatisticsParams{
FromTime: &fromTime,
SenderDomain: ahasend.String("example.com"),
RecipientDomains: ahasend.String("gmail.com"),
GroupBy: ahasend.String("week"),
},
)
if err != nil {
log.Fatalf("Error getting delivery time statistics: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Delivery time statistics: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}import { AhaSendClient } from "@ahasend/sdk";
const client = AhaSendClient.fromEnv();
const statistics = await client.statistics.deliveryTimes({
from_time: "2026-01-01T00:00:00Z",
to_time: "2026-01-02T00:00:00Z",
});
console.log("Delivery-time statistics loaded.", { buckets: statistics.data.length });
curl --request GET \
--url https://api.ahasend.com/v2/accounts/{account_id}/statistics/transactional/delivery-time \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ahasend.com/v2/accounts/{account_id}/statistics/transactional/delivery-time"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ahasend.com/v2/accounts/{account_id}/statistics/transactional/delivery-time",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.ahasend.com/v2/accounts/{account_id}/statistics/transactional/delivery-time")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ahasend.com/v2/accounts/{account_id}/statistics/transactional/delivery-time")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "list",
"data": [
{
"from_timestamp": "2023-11-07T05:31:56Z",
"to_timestamp": "2023-11-07T05:31:56Z",
"avg_delivery_time": 123,
"delivered_count": 123,
"delivery_times": [
{
"recipient_domain": "<string>",
"delivery_time": 123,
"count": 123
}
]
}
]
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}Authorizations
API key for authentication. Non-empty Security Requirement values are AhaSend API-key roles. Roles listed within one requirement object are jointly required; separate requirement objects are alternatives.
Path Parameters
Account ID
Query Parameters
Filter statistics after this datetime (RFC3339 format)
Filter statistics before this datetime (RFC3339 format)
Comma-separated sender domains; the key must authorize every requested domain
Filter by a comma separated list of recipient domains
Filter by tags (comma-separated)
Group by time period
hour, day, week, month 
