Quickstarts

Quickstart: Email

Add a sending domain and send your first message.

The transactional email service has a Resend-style API (hbe_… keys).

Variables used below: $HOSTBASE_TOKEN (access token), $REF (project ref). SDKs: @hostbase/management (TypeScript) and hostbase_management (Python); full reference at /docs/api.

1. Add a domain

The response contains the DNS records (SPF, DKIM, DMARC).

curl -X POST https://host.ulewicz.space/api/v1/projects/$REF/email/domains -H "Authorization: Bearer $HOSTBASE_TOKEN" -H "Content-Type: application/json" -d '{"domain":"mail.example.com"}'
await hb.addEmailDomain({ ref, body: { domain: "mail.example.com" } });
hb.add_email_domain(ref=ref, body={"domain": "mail.example.com"})

2. Verify

After setting DNS, check the domain again.

curl -X POST https://host.ulewicz.space/api/v1/projects/$REF/email/domains -H "Authorization: Bearer $HOSTBASE_TOKEN" -H "Content-Type: application/json" -d '{"domain":"mail.example.com","verify":true}'
await hb.addEmailDomain({ ref, body: { domain: "mail.example.com", verify: true } });
hb.add_email_domain(ref=ref, body={"domain": "mail.example.com", "verify": True})

3. Send

Create the API key (hbe_…) in the dashboard; optional Idempotency-Key header.

curl -X POST https://host.ulewicz.space/api/email/v1/send -H "Authorization: Bearer $HBE_KEY" -H "Content-Type: application/json" \
  -d '{"from":"App <hi@mail.example.com>","to":["jan@example.com"],"subject":"Hello","html":"<p>It works</p>"}'
await fetch("https://host.ulewicz.space/api/email/v1/send", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.HBE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ from: "App <hi@mail.example.com>", to: ["jan@example.com"], subject: "Hello", html: "<p>It works</p>" }),
});
import requests
requests.post("https://host.ulewicz.space/api/email/v1/send", headers={"Authorization": f"Bearer {HBE_KEY}"},
  json={"from": "App <hi@mail.example.com>", "to": ["jan@example.com"], "subject": "Hello", "html": "<p>It works</p>"})

Next: /docs/limity-api.