AhaSend Go SDK
package main
import (
"context"
"fmt"
"log"
"github.com/AhaSend/ahasend-go/api"
)
func main() {
// Create API client with authentication
client := api.NewAPIClient(
api.WithAPIKey("aha-sk-your-64-character-key"),
)
// Create context for the API call
ctx := context.Background()
// Call the ping endpoint
response, httpResp, err := client.UtilityAPI.Ping(ctx)
if err != nil {
log.Fatalf("Error pinging API: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Ping successful! Status: %d\n", httpResp.StatusCode)
if response != nil && response.Message != "" {
fmt.Printf("Response: %s\n", response.Message)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}import { AhaSendClient } from "@ahasend/sdk";
const client = AhaSendClient.fromEnv();
const health = await client.ping();
console.log("AhaSend API is reachable.", { message: health.message });
curl --request GET \
--url https://api.ahasend.com/v2/ping \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ahasend.com/v2/ping"
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/ping",
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/ping")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ahasend.com/v2/ping")
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{
"message": "pong"
}{
"message": "missing or malformed bearer token"
}{
"message": "invalid API key"
}{
"message": "insufficient permissions for the required scope"
}{
"message": "internal server error"
}Utility endpoints
Ping
Health check endpoint for testing API connectivity and authentication
GET
/
v2
/
ping
AhaSend Go SDK
package main
import (
"context"
"fmt"
"log"
"github.com/AhaSend/ahasend-go/api"
)
func main() {
// Create API client with authentication
client := api.NewAPIClient(
api.WithAPIKey("aha-sk-your-64-character-key"),
)
// Create context for the API call
ctx := context.Background()
// Call the ping endpoint
response, httpResp, err := client.UtilityAPI.Ping(ctx)
if err != nil {
log.Fatalf("Error pinging API: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Ping successful! Status: %d\n", httpResp.StatusCode)
if response != nil && response.Message != "" {
fmt.Printf("Response: %s\n", response.Message)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}import { AhaSendClient } from "@ahasend/sdk";
const client = AhaSendClient.fromEnv();
const health = await client.ping();
console.log("AhaSend API is reachable.", { message: health.message });
curl --request GET \
--url https://api.ahasend.com/v2/ping \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ahasend.com/v2/ping"
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/ping",
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/ping")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ahasend.com/v2/ping")
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{
"message": "pong"
}{
"message": "missing or malformed bearer token"
}{
"message": "invalid API key"
}{
"message": "insufficient permissions for the required scope"
}{
"message": "internal server error"
}The ping endpoint is a simple health check, particularly useful for:
- API Key Validation: Test if your API key is valid without performing any other operations
- Service Health Monitoring: Check if the AhaSend API is available for automated monitoring systems
- Connection Testing: Verify network connectivity before sending important emails
- Integration Testing: Validate your authentication setup during development
Authentication
This endpoint requires a valid API key with any scope. It’s the most permissive endpoint in the API, making it ideal for basic connectivity testing without requiring specific permissions.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.
Response
Pong response
Success message

