Versions in this module Expand all Collapse all v1 v1.1.0 Jul 21, 2026 Changes in this version + const APIVersion + var ErrInvalidCursor = errors.New("invalid pagination cursor") + func DecodeCursor(secrets []string, cursor string, dst any) error + func EncodeCursor(secret string, payload any) (string, error) + func RequestFromContext(ctx context.Context) *http.Request + func RequestIDFromContext(ctx context.Context) string + func WriteError(w http.ResponseWriter, r *http.Request, status int, code, message string) + type APIKeyView struct + Agent string + CreatedAt time.Time + ExpiresAt *time.Time + ID string + KeyPrefix string + LastUsedAt *time.Time + Name string + Scope string + type AccountUserView struct + Email string + ID string + type AccountView struct + AgentAddress string + Limits LimitsCapsView + PlanCode string + Scope string + UpgradeURL string + Usage LimitsUsageView + User AccountUserView + type AddressParam struct + Address string + type AgentCreateEnforcer func(ctx context.Context, userID string) error + type AgentCreator func(ctx context.Context, email, domain, name, webhookURL, agentMode, userID string) (*identity.AgentIdentity, error) + type AgentDeleter func(ctx context.Context, agentID, userID string) (messagesDeleted int64, err error) + type AgentGetter func(ctx context.Context, address string) (*identity.AgentIdentity, error) + type AgentLister func(ctx context.Context, userID string, limit int, afterCreatedAt time.Time, ...) ([]identity.AgentIdentity, error) + type AgentSuppressionView struct + Address string + AgentEmail string + CreatedAt time.Time + Reason string + Source string + type AgentTrashOp func(ctx context.Context, agentID, userID string) error + type AgentView struct + CreatedAt time.Time + DeletedAt *time.Time + Domain string + DomainVerified bool + Email string + Name string + RegisteredDomain string + type AttachmentMetaView = eventpayload.AttachmentMetaView + type AttachmentStore interface + DownloadURL func(agentEmail, messageID string, index int, ttl time.Duration) (downloadURL string, expiresAt time.Time, err error) + VerifyDownload func(token, messageID string, index int) bool + func NewNativeAttachmentStore(secret, publicURL string) AttachmentStore + type AttachmentView struct + ContentID string + ContentType string + Data string + DownloadURL string + ExpiresAt time.Time + Filename string + Index int + SizeBytes int + type Authenticator func(r *http.Request) (*identity.User, error) + type ConversationDetailView struct + Labels []string + Messages []MessageSummaryView + Participants []string + type ConversationGetter func(ctx context.Context, agentID, conversationID string) (*identity.ConversationDetail, error) + type ConversationIDParam struct + Address string + ConversationID string + type ConversationLister func(ctx context.Context, filter identity.ConversationListFilter) ([]identity.ConversationSummary, error) + type ConversationSummaryView struct + FirstMessageAt time.Time + HasUnread bool + ID string + InboundCount int + LastMessageAt time.Time + LatestSender string + LatestSubject string + MessageCount int + OutboundCount int + type CoveringDomainLookup func(ctx context.Context, sub, userID string) (*identity.Domain, error) + type CreateAPIKeyRequest struct + Agent string + ExpiresAt string + Name string + Scope string + type CreateAPIKeyResponse struct + Key string + type CreateAgentRequest struct + Email string + Name string + type CreateAgentSuppressionRequest struct + Address string + Reason string + type CreateTemplateRequest struct + Alias string + Body string + FromStarter string + HTMLBody string + Name string + Subject string + type CreateWebhookRequest struct + Description string + Events []string + Filters *WebhookFiltersRequest + URL string + type CreateWebhookResponse struct + SigningSecret string + type DNSRecord struct + Name string + Priority *int + Purpose string + Status string + Type string + Value string + type DeleteAgentResult struct + Deleted bool + Email string + MessagesDeleted int64 + type DeleteApiKeyResult struct + Deleted bool + ID string + type DeleteConfirm struct + Confirm string + type DeleteDomainResult struct + Deleted bool + Domain string + type DeleteMessageResult struct + Deleted bool + ID string + type DeleteSuppressionResult struct + Address string + Deleted bool + type DeleteTemplateResult struct + Deleted bool + ID string + type DeleteWebhookResult struct + Deleted bool + ID string + type DeploymentInfoView struct + PublicURL string + SharedDomain string + SlugRegistrationEnabled bool + Version string + type Deps struct + AddAgentSuppression func(ctx context.Context, userID, agentID, address, reason, source string, ...) (identity.AgentSuppression, bool, error) + AddAgentSuppressionFromTokenScope func(ctx context.Context, scope identity.UnsubscribeScope, ...) (identity.AgentSuppression, bool, error) + AgentSuppressionAddedHook identity.AgentSuppressionTxHook + ApproveInboundReview func(ctx context.Context, userID string, msg *identity.ReviewMessageMeta) *agent.OutboundError + ApprovePending func(ctx context.Context, userID, messageID, expectedAgentEmail string, ...) (*identity.Message, *agent.OutboundError) + AttachmentStore AttachmentStore + AuthChallenge func(r *http.Request) string + Authenticator Authenticator + ClaimDomain func(ctx context.Context, domain, userID string) (*identity.Domain, error) + CreateAgent AgentCreator + CreateScopedAPIKey func(ctx context.Context, userID, name, scope, agentID string, expiresAt *time.Time) (*identity.APIKey, error) + CreateTemplate func(ctx context.Context, userID string, in identity.TemplateCreate) (*identity.Template, error) + CreateWebhook func(ctx context.Context, userID, url, description string, events []string, ...) (*identity.Webhook, error) + CursorSecret string + DeleteAPIKey func(ctx context.Context, keyID, userID string) error + DeleteAgent AgentTrashOp + DeleteDomain func(ctx context.Context, domain, userID string) error + DeleteMessage MessageTrashOp + DeleteTemplate func(ctx context.Context, templateID, userID string) error + DeleteUserData func(ctx context.Context, user *identity.User) (*identity.DeleteUserDataResult, error) + DeleteWebhook func(ctx context.Context, webhookID, userID string) error + DeliverOutbound func(ctx context.Context, user *identity.User, ag *identity.AgentIdentity, ...) (*agent.OutboundResult, *agent.OutboundError) + DownloadLimit RateSnapshot + EnforceAgentCreate AgentCreateEnforcer + EnforceDomainCreate func(ctx context.Context, userID string) error + EnforceMessageSend func(ctx context.Context, userID string) error + EnqueueDelivery func(ctx context.Context, deliveryID string) error + EnqueueSenderProvision func(ctx context.Context, domain string) + EventsEnabled bool + ExportUserData func(ctx context.Context, userID string) (*identity.UserExport, error) + GetAgent AgentGetter + GetAgentAnyState AgentGetter + GetConversation ConversationGetter + GetEvent2 func(ctx context.Context, userID, eventID string) (*agent.EventView, error) + GetLimits func(ctx context.Context, userID string) (limits.Limits, error) + GetMessage MessageGetter + GetRepliableMessage func(ctx context.Context, messageID string) (*identity.Message, error) + GetReviewMessage func(ctx context.Context, messageID, agentID string) (*identity.ReviewMessageMeta, error) + GetReviewWithContent func(ctx context.Context, userID, messageID string) (*identity.Message, error) + GetTemplate func(ctx context.Context, templateID, userID string) (*identity.Template, error) + GetTemplateByAlias func(ctx context.Context, alias, userID string) (*identity.Template, error) + GetUsage func(ctx context.Context, userID string) LimitsUsageView + GetWebhook func(ctx context.Context, webhookID, userID string) (*identity.Webhook, error) + HasAgentsOnDomain func(ctx context.Context, domain, userID string) (bool, error) + Idempotency IdemStore + InsertReplayDelivery func(ctx context.Context, eventID, webhookID, eventType string, messageID *string, ...) (string, error) + Legacy http.Handler + ListAPIKeys func(ctx context.Context, userID string, limit int, afterCreatedAt time.Time, ...) ([]identity.APIKey, error) + ListAgentSuppressions func(ctx context.Context, userID, agentID string, limit int, ...) ([]identity.AgentSuppression, error) + ListAgents AgentLister + ListConversations ConversationLister + ListDeletedAgents AgentLister + ListDeliveries func(ctx context.Context, webhookID, status string, limit int, ...) ([]webhook.SubscriberDelivery, error) + ListDomains func(ctx context.Context, userID string, limit int, afterCreatedAt time.Time, ...) ([]identity.Domain, error) + ListEvents func(ctx context.Context, q EventQuery) ([]agent.EventView, error) + ListMessages MessageLister + ListProtectionEventsByMessage func(ctx context.Context, messageID string) ([]identity.ProtectionEvent, error) + ListReviews func(ctx context.Context, userID string, limit int, afterCreatedAt time.Time, ...) ([]identity.ReviewListItem, error) + ListSuppressions func(ctx context.Context, userID string, limit int, afterCreatedAt time.Time, ...) ([]identity.Suppression, error) + ListTemplates func(ctx context.Context, userID string, limit int, afterCreatedAt time.Time, ...) ([]identity.TemplateSummary, error) + ListWebhooks func(ctx context.Context, userID string, limit int, afterCreatedAt time.Time, ...) ([]identity.Webhook, error) + LoadReplayEvent func(ctx context.Context, userID, eventID string) (*agent.ReplayEvent, error) + LookupCoveringDomain CoveringDomainLookup + LookupDomain DomainLookup + ModifyMessageLabels func(ctx context.Context, messageID, agentID string, add, remove []string) ([]string, error) + PermanentDeleteAgent AgentDeleter + PollLimit RateSnapshot + PollSendOutcome func(ctx context.Context, messageID string) (identity.SendOutcome, error) + PrincipalAuthenticator PrincipalAuthenticator + PublicURL string + PurgeMessage MessageTrashOp + RegLimit RateSnapshot + RejectInboundReview func(ctx context.Context, userID, reason string, msg *identity.ReviewMessageMeta) *agent.OutboundError + RejectPending func(ctx context.Context, userID, messageID, expectedAgentEmail, reason string) (*identity.Message, *agent.OutboundError) + RemoveAgentSuppression func(ctx context.Context, userID, agentID, address string) (bool, error) + RemoveSuppression func(ctx context.Context, userID, address string) (bool, error) + ResolveMX MXResolver + ResolveUnsubscribeToken func(ctx context.Context, tokenHash []byte) (*identity.UnsubscribeScope, error) + RestoreAgent AgentTrashOp + RestoreMessage MessageTrashOp + RotateSecret func(ctx context.Context, webhookID, userID string) (string, time.Time, error) + SESRegion string + SMTPDomain string + SendLimit func(key string) (ok bool, retryAfter time.Duration) + SendTest func(ctx context.Context, ag *identity.AgentIdentity) (*agent.OutboundResult, *agent.OutboundError) + SendingRampSnapshot func(ctx context.Context, userID, domain string, now time.Time) (sendramp.Snapshot, error) + SharedDomain string + TestWebhookInsert func(ctx context.Context, webhookID, eventType string, envelope []byte) (string, error) + TouchDomainChecked func(ctx context.Context, domain, userID string) error + UnsubscribeLimit RateSnapshot + UpdateAgentName func(ctx context.Context, agentID, userID, name string) error + UpdateAgentProtection func(ctx context.Context, agentID, userID string, cfg identity.ProtectionConfig) error + UpdateTemplate func(ctx context.Context, templateID, userID string, u identity.TemplateUpdate) (*identity.Template, error) + UpdateWebhook func(ctx context.Context, webhookID, userID string, u identity.WebhookUpdate) (*identity.Webhook, error) + VerifyDomain func(ctx context.Context, domain, userID string) error + VerifyProbe func(domain, verificationToken, dkimSelector, dkimPublicKey string) DomainCheckResult + WSHandle func(w http.ResponseWriter, r *http.Request, address string) + type DomainCheckResult struct + DKIM string + MX string + SPF string + TXTFound bool + type DomainLookup func(ctx context.Context, domain, userID string) (*identity.Domain, error) + type DomainParam struct + Domain string + type DomainView struct + AgentCount int + CreatedAt time.Time + DNSRecords []DNSRecord + Domain string + LastCheckedAt *time.Time + SendingError string + SendingLastCheckedAt *time.Time + SendingRamp SendingRampView + SendingStatus string + VerificationToken string + Verified bool + VerifiedAt *time.Time + type ErrorBody struct + Code string + Details any + Message string + RequestID string + func (ErrorBody) TransformSchema(r huma.Registry, s *huma.Schema) *huma.Schema + type ErrorEnvelope struct + Err ErrorBody + func NewError(status int, code, message string) *ErrorEnvelope + func (e *ErrorEnvelope) Code() string + func (e *ErrorEnvelope) Error() string + func (e *ErrorEnvelope) GetStatus() int + func (e *ErrorEnvelope) WithDetails(details any) *ErrorEnvelope + func (e *ErrorEnvelope) WithRetryAfter(seconds int) *ErrorEnvelope + type EventEnvelope struct + CreatedAt time.Time + Data map[string]any + ID string + SchemaVersion string + Type string + type EventQuery struct + AgentID string + ConversationID string + CursorCreatedAt time.Time + CursorID string + Limit int + MessageID string + Since *time.Time + Type string + Until *time.Time + UserID string + type FieldError struct + Location string + Message string + type ForwardRequest struct + Attachments []outbound.Attachment + BCC []string + Body string + CC []string + ConversationID string + HTMLBody string + ReplyTo string + To []string + Unsubscribe UnsubscribeOptions + type HoldReasonView struct + Category string + Code string + Confidence *float64 + Detail string + Summary string + Type string + type IdemStore interface + Claim func(ctx context.Context, userID, key, path, bodyHash string) (idempotency.ClaimResult, error) + Complete func(ctx context.Context, userID, key string, resp idempotency.CachedResponse) error + CompleteTx func(ctx context.Context, tx pgx.Tx, userID, key string, ...) error + Release func(ctx context.Context, userID, key string) error + type LimitExceededDetails struct + Current int64 + Limit int64 + PlanCode string + Resource string + UpgradeURL string + type LimitExceededEnvelope struct + Err LimitExceededErrorBody + type LimitExceededErrorBody struct + Code string + Details LimitExceededDetails + Message string + RequestID string + type LimitsCapsView struct + MaxAgents int + MaxDomains int + MaxMessagesMonth int + MaxStorageBytes int64 + type LimitsUsageView struct + Agents int + Domains int + MessagesMonth int + StorageBytes int64 + type ListConversationsInput struct + Address string + Cursor string + Limit int + Since string + Until string + type ListDeliveriesInput struct + Cursor string + ID string + Limit int + Status string + type ListEventsInput struct + AgentID string + ConversationID string + Cursor string + Limit int + MessageID string + Since string + Type string + Until string + type ListMessagesInput struct + Address string + ConversationID string + Cursor string + Deleted bool + Direction string + From string + Labels []string + Limit int + Since string + Sort string + Status string + SubjectContains string + Until string + type MXResolver func(ctx context.Context, name string) ([]string, error) + type MessageBodyView struct + HTML string + Text string + type MessageGetter func(ctx context.Context, messageID, agentID string) (*identity.Message, error) + type MessageIDParam struct + Address string + MessageID string + type MessageLister func(ctx context.Context, filter identity.MessageListFilter) ([]identity.Message, error) + type MessageParsedView struct + HTML string + Text string + Truncated bool + type MessageSummaryView struct + CC []string + ConversationID string + CreatedAt time.Time + DeletedAt *time.Time + DeliveryDetail string + DeliveryStatus string + Direction string + EnvelopeFrom *string + FlagReason string + Flagged bool + HITLStatus string + HeaderFrom *string + ID string + Labels []string + Recipient string + ReplyTo []string + SentAs string + SizeBytes int + Status string + Subject string + To []string + VerifiedDomain *string + WebhookError string + WebhookStatus string + type MessageTrashOp func(ctx context.Context, messageID, agentID string) error + type MessageView struct + Attachments []AttachmentMetaView + Authentication *emailauth.Authentication + Body *MessageBodyView + CC []string + ConversationID string + CreatedAt time.Time + DeletedAt *time.Time + DeliveryDetail string + DeliveryStatus string + Direction string + EnvelopeFrom *string + FlagReason string + Flagged bool + HITLStatus string + HeaderFrom *string + HoldReason *HoldReasonView + ID string + Labels []string + Parsed *MessageParsedView + Protection []ProtectionFindingView + RawMessage []byte + Recipient string + ReplyTo []string + SentAs string + SizeBytes int + Status string + Subject string + To []string + VerifiedDomain *string + WebhookError string + WebhookStatus string + type Page struct + Items []T + NextCursor *string + func NewPage[T any](items []T, nextCursor string) Page[T] + type PageParams struct + Cursor string + Limit int + type PayloadTooLargeDetails struct + ActualBytes int64 + Filename string + MaxBytes int64 + Scope string + type PrincipalAuthenticator func(r *http.Request) (*identity.Principal, error) + type ProtectionConfigRequest struct + Holds ProtectionHoldsRequest + Inbound ProtectionDirectionRequest + Outbound ProtectionDirectionRequest + type ProtectionConfigView struct + Holds ProtectionHoldsView + Inbound ProtectionDirectionView + Outbound ProtectionDirectionView + type ProtectionDirectionRequest struct + Gate ProtectionGateRequest + Scan ProtectionScanRequest + type ProtectionDirectionView struct + Gate ProtectionGateView + Scan ProtectionScanView + type ProtectionFindingView struct + Action string + Categories []ThreatCategoryView + Detector string + Score *float64 + Source string + Summary string + type ProtectionGateRequest struct + Action string + Allowlist []string + Policy string + type ProtectionGateView struct + Action string + Allowlist []string + Policy string + type ProtectionHoldsRequest struct + OnExpiry string + SuppressNotifications bool + TTLSeconds int + type ProtectionHoldsView struct + OnExpiry string + SuppressNotifications bool + TTLSeconds int + type ProtectionScanRequest struct + Sensitivity string + type ProtectionScanView struct + Sensitivity string + type RateLimitedDetails struct + RetryAfterSeconds int + type RateLimitedEnvelope struct + Err RateLimitedErrorBody + type RateLimitedErrorBody struct + Code string + Details RateLimitedDetails + Message string + RequestID string + type RateSnapshot func(key string) (ok bool, retryAfter time.Duration, limit, remaining, resetSeconds int) + type RedeliverDelivery struct + DeliveryID string + Reason string + Status string + WebhookID string + type RedeliverEventInput struct + Body RedeliverEventRequest + ID string + type RedeliverEventRequest struct + WebhookID string + func (r *RedeliverEventRequest) UnmarshalJSON(data []byte) error + type RedeliverView struct + Deliveries []RedeliverDelivery + DeliveryID string + EventID string + Status string + WebhookID string + type RegisterDomainRequest struct + Domain string + type RejectRequest struct + Reason string + type RejectResultView struct + MessageID string + RejectionReason string + Status string + type RenderedTemplateView struct + Body string + HTMLBody string + Subject string + type ReplyRequest struct + Attachments []outbound.Attachment + BCC []string + Body string + CC []string + ConversationID string + HTMLBody string + ReplyAll bool + ReplyTo string + Unsubscribe UnsubscribeOptions + type RetryAfterDetails struct + RetryAfterSeconds int + type ReviewView struct + Agent string + ConversationID string + CreatedAt time.Time + Direction string + EnvelopeFrom *string + FlagReason string + Flagged bool + HeaderFrom *string + HoldReason *HoldReasonView + ID string + ReviewStatus string + Subject string + To []string + VerifiedDomain *string + type SendEmailRequest struct + Attachments []outbound.Attachment + BCC []string + Body string + CC []string + ConversationID string + HTMLBody string + ReplyTo string + Subject string + TemplateAlias string + TemplateData TemplateData + TemplateID string + To []string + Unsubscribe UnsubscribeOptions + type SendResultView struct + ApprovalExpiresAt *time.Time + Edited *bool + MessageID string + Method string + ProviderMessageID string + SentAs string + Status string + type SendingRampView struct + ActiveDays int + DailyRecipientLimit int + EstimatedCompletionAt *time.Time + RampDays int + RecipientsUsedToday int + ResetsAt *time.Time + Status string + type Server struct + API huma.API + Router chi.Router + func New(deps Deps) *Server + func (s *Server) OpenAPIYAML() ([]byte, error) + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + type StarterTemplateAliasParam struct + Alias string + type StarterTemplateDetailView struct + Body string + HTMLBody string + type StarterTemplateVariableView struct + Description string + Example string + Name string + Raw bool + Required bool + type StarterTemplateView struct + Alias string + Description string + Name string + Subject string + Variables []StarterTemplateVariableView + Version string + type SuppressionView struct + Address string + CreatedAt time.Time + Reason string + Source string + SourceMessageID string + type TemplateData map[string]any + func (d *TemplateData) UnmarshalJSON(b []byte) error + type TemplateIDParam struct + ID string + type TemplatePartError struct + Message string + Part string + type TemplateSummaryView struct + Alias string + CreatedAt time.Time + ID string + Name string + Subject string + UpdatedAt time.Time + type TemplateView struct + Alias string + Body string + CreatedAt time.Time + FromStarterAlias string + FromStarterVersion string + HTMLBody string + ID string + Name string + Subject string + UpdatedAt time.Time + type TestWebhookRequest struct + Data map[string]any + Event string + type TestWebhookResponse struct + DeliveryID string + type ThreatCategoryView struct + Name string + Score float64 + type TooManyRecipientsDetails struct + MaxRecipients int + Provided int + type UnsubscribeOptions struct + Mode string + Present bool + func (o *UnsubscribeOptions) UnmarshalJSON(data []byte) error + type UpdateAgentRequest struct + Name *string + type UpdateMessageRequest struct + AddLabels []string + RemoveLabels []string + type UpdateMessageResultView struct + Labels []string + MessageID string + type UpdateTemplateRequest struct + Alias *string + Body *string + HTMLBody *string + Name *string + Subject *string + type UpdateWebhookRequest struct + Description *string + Enabled *bool + Events *[]string + Filters *WebhookFiltersRequest + URL *string + type ValidateTemplateRequest struct + Body string + HTMLBody string + Subject string + TestData TemplateData + type ValidateTemplateResponse struct + Errors []TemplatePartError + Rendered *RenderedTemplateView + SuggestedData map[string]any + Valid bool + type ValidationErrorDetails struct + Fields []FieldError + type VerifyDomainView struct + DKIM string + Domain string + MX string + SPF string + Verified bool + VerifiedAt *time.Time + type WebhookDeliveryView struct + Attempts int + CreatedAt time.Time + EventType string + ID string + LastAttemptAt *time.Time + LastError string + LastStatusCode *int + NextRetryAt time.Time + Status string + type WebhookFiltersRequest struct + AgentIDs []string + ConversationIDs []string + Labels []string + type WebhookFiltersView struct + AgentIDs []string + ConversationIDs []string + Labels []string + type WebhookIDParam struct + ID string + type WebhookView struct + AutoDisabledAt *time.Time + CreatedAt time.Time + Description string + Enabled bool + Events []string + Filters WebhookFiltersView + ID string + LastDeliveredAt *time.Time + URL string