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)
  }
}
{
  "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
        }
      ]
    }
  ]
}

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

200
application/json

Delivery time statistics

The response is of type object.