--- title: Hep.gg Email JavaScript SDK (LLM) description: Send transactional email from Node/TypeScript via the hepgg package. --- # Hep.gg Email SDK (hepgg package) Typed Node/TypeScript client for the Email HTTPS API. Subpath: `hepgg/email`. Part of the unified `hepgg` package. Node 20+. ## Install npm install hepgg --registry https://npm.hep.gg ## Construct import { Email } from "hepgg/email"; const email = new Email({ token, baseURL?, timeoutMs?, retries?, fetch? }); token string required. hyd-mail- key. Sent as Authorization: Bearer . baseURL string optional. Default https://hep.gg. Endpoint: POST /api/v1/email/send. ## Method email.send(message) -> SendEmailResult message fields: to string | string[] required (>=1 recipient). cc string | string[] optional. bcc string | string[] optional. subject string optional. html string one of html/text required. text string one of html/text required. from string optional, must be an address you own. fromName string optional, max 100 chars. replyTo string optional. SendEmailResult fields: messageId, smtpMessageId?, status ("sent" | "queued"), from, recipients, creditsCharged, retryHint? (present when queued). Behavior: - 200 -> status "sent". 202 -> status "queued" (over the rolling 24h cap; charged, drains within 24h). - Billing: 1 credit per distinct recipient (to+cc+bcc, de-duped case-insensitively). ## Client-side validation (thrown before the request) - No body (neither html nor text): TypeError. - No recipients: TypeError. - More than 100 distinct recipients: RangeError. ## Errors API failures throw HepError { status, code, service: "email", message, body }. Common: 402 INSUFFICIENT_CREDITS, 429 rate limited (Retry-After), 413 body too large. ## Part of the hepgg package Also provides: hepgg/id, hepgg/sms, hepgg/uploader, hepgg/paste, hepgg/secrets, hepgg/ai, hepgg/login, hepgg/logger (logger docs: https://docs.teamhydra.dev/docs/logger/getting-started). Full email reference: /llms/email/https-api, /llms/email/senders-billing-limits, /llms/email/errors.