Skip to content

Latest commit

 

History

History
81 lines (59 loc) · 3 KB

File metadata and controls

81 lines (59 loc) · 3 KB

API surface

Client: new AgenticEmail({ apiKey, baseUrl? }) — default baseUrl is https://app.agenticemail.dev. All methods return Promises and throw AgenticEmailError on non-2xx responses.

inboxes

  • 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)

messages

  • client.messages.list(inboxId, filters?)
  • client.messages.search(inboxId, filters)
  • client.messages.get(inboxId, messageId)
  • client.messages.raw(inboxId, messageId) → RFC 822 source string
  • client.messages.getAttachment(inboxId, messageId, attachmentId) → ArrayBuffer
  • client.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? })

threads

  • client.threads.list(inboxId?, filters?) — omit inboxId for org-wide
  • client.threads.search({ q?, inboxId?, ... })
  • client.threads.get(threadId)
  • client.threads.update(threadId, { addLabels?, removeLabels? })

drafts

  • 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)

lists (allow/block lists)

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)

webhooks

  • 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)

domains

  • client.domains.create({ domain, dnsConnectionId?, returnPath?, trackingSubdomain?, openTracking?, clickTracking? })
  • client.domains.list()
  • client.domains.get(domainId)
  • client.domains.verify(domainId)
  • client.domains.delete(domainId)

apiKeys

  • client.apiKeys.create(name, { scopes?, scopeInboxId? })
  • client.apiKeys.list()
  • client.apiKeys.delete(apiKeyId)

events

  • client.events.connect({ inboxIds?, eventTypes? })EventStream.on(handler) returns an unsubscribe function; .close(); .socket (raw WebSocket)

Helpers

  • verifyWebhook(body, headers, secret) — validates the HMAC signature and returns the parsed event
  • AgenticEmailError.status, .code, .message