Skip to main content

Overview

The Nudgen Developer API gives scripts, internal tools, and AI agents a predictable REST interface for your workspace. Use a Personal Access Token (PAT) to manage workspace resources. Use a Team trigger API key only to trigger a Lifetime campaign from your backend.

Why this matters

You can automate marketing and event-driven retention workflows without sharing a dashboard session. PATs keep workspace management revocable, while a narrow Team trigger key lets a production service send an event-triggered nudge without broad workspace access.

Base URL

Set the app URL for your environment once and use it in every example. Production commonly uses https://app.nudgen.net; local development commonly uses http://localhost:3000.

Authentication

Personal Access Token

Create a PAT in SettingsAPI Keys. Use it for contacts, campaign management, brand settings, and AI generation.
PATs are shown only once. Store them securely and revoke any old or exposed token from SettingsAPI Keys.

Team trigger API key

A Team trigger API key starts with ndg_team_ and has the narrow campaigns:trigger scope. It can trigger Lifetime campaigns only; a PAT cannot trigger them. Only workspace owners and admins can create, rotate, or revoke these keys. By default, a key expires after 90 days. Set expiresInDays to null to create a non-expiring key.
The 201 response contains the plaintext key exactly once. Save it in a server-side secret manager. Later responses expose only keyPrefix.

REST endpoints

Identity and workspace

Contacts

One-shot and drip campaigns

Launching a campaign schedules real email. Use /api/v1/campaigns/test-send for inbox previews.

Lifetime campaigns

Lifetime campaigns are event-triggered: each accepted trigger creates at most one execution and sends one nudge to the supplied contact. See Use Lifetime campaigns for the dashboard workflow and variable-contract guidance.

Create a Lifetime campaign

Create Lifetime campaigns as draft. Do not send sendNow: true, status: "active", or status: "scheduled"; activate the campaign with its lifecycle endpoint instead.
variableManifest defines up to 100 data.* variables. It must include every data.* token used in the subject or HTML. Defaults must match the declared type, and a variable used in an HTML href must have type url. When you generate email content, save the matching generatedVariableManifest. Nudgen blocks activation if it differs from the current manifest or if required declared parameters are absent from the email.

Change the lifecycle

Valid transitions are draft → active → paused → active and active|paused → archived. Pausing or archiving cancels executions that are still pending or queued and releases their quota reservations. An execution already being processed may still send.

Trigger a nudge

The whole request body is limited to 64 KiB, JSON nesting to eight levels, and unsafe keys such as __proto__, constructor, and prototype are rejected. A new trigger returns 201 with { "execution": { "id": "...", "status": "queued" }, "duplicate": false }. Reusing an eventId returns the existing execution with 200 and duplicate: true.

List executions

Use limit from 1–100 (default 25), cursor for the next page, status to filter by execution status, and search to match an email or external ID. The response includes executions and nextCursor.

Errors, retries, and rate limits

Lifetime triggers allow 600 requests per minute for each Team trigger API key. Responses include x-ratelimit-limit, x-ratelimit-remaining, and x-ratelimit-reset. A 429 response also includes Retry-After. For 429, 503, and network errors, retry with exponential backoff and the same eventId. The queue job is deterministic for an execution, so retries do not create duplicate email.

Brand settings

AI draft generation

MCP server

Use Nudgen MCP when your agent supports Model Context Protocol tools. MCP uses the same PAT as workspace management APIs, but exposes Nudgen as agent-callable tools instead of conventional HTTP endpoints.

MCP server setup

Install Nudgen MCP in Claude Code, Cursor, Windsurf, Codex CLI, or a generic MCP client.