package main
import (
"context"
"fmt"
"log"
"os"
"github.com/AhaSend/ahasend-go/api"
"github.com/google/uuid"
)
func main() {
client := api.NewAPIClient(api.WithAPIKey(os.Getenv("AHASEND_API_KEY")))
accountID := uuid.MustParse(os.Getenv("AHASEND_ACCOUNT_ID"))
ctx := context.Background()
subAccountID := uuid.MustParse("7d3c9f5e-2a41-4b8e-9c6d-0f1e2a3b4c5d")
response, _, err := client.SubAccountsAPI.UnpauseSubAccountDomain(ctx, accountID, subAccountID, "example.com")
if err != nil {
log.Fatalf("Error unpausing sub account domain: %v", err)
}
fmt.Printf("%s paused: %t\n", response.Domain, response.Paused)
}
import { AhaSendClient } from "@ahasend/sdk";
const client = AhaSendClient.fromEnv();
const subAccountId = "00000000-0000-4000-8000-000000000004";
const domain = await client.subAccounts.unpauseDomain(subAccountId, "mail.example.com");
console.log("Sub-account domain unpaused.", { name: domain.domain, paused: domain.paused });
curl --request POST \
--url https://api.ahasend.com/v2/accounts/{account_id}/sub-accounts/{sub_account_id}/domains/{domain}/unpause \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ahasend.com/v2/accounts/{account_id}/sub-accounts/{sub_account_id}/domains/{domain}/unpause"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ahasend.com/v2/accounts/{account_id}/sub-accounts/{sub_account_id}/domains/{domain}/unpause",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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.post("https://api.ahasend.com/v2/accounts/{account_id}/sub-accounts/{sub_account_id}/domains/{domain}/unpause")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ahasend.com/v2/accounts/{account_id}/sub-accounts/{sub_account_id}/domains/{domain}/unpause")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "domain",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"domain": "<string>",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dns_records": [
{
"type": "<string>",
"host": "<string>",
"content": "<string>",
"required": true,
"propagated": true,
"label": "<string>"
}
],
"last_dns_check_at": "2023-11-07T05:31:56Z",
"dns_valid": true,
"tracking_subdomain": "<string>",
"return_path_subdomain": "<string>",
"subscription_subdomain": "<string>",
"media_subdomain": "<string>",
"dkim_rotation_interval_days": 123,
"dkim_selector": "<string>",
"rotation_ready": true,
"dsn_recipient": "<string>",
"sending_type": "transactional",
"paused": true,
"paused_at": "2023-11-07T05:31:56Z",
"pause_reason": "<string>"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}Unpause a Sub-Account Domain via the API
Lift the pause on a sending domain of an AhaSend sub-account from the parent account. The call is idempotent. Requires the sub-accounts:suspend scope.
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/AhaSend/ahasend-go/api"
"github.com/google/uuid"
)
func main() {
client := api.NewAPIClient(api.WithAPIKey(os.Getenv("AHASEND_API_KEY")))
accountID := uuid.MustParse(os.Getenv("AHASEND_ACCOUNT_ID"))
ctx := context.Background()
subAccountID := uuid.MustParse("7d3c9f5e-2a41-4b8e-9c6d-0f1e2a3b4c5d")
response, _, err := client.SubAccountsAPI.UnpauseSubAccountDomain(ctx, accountID, subAccountID, "example.com")
if err != nil {
log.Fatalf("Error unpausing sub account domain: %v", err)
}
fmt.Printf("%s paused: %t\n", response.Domain, response.Paused)
}
import { AhaSendClient } from "@ahasend/sdk";
const client = AhaSendClient.fromEnv();
const subAccountId = "00000000-0000-4000-8000-000000000004";
const domain = await client.subAccounts.unpauseDomain(subAccountId, "mail.example.com");
console.log("Sub-account domain unpaused.", { name: domain.domain, paused: domain.paused });
curl --request POST \
--url https://api.ahasend.com/v2/accounts/{account_id}/sub-accounts/{sub_account_id}/domains/{domain}/unpause \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ahasend.com/v2/accounts/{account_id}/sub-accounts/{sub_account_id}/domains/{domain}/unpause"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ahasend.com/v2/accounts/{account_id}/sub-accounts/{sub_account_id}/domains/{domain}/unpause",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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.post("https://api.ahasend.com/v2/accounts/{account_id}/sub-accounts/{sub_account_id}/domains/{domain}/unpause")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ahasend.com/v2/accounts/{account_id}/sub-accounts/{sub_account_id}/domains/{domain}/unpause")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "domain",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"domain": "<string>",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dns_records": [
{
"type": "<string>",
"host": "<string>",
"content": "<string>",
"required": true,
"propagated": true,
"label": "<string>"
}
],
"last_dns_check_at": "2023-11-07T05:31:56Z",
"dns_valid": true,
"tracking_subdomain": "<string>",
"return_path_subdomain": "<string>",
"subscription_subdomain": "<string>",
"media_subdomain": "<string>",
"dkim_rotation_interval_days": 123,
"dkim_selector": "<string>",
"rotation_ready": true,
"dsn_recipient": "<string>",
"sending_type": "transactional",
"paused": true,
"paused_at": "2023-11-07T05:31:56Z",
"pause_reason": "<string>"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}Related Guides
- API authentication, Permission scopes, Sub-account paused domains.
- Sub-account API rules, Get Domain, Resume Sub-Account.
- API errors, API rate limits, Plans and limits.
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
Parent account ID
Sub account ID
Domain name
Response
The domain, with sending not paused
Object type identifier
domain Unique identifier for the domain
When the domain was created
When the domain was last updated
The domain name
Account ID this domain belongs to
DNS records required for domain verification
Show child attributes
Show child attributes
When DNS records were last checked
Whether all required DNS records are properly configured
Custom tracking subdomain. Null means the account or product default is used. Applies to both manual-DNS and managed-DNS domains.
Custom return-path subdomain. Null means the account or product default is used. Applies to both manual-DNS and managed-DNS domains.
Custom subscription management subdomain. Null means the account or product default is used. Applies to both manual-DNS and managed-DNS domains.
Custom media subdomain. Null means the account or product default is used. Applies to both manual-DNS and managed-DNS domains.
Custom DKIM rotation interval in days. Null means the account default is used. Only supported for managed DNS domains.
Per-domain DKIM selector override. Null means no per-domain override is set.
This reports the configured per-domain override only, not the effective selector used for DKIM signing. The effective selector is resolved separately and can differ — for example, a selector locked after DNS verification takes precedence over this override.
Whether the standby DKIM slot is ready for rotation.
Optional recipient address for delivery status notifications.
The type of email that you send from the domain. The sending type affects your deliverability. Marketing email from a transactional domain can get your account paused.
transactional, marketing Whether sending from the domain is paused. While the domain is paused, new email from it is refused, and you cannot delete or rename it. Your other domains continue to send.
When sending from the domain was paused. Null when the domain is not paused.
The reason of the pause. Null when the domain is not paused.
bounce_rate: too many recent emails from the domain bounced.

