NightmailDocs
Docs

List every endpoint

get/v1/inbound/endpoints

List every endpoint a page at a time, with the routes and rules that use it. Named endpoints of every type (Slack, Discord, webhook, forward) by name, then webhooks without a name. Pass nextCursor back as cursor until it is null. addressId lists only the webhooks that get that address's received mail (subscribed to it or to every address), the full list a route's toMore points to.

Needs Receiving rules: write on the whole workspace. A person needs to be an owner or admin.

Example

import { createClient } from '@nightmail/sdk/client';
import { listInboundEndpoints } from '@nightmail/sdk';

const client = createClient({
  baseUrl: 'https://nightmail.dev',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.NIGHTMAIL_API_KEY
    : undefined,
});

const result = await listInboundEndpoints({
  client,
  throwOnError: true,
});

console.log(result.data);
curl --request GET \
  --url 'https://nightmail.dev/v1/inbound/endpoints' \
  --header "Authorization: Bearer $NIGHTMAIL_API_KEY"

Parameters

cursorquery · string

nextCursor from the previous page.

limitquery · integer
addressIdquery · string

Only webhooks that get this address's received mail.

Responses

200Success
InboundEndpointPage
datarequiredobject[]
data[].idrequiredstring

Endpoint ID: mwh_… for a webhook, con_… for Slack, Discord or a forward.

data[].sourcerequiredstring

endpoint: a named endpoint, which rules call (listEndpoints). inbound_webhook: a webhook without a name (listInboundWebhooks lists every webhook, named or not).

data[].namerequiredstring
data[].typerequiredstring
data[].statusrequiredstring
data[].targetrequiredstring

Where it delivers; URLs are write-only (last four characters).

data[].callrequiredstring or null

How a rule calls an endpoint; null for an inbound webhook.

data[].eventTypesrequiredstring[]

Events a webhook subscribes to; empty for a route-only webhook and for Slack, Discord and forward endpoints.

data[].routesrequiredinteger

Routes that name it.

data[].rulesrequiredstring[]

Rules that call it.

data[].ritualsrequiredstring[]

Deprecated: rules.

nextCursorrequiredstring or null
400, 401, 403, 404, 409, 413, 422, 429, 500, 503Request failed; use error.code and requestId to diagnose.
ApiError
errorrequiredobject
error.coderequiredstring
error.messagerequiredstring
error.requestIdrequiredstring
error.fieldstring
error.retryablerequiredboolean
error.resetAtstring

Next capacity change for a Hosted rolling send limit.

error.detailsobject[]

Every problem found, when there is more than one part, such as rule diagnostics with rule, line, column, message and hint, or a measurement, such as CONTENT_TOO_LARGE_TO_SCREEN with screenedBytes and limitBytes (and index in a batch).

error.requiredobject

On a 403 permission refusal: what the request needs that this credential lacks. The Nightmail-Required-Permission header says the same.