List visible conversations
/v1/inbound/threadsNewest visible activity first, then descending thread ID. addressId narrows all projected messages and IDs. q searches visible messages; view matches state on any visible address. all (default) includes trash. Pass nextCursor to continue. Each statement stops after 3 seconds: a request that needs longer is refused with 422 READ_TOO_LARGE. Narrow the dates or filters.
Needs Received mail: read for the address it reached, or a sender domain it was addressed to.
Example
import { createClient } from '@nightmail/sdk/client';
import { listInboundThreads } from '@nightmail/sdk';
const client = createClient({
baseUrl: 'https://nightmail.dev',
auth: scheme => scheme.scheme === 'bearer'
? process.env.NIGHTMAIL_API_KEY
: undefined,
});
const result = await listInboundThreads({
client,
throwOnError: true,
});
console.log(result.data);curl --request GET \
--url 'https://nightmail.dev/v1/inbound/threads' \
--header "Authorization: Bearer $NIGHTMAIL_API_KEY"Parameters
addressIdquery · stringOpaque inbound address ID (mbx_…).
cursorquery · stringOpaque cursor from the preceding page, with the same filters.
limitquery · integerviewquery · stringqquery · stringResponses
200Success
InboundThreadPagedatarequiredobject[]data[].idrequiredstringdata[].subjectrequiredstringdata[].snippetrequiredstringdata[].lastMessageAtrequiredstringdata[].fromrequiredobjectSender of the newest visible message (the subject and snippet are from it). For a sent reply this is your own address.
data[].addressIdsrequiredstring[]data[].messageCountrequiredintegerDistinct messages visible within the requested address scope.
nextCursorrequiredstring or null400, 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.