Tên Miền

Thêm và quản lý tên miền tùy chỉnh với sẵn sàng gửi và nhận riêng. Xác minh các bản ghi danh tính người gửi và kiểm tra định tuyến MX độc lập.

Tổng Quan

Theo mặc định, các hộp thư gửi từ @agentsend.io. Thêm tên miền của riêng bạn cho phép gửi từ các địa chỉ như agent@yourdomain.com, cải thiện khả năng giao email và độ tin cậy thương hiệu.

Sau khi thêm một tên miền, AgentSend trả về các bản ghi DNS riêng cho việc gửi và nhận. Sau khi công bố, gọi endpoint xác minh để làm mới cả hai trạng thái: gửi kiểm tra xác minh người gửi SES và DKIM, còn nhận kiểm tra xem MX của tên miền có trỏ đến AgentSend hay không.

Tất cả yêu cầu cần header x-api-key. Lấy key của bạn từ bảng điều khiển.

Đối Tượng Tên Miền

All domain endpoints return a Domain object (or an array of them).

Đối tượng Tên Miền
{
  "id":                 "dom_01hxyz...",          // UUID
  "domain":             "mail.yourdomain.com",
  "sendingStatus":      "pending",              // pending | pending_dkim | verified | failed
  "receivingStatus":    "pending",              // pending | verified | failed
  "verificationStatus": "pending",              // backward-compatible alias of sendingStatus
  "sendingDnsRecords": [
    {
      "type":  "TXT",
      "name":  "_amazonses.mail.yourdomain.com",
      "value": "verification-token"
    },
    {
      "type":  "CNAME",
      "name":  "agsend1._domainkey.mail.yourdomain.com",
      "value": "agsend1.dkim.amazonses.com"
    }
  ],
  "receivingDnsRecords": [
    {
      "type":  "MX",
      "name":  "mail.yourdomain.com",
      "value": "mx.agentsend.io",
      "priority": 10
    }
  ],
  "dnsRecords": [
    {
      "type":  "TXT",
      "name":  "_amazonses.mail.yourdomain.com",
      "value": "verification-token"
    }
  ],
  "sendingVerifiedAt": null,
  "receivingVerifiedAt": null,
  "createdAt": "2024-11-01T09:00:00Z"
}
Trường Kiểu Mô tả
idstringUnique domain identifier (UUID).
domainstringThe domain or subdomain you added.
sendingStatusstringSender verification status. pending, pending_dkim, verified, or failed.
receivingStatusstringInbound routing status based on MX. pending, verified, or failed.
verificationStatusstringBackward-compatible alias of sendingStatus.
sendingDnsRecordsarrayDNS records required for sending verification and DKIM signing.
receivingDnsRecordsarrayDNS records required if you want AgentSend to receive inbound mail for the domain.
dnsRecordsarrayCombined list of sending and receiving records for convenience.
sendingVerifiedAtstring | nullWhen sending verification last reached verified.
receivingVerifiedAtstring | nullWhen MX verification last reached verified.
createdAtstring (ISO 8601)Timestamp when the domain was added.

POST /domains

Add a custom domain. Returns the new Domain object including the DNS records you must publish before verifying.

Nội dung yêu cầu

ParameterTypeDescription
domain bắt buộc string The domain or subdomain to add, e.g. mail.yourdomain.com.
curl
curl -X POST https://api.agentsend.io/domains \
  -H "x-api-key: $AGENTSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"domain": "mail.yourdomain.com"}'

Response 201 Created

json
{
  "id": "dom_01hxyz4k9s2n3p7q",
  "domain": "mail.yourdomain.com",
  "verificationStatus": "pending",
  "dnsRecords": [
    {
      "type": "TXT",
      "name": "mail.yourdomain.com",
      "value": "v=spf1 include:spf.agentsend.io ~all"
    },
    {
      "type": "CNAME",
      "name": "agsend1._domainkey.mail.yourdomain.com",
      "value": "agsend1._domainkey.agentsend.io"
    },
    {
      "type": "CNAME",
      "name": "agsend2._domainkey.mail.yourdomain.com",
      "value": "agsend2._domainkey.agentsend.io"
    }
  ],
  "createdAt": "2024-11-01T09:00:00Z"
}
💡

Publish all returned dnsRecords at your DNS registrar, then call POST /domains/{id}/verify to activate the domain.


GET /domains

List all domains on your account, including their current verification status.

Parameters

No query parameters.

curl
curl https://api.agentsend.io/domains \
  -H "x-api-key: $AGENTSEND_API_KEY"

Response 200 OK

json
{
  "data": [
    {
      "id": "dom_01hxyz4k9s2n3p7q",
      "domain": "mail.yourdomain.com",
      "verificationStatus": "verified",
      "dnsRecords": [ /* ... */ ],
      "createdAt": "2024-11-01T09:00:00Z"
    },
    {
      "id": "dom_01hzab8m3t4r2w9c",
      "domain": "outbound.acme.io",
      "verificationStatus": "pending",
      "dnsRecords": [ /* ... */ ],
      "createdAt": "2024-11-15T14:23:00Z"
    }
  ]
}

GET /domains/{id}

Retrieve a single domain by ID, including its full DNS records and current verification status.

Tham số đường dẫn

ParameterTypeDescription
id bắt buộc string (uuid) The ID of the domain to retrieve.
curl
curl https://api.agentsend.io/domains/dom_01hxyz4k9s2n3p7q \
  -H "x-api-key: $AGENTSEND_API_KEY"

Response 200 OK

json
{
  "id": "dom_01hxyz4k9s2n3p7q",
  "domain": "mail.yourdomain.com",
  "verificationStatus": "verified",
  "dnsRecords": [
    {
      "type": "TXT",
      "name": "mail.yourdomain.com",
      "value": "v=spf1 include:spf.agentsend.io ~all"
    },
    {
      "type": "CNAME",
      "name": "agsend1._domainkey.mail.yourdomain.com",
      "value": "agsend1._domainkey.agentsend.io"
    },
    {
      "type": "CNAME",
      "name": "agsend2._domainkey.mail.yourdomain.com",
      "value": "agsend2._domainkey.agentsend.io"
    }
  ],
  "createdAt": "2024-11-01T09:00:00Z"
}

DELETE /domains/{id}

Permanently delete a domain from your account. Inboxes using this domain will fall back to @agentsend.io addresses. This action is irreversible.

Tham số đường dẫn

ParameterTypeDescription
id bắt buộc string (uuid) The ID of the domain to delete.
curl
curl -X DELETE https://api.agentsend.io/domains/dom_01hxyz4k9s2n3p7q \
  -H "x-api-key: $AGENTSEND_API_KEY"

Response 204 No Content

Returns an empty body on success.

Deleting a domain does not remove the DNS records from your registrar. You should clean those up manually after deletion.


POST /domains/{id}/verify

Trigger a fresh domain readiness check. AgentSend updates sender verification from SES and DKIM, then separately checks whether the domain's MX points to AgentSend for inbound mail.

Tham số đường dẫn

ParameterTypeDescription
id bắt buộc string (uuid) The ID of the domain to verify.
curl
curl -X POST https://api.agentsend.io/domains/dom_01hxyz4k9s2n3p7q/verify \
  -H "x-api-key: $AGENTSEND_API_KEY"

Response 200 OK

Trả về updated Domain object. Check sendingStatus and receivingStatus to see the latest result.

json — verified
{
  "id": "dom_01hxyz4k9s2n3p7q",
  "domain": "mail.yourdomain.com",
  "verificationStatus": "verified",
  "dnsRecords": [
    {
      "type": "TXT",
      "name": "mail.yourdomain.com",
      "value": "v=spf1 include:spf.agentsend.io ~all"
    },
    {
      "type": "CNAME",
      "name": "agsend1._domainkey.mail.yourdomain.com",
      "value": "agsend1._domainkey.agentsend.io"
    },
    {
      "type": "CNAME",
      "name": "agsend2._domainkey.mail.yourdomain.com",
      "value": "agsend2._domainkey.agentsend.io"
    }
  ],
  "createdAt": "2024-11-01T09:00:00Z"
}
json — pending_dkim (ownership ok, DKIM not yet propagated)
{
  "id": "dom_01hxyz4k9s2n3p7q",
  "domain": "mail.yourdomain.com",
  "verificationStatus": "pending_dkim",
  "dnsRecords": [ /* ... */ ],
  "createdAt": "2024-11-01T09:00:00Z"
}

DNS changes can take up to 48 hours to propagate worldwide. If verification returns pending_dkim or failed, wait a few minutes and call verify again.