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 useshttps://app.nudgen.net; local development commonly uses http://localhost:3000.
Authentication
Personal Access Token
Create a PAT in Settings → API Keys. Use it for contacts, campaign management, brand settings, and AI generation.Team trigger API key
A Team trigger API key starts withndg_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.
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
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 asdraft. 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
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
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 includex-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.
Sending domains
Owners and admins on an active paid plan can manage one custom sending domain per workspace. The API reference includes list, add, edit, verify, choose default sender, remove, and resume-sending endpoints under/api/v1/settings/sending-domains. Every request requires a teamId query parameter that matches the PAT owner’s active workspace. Adding a domain does not verify it; publish the DNS records returned by the list endpoint and call the verification endpoint before selecting it as the default sender.
Brand settings
AI draft generation
MCP server
Use Nudgen MCP when your agent supports Model Context Protocol tools. MCP uses OAuth sign-in tied to a selected workspace; PATs remain for the REST API. MCP campaign creation saves a draft, and each launch requires separate browser approval.MCP server setup
Install Nudgen MCP in Claude Code, Cursor, Windsurf, Codex CLI, or a generic MCP client.
Map Leads API
Use a PAT for the active workspace. New searches consume the daily search quota; pagination and enrichment retries do not. Quota resets at midnight UTC. An explicit larger radius starts a new search. Provider failures release a reserved search; cancelling an accepted search does not. API and MCP searches default to 5 km and accept an explicit integerradiusKm from 1 to 100. They do not show the dashboard confirmation dialog. Keep the same search inputs when passing nextPageToken as pageToken; a page can contain no matching leads and still have another page.
Contact enrichment may finish after businesses first appear. enrichmentPending marks unfinished website research. Review businessSummary and businessSources when available; imported business context can support personalized campaign introductions. A missing email can mean research is still pending.
enrichmentRetryToken is present, call POST /api/v1/map-leads/enrichment-retry with token to retry pending website research. It requires PAT, is bound to the connected workspace, expires after 15 minutes, and can be used once. Merge returned leads by placeId before importing.
Set Accept: application/x-ndjson on search or enrichment retry for incremental results. Each line is JSON: type is progress, complete, or error. Merge leads in data.leads by placeId. Use the final complete.data as the authoritative result; errors use error. Without this header, the response is ordinary JSON. POST /place resolves a location suggestion, not a business contact record. GET /geolocate returns a fixed Ho Chi Minh City fallback; it does not determine your location.