Client: new AgenticEmail({ apiKey, baseUrl? }) — default baseUrl is https://app.agenticemail.dev. All methods return Promises and throw AgenticEmailError on non-2xx responses.
client.inboxes.create({ username?, domain?, displayName?, clientId? })client.inboxes.list({ limit?, pageToken? })client.inboxes.get(inboxId)client.inboxes.update(inboxId, { displayName })client.inboxes.delete(inboxId)
client.messages.list(inboxId, filters?)client.messages.search(inboxId, filters)client.messages.get(inboxId, messageId)client.messages.raw(inboxId, messageId)→ RFC 822 source stringclient.messages.getAttachment(inboxId, messageId, attachmentId)→ ArrayBufferclient.messages.send(inboxId, { to, subject, text?, html?, cc?, bcc?, attachments?, labels?, clientId? })client.messages.sendBatch(inboxId, messages[])client.messages.reply(inboxId, messageId, { text?, html?, to?, cc?, clientId? })client.messages.forward(inboxId, messageId, { to, text?, clientId? })client.messages.update(inboxId, messageId, { addLabels?, removeLabels? })
client.threads.list(inboxId?, filters?)— omitinboxIdfor org-wideclient.threads.search({ q?, inboxId?, ... })client.threads.get(threadId)client.threads.update(threadId, { addLabels?, removeLabels? })
client.drafts.create(inboxId, { to, subject, text?, html?, sendAt?, ... })client.drafts.list(inboxId)client.drafts.get(inboxId, draftId)client.drafts.update(inboxId, draftId, input)client.drafts.delete(inboxId, draftId)client.drafts.send(inboxId, draftId)
direction is "receive" | "send" | "reply", type is "allow" | "block"; pass inboxId: null for org-level lists.
client.lists.create(inboxId, direction, type, { entry, reason? })client.lists.list(inboxId, direction, type)client.lists.get(inboxId, direction, type, entry)client.lists.delete(inboxId, direction, type, entry)
client.webhooks.create({ url, eventTypes, inboxIds? })client.webhooks.list()client.webhooks.get(webhookId)client.webhooks.update(webhookId, input)client.webhooks.delete(webhookId)client.webhooks.deliveries(webhookId)
client.domains.create({ domain, dnsConnectionId?, returnPath?, trackingSubdomain?, openTracking?, clickTracking? })client.domains.list()client.domains.get(domainId)client.domains.verify(domainId)client.domains.delete(domainId)
client.apiKeys.create(name, { scopes?, scopeInboxId? })client.apiKeys.list()client.apiKeys.delete(apiKeyId)
client.events.connect({ inboxIds?, eventTypes? })→EventStream—.on(handler)returns an unsubscribe function;.close();.socket(raw WebSocket)
verifyWebhook(body, headers, secret)— validates the HMAC signature and returns the parsed eventAgenticEmailError—.status,.code,.message