โดเมน

ส่งอีเมลจากแบรนด์ของคุณเองและติดตามความพร้อมขาเข้าแยกต่างหาก เพิ่มโดเมนเพื่อสร้างกล่องจดหมายที่ที่อยู่เช่น agent@yourdomain.com แทนค่าเริ่มต้น @agentsend.io

ภาพรวม

By default, every inbox you create gets a randomly generated address on the shared @agentsend.io domain. This works great for getting started, but if you want your agents to send email from your own brand, you can add a custom domain.

Once a domain is verified, you can create inboxes on it and send email that appears to come from addresses like support@yourdomain.com or assistant@yourdomain.com. Recipients see your domain in the From header. Incoming replies will follow whatever MX routing your domain uses, so point MX to AgentSend only if you want inbound mail delivered into AgentSend.

Custom domains require adding DNS records to your domain registrar (Cloudflare, Route 53, Namecheap, etc.). The verification process checks that those records have propagated before allowing sends.

Adding a Domain

Register a domain with AgentSend by sending a POST request to /domains. The response includes the DNS records you need to add.

javascript
const res = await fetch("https://api.agentsend.io/domains", {
  method: "POST",
  headers: {
    "x-api-key": process.env.AGENTSEND_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    domain: "yourdomain.com",
  }),
});

const domain = await res.json();
console.log(domain.id);               // "dom_..."
console.log(domain.sendingStatus);   // "pending"
console.log(domain.receivingStatus); // "pending"
console.log(domain.dnsRecords);      // combined DNS records to add

Example response

json
{
  "id": "dom_01hx4r2kt9fzv8s3n",
  "domain": "yourdomain.com",
  "sendingStatus": "pending",
  "receivingStatus": "pending",
  "verificationStatus": "pending",
  "createdAt": "2025-04-16T10:00:00.000Z",
  "dnsRecords": [
    {
      "type": "TXT",
      "host": "_amazonses.yourdomain.com",
      "value": "verification-token"
    },
    {
      "type": "CNAME",
      "host": "dkim-a._domainkey.yourdomain.com",
      "value": "dkim-a.dkim.amazonses.com"
    },
    {
      "type": "MX",
      "host": "yourdomain.com",
      "value": "mx.agentsend.io",
      "priority": 10
    }
  ]
}

DNS Setup

After adding the domain, go to your DNS provider and add the records returned in dnsRecords. The TXT and CNAME records verify sender identity and DKIM signing. The MX record is only needed if you also want AgentSend to receive inbound mail for the domain.

ประเภท Host ค่า วัตถุประสงค์
MX yourdomain.com mx.agentsend.io (priority 10) Routes incoming email for your domain to AgentSend's mail servers, so replies land in your agent's inbox.
TXT (verification) _amazonses.yourdomain.com SES verification token Confirms that you control the sending domain in Amazon SES.
CNAME (DKIM) <token>._domainkey.yourdomain.com <token>.dkim.amazonses.com Cryptographically signs outgoing messages so recipients can verify they were sent by AgentSend with your domain's authorization.
💡

DNS changes typically propagate within a few minutes, but can take up to 48 hours in rare cases. You can run dig TXT agentsend._domainkey.yourdomain.com from a terminal to check whether your DKIM record is live.

If your domain already has an MX record, adding AgentSend's MX record will route all inbound email for that domain to AgentSend. Use a subdomain (e.g. mail.yourdomain.com) if you need to preserve existing mail routing.

การยืนยัน

Once you've added the DNS records, trigger a verification check by calling POST /domains/{id}/verify. AgentSend refreshes sender verification and separately checks whether your MX points to AgentSend for inbound mail.

javascript
const res = await fetch(
  `https://api.agentsend.io/domains/${domain.id}/verify`,
  {
    method: "POST",
    headers: { "x-api-key": process.env.AGENTSEND_API_KEY },
  }
);

const result = await res.json();
console.log(result.sendingStatus);   // "verified" | "pending_dkim" | "failed"
console.log(result.receivingStatus); // "verified" | "pending" | "failed"

Status flow

sendingStatus and receivingStatus are tracked separately. verificationStatus remains as a backward-compatible alias of sendingStatus.

สถานะ Meaning
pending Domain has been registered but verification has not been attempted yet. No DNS records have been checked.
pending_dkim Domain ownership is verified, but the DKIM records are not yet visible. Wait a few minutes and retry.
verified All required DNS records are confirmed. The domain is ready to use for sending email. Receiving still depends on where the domain's MX records point.
failed Verification failed. One or more required records could not be found. Check that the records are correctly entered in your DNS provider and retry.

You can call /domains/{id}/verify as many times as you need. It is safe to poll — for example, call it every 30 seconds until the status becomes verified.

Domain Properties

A domain object has the following fields:

คุณสมบัติ ประเภท คำอธิบาย
id string Unique identifier for the domain, prefixed with dom_.
domain string The domain name as provided when the domain was created, e.g. yourdomain.com.
sendingStatus string Current sender verification state: pending, pending_dkim, verified, or failed.
receivingStatus string Current inbound routing state based on MX: pending, verified, or failed.
verificationStatus string Backward-compatible alias of sendingStatus.
dnsRecords array Array of DNS record objects that must be added to your DNS provider. Each record has type, host, value, and optionally priority.
createdAt string (ISO 8601) Timestamp of when the domain was registered with AgentSend.

Creating Inboxes on Custom Domains

Once a domain is verified, pass its id as domainId when creating an inbox. The inbox address will use your domain instead of @agentsend.io.

javascript
const res = await fetch("https://api.agentsend.io/inboxes", {
  method: "POST",
  headers: {
    "x-api-key": process.env.AGENTSEND_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    displayName: "Support Agent",
    username: "support",       // becomes support@yourdomain.com
    domainId: "dom_01hx4r2kt9fzv8s3n",
  }),
});

const inbox = await res.json();
console.log(inbox.address); // "support@yourdomain.com"
💡

The username field sets the local part of the email address. If you omit it, AgentSend generates a random one. You can create as many inboxes as you need on the same verified domain.

Deleting a Domain

Remove a domain with a DELETE request to /domains/{id}.

javascript
await fetch(`https://api.agentsend.io/domains/${domain.id}`, {
  method: "DELETE",
  headers: { "x-api-key": process.env.AGENTSEND_API_KEY },
});

Deleting a domain is permanent. All inboxes associated with the domain will lose their email addresses and will no longer be able to send or receive email. Existing messages in those inboxes are retained, but new mail cannot be delivered. This action cannot be undone.