Skip to content

API Reference

Method reference for the TypeScript SDK: the constructor, endpoints, direct delivery, usage and introspection, with links to the reference for requests, emails, forwarding, teams and sharing, helpers and types.

Updated Nov 2026

The reference is split by topic so each page loads quickly:

  • Requests: list, search, wait for, replay and export captured requests; provider detection, body parsing, payload schemas and request diffing
  • Emails: wait for mail, codes and links, parsed fields, attachments and test emails
  • Forwarding: destinations, filters, formats, secrets, deliveries, alerts and templates
  • Teams and sharing: teams, client.shares, the flow builder, sandbox and agent registration
  • Types, helpers and errors: matchers, signature verification, duration strings, exported types and error classes

Constructor

import { WebhooksCC } from "@webhooks-cc/sdk";
 
const client = new WebhooksCC({
  apiKey: string,        // Your API key. Required unless getAccessToken is given.
  getAccessToken?: (o?: { forceRefresh?: boolean }) => Promise<string>,
                         // Optional. Supplies an expiring token instead (agents).
  baseUrl?: string,      // Optional. Override API base URL.
  webhookUrl?: string,   // Optional. Override webhook receiver URL.
  timeout?: number,      // Optional. Request timeout in ms (default: 30000).
  retry?: RetryOptions,  // Optional. Automatic retry configuration.
  hooks?: ClientHooks,   // Optional. Lifecycle hooks for observability.
  emailDomain?: string,  // Optional. Domain for emails.address() (default: mailhooks.cc).
  fetch?: typeof fetch,  // Optional. The fetch every call goes through (proxies, tests).
  userAgent?: string,    // Optional. Your product token, like "my-tool/1.2", sent before
                         // the SDK's (webhooks-cc-sdk/<version>) in the User-Agent.
});

Retries are off by default (maxAttempts: 1). With retry, GET, PUT and DELETE calls are repeated after a network error, a timeout or a status in retryOn (429, 500, 502, 503 and 504 by default), and any call after a 429, which the API sends before doing anything. A POST or PATCH that failed any other way is not repeated: it may have gone through, and a second endpoints.create() would leave an extra endpoint. Nor is requests.clear() without before, whose repeat would also delete what arrived in between.

Endpoints

POST/endpoints

client.endpoints.create

Create a new webhook endpoint. The slug is auto-generated.

create(options?: CreateEndpointOptions): Promise<Endpoint>
ParamTypeRequiredDescription
namestringnoDisplay name
ephemeralbooleannoAuto-delete after TTL
expiresInstring | numbernoCustom expiry duration, like "12h" or "7d"; implies ephemeral
mockResponseMockResponsenoMock response config
responseRulesResponseRule[]noResponse rules, first match wins
notificationUrlstringnoAdds a Notifications destination: a chat message, at most one a second
siteEndpointSitenoWhich site's dashboard lists it: "webhooks", "mailhooks" or "both" (the default). Listing only; both addresses work either way

MockResponse fields:

FieldTypeRequiredDescription
statusnumberyesHTTP status code (100-599)
bodystringnoResponse body
headersRecord<string, string>noResponse headers
delaynumbernoResponse delay in ms (0-30000)
GET/endpoints

client.endpoints.list

List the endpoints you own (each with sharedWith) and those shared with you through a subscribed team (each with fromTeam, the oldest share, and fromTeams, every one of your teams it is shared with), as one array. Each carries favorite, whether you marked it as a favourite.

list(options?: ListEndpointsOptions): Promise<Endpoint[]>
ParamTypeRequiredDescription
teamstringnoKeep only endpoints tied to this team, matched via fromTeams, fromTeam, or sharedWith. A team id or a unique name (case-insensitive), resolved through teams.list(); an ambiguous name throws
GET/endpoints/:slug

client.endpoints.get

Get a single endpoint by slug.

get(slug: string): Promise<Endpoint>
PATCH/endpoints/:slug

client.endpoints.update

Update an endpoint's settings. Only the options you pass change.

update(slug: string, options: UpdateEndpointOptions): Promise<Endpoint>
ParamTypeRequiredDescription
slugstringyesEndpoint slug
namestringnoNew display name
mockResponseMockResponse | nullnoDefault response (see fields above), or null to clear
responseRulesResponseRule[] | nullnoResponse rules, or null to clear
notificationUrlstring | nullnoSets the Notifications destination, or null removes it
showEmailExtractsbooleannoPick codes and links out of emails (owner only)
siteEndpointSitenoWhich site's dashboard lists it (owner only)
emailFieldsEmailField[] | nullnoNamed fields to pick out of every email, at most 20; replaces the list (owner only)
layoutsLayout[] | nullnoLayouts that read the endpoint's emails before delivery, at most 50; replaces the list (owner only)
retentionDaysnumber | nullnoKeep requests this many days (1 up to the plan's), or null for the plan's (owner only)
deleteAfterDeliverybooleannoDelete each request once every delivery is settled (owner only)
agentRepostring | nullnoGitHub owner/name a coding agent fixes failed deliveries in (fix prompts), or null to clear (owner only)
signingProviderstring | nullnoProvider for server-side signature verification, or null to turn it off
signingSecretstring | nullnoThe provider's signing secret (stored encrypted, never returned)
signingHeaderstring | nullnoThe header name for the generic-hmac provider

Mock response bodies and header values can hold placeholders such as {{ json.id }}, filled in from each request.

POST/endpoints/:slug/responses/preview

client.endpoints.previewResponse

A dry run: which response rule answers a captured request, and the response with its placeholders filled in, exactly as the receiver would send it. Nothing is sent.

previewResponse(slug: string, options?: PreviewResponseOptions): Promise<ResponsePreview>
ParamTypeRequiredDescription
slugstringyesEndpoint slug
requestIdstringnoA captured request on the endpoint (default: the newest HTTP request)
mockResponseMockResponse | nullnoTry an unsaved default response; left out, the saved one applies
responseRulesResponseRule[] | nullnoTry unsaved rules; left out, the saved ones apply

Returns rule ({ index, name } of the rule that answers, or null for the default response), response ({ status, headers, body, delay }, or null for the plain 200 OK), unknownPlaceholders (sent as written), email (true when the request is an email, which never gets a mock response) and request (the request it ran against; sample when none was captured yet).

const preview = await client.endpoints.previewResponse("payments", {
  responseRules: [
    {
      conditions: [{ field: "body_path", op: "gt", path: "data.amount", value: "10000" }],
      response: { status: 422, body: '{"amount": {{ json.data.amount }}}', headers: {} },
    },
  ],
});

The SDK also exports the rule language itself: evaluateConditions(group, subject) checks conditions against a request and renderTemplate(template, context) fills in placeholders, with the same results as the receiver.

POST/endpoints/:slug/layouts/preview

client.endpoints.previewLayouts

A dry run of the endpoint's layouts on a captured email: which layout matches and what it finds. Uses the endpoint's newest email unless requestId is given, and the saved layouts unless layouts are. Nothing is saved or sent and no parsed pages are used: attachments show an earlier parse, never a new one. Owner only.

previewLayouts(slug: string, options?: { layouts?: Layout[]; requestId?: string }): Promise<LayoutsPreview>
// Returns: { problems, layoutsCap, request, parsed }
POST/endpoints/:slug/replay

client.endpoints.redeliver

Send the endpoint's requests received in a time range through its destinations again, at most 500, oldest first: after a pattern was fixed or a destination came back. Owner only. limit is the most one call takes; appliedUntil is the end the range had (until, or without one the server's time when it ran); nextSince is there only when requests in the range are left, and goes on with them as the next call's since, with appliedUntil as its until. When more than 500 requests share one millisecond, the extra ones in it are skipped by that continuation.

redeliver(
  slug: string,
  range?: { since?: number; until?: number; kind?: "http" | "email" }
): Promise<{
  requests: number;
  queued: number;
  limit: number;
  appliedUntil: number;
  nextSince?: number;
}>
DELETE/endpoints/:slug

client.endpoints.delete

Delete an endpoint and all its captured requests.

delete(slug: string): Promise<void>
PUT/endpoints/:slug/favorite

client.endpoints.favorite

Mark an endpoint as one of your favourites, and unfavorite to unmark it. A favourite is your own choice, never the endpoint's, so you can mark endpoints shared with you through a team too. Both are idempotent and return the new state; list() and get() report it as favorite. They need an account: sandbox tokens are refused.

favorite(slug: string): Promise<{ favorite: boolean }>   // PUT /endpoints/:slug/favorite
unfavorite(slug: string): Promise<{ favorite: boolean }> // DELETE /endpoints/:slug/favorite
await client.endpoints.favorite("payments");
const favourites = (await client.endpoints.list()).filter((e) => e.favorite);
POST/w/:slug

client.endpoints.send

Send a test webhook to an endpoint. Sends directly to the receiver, does not go through the API.

send(slug: string, options?: SendOptions): Promise<Response>
ParamTypeRequiredDescription
slugstringyesEndpoint slug
methodstringnoHTTP method (default: "POST")
headersRecord<string, string>noHTTP headers to include
bodyunknownnoRequest body (JSON-serialized)
POST/w/:slug

client.endpoints.sendTemplate

Send a provider template webhook with generated signature headers.

sendTemplate(slug: string, options: SendTemplateOptions): Promise<Response>
ParamTypeRequiredDescription
slugstringyesEndpoint slug
providerTemplateProvideryesProvider template to generate
templatestringnoProvider-specific template preset
secretstringyesShared secret for signature generation; not needed for unsigned templates (secretRequired: false: sendgrid, discord, paypal, plaid)
eventstringnoProvider event/topic override
methodstringnoHTTP method override (defaults to POST)
timestampnumbernoUnix timestamp override for signature generation
messageIdstringnoMessage id for standard-webhooks, clerk and resend signatures (random by default); not in SDK 1.15.0 or earlier
headersRecord<string, string>noAdditional headers
bodyunknownnoTemplate body override

Direct Delivery

POST(any URL)

client.sendTo

Send a webhook directly to any URL with optional provider signing. Use it for local integration testing: send properly signed webhooks to localhost handlers without routing through webhooks.cc.

sendTo(url: string, options?: SendToOptions): Promise<Response>
ParamTypeRequiredDescription
urlstringyesTarget URL (http or https)
providerTemplateProvidernoProvider template for signing
templatestringnoProvider-specific template preset, like "checkout.session.completed"; its sample body is sent when body is left out
secretstringnoSecret for signature generation (required when provider is set)
bodyunknownnoRequest body (JSON-serialized if not a string)
headersRecord<string, string>noAdditional headers
methodstringnoHTTP method (default: "POST")
eventstringnoEvent name
timestampnumbernoUnix timestamp override for deterministic signatures in tests
messageIdstringnoMessage id for standard-webhooks, clerk and resend signatures (random by default); with timestamp, makes them deterministic. Not in SDK 1.15.0 or earlier
POST(build only)

client.buildRequest

Build a signed webhook request without sending it. Returns the computed URL, method, headers, and body.

buildRequest(url: string, options?: SendToOptions): Promise<{url, method, headers, body?}>

Usage

GET/usage

client.usage

Get current request quota and usage.

usage(): Promise<UsageInfo>
// Returns: { used, limit, remaining, plan, periodEnd, parsedPages, previewData, aiAssists }
// parsedPages: { used, limit, creditPages, overage, resetsAt }
// previewData: { bytes, limitBytes, over, resetsAt } (null where sharing is not offered)
// aiAssists: { used, allowed, nextAt } (rolling 30 days; null where not offered)

Introspection

GET(local)

client.describe

Returns a static description of all SDK operations and their parameters. No API call is made. Useful for AI agents and tool discovery.

describe(): SDKDescription