NightmailDocs
Docs

Get newsletter

get/v1/newsletters/{id}

The newsletter with its readers. Readers are the list’s members who are not deleted, not suppressed and subscribed to marketing, as campaign audiences count them. A list of up to 10,000 members is counted exactly when read. A larger list is counted in the background, a few minutes per pass, and read from its last count, which is refreshed when read more than an hour after it was taken; readers is null until the first count of a large list. Each statement stops after 3 seconds: a request that needs longer is refused with 422 READ_TOO_LARGE. Narrow the dates or filters.

Needs Audience & content: read on the whole workspace.

Example

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

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

const result = await getNewsletter({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

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

Parameters

idrequiredpath · string

Responses

200Success
NewsletterRead
idrequiredstring

The list’s ID.

namerequiredstring

The list’s name.

fromrequiredstring
fromNamerequiredstring or null
urlrequiredstring

Dashboard URL for opening this newsletter.

createdAtrequiredstring

When the list was created.

readersrequiredobject or null

Readers are the list’s members who are not deleted, not suppressed and subscribed to marketing, as campaign audiences count them. A list of up to 10,000 members is counted exactly when read. A larger list is counted in the background, a few minutes per pass, and read from its last count, which is refreshed when read more than an hour after it was taken; readers is null until the first count of a large list.

readers.countrequiredinteger

Readers now (at countedAt).

readers.dailyrequiredinteger[]

One number per UTC day for the 182 days ending on the day of countedAt, oldest first: how many of these readers joined the list that day.

readers.sincerequiredstring

The first of those days, YYYY-MM-DD.

readers.countedAtrequiredstring

When the count was taken; it includes every change made before then.

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.