Skip to main content
GET
/
v2
/
accounts
/
{account_id}
/
api-keys
AhaSend Go SDK
package main

import (
  "context"
  "fmt"
  "log"

  "github.com/AhaSend/ahasend-go/api"
  "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()

  // Call the ping endpoint
  response, httpResp, err := client.APIKeysAPI.GetAPIKeys(
    ctx,
    accountID,
    nil,
    nil,
  )
  if err != nil {
    log.Fatalf("Error getting API keys: %v", err)
  }

  // Check response
  if httpResp.StatusCode == 200 {
    fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
    if response != nil {
      fmt.Printf("Found %d API keys\n", len(response.Data))
    }
  } else {
    fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
  }
}
curl --request GET \
--url https://api.ahasend.com/v2/accounts/{account_id}/api-keys \
--header 'Authorization: Bearer <token>'
import requests

url = "https://api.ahasend.com/v2/accounts/{account_id}/api-keys"

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}/api-keys', 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}/api-keys",
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}/api-keys")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.ahasend.com/v2/accounts/{account_id}/api-keys")

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": [
    {
      "object": "api_key",
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "created_at": "2023-11-07T05:31:56Z",
      "updated_at": "2023-11-07T05:31:56Z",
      "account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "label": "<string>",
      "public_key": "<string>",
      "scopes": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "created_at": "2023-11-07T05:31:56Z",
          "updated_at": "2023-11-07T05:31:56Z",
          "api_key_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "scope": "<string>",
          "domain_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        }
      ],
      "ip_allow_list": [
        "<string>"
      ],
      "last_used_at": "2023-11-07T05:31:56Z",
      "secret_key": "<string>"
    }
  ],
  "pagination": {
    "has_more": true,
    "next_cursor": "eyJpZCI6MTIzNH0="
  }
}
{
"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

limit
integer
default:100

Maximum number of items to return

Required range: 1 <= x <= 100
after
string

Pagination cursor for the next page. Provide the value provided in next_cursor from the response.

before
string

Pagination cursor for the previous page.

Response

List of API keys

object
enum<string>
required

Object type identifier

Available options:
list
data
object[]
required

Array of API keys

pagination
object
required
Example:
{
"has_more": true,
"next_cursor": "eyJpZCI6MTIzNH0="
}