Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lettr.com/llms.txt

Use this file to discover all available pages before exploring further.

The lettr.domains() service manages your sending domains — useful for multi-tenant apps onboarding customer domains, or for automating DNS verification. For the concepts behind domain setup (SPF, DKIM, DMARC), see Sending Domains.
import com.lettr.Lettr;
import com.lettr.services.domains.model.*;

Lettr lettr = new Lettr("your-api-key");

List Domains

ListDomainsResponse domains = lettr.domains().list();
for (DomainListItem d : domains.getDomains()) {
    System.out.println(d.getDomain() + " - " + d.getStatus() + " (can send: " + d.isCanSend() + ")");
}

API Reference

GET /domains

Create a Domain

CreateDomainResponse newDomain = lettr.domains().create(
    CreateDomainOptions.of("example.com")
);
System.out.println("DKIM selector: " + newDomain.getDkim().getSelector());
System.out.println("DKIM public key: " + newDomain.getDkim().getPublicKey());

API Reference

POST /domains

Get Domain Details

Domain domain = lettr.domains().get("example.com");
System.out.println("DKIM status: " + domain.getDkimStatus());
System.out.println("DMARC status: " + domain.getDmarcStatus());
System.out.println("SPF status: " + domain.getSpfStatus());
System.out.println("Primary domain: " + domain.getIsPrimaryDomain());

API Reference

GET /domains/

Verify Domain DNS

After publishing the records, trigger a verification check:
VerifyDomainResponse result = lettr.domains().verify("example.com");
System.out.println("DKIM: " + result.getDkimStatus());
System.out.println("CNAME: " + result.getCnameStatus());
System.out.println("DMARC: " + result.getDmarcStatus());
System.out.println("SPF: " + result.getSpfStatus());

if (result.getDns().getDkimError() != null) {
    System.out.println("DKIM error: " + result.getDns().getDkimError());
}
DNS changes take time to propagate. If verification fails right after publishing, wait a few minutes and retry. See Domain Verification troubleshooting.

API Reference

POST /domains//verify

Delete a Domain

lettr.domains().delete("example.com");
Deleting a domain stops all sending from it immediately. Emails from a deleted domain fail with a validation error.

API Reference

DELETE /domains/

What’s Next

Sending Domains

DNS setup: SPF, DKIM, DMARC

Webhooks

Receive delivery and engagement events