Get newsletter
/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 · stringResponses
200Success
NewsletterReadidrequiredstringThe list’s ID.
namerequiredstringThe list’s name.
fromrequiredstringfromNamerequiredstring or nullurlrequiredstringDashboard URL for opening this newsletter.
createdAtrequiredstringWhen the list was created.
readersrequiredobject or nullReaders 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.countrequiredintegerReaders 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.sincerequiredstringThe first of those days, YYYY-MM-DD.
readers.countedAtrequiredstringWhen 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.
ApiErrorerrorrequiredobjecterror.coderequiredstringerror.messagerequiredstringerror.requestIdrequiredstringerror.fieldstringerror.retryablerequiredbooleanerror.resetAtstringNext 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.requiredobjectOn a 403 permission refusal: what the request needs that this credential lacks. The Nightmail-Required-Permission header says the same.