Nudgescribe API Reference
APIs
API types
API types
  • Authentication
  • Content
  • Campaign
APIs
API types
API types
  • Authentication
  • Content
  • Campaign
  1. Campaigns
  • Nudgescribe API
  • Authentication
    • Authentication
    • Authenticate
      POST
    • Re-Authenticate
      GET
  • Content
    • Customers
      • Customer Management
      • Upload and Validate Customer Data
      • Get pages
      • Get Customers
      • Delete Customers
    • Customer Groups
      • Customer Groups
      • Create Customer Group
      • Get Customer Groups
      • Update Customer Group
      • Delete Customer Group
    • Customer Profile Fields
      • Customer Profile Fields
      • Create a Custom Profile Field
      • Get Customer Profile Fields for a Workspace
      • Update Custom Fields
      • Delete Custom Fields
  • Campaigns
    • Campaign Messages Management
    • Get All Accounts Campaigns
      POST
    • Publish Messages to Secure Storage
      POST
    • Get Campaign Messages Pages
      POST
    • Retrieve Published Messages
      POST
APIs
API types
API types
  • Authentication
  • Content
  • Campaign
APIs
API types
API types
  • Authentication
  • Content
  • Campaign
  1. Campaigns

Campaign Messages Management

This API provides comprehensive campaign management and message export capabilities, enabling external systems to retrieve campaign data and download generated customer messages in multiple formats.

Introduction#

The Campaign Messages Management API enables organisations to integrate with the campaign and messaging system:
Campaign Listing: Retrieve all campaigns grouped by workspace with status and metadata
Async Message Export: Queue bulk message exports for background processing
Storage Integration: Messages stored securely with account and campaign isolation
Multiple Export Formats: Download messages as UTF-8 CSV, JSON array, or pre-signed URL
Usage Tracking: Quota enforcement for message generation and export operations
These endpoints are designed for CRM systems, marketing automation platforms, and external integrations requiring access to campaign data and generated customer messages.

Field Descriptions#

Campaign Fields

Message Export Fields

Response: Message Export Fields


Endpoints#

Endpoints Overview#

EndpointMethodPurposeAccess Control
/v1/campaign/allPOSTList all campaigns grouped by workspaceAPI Authentication (JWT + API Headers)
POST /v1/messages/publishPOSTQueue async message exportAPI Authentication + Usage Quota Check
POST /v1/messages/pagesPOSTGet count of exported message filesAPI Authentication + Usage Tracking
POST /v1/messages/fetchPOSTDownload specific message fileAPI Authentication

Authentication#

All endpoints require API authentication via HTTP headers.

Required Headers#

HeaderRequiredDescription
authorizationYesBearer token (JWT) containing user_id, account_id, role_code
x-auth-contextYesJSON object: { "api_access": true, "api_code": "<API_CODE>" }
x-ipYesClient IP address for audit logging
x-api-keyNoOptional API key for additional validation

Authentication Flow#

1.
API Code Validation: Validate api_code in x-auth-context matches server configuration
2.
JWT Verification: Verify JWT token signature against API secret
3.
Access Check: Confirm api_access is set to true
4.
Account Extraction: Extract account_id from JWT for data isolation

Example Headers#

authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
x-auth-context: {"api_access": true, "api_code": "your-api-code"}
x-ip: 192.168.1.100
Content-Type: application/json

1. Get All Accounts Campaigns#

Endpoint#

POST /v1/campaign/all

Description#

Retrieves all campaigns for the authenticated account, organized by workspace. Returns essential campaign metadata including status, stage, and date range for each campaign.

Purpose#

Enables external systems to discover available campaigns and their current state, facilitating integration with CRM systems, dashboards, and campaign management tools.

Business Use Cases#

Integration Dashboards: Display all campaigns in an external management interface.
Campaign Selection: Allow users to choose which campaign's messages to export.
Status Monitoring: Track campaign progress and workflow stages across workspaces.
Reporting: Generate reports on campaign activity by workspace.
Workflow Automation: Trigger actions based on campaign status changes.

Security Features#

JWT token validation with account-specific secret.
API code verification against server configuration.
Account-level data isolation (only returns campaigns for authenticated account).
All queries scoped to authenticated account_id.

2. Publish Messages to Secure Storage#

Endpoint#

POST /v1/messages/publish

Description#

Exports generated campaign messages to secure cloud storage in CSV format, making them accessible for download and integration with external systems. When the campaign is in the "Ready to Publish" stage, the campaign will move to the "Published" stage and the campaign messages will also be published.

Purpose#

Enables secure, scalable access to generated messages for campaign execution, analytics, and integration with delivery platforms.

Business Use Cases#

Bulk Download Preparation: Prepare large message datasets for download.
Marketing Automation: Feed generated messages into marketing automation platforms.
Multi-Channel Delivery: Export messages for distribution across multiple channels.

Security Features#

Full API authentication stack.
Usage quota enforcement prevents resource abuse.
Campaign ownership validation.
Async processing prevents request timeout on large datasets.

3. Get Campaign Messages Pages#

Endpoint#

POST /v1/messages/pages

Description#

Returns the total count of exported message files stored for a specific campaign. Used to determine pagination when downloading message files.

Purpose#

Allows applications to understand the size of the exported dataset and implement proper pagination controls for downloading message files.

Business Use Cases#

Pagination UI: Build page navigation controls in download interfaces.
Progress Indicators: Display download progress (e.g., "File 3 of 10").
Export Validation: Verify that message export completed successfully.
Batch Processing: Plan batch download operations based on file count.
Memory Management: Allocate appropriate resources for processing downloads.

Security Features#

API authentication required.
Queries scoped to account's path prefix.
No actual message data exposed (only file count).
Efficient query that doesn't load file contents.

4. Retrieve Published Messages#

Endpoint#

POST /v1/messages/fetch

Description#

Downloads a specific exported message file in the requested format. Supports three output formats: raw UTF-8 CSV content, parsed JSON array, or a pre-signed URL for direct download.

Purpose#

Provides flexible options for retrieving exported message data, accommodating different integration requirements and use cases.

Business Use Cases#

Direct Integration (JSON): Parse messages programmatically for CRM or marketing automation.
Spreadsheet Export (UTF-8): Download raw CSV for import into Excel or Google Sheets.
Secure Sharing (URL): Generate time-limited URLs for secure file sharing.
Bulk Processing: Download files sequentially for batch processing pipelines.
Data Analysis: Retrieve messages for analytics and reporting tools.

Security Features#

Full API authentication.
Campaign ownership validation via account_id.
Pre-signed URLs have limited validity period.

Export Type Options#

The data transforms based on the export_type:
TypeDescriptionUse Cases
utf8Returns raw CSV file content as UTF-8 stringDirect file processing, spreadsheet import
jsonReturns parsed array of {customer_id, message} JSON objects (max 1000 rows)API integration, small dataset processing
urlGenerates pre-signed URL for direct downloadBrowser downloads, secure sharing

Security & Compliance#

Data Protection#

Account-Level Isolation: All data queries filtered by account_id from JWT
Pre-signed URL Expiry: Generated URLs have limited validity (typically 1 hour)
Encrypted Transport: All API communications over HTTPS

Access Control#

JWT Authentication: All endpoints require valid JWT token
API Code Validation: api_code must match server configuration
Campaign Ownership: Campaign queries validate account ownership
Database Context: All operations use authenticated database context

Usage Tracking#

Quota Enforcement: Message exports tracked against account quota
Usage Limit Response: Returned when quota exceeded
Usage Middleware: Applied to /api/store and /api/pages endpoints

Audit Logging#

User Context: All operations logged with user ID
Job Tracking: Async operations tracked with unique job IDs
Timestamp Recording: Creation and modification times recorded

Common Error Codes#

Status CodeDescriptionCommon Causes
400Bad RequestMalformed JSON, invalid data types
401UnauthorizedMissing required fields, campaign not found, invalid export option
403ForbiddenMissing authentication headers, invalid API code, invalid JWT
404Not FoundCampaign not found, file not found
500Internal Server ErrorDatabase errors, CSV parsing failures

Specific Error Messages#

MessageCauseResolution
"auth error"Missing req.auth or entity managerEnsure valid JWT token in authorization header
"Unauthorized"API validation failedVerify x-auth-context contains valid api_code
"Missing required fields."Required body fields missingInclude all required fields in request body
"Campaign/details not found."Campaign missing messages or audienceEnsure campaign has generated messages and audience setup
"Campaign not found."Invalid campaign_idVerify campaign_id exists and belongs to account
"File not found."File doesn't existCheck file_num is within valid range (0 to num_files-1)
"Invalid export option."Invalid export_type valueUse utf8, json, or url
"Failed to parse."CSV parsing errorContact support if error persists
Modified at 2026-02-02 06:54:15
Previous
Delete Custom Fields
Next
Get All Accounts Campaigns
Built with