openapi: 3.1.0
info:
title: AhaSend API v2
description: |
The AhaSend API v2 allows you to send transactional emails, manage domains, webhooks, routes, API keys, and view statistics.
## Authentication
All API requests must be authenticated using a Bearer token in the Authorization header:
```
Authorization: Bearer aha-sk-64-CHARACTER-RANDOM-STRING
```
## Scopes
API keys have specific scopes that control access to different resources and actions:
### Message Scopes
- `messages:send:all` - Send messages from any domain in the account
- `messages:send:{domain}` - Send messages from a specific domain
- `messages:cancel:all` - Cancel messages from any domain
- `messages:cancel:{domain}` - Cancel messages from a specific domain
- `messages:read:all` - Read messages from any domain
- `messages:read:{domain}` - Read messages from a specific domain
### Domain Scopes
- `domains:read` - Read all domains
- `domains:write` - Create and update domains
- `domains:delete:all` - Delete any domain
- `domains:delete:{domain}` - Delete a specific domain
### Account Scopes
- `accounts:read` - Read account information
- `accounts:write` - Update account settings
- `accounts:billing` - Access billing information
- `accounts:members:read` - Read account members
- `accounts:members:add` - Add account members
- `accounts:members:update` - Update account members
- `accounts:members:remove` - Remove account members
### Webhook Scopes
- `webhooks:read:all` - Read all webhooks
- `webhooks:read:{domain}` - Read webhooks for a specific domain
- `webhooks:write:all` - Create and update webhooks
- `webhooks:write:{domain}` - Create and update webhooks for a specific domain
- `webhooks:delete:all` - Delete any webhook
- `webhooks:delete:{domain}` - Delete webhooks for a specific domain
### Route Scopes
- `routes:read:all` - Read all routes
- `routes:read:{domain}` - Read routes for a specific domain
- `routes:write:all` - Create and update routes
- `routes:write:{domain}` - Create and update routes for a specific domain
- `routes:delete:all` - Delete any route
- `routes:delete:{domain}` - Delete routes for a specific domain
### Suppression Scopes
- `suppressions:read` - Read suppressions
- `suppressions:write` - Create suppressions
- `suppressions:delete` - Delete suppressions
- `suppressions:wipe` - Delete all suppressions (dangerous)
### SMTP Credentials Scopes
- `smtp-credentials:read:all` - Read all SMTP credentials
- `smtp-credentials:read:{domain}` - Read SMTP credentials for a specific domain
- `smtp-credentials:write:all` - Create SMTP credentials
- `smtp-credentials:write:{domain}` - Create SMTP credentials for a specific domain
- `smtp-credentials:delete:all` - Delete any SMTP credentials
- `smtp-credentials:delete:{domain}` - Delete SMTP credentials for a specific domain
### Statistics Scopes
- `statistics-transactional:read:all` - Read all transactional statistics
- `statistics-transactional:read:{domain}` - Read transactional statistics for a specific domain
### API Key Scopes
- `api-keys:read` - Read API keys
- `api-keys:write` - Create and update API keys
- `api-keys:delete` - Delete API keys
## Rate Limiting
- General API endpoints: 100 requests per second, 200 burst
- Statistics endpoints: 1 request per second, 1 burst
## Pagination
List endpoints use cursor-based pagination with the following parameters:
- `limit`: Maximum number of items to return (default: 100, max: 100)
- `cursor`: Pagination cursor for the next page
## Time Formats
All timestamps must be in RFC3339 format, e.g., `2023-12-25T10:30:00Z`
## Idempotency
POST requests support idempotency through the optional `Idempotency-Key` header. When provided:
- The same request can be safely retried multiple times
- Duplicate requests return the same response with `Idempotent-Replayed: true`
- In-progress requests return HTTP 409 with `Idempotent-Replayed: false`
- Failed requests return HTTP 412 with `Idempotent-Replayed: false`
- Idempotency keys expire after 24 hours
version: "2.0.0"
contact:
email: support@ahasend.com
license:
name: MIT
identifier: MIT
servers:
- url: https://api.ahasend.com
description: Production server
security:
- BearerAuth: []
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: "aha-sk-64-CHARACTER-RANDOM-STRING"
description: API key for authentication
parameters:
IdempotencyKey:
name: Idempotency-Key
in: header
required: false
description: |
Optional idempotency key for safe request retries. Must be a unique string for each logical request.
Requests with the same key will return the same response. Keys expire after 24 hours.
schema:
type: string
maxLength: 255
example: "user-12345-create-domain-20240101"
headers:
IdempotentReplayed:
description: |
Indicates whether this response is replayed from a previous identical request.
- `true`: Response was replayed from cache (duplicate request)
- `false`: Response from original processing or error state
schema:
type: string
enum: [true, false]
responses:
IdempotencyConflict:
description: Request in progress - a request with this idempotency key is already being processed
headers:
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
message: "A request with this idempotency key is already in progress"
IdempotencyPreconditionFailed:
description: Original request failed - the request with this idempotency key previously failed and cannot be retried
headers:
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
message: "The original request with this idempotency key failed and cannot be retried"
schemas:
ErrorResponse:
type: object
required:
- message
properties:
message:
type: string
description: Error description
example: example_value
example:
message: "Error message"
SuccessResponse:
type: object
required:
- message
properties:
message:
type: string
description: Success message
example: example_value
example:
message: "Operation completed successfully"
PaginationInfo:
type: object
required:
- has_more
properties:
has_more:
type: boolean
description: Whether there are more items available
example: true
next_cursor:
type: string
description: Cursor for the next page of results
example: example_value
previous_cursor:
type: string
description: Cursor for the previous page of results
example: example_value
example:
has_more: true
next_cursor: "eyJpZCI6MTIzNH0="
# API Key Schemas
APIKeyScope:
type: object
properties:
id:
type: string
format: uuid
description: Unique identifier for the scope
example: '500123'
created_at:
type: string
format: date-time
description: When the scope was created
example: '2025-03-15T14:30:00Z'
updated_at:
type: string
format: date-time
description: When the scope was last updated
example: '2025-03-15T14:30:00Z'
api_key_id:
type: string
format: uuid
description: ID of the API key this scope belongs to
example: '500123'
scope:
type: string
description: The scope string
example: example_value
domain_id:
type: string
format: uuid
description: Domain ID for domain-specific scopes
example: '500123'
required:
- id
- created_at
- updated_at
- api_key_id
- scope
APIKey:
type: object
properties:
object:
type: string
enum: [api_key]
description: Object type identifier
example: api_key
id:
type: string
format: uuid
description: Unique identifier for the API key
example: '500123'
created_at:
type: string
format: date-time
description: When the API key was created
example: '2025-03-15T14:30:00Z'
updated_at:
type: string
format: date-time
description: When the API key was last updated
example: '2025-03-15T14:30:00Z'
last_used_at:
type: string
format: date-time
description: When the API key was last used (updates every 5-10 minutes)
example: '2025-03-15T14:30:00Z'
account_id:
type: string
format: uuid
description: Account ID this API key belongs to
example: '500123'
label:
type: string
description: Human-readable label for the API key
example: example_value
public_key:
type: string
description: Public portion of the API key
example: aha-sk-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
secret_key:
type: string
description: Secret key (only returned on creation)
example: aha-sk-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
scopes:
type: array
items:
$ref: '#/components/schemas/APIKeyScope'
description: Scopes granted to this API key
example:
- id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
api_key_id: '500123'
scope: example_value
required:
- object
- id
- created_at
- updated_at
- account_id
- label
- public_key
- scopes
CreateAPIKeyRequest:
type: object
required:
- label
- scopes
properties:
label:
type: string
maxLength: 255
description: Human-readable label for the API key
example: example_value
scopes:
type: array
items:
type: string
minItems: 1
description: Array of scope strings to grant to this API key
example:
- example_value
example:
label: "Production API Key"
scopes: ["messages:send:all", "domains:read"]
UpdateAPIKeyRequest:
type: object
properties:
label:
type: string
maxLength: 255
description: Human-readable label for the API key
example: example_value
scopes:
type: array
items:
type: string
minItems: 1
description: Array of scope strings to grant to this API key
example:
- example_value
example:
label: "Updated API Key"
scopes: ["messages:send:example.com", "domains:read"]
PaginatedAPIKeysResponse:
type: object
required:
- object
- data
- pagination
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/APIKey'
description: Array of API keys
example:
- object: api_key
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
last_used_at: '2025-03-15T14:30:00Z'
pagination:
$ref: '#/components/schemas/PaginationInfo'
# Domain Schemas
DNSRecord:
type: object
properties:
type:
type: string
description: DNS record type (e.g., CNAME, TXT, MX)
example: example_value
host:
type: string
description: DNS record host/name
example: example_value
content:
type: string
description: DNS record content/value
example: example_value
required:
type: boolean
description: Whether this DNS record is required for domain verification
example: true
propagated:
type: boolean
description: Whether this DNS record has been propagated and verified
example: true
required:
- type
- host
- content
- required
- propagated
Domain:
type: object
properties:
object:
type: string
enum: [domain]
description: Object type identifier
example: domain
id:
type: string
format: uuid
description: Unique identifier for the domain
example: '500123'
created_at:
type: string
format: date-time
description: When the domain was created
example: '2025-03-15T14:30:00Z'
updated_at:
type: string
format: date-time
description: When the domain was last updated
example: '2025-03-15T14:30:00Z'
domain:
type: string
description: The domain name
example: mail.example.com
account_id:
type: string
format: uuid
description: Account ID this domain belongs to
example: '500123'
dns_records:
type: array
items:
$ref: '#/components/schemas/DNSRecord'
description: DNS records required for domain verification
example:
- type: example_value
host: example_value
content: example_value
required: true
propagated: true
last_dns_check_at:
type: string
nullable: true
format: date-time
description: When DNS records were last checked
example: '2025-03-15T14:30:00Z'
dns_valid:
type: boolean
description: Whether all required DNS records are properly configured
example: true
tracking_subdomain:
type: string
nullable: true
description: Custom tracking subdomain. Null means the account or product default is used.
example: mail.example.com
return_path_subdomain:
type: string
nullable: true
description: Custom return-path subdomain. Null means the account or product default is used.
example: mail.example.com
subscription_subdomain:
type: string
nullable: true
description: Custom subscription management subdomain. Null means the account or product default is used.
example: mail.example.com
media_subdomain:
type: string
nullable: true
description: Custom media subdomain. Null means the account or product default is used.
example: mail.example.com
dkim_rotation_interval_days:
type: integer
nullable: true
description: Custom DKIM rotation interval in days. Null means the account default is used.
example: 1
rotation_ready:
type: boolean
description: Whether the standby DKIM slot is ready for rotation.
example: true
required:
- object
- id
- created_at
- updated_at
- domain
- account_id
- dns_records
- dns_valid
CreateDomainRequest:
type: object
required:
- domain
properties:
domain:
type: string
format: hostname
description: Fully qualified domain name
example: mail.example.com
dkim_private_key:
type: string
description: |
DKIM Private Key for the domain. Only RSA keys with a minimum key size of 2048 bits are supported.
**Note:** This parameter is only supported on [Platform Partner](https://ahasend.com/partners) accounts.
example: aha-sk-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
tracking_subdomain:
type: string
description: Optional custom tracking subdomain. Omit to use the default on create.
example: mail.example.com
return_path_subdomain:
type: string
description: Optional custom return-path subdomain. Omit to use the default on create.
example: mail.example.com
subscription_subdomain:
type: string
description: Optional custom subscription management subdomain. Omit to use the default on create.
example: mail.example.com
media_subdomain:
type: string
description: Optional custom media subdomain. Omit to use the default on create.
example: mail.example.com
dkim_rotation_interval_days:
type: integer
description: Optional custom DKIM rotation interval in days. Only supported for managed DNS domains on eligible plans.
example: 1
example:
domain: "example.com"
tracking_subdomain: "click"
return_path_subdomain: "mail"
subscription_subdomain: "preferences"
media_subdomain: "media"
dkim_rotation_interval_days: 45
UpdateDomainRequest:
type: object
properties:
tracking_subdomain:
type: string
description: Optional custom tracking subdomain. Omit to leave the current value unchanged.
example: mail.example.com
return_path_subdomain:
type: string
description: Optional custom return-path subdomain. Omit to leave the current value unchanged.
example: mail.example.com
subscription_subdomain:
type: string
description: Optional custom subscription management subdomain. Omit to leave the current value unchanged.
example: mail.example.com
media_subdomain:
type: string
description: Optional custom media subdomain. Omit to leave the current value unchanged.
example: mail.example.com
dkim_rotation_interval_days:
type: integer
description: Optional custom DKIM rotation interval in days. Omit to leave the current value unchanged. Only supported for managed DNS domains on eligible plans.
example: 1
example:
tracking_subdomain: "click"
return_path_subdomain: "mail"
subscription_subdomain: "preferences"
media_subdomain: "media"
dkim_rotation_interval_days: 45
PaginatedDomainsResponse:
type: object
required:
- object
- data
- pagination
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/Domain'
description: Array of domains
example:
- object: domain
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
domain: mail.example.com
pagination:
$ref: '#/components/schemas/PaginationInfo'
# Message Schemas
Address:
type: object
required:
- email
properties:
email:
type: string
format: email
description: Valid email address from a domain defined in your account with valid DNS records
example: user@example.com
name:
type: string
description: Display name for the sender
example: Example Name
example:
email: "noreply@example.com"
name: "Example Corp"
Recipient:
type: object
required:
- email
properties:
email:
type: string
format: email
description: Recipient email address
example: user@example.com
name:
type: string
description: Display name for the recipient
example: Example Name
substitutions:
type: object
additionalProperties: true
description: Substitution data for the recipient. Used with jinja2 templating language for dynamic content
example: {}
example:
email: "user@example.com"
name: "John Doe"
substitutions:
first_name: "John"
order_id: "12345"
Attachment:
type: object
required:
- data
- content_type
- file_name
properties:
base64:
type: boolean
description: If true, data must be encoded using base64. Otherwise, data will be interpreted as UTF-8
default: false
example: true
data:
type: string
description: Either plaintext or base64 encoded attachment data (depending on base64 field)
example: example_value
content_type:
type: string
description: The MIME type of the attachment
example: example_value
content_disposition:
type: string
description: The disposition of the attachment
example: example_value
content_id:
type: string
description: The Content-ID of the attachment for inline images
example: '500123'
file_name:
type: string
description: The filename of the attachment
example: Example Name
example:
base64: true
data: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg=="
content_type: "image/png"
file_name: "pixel.png"
Tracking:
type: object
nullable: true
properties:
open:
type: boolean
nullable: true
description: Whether to track opens
example: true
click:
type: boolean
nullable: true
description: Whether to track clicks
example: true
example:
open: true
click: true
Retention:
type: object
nullable: true
properties:
metadata:
type: integer
nullable: true
description: Number of days to retain metadata
minimum: 1
maximum: 30
example: 1
data:
type: integer
nullable: true
description: Number of days to retain data
minimum: 0
maximum: 30
example: 1
example:
metadata: 1
data: 0
MessageSchedule:
type: object
properties:
first_attempt:
type: string
format: date-time
description: The time to make the first attempt for delivering the message (RFC3339 format)
example: '2025-03-15T14:30:00Z'
expires:
type: string
format: date-time
description: Expire and drop the message if not delivered by this time (RFC3339 format)
example: '2025-03-15T14:30:00Z'
example:
first_attempt: "2023-12-25T10:30:00Z"
expires: "2023-12-26T10:30:00Z"
CreateMessageRequest:
type: object
required:
- from
- recipients
- subject
properties:
from:
$ref: '#/components/schemas/Address'
recipients:
type: array
items:
$ref: '#/components/schemas/Recipient'
minItems: 1
description: This does not set the To header to multiple addresses, it sends a separate message for each recipient
example:
- email: user@example.com
name: Example Name
substitutions: {}
reply_to:
$ref: '#/components/schemas/Address'
description: If provided, the reply-to header in headers array must not be provided
subject:
type: string
description: Email subject line
example: example_value
text_content:
type: string
description: Plain text content. Required if html_content is empty
example: example_value
html_content:
type: string
description: HTML content. Required if text_content is empty
example: example_value
amp_content:
type: string
description: AMP HTML content
example: example_value
attachments:
type: array
items:
$ref: '#/components/schemas/Attachment'
description: File attachments
example:
- base64: true
data: example_value
content_type: example_value
content_disposition: example_value
content_id: '500123'
headers:
type: object
additionalProperties:
type: string
description: Custom email headers. reply-to header cannot be provided if reply_to is provided, message-id will be ignored and automatically generated
example: {}
substitutions:
type: object
additionalProperties: true
description: Global substitutions, recipient substitutions override global
example: {}
tags:
type: array
items:
type: string
description: Tags for categorizing messages
example:
- example_value
sandbox:
type: boolean
description: If true, the message will be sent to the sandbox environment
default: false
example: true
sandbox_result:
type: string
enum: [deliver, bounce, defer, fail, suppress]
description: The result of the sandbox send
example: deliver
tracking:
$ref: '#/components/schemas/Tracking'
description: Tracking settings for the message, overrides default account settings
retention:
$ref: '#/components/schemas/Retention'
description: Retention settings for the message, overrides default account settings
schedule:
$ref: '#/components/schemas/MessageSchedule'
description: Schedule for message delivery
example:
from:
email: "noreply@example.com"
name: "Example Corp"
recipients:
- email: "user@example.com"
name: "John Doe"
subject: "Welcome to Example Corp"
html_content: "
Welcome {{first_name}}!
"
text_content: "Welcome {{first_name}}!"
substitutions:
first_name: "John"
CreateConversationMessageRequest:
type: object
required:
- from
- recipients
- subject
properties:
from:
$ref: '#/components/schemas/Address'
to:
type: array
items:
$ref: '#/components/schemas/Address'
minItems: 1
description: This parameter can set the `To` header to multiple addresses.
example:
- email: user@example.com
name: Example Name
cc:
type: array
items:
$ref: '#/components/schemas/Address'
minItems: 1
description: This parameter can set the `CC` header to multiple addresses. Do not include `cc` in the headers array.
example:
- email: user@example.com
name: Example Name
bcc:
type: array
items:
$ref: '#/components/schemas/Address'
minItems: 1
description: This parameter can set the `To` header to multiple addresses.
example:
- email: user@example.com
name: Example Name
reply_to:
$ref: '#/components/schemas/Address'
description: If provided, the reply-to header in headers array must not be provided
subject:
type: string
description: Email subject line
example: example_value
text_content:
type: string
description: Plain text content. Required if html_content is empty
example: example_value
html_content:
type: string
description: HTML content. Required if text_content is empty
example: example_value
amp_content:
type: string
description: AMP HTML content
example: example_value
attachments:
type: array
items:
$ref: '#/components/schemas/Attachment'
description: File attachments
example:
- base64: true
data: example_value
content_type: example_value
content_disposition: example_value
content_id: '500123'
headers:
type: object
additionalProperties:
type: string
description: Custom email headers. `cc` and `reply-to` headers cannot be provided if `reply_to` or `cc` parameters are provided, message-id will be ignored and automatically generated
example: {}
tags:
type: array
items:
type: string
description: Tags for categorizing messages
example:
- example_value
sandbox:
type: boolean
description: If true, the message will be sent to the sandbox environment
default: false
example: true
sandbox_result:
type: string
enum: [deliver, bounce, defer, fail, suppress]
description: The result of the sandbox send
example: deliver
tracking:
$ref: '#/components/schemas/Tracking'
description: Tracking settings for the message, overrides default account settings
retention:
$ref: '#/components/schemas/Retention'
description: Retention settings for the message, overrides default account settings
schedule:
$ref: '#/components/schemas/MessageSchedule'
description: Schedule for message delivery
example:
from:
email: "noreply@example.com"
name: "Example Corp"
to:
- email: "user@example.com"
name: "John Doe"
- email: "someone@example.com"
name: "Jane Doe"
cc:
- email: "hr@example.com"
name: "Example Corp HR"
bcc:
- email: "bcc@example.com"
name: "BCC Recipient"
subject: "Welcome to Example Corp"
html_content: "Dear John and Jane, welcome to Example Corp!
"
text_content: "Dear John and Jane, welcome to Example Corp!"
CreateSingleMessageResponse:
type: object
required:
- object
- recipient
- status
properties:
object:
type: string
enum: [message]
description: Object type identifier
example: message
id:
type: string
nullable: true
description: Message ID (null if the message was not sent)
example:
recipient:
$ref: '#/components/schemas/Recipient'
status:
type: string
enum: [queued, scheduled, error]
description: Status of the message
example: queued
error:
type: string
nullable: true
description: Error message if the message was not sent
example: example_value
schedule:
$ref: '#/components/schemas/MessageSchedule'
description: Provided if the request contained a schedule
CreateMessageResponse:
type: object
required:
- object
- data
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/CreateSingleMessageResponse'
description: List of messages and their statuses
example:
- object: message
id: '500123'
recipient: {}
status: queued
error: example_value
DeliveryEvent:
type: object
properties:
time:
type: string
format: date-time
description: Timestamp of the delivery event
example: '2025-03-15T14:30:00Z'
log:
type: string
description: Log message for the delivery event
example: example_value
status:
type: string
description: Status of the delivery event
example: example_value
required:
- time
- log
- status
MessageContentPart:
type: object
properties:
content_type:
type: string
description: MIME content type (e.g., "text/plain", "text/html")
example: "text/html"
content:
type: string
description: The actual content for this part
example: example_value
required:
- content_type
- content
MessageAttachment:
type: object
properties:
filename:
type: string
description: Original filename of the attachment
example: "document.pdf"
content:
type: string
description: Base64 encoded attachment content
example: example_value
content_type:
type: string
description: MIME content type of the attachment
example: "application/pdf"
content_id:
type: string
description: Content-ID for inline attachments
nullable: true
example: "image001@example.com"
required:
- filename
- content
- content_type
MessageContentParsed:
type: object
properties:
parts:
type: array
items:
$ref: '#/components/schemas/MessageContentPart'
description: Array of message content parts (text, HTML, etc.)
example:
- content_type: example_value
content: example_value
attachments:
type: array
items:
$ref: '#/components/schemas/MessageAttachment'
description: Array of message attachments
example:
- filename: Example Name
content: example_value
content_type: example_value
content_id: '500123'
headers:
type: object
additionalProperties:
type: array
items:
type: string
description: Email headers as key-value pairs (values are arrays to handle multiple headers with same name)
example:
"Content-Type": ["text/html; charset=utf-8"]
"X-Custom-Header": ["value1", "value2"]
required:
- parts
- attachments
- headers
# Base message schema without heavy content fields
MessageSummary:
type: object
properties:
object:
type: string
enum: [message]
description: Object type identifier
example: message
created_at:
type: string
format: date-time
description: When the message was created
example: '2025-03-15T14:30:00Z'
updated_at:
type: string
format: date-time
description: When the message was last updated
example: '2025-03-15T14:30:00Z'
sent_at:
type: string
format: date-time
nullable: true
description: When the message was sent
example: '2025-03-15T14:30:00Z'
delivered_at:
type: string
format: date-time
nullable: true
description: When the message was delivered
example: '2025-03-15T14:30:00Z'
retain_until:
type: string
format: date-time
description: When the message data will be purged
example: '2025-03-15T14:30:00Z'
direction:
type: string
enum: [incoming, outgoing]
description: Message direction
example: incoming
is_bounce_notification:
type: boolean
description: Whether this is a bounce notification
example: true
bounce_classification:
type: string
description: Classification of bounce if applicable
example: example_value
delivery_attempts:
type: array
items:
$ref: '#/components/schemas/DeliveryEvent'
description: List of delivery attempts for this message
example:
- time: '2025-03-15T14:30:00Z'
log: example_value
status: example_value
message_id:
type: string
description: Message-ID header value
example: '500123'
id:
type: string
format: uuid
description: API-generated message ID
example: '500123'
subject:
type: string
description: Message subject
example: example_value
tags:
type: array
items:
type: string
description: Tags associated with the message
example:
- example_value
sender:
type: string
format: email
description: Sender email address
example: example_value
recipient:
type: string
format: email
description: Recipient email address
example: example_value
status:
type: string
description: Current message status
example: example_value
num_attempts:
type: integer
description: Number of delivery attempts
example: 1
click_count:
type: integer
description: Number of clicks tracked for this message
example: 1
open_count:
type: integer
description: Number of opens tracked for this message
example: 1
reference_message_id:
type: integer
format: int64
description: ID of the original message (for bounce messages)
example: 1
domain_id:
type: string
format: uuid
description: Domain ID this message was sent from
example: '500123'
account_id:
type: string
format: uuid
description: Account ID this message belongs to
example: '500123'
required:
- object
- created_at
- updated_at
- retain_until
- direction
- is_bounce_notification
- delivery_attempts
- message_id
- id
- subject
- tags
- sender
- recipient
- status
- num_attempts
- click_count
- open_count
- domain_id
- account_id
# Full message schema with content fields
Message:
allOf:
- $ref: '#/components/schemas/MessageSummary'
- type: object
properties:
content:
type: string
nullable: true
description: Original, raw email content (RFC822 format) - may be null if the message content is not available.
content_parsed:
$ref: '#/components/schemas/MessageContentParsed'
description: Parsed and structured message content including parts, attachments, and headers - may be null if the message content is not available.
# Update the paginated response to use the lighter schema
PaginatedMessagesResponse:
type: object
required:
- object
- data
- pagination
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/MessageSummary'
description: Array of message summaries (content and content_parsed fields omitted for performance)
example:
- object: message
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
sent_at: '2025-03-15T14:30:00Z'
delivered_at: '2025-03-15T14:30:00Z'
pagination:
$ref: '#/components/schemas/PaginationInfo'
# Account Schemas
Account:
type: object
properties:
object:
type: string
enum: [account]
description: Object type identifier
example: account
id:
type: string
format: uuid
description: Unique identifier for the account
example: '500123'
created_at:
type: string
format: date-time
description: When the account was created
example: '2025-03-15T14:30:00Z'
updated_at:
type: string
format: date-time
description: When the account was last updated
example: '2025-03-15T14:30:00Z'
name:
type: string
description: Account name
example: Example Name
website:
type: string
format: uri
nullable: true
description: Account website URL
example: https://example.com
about:
type: string
nullable: true
description: Account description
example: example_value
track_opens:
type: boolean
description: Default open tracking setting
example: true
track_clicks:
type: boolean
description: Default click tracking setting
example: true
reject_bad_recipients:
type: boolean
description: Whether to reject bad recipients
example: true
reject_mistyped_recipients:
type: boolean
description: Whether to reject mistyped recipients
example: true
message_metadata_retention:
type: integer
description: Default message metadata retention in days
example: 1
message_data_retention:
type: integer
description: Default message data retention in days
example: 1
required:
- object
- id
- created_at
- updated_at
- name
UpdateAccountRequest:
type: object
properties:
name:
type: string
maxLength: 255
description: Account name
example: Example Name
website:
type: string
format: uri
description: Account website URL
example: https://example.com
about:
type: string
description: Account description (used for account verification)
example: example_value
track_opens:
type: boolean
description: Default open tracking setting
example: true
track_clicks:
type: boolean
description: Default click tracking setting
example: true
reject_bad_recipients:
type: boolean
description: Whether to reject bad recipients
example: true
reject_mistyped_recipients:
type: boolean
description: Whether to reject mistyped recipients
example: true
message_metadata_retention:
type: integer
minimum: 1
maximum: 30
description: Default message metadata retention in days
example: 1
message_data_retention:
type: integer
minimum: 0
maximum: 30
description: Default message data retention in days
example: 1
example:
name: "Updated Company Name"
website: "https://example.com"
track_opens: true
UserAccount:
type: object
properties:
id:
type: string
format: uuid
description: Unique identifier for the user account relationship
example: '500123'
created_at:
type: string
format: date-time
description: When the relationship was created
example: '2025-03-15T14:30:00Z'
updated_at:
type: string
format: date-time
description: When the relationship was last updated
example: '2025-03-15T14:30:00Z'
user_id:
type: string
format: uuid
description: User ID
example: '500123'
account_id:
type: string
format: uuid
description: Account ID
example: '500123'
role:
type: string
enum: [Administrator, Developer, Analyst, "Billing Manager"]
description: User role in the account
example: Administrator
required:
- id
- created_at
- updated_at
- user_id
- account_id
- role
AccountMembersResponse:
type: object
required:
- object
- data
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/UserAccount'
description: Array of account members
example:
- id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
user_id: '500123'
account_id: '500123'
AddMemberRequest:
type: object
required:
- email
- role
properties:
email:
type: string
format: email
description: Email address of the user to add
example: user@example.com
name:
type: string
description: Display name for the user
example: Example Name
role:
type: string
enum: [Administrator, Developer, Analyst, "Billing Manager"]
description: Role to assign to the user
example: Administrator
example:
email: "user@example.com"
name: "John Doe"
role: "Developer"
# Suppression Schemas
Suppression:
type: object
properties:
object:
type: string
enum: [suppression]
description: Object type identifier
example: suppression
id:
type: string
format: uuid
description: Unique identifier for the suppression
example: '500123'
created_at:
type: string
format: date-time
description: When the suppression was created
example: '2025-03-15T14:30:00Z'
updated_at:
type: string
format: date-time
description: When the suppression was last updated
example: '2025-03-15T14:30:00Z'
email:
type: string
format: email
description: Suppressed email address
example: user@example.com
domain:
type: string
nullable: true
description: Domain for which the email is suppressed
example: mail.example.com
reason:
type: string
nullable: true
description: Reason for suppression
example: example_value
expires_at:
type: string
format: date-time
description: When the suppression expires
example: '2025-03-15T14:30:00Z'
required:
- object
- id
- created_at
- updated_at
- email
- expires_at
CreateSuppressionResponse:
type: object
required:
- object
- data
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/Suppression'
description: Array of suppressions
example:
- object: suppression
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
email: user@example.com
CreateSuppressionRequest:
type: object
required:
- email
- expires_at
properties:
email:
type: string
format: email
description: Email address to suppress
example: user@example.com
domain:
type: string
format: hostname
description: Domain for which to suppress the email
example: mail.example.com
reason:
type: string
maxLength: 255
description: Reason for suppression
example: example_value
expires_at:
type: string
format: date-time
description: When the suppression expires (RFC3339 format)
example: '2025-03-15T14:30:00Z'
example:
email: "user@example.com"
domain: "example.com"
reason: "User requested removal"
expires_at: "2024-12-25T10:30:00Z"
PaginatedSuppressionsResponse:
type: object
required:
- object
- data
- pagination
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/Suppression'
description: Array of suppressions
example:
- object: suppression
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
email: user@example.com
pagination:
$ref: '#/components/schemas/PaginationInfo'
# Route Schemas
Route:
type: object
properties:
object:
type: string
enum: [route]
description: Object type identifier
example: route
id:
type: string
format: uuid
description: Unique identifier for the route
example: '500123'
created_at:
type: string
format: date-time
description: When the route was created
example: '2025-03-15T14:30:00Z'
updated_at:
type: string
format: date-time
description: When the route was last updated
example: '2025-03-15T14:30:00Z'
name:
type: string
description: Route name
example: Example Name
url:
type: string
format: uri
description: Webhook URL for the route
example: https://example.com
recipient:
type: string
nullable: true
description: Recipient filter
example: example_value
attachments:
type: boolean
description: Whether to include attachments in route payload
example: true
headers:
type: boolean
description: Whether to include headers in route payload
example: true
group_by_message_id:
type: boolean
description: Whether to group by message ID
example: true
strip_replies:
type: boolean
description: Whether to strip reply content
example: true
enabled:
type: boolean
description: Whether the route is enabled
example: true
success_count:
type: integer
description: Number of successful calls
example: 1
error_count:
type: integer
description: Number of unsuccessful calls
example: 1
errors_since_last_success:
type: integer
description: Number of consecutive failed calls
example: 1
last_request_at:
type: string
format: date-time
description: When the route was last called
example: '2025-03-15T14:30:00Z'
required:
- object
- id
- created_at
- updated_at
- name
- url
- enabled
CreateRouteRequest:
type: object
required:
- name
- url
properties:
name:
type: string
maxLength: 255
description: Route name
example: Example Name
url:
type: string
format: uri
description: Webhook URL for the route
example: https://example.com
recipient:
type: string
maxLength: 255
description: Recipient filter
example: example_value
attachments:
type: boolean
description: Whether to include attachments in webhooks
default: false
example: true
headers:
type: boolean
description: Whether to include headers in webhooks
default: false
example: true
group_by_message_id:
type: boolean
description: Whether to group by message ID
default: false
example: true
strip_replies:
type: boolean
description: Whether to strip reply content
default: false
example: true
enabled:
type: boolean
description: Whether the route is enabled
default: true
example: true
example:
name: "Support Route"
url: "https://example.com/webhook"
enabled: true
UpdateRouteRequest:
type: object
properties:
name:
type: string
maxLength: 255
nullable: true
description: Route name
example: Example Name
url:
type: string
format: uri
nullable: true
description: Webhook URL for the route
example: https://example.com
recipient:
type: string
maxLength: 255
nullable: true
description: Recipient filter
example: example_value
attachments:
type: boolean
nullable: true
description: Whether to include attachments in webhooks
example: true
headers:
type: boolean
nullable: true
description: Whether to include headers in webhooks
example: true
group_by_message_id:
type: boolean
nullable: true
description: Whether to group by message ID
example: true
strip_replies:
type: boolean
nullable: true
description: Whether to strip reply content
example: true
enabled:
type: boolean
nullable: true
description: Whether the route is enabled
example: true
example:
name: "Updated Support Route"
enabled: false
PaginatedRoutesResponse:
type: object
required:
- object
- data
- pagination
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/Route'
description: Array of routes
example:
- object: route
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
pagination:
$ref: '#/components/schemas/PaginationInfo'
# Webhook Schemas
Webhook:
type: object
properties:
object:
type: string
enum: [webhook]
description: Object type identifier
example: webhook
id:
type: string
format: uuid
description: Unique identifier for the webhook
example: '500123'
created_at:
type: string
format: date-time
description: When the webhook was created
example: '2025-03-15T14:30:00Z'
updated_at:
type: string
format: date-time
description: When the webhook was last updated
example: '2025-03-15T14:30:00Z'
name:
type: string
description: Webhook name
example: Example Name
url:
type: string
format: uri
description: Webhook URL
example: https://example.com
enabled:
type: boolean
description: Whether the webhook is enabled
example: true
on_reception:
type: boolean
description: Trigger on message reception
example: true
on_delivered:
type: boolean
description: Trigger on message delivery
example: true
on_transient_error:
type: boolean
description: Trigger on transient errors
example: true
on_failed:
type: boolean
description: Trigger on permanent failures
example: true
on_bounced:
type: boolean
description: Trigger on bounces
example: true
on_suppressed:
type: boolean
description: Trigger on suppressions
example: true
on_opened:
type: boolean
description: Trigger on opens
example: true
on_clicked:
type: boolean
description: Trigger on clicks
example: true
on_suppression_created:
type: boolean
description: Trigger on suppression creation
example: true
on_dns_error:
type: boolean
description: Trigger on DNS errors
example: true
scope:
type: string
description: Webhook scope
example: example_value
domains:
type: array
items:
type: string
description: Domains this webhook applies to
example:
- mail.example.com
success_count:
type: integer
description: Number of successful calls
example: 1
error_count:
type: integer
description: Number of unsuccessful calls
example: 1
errors_since_last_success:
type: integer
description: Number of consecutive failed calls
example: 1
last_request_at:
type: string
format: date-time
description: When the webhook was last called
example: '2025-03-15T14:30:00Z'
required:
- object
- id
- created_at
- updated_at
- name
- url
- enabled
CreateWebhookRequest:
type: object
required:
- name
- url
properties:
name:
type: string
maxLength: 255
description: Webhook name
example: Example Name
url:
type: string
format: uri
description: Webhook URL
example: https://example.com
enabled:
type: boolean
description: Whether the webhook is enabled
default: true
example: true
on_reception:
type: boolean
description: Trigger on message reception
default: false
example: true
on_delivered:
type: boolean
description: Trigger on message delivery
default: false
example: true
on_transient_error:
type: boolean
description: Trigger on transient errors
default: false
example: true
on_failed:
type: boolean
description: Trigger on permanent failures
default: false
example: true
on_bounced:
type: boolean
description: Trigger on bounces
default: false
example: true
on_suppressed:
type: boolean
description: Trigger on suppressions
default: false
example: true
on_opened:
type: boolean
description: Trigger on opens
default: false
example: true
on_clicked:
type: boolean
description: Trigger on clicks
default: false
example: true
on_suppression_created:
type: boolean
description: Trigger on suppression creation
default: false
example: true
on_dns_error:
type: boolean
description: Trigger on DNS errors
default: false
example: true
scope:
type: string
description: Webhook scope
example: example_value
domains:
type: array
items:
type: string
nullable: true
description: Domains this webhook applies to
example:
- mail.example.com
example:
name: "Delivery Webhook"
url: "https://example.com/webhook"
enabled: true
on_delivered: true
UpdateWebhookRequest:
type: object
properties:
name:
type: string
maxLength: 255
nullable: true
description: Webhook name
example: Example Name
url:
type: string
format: uri
nullable: true
description: Webhook URL
example: https://example.com
enabled:
type: boolean
nullable: true
description: Whether the webhook is enabled
example: true
on_reception:
type: boolean
nullable: true
description: Trigger on message reception
example: true
on_delivered:
type: boolean
nullable: true
description: Trigger on message delivery
example: true
on_transient_error:
type: boolean
nullable: true
description: Trigger on transient errors
example: true
on_failed:
type: boolean
nullable: true
description: Trigger on permanent failures
example: true
on_bounced:
type: boolean
nullable: true
description: Trigger on bounces
example: true
on_suppressed:
type: boolean
nullable: true
description: Trigger on suppressions
example: true
on_opened:
type: boolean
nullable: true
description: Trigger on opens
example: true
on_clicked:
type: boolean
nullable: true
description: Trigger on clicks
example: true
on_suppression_created:
type: boolean
nullable: true
description: Trigger on suppression creation
example: true
on_dns_error:
type: boolean
nullable: true
description: Trigger on DNS errors
example: true
scope:
type: string
nullable: true
description: Webhook scope
example: example_value
domains:
type: array
nullable: true
items:
type: string
description: Domains this webhook applies to
example:
- mail.example.com
PaginatedWebhooksResponse:
type: object
required:
- object
- data
- pagination
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/Webhook'
description: Array of webhooks
example:
- object: webhook
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
pagination:
$ref: '#/components/schemas/PaginationInfo'
# SMTP Credentials Schemas
SMTPCredential:
type: object
properties:
object:
type: string
enum: [smtp_credential]
description: Object type identifier
example: smtp_credential
id:
type: string
format: uuid
description: Unique identifier for the SMTP credential
example: '500123'
created_at:
type: string
format: date-time
description: When the credential was created
example: '2025-03-15T14:30:00Z'
updated_at:
type: string
format: date-time
description: When the credential was last updated
example: '2025-03-15T14:30:00Z'
name:
type: string
description: Credential name
example: Example Name
username:
type: string
description: SMTP username
example: Example Name
sandbox:
type: boolean
description: Whether this is a sandbox credential
example: true
scope:
type: string
enum: [global, scoped]
description: Credential scope
example: global
domains:
type: array
items:
type: string
description: Domains this credential can send from
example:
- mail.example.com
required:
- object
- id
- created_at
- updated_at
- name
- username
- sandbox
- scope
CreateSMTPCredentialRequest:
type: object
required:
- name
- scope
properties:
name:
type: string
maxLength: 255
description: Credential name
example: Example Name
sandbox:
type: boolean
description: Whether this is a sandbox credential
default: false
example: true
scope:
type: string
enum: [global, scoped]
description: Credential scope - "global" or "scoped"
example: global
domains:
type: array
items:
type: string
description: Required if scope is "scoped"
example:
- mail.example.com
example:
name: "Production SMTP"
username: "smtp_user"
password: "secure_password"
scope: "global"
PaginatedSMTPCredentialsResponse:
type: object
required:
- object
- data
- pagination
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/SMTPCredential'
description: Array of SMTP credentials
example:
- object: smtp_credential
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
pagination:
$ref: '#/components/schemas/PaginationInfo'
# Statistics Schemas
DeliverabilityStatistics:
type: object
properties:
from_timestamp:
type: string
format: date-time
description: Start time of the statistics bucket
example: '2025-03-15T14:30:00Z'
to_timestamp:
type: string
format: date-time
description: End time of the statistics bucket
example: '2025-03-15T14:30:00Z'
reception_count:
type: integer
description: Number of messages accepted for delivery
example: 1
delivered_count:
type: integer
description: Number of messages delivered
example: 1
deferred_count:
type: integer
description: Number of messages deferred
example: 1
bounced_count:
type: integer
description: Number of messages bounced
example: 1
failed_count:
type: integer
description: Number of messages failed
example: 1
suppressed_count:
type: integer
description: Number of messages suppressed
example: 1
opened_count:
type: integer
description: Number of messages opened at least once
example: 1
clicked_count:
type: integer
description: Number of messages that have at least one link in them clicked.
example: 1
required:
- from_timestamp
- to_timestamp
DeliverabilityStatisticsResponse:
type: object
required:
- object
- data
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/DeliverabilityStatistics'
description: Array of deliverability statistics
example:
- from_timestamp: '2025-03-15T14:30:00Z'
to_timestamp: '2025-03-15T14:30:00Z'
reception_count: 1
delivered_count: 1
deferred_count: 1
Bounce:
type: object
properties:
classification:
type: string
description: Bounce classification
example: example_value
count:
type: integer
description: Number of bounces
example: 1
required:
- classification
- count
BounceStatistics:
type: object
properties:
from_timestamp:
type: string
format: date-time
description: Start time of the statistics bucket
example: '2025-03-15T14:30:00Z'
to_timestamp:
type: string
format: date-time
description: End time of the statistics bucket
example: '2025-03-15T14:30:00Z'
bounces:
type: array
items:
$ref: '#/components/schemas/Bounce'
description: Bounce count per bounce classification
example:
- classification: example_value
count: 1
required:
- from_timestamp
- to_timestamp
- bounces
BounceStatisticsResponse:
type: object
required:
- object
- data
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/BounceStatistics'
description: Array of bounce statistics
example:
- from_timestamp: '2025-03-15T14:30:00Z'
to_timestamp: '2025-03-15T14:30:00Z'
bounces:
- {}
DeliveryTimeStatistics:
type: object
properties:
from_timestamp:
type: string
format: date-time
description: Start time of the statistics bucket
example: '2025-03-15T14:30:00Z'
to_timestamp:
type: string
format: date-time
description: End time of the statistics bucket
example: '2025-03-15T14:30:00Z'
avg_delivery_time:
type: number
format: double
description: Average delivery time in seconds
example: 1.0
delivered_count:
type: integer
description: Number of messages
example: 1
delivery_times:
type: array
items:
$ref: '#/components/schemas/DeliveryTime'
description: Delivery times per recipient domain
example:
- recipient_domain: mail.example.com
delivery_time: 1.0
required:
- from_timestamp
- to_timestamp
- avg_delivery_time
- delivered_count
DeliveryTime:
type: object
properties:
recipient_domain:
type: string
format: fqdn
description: The recipient domain
example: mail.example.com
delivery_time:
type: number
format: double
description: The average time from reception to delivery in seconds
example: 1.0
DeliveryTimeStatisticsResponse:
type: object
required:
- object
- data
properties:
object:
type: string
enum: [list]
description: Object type identifier
example: list
data:
type: array
items:
$ref: '#/components/schemas/DeliveryTimeStatistics'
description: Array of delivery time statistics
example:
- from_timestamp: '2025-03-15T14:30:00Z'
to_timestamp: '2025-03-15T14:30:00Z'
avg_delivery_time: 1.0
delivered_count: 1
delivery_times:
- {}
paths:
# Utility endpoints
/v2/ping:
get:
summary: AhaSend Ping
description: Health check endpoint that returns a simple pong response
operationId: ping
tags:
- Utility
security:
- BearerAuth: []
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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)
}
}
responses:
'200':
description: Pong response
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
example:
message: "pong"
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
message: "missing or malformed bearer token"
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
message: invalid API key
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
message: insufficient permissions for the required scope
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
message: internal server error
# API Keys endpoints
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/api-keys:
get:
summary: AhaSend Get API Keys
description: Returns a list of API keys for the account
operationId: getAPIKeys
tags:
- API Keys
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: limit
in: query
description: Maximum number of items to return
schema:
type: integer
minimum: 1
maximum: 100
default: 100
example: 1
- name: after
in: query
description: Pagination cursor for the next page. Provide the value provided in `next_cursor` from the response.
schema:
type: string
example: example_value
- name: before
in: query
description: Pagination cursor for the previous page.
schema:
type: string
example: example_value
security:
- BearerAuth: ["api-keys:read"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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)
}
}
responses:
'200':
description: List of API keys
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedAPIKeysResponse'
examples:
getAPIKeys200Example:
summary: Default getAPIKeys 200 response
x-microcks-default: true
value:
object: list
data:
- {}
pagination:
has_more: {}
next_cursor: {}
previous_cursor: {}
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAPIKeys401Example:
summary: Default getAPIKeys 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAPIKeys403Example:
summary: Default getAPIKeys 403 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAPIKeys500Example:
summary: Default getAPIKeys 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
post:
summary: AhaSend Create API Key
description: Creates a new API key with the specified scopes
operationId: createAPIKey
tags:
- API Keys
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- $ref: '#/components/parameters/IdempotencyKey'
example: example
security:
- BearerAuth: ["api-keys:write"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"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()
// Call the ping endpoint
response, httpResp, err := client.APIKeysAPI.CreateAPIKey(
ctx,
accountID,
requests.CreateAPIKeyRequest{
Label: "My API Key",
Scopes: []string{
"messages:read:all",
"domains:read:all",
},
},
)
if err != nil {
log.Fatalf("Error creating API key: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Created API key, secret key: %s\n", response.SecretKey)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateAPIKeyRequest'
responses:
'201':
description: API key created successfully
headers:
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/APIKey'
examples:
createAPIKey201Example:
summary: Default createAPIKey 201 response
x-microcks-default: true
value:
object: api_key
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
last_used_at: '2025-03-15T14:30:00Z'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createAPIKey401Example:
summary: Default createAPIKey 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createAPIKey403Example:
summary: Default createAPIKey 403 response
x-microcks-default: true
value:
message: example_value
'409':
$ref: '#/components/responses/IdempotencyConflict'
'412':
$ref: '#/components/responses/IdempotencyPreconditionFailed'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createAPIKey500Example:
summary: Default createAPIKey 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/api-keys/{key_id}:
get:
summary: AhaSend Get API Key
description: Returns a specific API key by ID
operationId: getAPIKey
tags:
- API Keys
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: key_id
in: path
required: true
description: API Key ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["api-keys:read"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.GetAPIKey(
ctx,
accountID,
uuid.MustParse("c5a32c40-b351-439f-8230-779daed3e42c"),
)
if err != nil {
log.Fatalf("Error getting API key: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("API key: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: API key details
content:
application/json:
schema:
$ref: '#/components/schemas/APIKey'
examples:
getAPIKey200Example:
summary: Default getAPIKey 200 response
x-microcks-default: true
value:
object: api_key
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
last_used_at: '2025-03-15T14:30:00Z'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAPIKey400Example:
summary: Default getAPIKey 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAPIKey401Example:
summary: Default getAPIKey 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAPIKey403Example:
summary: Default getAPIKey 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: API key not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAPIKey404Example:
summary: Default getAPIKey 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAPIKey500Example:
summary: Default getAPIKey 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
put:
summary: AhaSend Update API Key
description: Updates an existing API key's label and scopes
operationId: updateAPIKey
tags:
- API Keys
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: key_id
in: path
required: true
description: API Key ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["api-keys:write"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"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()
// Call the ping endpoint
response, httpResp, err := client.APIKeysAPI.UpdateAPIKey(
ctx,
accountID,
uuid.MustParse("c5a32c40-b351-439f-8230-779daed3e42c"),
requests.UpdateAPIKeyRequest{
Label: ahasend.String("My API Key"),
Scopes: &[]string{
"messages:read:all",
"domains:read:all",
},
},
)
if err != nil {
log.Fatalf("Error updating API key: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Updated API key: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateAPIKeyRequest'
responses:
'200':
description: API key updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/APIKey'
examples:
updateAPIKey200Example:
summary: Default updateAPIKey 200 response
x-microcks-default: true
value:
object: api_key
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
last_used_at: '2025-03-15T14:30:00Z'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateAPIKey400Example:
summary: Default updateAPIKey 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateAPIKey401Example:
summary: Default updateAPIKey 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateAPIKey403Example:
summary: Default updateAPIKey 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: API key not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateAPIKey404Example:
summary: Default updateAPIKey 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateAPIKey500Example:
summary: Default updateAPIKey 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
delete:
summary: AhaSend Delete API Key
description: Deletes an API key
operationId: deleteAPIKey
tags:
- API Keys
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: key_id
in: path
required: true
description: API Key ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["api-keys:delete"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.DeleteAPIKey(
ctx,
accountID,
uuid.MustParse("c5a32c40-b351-439f-8230-779daed3e42c"),
)
if err != nil {
log.Fatalf("Error deleting API key: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Deleted API key: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: API key deleted successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
example:
message: "api key {id} ({label}) deleted successfully"
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteAPIKey400Example:
summary: Default deleteAPIKey 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteAPIKey401Example:
summary: Default deleteAPIKey 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteAPIKey403Example:
summary: Default deleteAPIKey 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: API key not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteAPIKey404Example:
summary: Default deleteAPIKey 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
# Domains endpoints
examples:
deleteAPIKey500Example:
summary: Default deleteAPIKey 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/domains:
get:
summary: AhaSend Get Domains
description: Returns a list of domains for the account
operationId: getDomains
tags:
- Domains
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: dns_valid
in: query
description: Filter results by DNS validation status
schema:
type: boolean
nullable: true
example: true
- name: limit
in: query
description: Maximum number of items to return (1-100)
schema:
type: integer
minimum: 1
maximum: 100
default: 100
example: 1
- name: after
in: query
description: Pagination cursor for the next page. Provide the value provided in `next_cursor` from the response.
schema:
type: string
example: example_value
- name: before
in: query
description: Pagination cursor for the previous page.
schema:
type: string
example: example_value
security:
- BearerAuth: ["domains:read"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.DomainsAPI.GetDomains(
ctx,
accountID,
nil,
nil,
nil,
)
if err != nil {
log.Fatalf("Error getting domains: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Found %d domains\n", len(response.Data))
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: List of domains
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedDomainsResponse'
examples:
getDomains200Example:
summary: Default getDomains 200 response
x-microcks-default: true
value:
object: list
data:
- {}
pagination:
has_more: {}
next_cursor: {}
previous_cursor: {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDomains400Example:
summary: Default getDomains 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDomains401Example:
summary: Default getDomains 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDomains403Example:
summary: Default getDomains 403 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDomains500Example:
summary: Default getDomains 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
post:
summary: AhaSend Create Domain
description: Creates a new domain
operationId: createDomain
tags:
- Domains
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- $ref: '#/components/parameters/IdempotencyKey'
example: example
security:
- BearerAuth: ["domains:write"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"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()
// Call the ping endpoint
response, httpResp, err := client.DomainsAPI.CreateDomain(
ctx,
accountID,
requests.CreateDomainRequest{
Domain: "example.com",
},
)
if err != nil {
log.Fatalf("Error creating domain: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Created domain: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateDomainRequest'
responses:
'201':
description: Domain created successfully
headers:
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/Domain'
examples:
createDomain201Example:
summary: Default createDomain 201 response
x-microcks-default: true
value:
object: domain
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
domain: mail.example.com
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createDomain400Example:
summary: Default createDomain 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createDomain401Example:
summary: Default createDomain 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createDomain403Example:
summary: Default createDomain 403 response
x-microcks-default: true
value:
message: example_value
'409':
$ref: '#/components/responses/IdempotencyConflict'
'412':
$ref: '#/components/responses/IdempotencyPreconditionFailed'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createDomain500Example:
summary: Default createDomain 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/domains/{domain}:
get:
summary: AhaSend Get Domain
description: Returns a specific domain by name
operationId: getDomain
tags:
- Domains
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: domain
in: path
required: true
description: Domain name
schema:
type: string
example: mail.example.com
security:
- BearerAuth: ["domains:read"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.DomainsAPI.GetDomain(
ctx,
accountID,
"example.com",
)
if err != nil {
log.Fatalf("Error getting domain: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Domain: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: Domain details
content:
application/json:
schema:
$ref: '#/components/schemas/Domain'
examples:
getDomain200Example:
summary: Default getDomain 200 response
x-microcks-default: true
value:
object: domain
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
domain: mail.example.com
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDomain400Example:
summary: Default getDomain 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDomain401Example:
summary: Default getDomain 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDomain403Example:
summary: Default getDomain 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Domain not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDomain404Example:
summary: Default getDomain 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDomain500Example:
summary: Default getDomain 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
put:
summary: AhaSend Update Domain
description: Updates DNS domain settings such as custom subdomains and DKIM rotation interval.
operationId: updateDomain
tags:
- Domains
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: domain
in: path
required: true
description: Domain name
schema:
type: string
example: mail.example.com
security:
- BearerAuth: ["domains:write"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
ahasend "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()
// Update domain settings
response, httpResp, err := client.DomainsAPI.UpdateDomain(
ctx,
accountID,
"example.com",
requests.UpdateDomainRequest{
TrackingSubdomain: ahasend.String("click"),
ReturnPathSubdomain: ahasend.String("mail"),
DKIMRotationIntervalDays: ahasend.Int(45),
},
)
if err != nil {
log.Fatalf("Error updating domain: %v", err)
}
fmt.Printf("Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Updated domain: %s\n", response.Domain)
}
}
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateDomainRequest'
responses:
'200':
description: Domain updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Domain'
examples:
updateDomain200Example:
summary: Default updateDomain 200 response
x-microcks-default: true
value:
object: domain
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
domain: mail.example.com
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateDomain400Example:
summary: Default updateDomain 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateDomain401Example:
summary: Default updateDomain 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateDomain403Example:
summary: Default updateDomain 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Domain not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateDomain404Example:
summary: Default updateDomain 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateDomain500Example:
summary: Default updateDomain 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
delete:
summary: AhaSend Delete Domain
description: Deletes a domain
operationId: deleteDomain
tags:
- Domains
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: domain
in: path
required: true
description: Domain name
schema:
type: string
example: mail.example.com
security:
- BearerAuth: ["domains:delete:{domain}", "domains:delete:all"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.DomainsAPI.DeleteDomain(
ctx,
accountID,
"example.com",
)
if err != nil {
log.Fatalf("Error deleting domain: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Deleted domain: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: Domain deleted successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
examples:
deleteDomain200Example:
summary: Default deleteDomain 200 response
x-microcks-default: true
value:
message: example_value
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteDomain400Example:
summary: Default deleteDomain 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteDomain401Example:
summary: Default deleteDomain 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteDomain403Example:
summary: Default deleteDomain 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Domain not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteDomain404Example:
summary: Default deleteDomain 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteDomain500Example:
summary: Default deleteDomain 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/domains/{domain}/check-dns:
post:
summary: AhaSend Check Domain DNS
description: Triggers a DNS validation check for the domain. If the domain was checked within the last 60 seconds, the cached validation result is returned instead of performing a fresh lookup.
operationId: checkDomainDNS
tags:
- Domains
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: domain
in: path
required: true
description: Domain name
schema:
type: string
example: mail.example.com
security:
- BearerAuth: ["domains:write"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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()
// Trigger a DNS validation check
response, httpResp, err := client.DomainsAPI.CheckDomainDNS(
ctx,
accountID,
"example.com",
)
if err != nil {
log.Fatalf("Error checking domain DNS: %v", err)
}
fmt.Printf("Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("DNS valid: %t\n", response.DNSValid)
}
}
responses:
'200':
description: Domain DNS status
content:
application/json:
schema:
$ref: '#/components/schemas/Domain'
examples:
checkDomainDNS200Example:
summary: Default checkDomainDNS 200 response
x-microcks-default: true
value:
object: domain
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
domain: mail.example.com
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
checkDomainDNS401Example:
summary: Default checkDomainDNS 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
checkDomainDNS403Example:
summary: Default checkDomainDNS 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Domain not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
checkDomainDNS404Example:
summary: Default checkDomainDNS 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
checkDomainDNS500Example:
summary: Default checkDomainDNS 500 response
x-microcks-default: true
value:
message: example_value
'503':
description: Managed DNS is currently unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
# Messages endpoints
examples:
checkDomainDNS503Example:
summary: Default checkDomainDNS 503 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/messages:
get:
summary: AhaSend Get Messages
description: |
Returns a list of message summaries for the account. Can be filtered by various parameters.
operationId: getMessages
tags:
- Messages
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: status
in: query
description: Filter by comma-separated list of message statuses
schema:
type: string
example: "Bounced,Failed"
- name: sender
in: query
description: Sender email address (must be from domain in API key scopes)
schema:
type: string
format: email
example: example_value
- name: recipient
in: query
description: Recipient email address
schema:
type: string
format: email
example: example_value
- name: subject
in: query
description: Filter by subject text
schema:
type: string
example: example_value
- name: message_id_header
in: query
description: Filter by message ID header (same ID returned by CreateMessage API)
schema:
type: string
example: '500123'
- name: tags
in: query
description: Filter by comma-separated list of tags (max 20)
schema:
type: string
example: "billing,urgent"
- name: from_time
in: query
description: Filter messages created after this time (RFC3339 format)
schema:
type: string
format: date-time
example: "2023-12-25T10:30:00Z"
- name: to_time
in: query
description: Filter messages created before this time (RFC3339 format)
schema:
type: string
format: date-time
example: "2023-12-26T10:30:00Z"
- name: limit
in: query
description: Maximum number of items to return (1-100)
schema:
type: integer
minimum: 1
maximum: 100
default: 100
example: 1
- name: after
in: query
description: Pagination cursor for the next page. Provide the value provided in `next_cursor` from the response.
schema:
type: string
example: example_value
- name: before
in: query
description: Pagination cursor for the previous page.
schema:
type: string
example: example_value
security:
- BearerAuth: ["messages:read:all", "messages:read:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"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()
// Call the ping endpoint
response, httpResp, err := client.MessagesAPI.GetMessages(
ctx,
accountID,
requests.GetMessagesParams{
Status: ahasend.String("bounced,failed"),
Sender: ahasend.String("info@example.com"),
Tags: []string{"billing", "urgent"},
},
)
if err != nil {
log.Fatalf("Error getting messages: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Found %d messages\n", len(response.Data))
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: List of messages
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedMessagesResponse'
examples:
getMessages200Example:
summary: Default getMessages 200 response
x-microcks-default: true
value:
object: list
data:
- {}
pagination:
has_more: {}
next_cursor: {}
previous_cursor: {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getMessages400Example:
summary: Default getMessages 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getMessages401Example:
summary: Default getMessages 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getMessages403Example:
summary: Default getMessages 403 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getMessages500Example:
summary: Default getMessages 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
post:
summary: AhaSend Create Message
description: |
Creates and sends a message to one or more recipients. This API cannot be used if you want to send a conversational/P2P message and set CC or BCC. Use [Create Conversation Message](https://ahasend.com/docs/api-reference/messages/create-conversation) instead.
**Validation Requirements:**
- Either `text_content` or `html_content` is required
- `from.email` must be from a domain you own with valid DNS records
- `retention.metadata` must be between 1 and 30 days
- `retention.data` must be between 0 and 30 days
- If `reply_to` is provided, do not include `reply-to` in headers
- `message-id` header will be ignored and automatically generated
- Schedule times must be in RFC3339 format
operationId: createMessage
tags:
- Messages
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- $ref: '#/components/parameters/IdempotencyKey'
example: example
security:
- BearerAuth: ["messages:send:all", "messages:send:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"github.com/AhaSend/ahasend-go"
"github.com/AhaSend/ahasend-go/api"
"github.com/AhaSend/ahasend-go/models/common"
"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()
response, httpResp, err := client.MessagesAPI.CreateMessage(
ctx,
accountID,
requests.CreateMessageRequest{
From: common.Address{
Email: "info@example.com",
Name: ahasend.String("Example Corp."),
},
Recipients: []common.Recipient{
{
Email: "john@example.com",
Name: ahasend.String("John Smith"),
},
},
Subject: "Hello",
TextContent: ahasend.String("Hello world!"),
Sandbox: ahasend.Bool(true),
},
)
if err != nil {
log.Fatalf("Error sending message: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Send successful! Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Message ID: %s\n", *response.Data[0].ID)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateMessageRequest'
responses:
'202':
description: Message created successfully
headers:
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/CreateMessageResponse'
examples:
createMessage202Example:
summary: Default createMessage 202 response
x-microcks-default: true
value:
object: list
data:
- {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createMessage400Example:
summary: Default createMessage 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createMessage401Example:
summary: Default createMessage 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createMessage403Example:
summary: Default createMessage 403 response
x-microcks-default: true
value:
message: example_value
'409':
$ref: '#/components/responses/IdempotencyConflict'
'412':
$ref: '#/components/responses/IdempotencyPreconditionFailed'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createMessage500Example:
summary: Default createMessage 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/messages/conversation:
post:
summary: AhaSend Create Conversational Message
description: |
Creates and sends a conversational message (with support for CC and BCC) to one or more recipients. This API does not support template substitutions, use [Create Message](https://ahasend.com/docs/api-reference/messages/create-message) instead if you need substitutions.
**Validation Requirements:**
- Either `text_content` or `html_content` is required
- `from.email` must be from a domain you own with valid DNS records
- `retention.metadata` must be between 1 and 30 days
- `retention.data` must be between 0 and 30 days
- If the `reply_to` parameter is provided, do not include `reply-to` in headers
- If the `cc` parameter is provided, do not include `cc` in headers
- `message-id` header will be ignored and automatically generated
- Schedule times must be in RFC3339 format
operationId: createConversationMessage
tags:
- Messages
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- $ref: '#/components/parameters/IdempotencyKey'
example: example
security:
- BearerAuth: ["messages:send:all", "messages:send:{domain}"]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateConversationMessageRequest'
responses:
'202':
description: Message created successfully
headers:
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/CreateMessageResponse'
examples:
createConversationMessage202Example:
summary: Default createConversationMessage 202 response
x-microcks-default: true
value:
object: list
data:
- {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createConversationMessage400Example:
summary: Default createConversationMessage 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createConversationMessage401Example:
summary: Default createConversationMessage 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createConversationMessage403Example:
summary: Default createConversationMessage 403 response
x-microcks-default: true
value:
message: example_value
'409':
$ref: '#/components/responses/IdempotencyConflict'
'412':
$ref: '#/components/responses/IdempotencyPreconditionFailed'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createConversationMessage500Example:
summary: Default createConversationMessage 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/messages/{message_id}:
get:
summary: AhaSend Get Message
description: |
Returns the complete message by its ID, including raw content and parsed content structure.
operationId: getMessage
tags:
- Messages
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: message_id
in: path
required: true
description: Message API ID (the same ID returned by [Create Message API](https://ahasend.com/docs/api-reference/messages/create-message))
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["messages:read:all", "messages:read:{domain}"]
responses:
'200':
description: Message details
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
examples:
getMessage200Example:
summary: Default getMessage 200 response
x-microcks-default: true
value: example_value
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getMessage400Example:
summary: Default getMessage 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getMessage401Example:
summary: Default getMessage 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getMessage403Example:
summary: Default getMessage 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Message not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getMessage404Example:
summary: Default getMessage 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getMessage500Example:
summary: Default getMessage 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/messages/{message_id}/cancel:
delete:
summary: AhaSend Cancel Message
description: Cancels a scheduled message
operationId: cancelMessage
tags:
- Messages
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: message_id
in: path
required: true
description: Message API ID (the same ID returned by [Create Message API](https://ahasend.com/docs/api-reference/messages/create-message))
schema:
type: string
example: '500123'
security:
- BearerAuth: ["messages:cancel:all", "messages:cancel:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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()
response, httpResp, err := client.MessagesAPI.CancelMessage(
ctx,
accountID,
"",
)
if err != nil {
log.Fatalf("Error canceling message: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Successfully canceled! Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Message canceled: %s\n", response.Message)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: Scheduled message is cancelled
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
examples:
cancelMessage200Example:
summary: Default cancelMessage 200 response
x-microcks-default: true
value:
message: example_value
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
cancelMessage400Example:
summary: Default cancelMessage 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
cancelMessage401Example:
summary: Default cancelMessage 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
cancelMessage403Example:
summary: Default cancelMessage 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Message not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
cancelMessage404Example:
summary: Default cancelMessage 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
# Account endpoints
examples:
cancelMessage500Example:
summary: Default cancelMessage 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}:
get:
summary: AhaSend Get Account
description: Returns account information
operationId: getAccount
tags:
- Accounts
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["accounts:read"]
responses:
'200':
description: Account details
content:
application/json:
schema:
$ref: '#/components/schemas/Account'
examples:
getAccount200Example:
summary: Default getAccount 200 response
x-microcks-default: true
value:
object: account
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAccount400Example:
summary: Default getAccount 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAccount401Example:
summary: Default getAccount 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAccount403Example:
summary: Default getAccount 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Account not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAccount404Example:
summary: Default getAccount 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAccount500Example:
summary: Default getAccount 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
put:
summary: AhaSend Update Account
description: |
Updates account settings
**Validation Requirements:**
- `name` must be maximum 255 characters
- `website` must be a valid URL
- `message_metadata_retention` must be between 1 and 30 days
- `message_data_retention` must be between 0 and 30 days
operationId: updateAccount
tags:
- Accounts
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["accounts:write"]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateAccountRequest'
responses:
'200':
description: Account updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Account'
examples:
updateAccount200Example:
summary: Default updateAccount 200 response
x-microcks-default: true
value:
object: account
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateAccount400Example:
summary: Default updateAccount 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateAccount401Example:
summary: Default updateAccount 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateAccount403Example:
summary: Default updateAccount 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Account not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateAccount404Example:
summary: Default updateAccount 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateAccount500Example:
summary: Default updateAccount 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/members:
get:
summary: AhaSend Get Account Members
description: Returns a list of account members
operationId: getAccountMembers
tags:
- Accounts
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["accounts:members:read"]
responses:
'200':
description: List of account members
content:
application/json:
schema:
$ref: '#/components/schemas/AccountMembersResponse'
examples:
getAccountMembers200Example:
summary: Default getAccountMembers 200 response
x-microcks-default: true
value:
object: list
data:
- {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAccountMembers400Example:
summary: Default getAccountMembers 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAccountMembers401Example:
summary: Default getAccountMembers 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAccountMembers403Example:
summary: Default getAccountMembers 403 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getAccountMembers500Example:
summary: Default getAccountMembers 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
post:
summary: AhaSend Add Account Member
description: |
Adds a new member to the account
**Validation Requirements:**
- `email` must be a valid email address
- `role` must be one of: Administrator, Developer, Analyst, Billing Manager
operationId: addAccountMember
tags:
- Accounts
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- $ref: '#/components/parameters/IdempotencyKey'
example: example
security:
- BearerAuth: ["accounts:members:add"]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AddMemberRequest'
responses:
'200':
description: Member added successfully
headers:
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/UserAccount'
examples:
addAccountMember200Example:
summary: Default addAccountMember 200 response
x-microcks-default: true
value:
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
user_id: '500123'
account_id: '500123'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
addAccountMember400Example:
summary: Default addAccountMember 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
addAccountMember401Example:
summary: Default addAccountMember 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
addAccountMember403Example:
summary: Default addAccountMember 403 response
x-microcks-default: true
value:
message: example_value
'409':
$ref: '#/components/responses/IdempotencyConflict'
'412':
$ref: '#/components/responses/IdempotencyPreconditionFailed'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
addAccountMember500Example:
summary: Default addAccountMember 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/members/{user_id}:
delete:
summary: AhaSend Remove Account Member
description: |
Removes a member from the account
**Restrictions:**
- You cannot delete yourself
- You cannot delete the account owner
operationId: removeAccountMember
tags:
- Accounts
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: user_id
in: path
required: true
description: User ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["accounts:members:remove"]
responses:
'200':
description: Member removed successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
examples:
removeAccountMember200Example:
summary: Default removeAccountMember 200 response
x-microcks-default: true
value:
message: example_value
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
removeAccountMember400Example:
summary: Default removeAccountMember 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
removeAccountMember401Example:
summary: Default removeAccountMember 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
removeAccountMember403Example:
summary: Default removeAccountMember 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Member not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
removeAccountMember404Example:
summary: Default removeAccountMember 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
# Suppressions endpoints
examples:
removeAccountMember500Example:
summary: Default removeAccountMember 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/suppressions:
get:
summary: AhaSend Get Suppressions
description: |
Returns a list of suppressions for the account
**Query Parameters:**
- `domain`: Filter by domain (optional)
- `email`: Filter by email (optional)
- `from_date`: Filter suppressions created after this date (RFC3339 format)
- `to_date`: Filter suppressions created before this date (RFC3339 format)
- `limit`: Maximum number of items to return (1-100, default: 100)
- `cursor`: Pagination cursor for the next page
operationId: getSuppressions
tags:
- Suppressions
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: domain
in: query
description: Filter by domain
schema:
type: string
example: mail.example.com
- name: email
in: query
required: true
description: Email address
schema:
type: string
format: email
example: user@example.com
- name: from_date
in: query
description: Filter suppressions created after this date (RFC3339 format)
schema:
type: string
format: date-time
example: '2025-03-15T14:30:00Z'
- name: to_date
in: query
description: Filter suppressions created before this date (RFC3339 format)
schema:
type: string
format: date-time
example: '2025-03-15T14:30:00Z'
- name: limit
in: query
description: Maximum number of items to return (1-100)
schema:
type: integer
minimum: 1
maximum: 100
default: 100
example: 1
- name: after
in: query
description: Pagination cursor for the next page. Provide the value provided in `next_cursor` from the response.
schema:
type: string
example: example_value
- name: before
in: query
description: Pagination cursor for the previous page. Provide the value provided in `previous_cursor` from the response.
schema:
type: string
example: example_value
security:
- BearerAuth: ["suppressions:read"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"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()
// Call the ping endpoint
response, httpResp, err := client.SuppressionsAPI.GetSuppressions(
ctx,
accountID,
requests.GetSuppressionsParams{},
nil,
)
if err != nil {
log.Fatalf("Error getting suppressions: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Found %d suppressions\n", len(response.Data))
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: List of suppressions
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedSuppressionsResponse'
examples:
getSuppressions200Example:
summary: Default getSuppressions 200 response
x-microcks-default: true
value:
object: list
data:
- {}
pagination:
has_more: {}
next_cursor: {}
previous_cursor: {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSuppressions400Example:
summary: Default getSuppressions 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSuppressions401Example:
summary: Default getSuppressions 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSuppressions403Example:
summary: Default getSuppressions 403 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSuppressions500Example:
summary: Default getSuppressions 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
post:
summary: AhaSend Create Suppression
description: |
Creates a new suppression for an email address
**Validation Requirements:**
- `email` must be a valid email address
- `expires_at` must be in RFC3339 format
- `domain` is optional - if not provided, applies to all account domains
operationId: createSuppression
tags:
- Suppressions
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- $ref: '#/components/parameters/IdempotencyKey'
example: example
security:
- BearerAuth: ["suppressions:write"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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()
// Call the ping endpoint
response, httpResp, err := client.SuppressionsAPI.CreateSuppression(
ctx,
accountID,
requests.CreateSuppressionRequest{
Email: "test@example.com",
Reason: ahasend.String("Inbox full"),
ExpiresAt: time.Now().Add(time.Hour * 24 * 30),
},
)
if err != nil {
log.Fatalf("Error creating suppression: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Created suppression: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateSuppressionRequest'
responses:
'201':
description: Suppression created successfully
headers:
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/CreateSuppressionResponse'
examples:
createSuppression201Example:
summary: Default createSuppression 201 response
x-microcks-default: true
value:
object: list
data:
- {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createSuppression400Example:
summary: Default createSuppression 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createSuppression401Example:
summary: Default createSuppression 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createSuppression403Example:
summary: Default createSuppression 403 response
x-microcks-default: true
value:
message: example_value
'409':
$ref: '#/components/responses/IdempotencyConflict'
'412':
$ref: '#/components/responses/IdempotencyPreconditionFailed'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createSuppression500Example:
summary: Default createSuppression 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
delete:
summary: AhaSend Delete Suppression
description: |
Deletes suppressions for an email address
**Query Parameters:**
- `email`: Required email address to delete from suppression list
- `domain`: Optional domain filter to delete suppressions for specific domain only
operationId: deleteSuppression
tags:
- Suppressions
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: email
in: query
required: true
description: Email address
schema:
type: string
format: email
example: user@example.com
- name: domain
in: query
description: Optional domain filter
schema:
type: string
example: mail.example.com
security:
- BearerAuth: ["suppressions:delete"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"github.com/AhaSend/ahasend-go"
"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.SuppressionsAPI.DeleteSuppression(
ctx,
accountID,
"info@bigco.com",
ahasend.String("notifications.example.com"),
)
if err != nil {
log.Fatalf("Error deleting suppression: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Deleted the suppression, response: %s\n", len(response.Message))
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: Suppression deleted successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
examples:
deleteSuppression200Example:
summary: Default deleteSuppression 200 response
x-microcks-default: true
value:
message: example_value
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteSuppression400Example:
summary: Default deleteSuppression 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteSuppression401Example:
summary: Default deleteSuppression 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteSuppression403Example:
summary: Default deleteSuppression 403 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteSuppression500Example:
summary: Default deleteSuppression 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/suppressions/all:
delete:
summary: AhaSend Delete All Suppressions
description: |
Deletes all suppressions for the account
**Query Parameters:**
- `domain`: Optional domain filter to delete suppressions for specific domain only
operationId: deleteAllSuppressions
tags:
- Suppressions
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: domain
in: query
description: Optional domain filter
schema:
type: string
example: mail.example.com
security:
- BearerAuth: ["suppressions:wipe"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.SuppressionsAPI.DeleteAllSuppressions(
ctx,
accountID,
nil,
)
if err != nil {
log.Fatalf("Error deleting all suppressions: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Deleted all suppressions: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: All suppressions deleted successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
examples:
deleteAllSuppressions200Example:
summary: Default deleteAllSuppressions 200 response
x-microcks-default: true
value:
message: example_value
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteAllSuppressions400Example:
summary: Default deleteAllSuppressions 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteAllSuppressions401Example:
summary: Default deleteAllSuppressions 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteAllSuppressions403Example:
summary: Default deleteAllSuppressions 403 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
# Routes endpoints
examples:
deleteAllSuppressions500Example:
summary: Default deleteAllSuppressions 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/routes:
get:
summary: AhaSend Get Routes
description: Returns a list of routes for the account
operationId: getRoutes
tags:
- Routes
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: limit
in: query
description: Maximum number of items to return (1-100)
schema:
type: integer
minimum: 1
maximum: 100
default: 100
example: 1
- name: after
in: query
description: Pagination cursor for the next page. Provide the value provided in `next_cursor` from the response.
schema:
type: string
example: example_value
- name: before
in: query
description: Pagination cursor for the previous page.
schema:
type: string
example: example_value
security:
- BearerAuth: ["routes:read:all", "routes:read:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.RoutesAPI.GetRoutes(
ctx,
accountID,
nil,
nil,
)
if err != nil {
log.Fatalf("Error getting routes: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Found %d routes\n", len(response.Data))
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: List of routes
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedRoutesResponse'
examples:
getRoutes200Example:
summary: Default getRoutes 200 response
x-microcks-default: true
value:
object: list
data:
- {}
pagination:
has_more: {}
next_cursor: {}
previous_cursor: {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getRoutes400Example:
summary: Default getRoutes 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getRoutes401Example:
summary: Default getRoutes 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getRoutes403Example:
summary: Default getRoutes 403 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getRoutes500Example:
summary: Default getRoutes 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
post:
summary: AhaSend Create Route
description: Creates a new route for inbound email routing
operationId: createRoute
tags:
- Routes
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- $ref: '#/components/parameters/IdempotencyKey'
example: example
security:
- BearerAuth: ["routes:write:all", "routes:write:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"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()
// Call the ping endpoint
response, httpResp, err := client.RoutesAPI.CreateRoute(
ctx,
accountID,
requests.CreateRouteRequest{
Name: "My Route",
URL: "https://mystartup.com/tickets",
Recipient: "ticket-*@mystartup.com",
Enabled: true,
Attachments: true,
Headers: true,
StripReplies: true,
},
)
if err != nil {
log.Fatalf("Error creating route: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Created route: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateRouteRequest'
responses:
'201':
description: Route created successfully
headers:
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/Route'
examples:
createRoute201Example:
summary: Default createRoute 201 response
x-microcks-default: true
value:
object: route
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createRoute400Example:
summary: Default createRoute 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createRoute401Example:
summary: Default createRoute 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createRoute403Example:
summary: Default createRoute 403 response
x-microcks-default: true
value:
message: example_value
'409':
$ref: '#/components/responses/IdempotencyConflict'
'412':
$ref: '#/components/responses/IdempotencyPreconditionFailed'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createRoute500Example:
summary: Default createRoute 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/routes/{route_id}:
get:
summary: AhaSend Get Route
description: Returns a specific route by ID
operationId: getRoute
tags:
- Routes
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: route_id
in: path
required: true
description: Route ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["routes:read:all", "routes:read:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.RoutesAPI.GetRoute(
ctx,
accountID,
uuid.MustParse("c5a32c40-b351-439f-8230-779daed3e42c"),
)
if err != nil {
log.Fatalf("Error getting route: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Route: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: Route details
content:
application/json:
schema:
$ref: '#/components/schemas/Route'
examples:
getRoute200Example:
summary: Default getRoute 200 response
x-microcks-default: true
value:
object: route
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getRoute400Example:
summary: Default getRoute 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getRoute401Example:
summary: Default getRoute 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getRoute403Example:
summary: Default getRoute 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Route not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getRoute404Example:
summary: Default getRoute 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getRoute500Example:
summary: Default getRoute 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
put:
summary: AhaSend Update Route
description: Updates an existing route
operationId: updateRoute
tags:
- Routes
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: route_id
in: path
required: true
description: Route ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["routes:write:all", "routes:write:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"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()
// Call the ping endpoint
response, httpResp, err := client.RoutesAPI.UpdateRoute(
ctx,
accountID,
uuid.MustParse("c5a32c40-b351-439f-8230-779daed3e42c"),
requests.UpdateRouteRequest{
Name: ahasend.String("Updated Name"),
URL: ahasend.String("https://mystartup.com/new-tickets"),
},
)
if err != nil {
log.Fatalf("Error updating route: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Updated route: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateRouteRequest'
responses:
'200':
description: Route updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Route'
examples:
updateRoute200Example:
summary: Default updateRoute 200 response
x-microcks-default: true
value:
object: route
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateRoute400Example:
summary: Default updateRoute 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateRoute401Example:
summary: Default updateRoute 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateRoute403Example:
summary: Default updateRoute 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Route not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateRoute404Example:
summary: Default updateRoute 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateRoute500Example:
summary: Default updateRoute 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
delete:
summary: AhaSend Delete Route
description: Deletes a route
operationId: deleteRoute
tags:
- Routes
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: route_id
in: path
required: true
description: Route ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["routes:delete:all", "routes:delete:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.RoutesAPI.DeleteRoute(
ctx,
accountID,
uuid.MustParse("c5a32c40-b351-439f-8230-779daed3e42c"),
)
if err != nil {
log.Fatalf("Error deleting route: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Deleted route: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: Route deleted successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
examples:
deleteRoute200Example:
summary: Default deleteRoute 200 response
x-microcks-default: true
value:
message: example_value
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteRoute400Example:
summary: Default deleteRoute 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteRoute401Example:
summary: Default deleteRoute 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteRoute403Example:
summary: Default deleteRoute 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Route not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteRoute404Example:
summary: Default deleteRoute 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
# Webhooks endpoints
examples:
deleteRoute500Example:
summary: Default deleteRoute 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/webhooks:
get:
summary: AhaSend Get Webhooks
description: |
Returns a list of webhooks for the account
**Query Parameters:**
- `enabled`: Filter by enabled status
- Event filters: `on_reception`, `on_delivered`, `on_transient_error`, `on_failed`, `on_bounced`, `on_suppressed`, `on_opened`, `on_clicked`, `on_suppression_created`, `on_dns_error`
- `limit`: Maximum number of items to return (1-100, default: 100)
- `cursor`: Pagination cursor for the next page
operationId: getWebhooks
tags:
- Webhooks
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: enabled
in: query
description: Filter by enabled status
schema:
type: boolean
example: true
- name: on_reception
in: query
description: Filter by reception event trigger
schema:
type: boolean
example: true
- name: on_delivered
in: query
description: Filter by delivery event trigger
schema:
type: boolean
example: true
- name: on_transient_error
in: query
description: Filter by transient error event trigger
schema:
type: boolean
example: true
- name: on_failed
in: query
description: Filter by failure event trigger
schema:
type: boolean
example: true
- name: on_bounced
in: query
description: Filter by bounce event trigger
schema:
type: boolean
example: true
- name: on_suppressed
in: query
description: Filter by suppression event trigger
schema:
type: boolean
example: true
- name: on_opened
in: query
description: Filter by open event trigger
schema:
type: boolean
example: true
- name: on_clicked
in: query
description: Filter by click event trigger
schema:
type: boolean
example: true
- name: on_suppression_created
in: query
description: Filter by suppression creation event trigger
schema:
type: boolean
example: true
- name: on_dns_error
in: query
description: Filter by DNS error event trigger
schema:
type: boolean
example: true
- name: limit
in: query
description: Maximum number of items to return (1-100)
schema:
type: integer
minimum: 1
maximum: 100
default: 100
example: 1
- name: after
in: query
description: Pagination cursor for the next page. Provide the value provided in `next_cursor` from the response.
schema:
type: string
example: example_value
- name: before
in: query
description: Pagination cursor for the previous page.
schema:
type: string
example: example_value
security:
- BearerAuth: ["webhooks:read:all", "webhooks:read:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"github.com/AhaSend/ahasend-go"
"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.WebhooksAPI.GetWebhooks(
ctx,
accountID,
api.GetWebhooksParams{
Limit: ahasend.Int32(100),
},
nil,
)
if err != nil {
log.Fatalf("Error getting webhooks: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Found %d webhooks\n", len(response.Data))
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: List of webhooks
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedWebhooksResponse'
examples:
getWebhooks200Example:
summary: Default getWebhooks 200 response
x-microcks-default: true
value:
object: list
data:
- {}
pagination:
has_more: {}
next_cursor: {}
previous_cursor: {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getWebhooks400Example:
summary: Default getWebhooks 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getWebhooks401Example:
summary: Default getWebhooks 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getWebhooks403Example:
summary: Default getWebhooks 403 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getWebhooks500Example:
summary: Default getWebhooks 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
post:
summary: AhaSend Create Webhook
description: Creates a new webhook for event notifications
operationId: createWebhook
tags:
- Webhooks
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- $ref: '#/components/parameters/IdempotencyKey'
example: example
security:
- BearerAuth: ["webhooks:write:all", "webhooks:write:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"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()
// Call the ping endpoint
response, httpResp, err := client.WebhooksAPI.CreateWebhook(
ctx,
accountID,
requests.CreateWebhookRequest{
Name: "Failures",
URL: "https://mystartup.com/webhook",
Enabled: true,
OnBounced: true,
OnTransientError: true,
OnFailed: true,
},
nil,
)
if err != nil {
log.Fatalf("Error creating webhook: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Created webhook: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateWebhookRequest'
responses:
'201':
description: Webhook created successfully
headers:
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/Webhook'
examples:
createWebhook201Example:
summary: Default createWebhook 201 response
x-microcks-default: true
value:
object: webhook
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createWebhook400Example:
summary: Default createWebhook 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createWebhook401Example:
summary: Default createWebhook 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createWebhook403Example:
summary: Default createWebhook 403 response
x-microcks-default: true
value:
message: example_value
'409':
$ref: '#/components/responses/IdempotencyConflict'
'412':
$ref: '#/components/responses/IdempotencyPreconditionFailed'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createWebhook500Example:
summary: Default createWebhook 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/webhooks/{webhook_id}:
get:
summary: AhaSend Get Webhook
description: Returns a specific webhook by ID
operationId: getWebhook
tags:
- Webhooks
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: webhook_id
in: path
required: true
description: Webhook ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["webhooks:read:all", "webhooks:read:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.WebhooksAPI.GetWebhook(
ctx,
accountID,
uuid.MustParse("c5a32c40-b351-439f-8230-779daed3e42c"),
nil,
)
if err != nil {
log.Fatalf("Error getting webhook: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Webhook: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: Webhook details
content:
application/json:
schema:
$ref: '#/components/schemas/Webhook'
examples:
getWebhook200Example:
summary: Default getWebhook 200 response
x-microcks-default: true
value:
object: webhook
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getWebhook400Example:
summary: Default getWebhook 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getWebhook401Example:
summary: Default getWebhook 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getWebhook403Example:
summary: Default getWebhook 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Webhook not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getWebhook404Example:
summary: Default getWebhook 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getWebhook500Example:
summary: Default getWebhook 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
put:
summary: AhaSend Update Webhook
description: |
Updates an existing webhook
**Note:** The webhook secret is not updatable
operationId: updateWebhook
tags:
- Webhooks
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: webhook_id
in: path
required: true
description: Webhook ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["webhooks:write:all", "webhooks:write:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"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()
// Call the ping endpoint
response, httpResp, err := client.WebhooksAPI.UpdateWebhook(
ctx,
accountID,
uuid.MustParse("c5a32c40-b351-439f-8230-779daed3e42c"),
requests.UpdateWebhookRequest{
Name: ahasend.String("Failures"),
URL: ahasend.String("https://mystartup.com/webhook"),
Enabled: ahasend.Bool(true),
OnBounced: ahasend.Bool(true),
},
)
if err != nil {
log.Fatalf("Error updating webhook: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Updated webhook: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateWebhookRequest'
responses:
'200':
description: Webhook updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Webhook'
examples:
updateWebhook200Example:
summary: Default updateWebhook 200 response
x-microcks-default: true
value:
object: webhook
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateWebhook400Example:
summary: Default updateWebhook 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateWebhook401Example:
summary: Default updateWebhook 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateWebhook403Example:
summary: Default updateWebhook 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Webhook not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateWebhook404Example:
summary: Default updateWebhook 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
updateWebhook500Example:
summary: Default updateWebhook 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
delete:
summary: AhaSend Delete Webhook
description: Deletes a webhook
operationId: deleteWebhook
tags:
- Webhooks
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: webhook_id
in: path
required: true
description: Webhook ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["webhooks:delete:all", "webhooks:delete:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.WebhooksAPI.DeleteWebhook(
ctx,
accountID,
uuid.MustParse("c5a32c40-b351-439f-8230-779daed3e42c"),
)
if err != nil {
log.Fatalf("Error deleting webhook: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Deleted webhook: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: Webhook deleted successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
examples:
deleteWebhook200Example:
summary: Default deleteWebhook 200 response
x-microcks-default: true
value:
message: example_value
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteWebhook400Example:
summary: Default deleteWebhook 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteWebhook401Example:
summary: Default deleteWebhook 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteWebhook403Example:
summary: Default deleteWebhook 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: Webhook not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteWebhook404Example:
summary: Default deleteWebhook 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
# SMTP Credentials endpoints
examples:
deleteWebhook500Example:
summary: Default deleteWebhook 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/smtp-credentials:
get:
summary: AhaSend Get SMTP Credentials
description: Returns a list of SMTP credentials for the account
operationId: getSMTPCredentials
tags:
- SMTP Credentials
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: limit
in: query
description: Maximum number of items to return (1-100)
schema:
type: integer
minimum: 1
maximum: 100
default: 100
example: 1
- name: after
in: query
description: Pagination cursor for the next page. Provide the value provided in `next_cursor` from the response.
schema:
type: string
example: example_value
- name: before
in: query
description: Pagination cursor for the previous page.
schema:
type: string
example: example_value
security:
- BearerAuth: ["smtp-credentials:read:all", "smtp-credentials:read:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.SMTPCredentialsAPI.GetSMTPCredentials(
ctx,
accountID,
nil,
nil,
)
if err != nil {
log.Fatalf("Error getting SMTP credentials: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("SMTP credentials: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: List of SMTP credentials
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedSMTPCredentialsResponse'
examples:
getSMTPCredentials200Example:
summary: Default getSMTPCredentials 200 response
x-microcks-default: true
value:
object: list
data:
- {}
pagination:
has_more: {}
next_cursor: {}
previous_cursor: {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSMTPCredentials400Example:
summary: Default getSMTPCredentials 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSMTPCredentials401Example:
summary: Default getSMTPCredentials 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSMTPCredentials403Example:
summary: Default getSMTPCredentials 403 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSMTPCredentials500Example:
summary: Default getSMTPCredentials 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
post:
summary: AhaSend Create SMTP Credential
description: Creates a new SMTP credential for SMTP authentication
operationId: createSMTPCredential
tags:
- SMTP Credentials
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- $ref: '#/components/parameters/IdempotencyKey'
example: example
security:
- BearerAuth: ["smtp-credentials:write:all", "smtp-credentials:write:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
package main
import (
"context"
"fmt"
"log"
"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()
// Call the ping endpoint
response, httpResp, err := client.SMTPCredentialsAPI.CreateSMTPCredential(
ctx,
accountID,
requests.CreateSMTPCredentialRequest{
Name: "My SMTP Credential",
Scope: "global",
Sandbox: true,
},
)
if err != nil {
log.Fatalf("Error creating SMTP credentials: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Created SMTP credentials: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateSMTPCredentialRequest'
responses:
'201':
description: SMTP credential created successfully
headers:
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/SMTPCredential'
examples:
createSMTPCredential201Example:
summary: Default createSMTPCredential 201 response
x-microcks-default: true
value:
object: smtp_credential
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createSMTPCredential400Example:
summary: Default createSMTPCredential 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createSMTPCredential401Example:
summary: Default createSMTPCredential 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createSMTPCredential403Example:
summary: Default createSMTPCredential 403 response
x-microcks-default: true
value:
message: example_value
'409':
$ref: '#/components/responses/IdempotencyConflict'
'412':
$ref: '#/components/responses/IdempotencyPreconditionFailed'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
createSMTPCredential500Example:
summary: Default createSMTPCredential 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/smtp-credentials/{smtp_credential_id}:
get:
summary: AhaSend Get SMTP Credential
description: Returns a specific SMTP credential by ID
operationId: getSMTPCredential
tags:
- SMTP Credentials
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: smtp_credential_id
in: path
required: true
description: SMTP Credential ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["smtp-credentials:read:all", "smtp-credentials:read:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.SMTPCredentialsAPI.GetSMTPCredential(
ctx,
accountID,
123,
)
if err != nil {
log.Fatalf("Error getting SMTP credentials: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("SMTP credentials: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: SMTP credential details
content:
application/json:
schema:
$ref: '#/components/schemas/SMTPCredential'
examples:
getSMTPCredential200Example:
summary: Default getSMTPCredential 200 response
x-microcks-default: true
value:
object: smtp_credential
id: '500123'
created_at: '2025-03-15T14:30:00Z'
updated_at: '2025-03-15T14:30:00Z'
name: Example Name
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSMTPCredential400Example:
summary: Default getSMTPCredential 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSMTPCredential401Example:
summary: Default getSMTPCredential 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSMTPCredential403Example:
summary: Default getSMTPCredential 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: SMTP credential not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSMTPCredential404Example:
summary: Default getSMTPCredential 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getSMTPCredential500Example:
summary: Default getSMTPCredential 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
delete:
summary: AhaSend Delete SMTP Credential
description: Deletes an SMTP credential
operationId: deleteSMTPCredential
tags:
- SMTP Credentials
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: smtp_credential_id
in: path
required: true
description: SMTP Credential ID
schema:
type: string
format: uuid
example: '500123'
security:
- BearerAuth: ["smtp-credentials:delete:all", "smtp-credentials:delete:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.SMTPCredentialsAPI.DeleteSMTPCredential(
ctx,
accountID,
123,
)
if err != nil {
log.Fatalf("Error deleting SMTP credentials: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Deleted SMTP credentials: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: SMTP credential deleted successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
examples:
deleteSMTPCredential200Example:
summary: Default deleteSMTPCredential 200 response
x-microcks-default: true
value:
message: example_value
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteSMTPCredential400Example:
summary: Default deleteSMTPCredential 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteSMTPCredential401Example:
summary: Default deleteSMTPCredential 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteSMTPCredential403Example:
summary: Default deleteSMTPCredential 403 response
x-microcks-default: true
value:
message: example_value
'404':
description: SMTP credential not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
deleteSMTPCredential404Example:
summary: Default deleteSMTPCredential 404 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
# Statistics endpoints
examples:
deleteSMTPCredential500Example:
summary: Default deleteSMTPCredential 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/statistics/transactional/deliverability:
get:
summary: AhaSend Get Deliverability Statistics
description: |
Returns transactional deliverability statistics grouped by status
**Query Parameters:**
- `from_time`: Filter statistics after this date (RFC3339 format)
- `to_time`: Filter statistics before this date (RFC3339 format)
- `sender_domain`: Filter by sender domain
- `recipient_domains`: Filter by recipient domain
- `tags`: Filter by tags (comma-separated)
- `group_by`: Group by time period (hour, day, week, month)
operationId: getDeliverabilityStatistics
tags:
- Statistics
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: from_time
in: query
description: Filter statistics after this datetime (RFC3339 format)
schema:
type: string
format: date-time
example: '2025-03-15T14:30:00Z'
- name: to_time
in: query
description: Filter statistics before this datetime (RFC3339 format)
schema:
type: string
format: date-time
example: '2025-03-15T14:30:00Z'
- name: sender_domain
in: query
description: Filter by sender domain
schema:
type: string
example: mail.example.com
- name: recipient_domains
in: query
description: Filter by a comma separated list of recipient domains
schema:
type: string
example: gmail.com,googlemail.com
- name: tags
in: query
description: Filter by tags (comma-separated)
schema:
type: string
example: example_value
- name: group_by
in: query
description: Group by time period
schema:
type: string
enum: [hour, day, week, month]
default: day
example: hour
security:
- BearerAuth: ["statistics-transactional:read:all", "statistics-transactional:read:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.GetDeliverabilityStatistics(
ctx,
accountID,
requests.GetDeliverabilityStatisticsParams{
FromTime: &fromTime,
SenderDomain: ahasend.String("example.com"),
RecipientDomains: ahasend.String("gmail.com"),
GroupBy: ahasend.String("week"),
},
)
if err != nil {
log.Fatalf("Error getting deliverability statistics: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Deliverability statistics: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: Deliverability statistics
content:
application/json:
schema:
$ref: '#/components/schemas/DeliverabilityStatisticsResponse'
examples:
getDeliverabilityStatistics200Example:
summary: Default getDeliverabilityStatistics 200 response
x-microcks-default: true
value:
object: list
data:
- {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDeliverabilityStatistics400Example:
summary: Default getDeliverabilityStatistics 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDeliverabilityStatistics401Example:
summary: Default getDeliverabilityStatistics 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDeliverabilityStatistics403Example:
summary: Default getDeliverabilityStatistics 403 response
x-microcks-default: true
value:
message: example_value
'429':
description: Too many requests (rate limited to 1 request per second)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDeliverabilityStatistics429Example:
summary: Default getDeliverabilityStatistics 429 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDeliverabilityStatistics500Example:
summary: Default getDeliverabilityStatistics 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/statistics/transactional/bounce:
get:
summary: AhaSend Get Bounce Statistics
description: |
Returns transactional bounce statistics grouped by classification
**Query Parameters:**
- `from_time`: Filter statistics after this date (RFC3339 format)
- `to_time`: Filter statistics before this date (RFC3339 format)
- `sender_domain`: Filter by sender domain
- `recipient_domains`: Filter by recipient domain
- `tags`: Filter by tags (comma-separated)
- `group_by`: Group by time period (hour, day, week, month)
operationId: getBounceStatistics
tags:
- Statistics
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: from_time
in: query
description: Filter statistics after this datetime (RFC3339 format)
schema:
type: string
format: date-time
example: '2025-03-15T14:30:00Z'
- name: to_time
in: query
description: Filter statistics before this datetime (RFC3339 format)
schema:
type: string
format: date-time
example: '2025-03-15T14:30:00Z'
- name: sender_domain
in: query
description: Filter by sender domain
schema:
type: string
example: mail.example.com
- name: recipient_domains
in: query
description: Filter by a comma separated list of recipient domains
schema:
type: string
example: gmail.com,googlemail.com
- name: tags
in: query
description: Filter by tags (comma-separated)
schema:
type: string
example: example_value
- name: group_by
in: query
description: Group by time period
schema:
type: string
enum: [hour, day, week, month]
default: day
example: hour
security:
- BearerAuth: ["statistics-transactional:read:all", "statistics-transactional:read:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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.GetBounceStatistics(
ctx,
accountID,
requests.GetBounceStatisticsParams{
FromTime: &fromTime,
SenderDomain: ahasend.String("example.com"),
RecipientDomains: ahasend.String("gmail.com"),
GroupBy: ahasend.String("week"),
},
)
if err != nil {
log.Fatalf("Error getting bounce statistics: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Bounce statistics: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
responses:
'200':
description: Bounce statistics
content:
application/json:
schema:
$ref: '#/components/schemas/BounceStatisticsResponse'
examples:
getBounceStatistics200Example:
summary: Default getBounceStatistics 200 response
x-microcks-default: true
value:
object: list
data:
- {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getBounceStatistics400Example:
summary: Default getBounceStatistics 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getBounceStatistics401Example:
summary: Default getBounceStatistics 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getBounceStatistics403Example:
summary: Default getBounceStatistics 403 response
x-microcks-default: true
value:
message: example_value
'429':
description: Too many requests (rate limited to 1 request per second)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getBounceStatistics429Example:
summary: Default getBounceStatistics 429 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getBounceStatistics500Example:
summary: Default getBounceStatistics 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/v2/accounts/{account_id}/statistics/transactional/delivery-time:
get:
summary: AhaSend Get Delivery Time Statistics
description: |
Returns transactional delivery time statistics grouped by recipient domain
**Query Parameters:**
- `from_time`: Filter statistics after this date (RFC3339 format)
- `to_time`: Filter statistics before this date (RFC3339 format)
- `sender_domain`: Filter by sender domain
- `recipient_domains`: Filter by recipient domains
- `tags`: Filter by tags (comma-separated)
- `group_by`: Group by time period (hour, day, week, month)
operationId: getDeliveryTimeStatistics
tags:
- Statistics
parameters:
- name: account_id
in: path
required: true
description: Account ID
schema:
type: string
format: uuid
example: '500123'
- name: from_time
in: query
description: Filter statistics after this datetime (RFC3339 format)
schema:
type: string
format: date-time
example: '2025-03-15T14:30:00Z'
- name: to_time
in: query
description: Filter statistics before this datetime (RFC3339 format)
schema:
type: string
format: date-time
example: '2025-03-15T14:30:00Z'
- name: sender_domain
in: query
description: Filter by sender domain
schema:
type: string
example: mail.example.com
- name: recipient_domains
in: query
description: Filter by a comma separated list of recipient domains
schema:
type: string
example: gmail.com,googlemail.com
- name: tags
in: query
description: Filter by tags (comma-separated)
schema:
type: string
example: example_value
- name: group_by
in: query
description: Group by time period
schema:
type: string
enum: [hour, day, week, month]
default: day
example: hour
security:
- BearerAuth: ["statistics-transactional:read:all", "statistics-transactional:read:{domain}"]
x-code-samples:
- lang: go
label: AhaSend Go SDK
source: |
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)
}
}
responses:
'200':
description: Delivery time statistics
content:
application/json:
schema:
$ref: '#/components/schemas/DeliveryTimeStatisticsResponse'
examples:
getDeliveryTimeStatistics200Example:
summary: Default getDeliveryTimeStatistics 200 response
x-microcks-default: true
value:
object: list
data:
- {}
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDeliveryTimeStatistics400Example:
summary: Default getDeliveryTimeStatistics 400 response
x-microcks-default: true
value:
message: example_value
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDeliveryTimeStatistics401Example:
summary: Default getDeliveryTimeStatistics 401 response
x-microcks-default: true
value:
message: example_value
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDeliveryTimeStatistics403Example:
summary: Default getDeliveryTimeStatistics 403 response
x-microcks-default: true
value:
message: example_value
'429':
description: Too many requests (rate limited to 1 request per second)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDeliveryTimeStatistics429Example:
summary: Default getDeliveryTimeStatistics 429 response
x-microcks-default: true
value:
message: example_value
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
getDeliveryTimeStatistics500Example:
summary: Default getDeliveryTimeStatistics 500 response
x-microcks-default: true
value:
message: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
tags:
- name: Utility
description: Utility endpoints for health checks and diagnostics
- name: API Keys
description: Manage API keys for authentication and access control
- name: Domains
description: Manage sending domains
- name: Messages
description: Send and manage transactional messages
- name: Accounts
description: Manage account settings and members
- name: Suppressions
description: Manage email suppressions
- name: Routes
description: Manage inbound email routing
- name: Webhooks
description: Manage webhook notifications
- name: SMTP Credentials
description: Manage SMTP authentication credentials
- name: Statistics
description: Access transactional email statistics
- name: Message Events
description: Webhooks for outbound message delivery events
- name: Suppression Events
description: Webhooks for suppression list changes
- name: Domain Events
description: Webhooks for domain configuration issues
- name: Route Events
description: Webhooks for inbound email routing