Skip to main content
GET
/
v2
/
accounts
/
{account_id}
/
statistics
/
transactional
/
delivery-time
AhaSend Go SDK
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)
  }
}
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)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.ahasend.com/v2/accounts/{account_id}/statistics/transactional/delivery-time', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?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

Authorization
string
header
required

API key for authentication

Path Parameters

account_id
string<uuid>
required

Account ID

Query Parameters

from_time
string<date-time>

Filter statistics after this datetime (RFC3339 format)

to_time
string<date-time>

Filter statistics before this datetime (RFC3339 format)

sender_domain
string

Filter by sender domain

recipient_domains
string

Filter by a comma separated list of recipient domains

tags
string

Filter by tags (comma-separated)

group_by
enum<string>
default:day

Group by time period

Available options:
hour,
day,
week,
month

Response

Delivery time statistics

object
enum<string>
required

Object type identifier

Available options:
list
data
object[]
required

Array of delivery time statistics