Nudgescribe API Reference
APIs
API types
  • Authentication
  • Content
  • Campaign
APIs
API types
  • Authentication
  • Content
  • Campaign
  1. Authentication
  • Nudgescribe API
  • Authentication
    • Authentication
    • Authenticate
      POST
    • Re-Authenticate
      GET
  • Content
    • Customers
      • Customer Management
      • Upload and Validate Customer Data
      • Get pages
      • Get Customers
      • Update 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
    • Campaigns and Campaign Messages
    • Get All Accounts Campaigns
      POST
    • Publish Messages to Secure Storage
      POST
    • Retrieve Published Messages
      POST
    • Get Campaign Messages Pages
      POST
  1. Authentication

Authentication

This documentation covers the specialised client API authentication endpoints that provide secure authentication for external clients and third-party integrations with the NudgeScribe platform.

Introduction#

The Client API Authentication endpoints are specialised authentication routes designed for:
Third-Party Integrations: Secure authentication for external applications
Client Applications: Authentication for mobile apps, web apps, and service-to-service communication
API Key Management: Token-based authentication for programmatic access
Re-authentication: Token refresh and session management for long-running applications
These endpoints implement enhanced security measures through the [client_api_middleware]and are designed for high-volume, programmatic access patterns.

Endpoints#

Endpoints Overview#

EndpointMethodPurposeAuthentication Type
/v1/authPOSTClient API authenticationAPI Key
/v1/authTRACERe-authenticate/refresh tokenRefresh Token

1. Authenticate#

POST /v1/auth

Description#

Primary authentication endpoint for client applications and third-party integrations requiring programmatic access to the NudgeScribe platform.

Purpose#

Enables secure authentication for external clients using API credentials, providing JWT tokens for subsequent API calls.

Business Use Cases#

Third-Party Integrations: SaaS platforms integrating with NudgeScribe
Mobile Applications: Mobile apps requiring secure backend access
Microservices: Service-to-service authentication in distributed architectures
Automated Systems: Batch processing systems and automated workflows
Partner Integrations: External partners accessing customer data or functionality

Technical Implementation#

Validates API key and secret against registered clients
Generates JWT token with client-specific claims
Sets Access Token expiration (default: 14 days)
Sets Refresh Token expiration (default: 15 days)
Applies client-level permissions and scope restrictions
Logs authentication attempts with client identification

Security Features#

API Credential Validation: Secure verification of API key
Scope-Based Authorization: Tokens limited to requested permissions
Rate Limiting: Protection against brute force attacks
Client Tracking: All authentication attempts logged with client ID
Token Expiration: Configurable token lifetime for security

2. Re-Authenticate#

Endpoint#

TRACE /v1/auth

Description#

Re-authentication endpoint for refreshing expired tokens or validating existing authentication status for client applications.

Purpose#

Enables client applications to maintain continuous authentication without requiring users to re-enter credentials.

Business Use Cases#

Session Management: Maintain long-running application sessions
Token Refresh: Refresh expired tokens before they become invalid
Health Checks: Validate current authentication status
Seamless UX: Prevent authentication interruptions in user workflows
Automated Systems: Keep long-running processes authenticated

Technical Implementation#

Validates refresh tokens
Generates new access tokens with updated expiration
May issue new refresh tokens for enhanced security
Maintains client session continuity
Logs re-authentication events for audit trails

Security Features#

API Credential Validation: Secure verification of API key
Scope-Based Authorization: Tokens limited to requested permissions
Rate Limiting: Protection against brute force attacks
Client Tracking: All authentication attempts logged with client ID
Token Expiration: Configurable token lifetime for security

Authentication Flow Diagrams#

Initial Authentication Flow#

Client Application
     ↓ POST /v1/auth
     ↓ {api_key}
Server Validation
     ↓ Validate credentials
     ↓ Generate JWT token
Response with Access Token
     ↓ Store token securely
Subsequent API Calls
     ↓ Authorization: Bearer <token>

Re-authentication Flow#

Client Application
     ↓ TRACE /v1/auth
     ↓ {refresh_token}
Server Validation
     ↓ Validate refresh token
     ↓ Generate a new access token
     ↓ Generate a new refresh token
Response with New Token
     ↓ Update stored token securely
Continue API Operations

Security & Compliance#

Authentication Security#

API Key Management: Secure storage and rotation of API credentials
Token Security: JWT tokens with cryptographic signatures
Scope Limitation: Tokens restricted to requested permissions
Expiration Handling: Configurable token lifetimes
Rate Limiting: Protection against authentication abuse

Client API middleware Features#

Request Validation: Comprehensive input validation
Authentication Verification: Multi-layer credential validation
Audit Logging: All authentication attempts logged
Error Handling: Secure error responses without information leakage
Performance Monitoring: Track authentication performance metrics

Compliance Considerations#

Audit Trails: All authentication events logged with timestamps
Access Control: Fine-grained permission management
Data Protection: Secure handling of authentication credentials
Regulatory Support: Compliance with data protection regulations

Common Error Codes#

Status CodeDescriptionCommon Causes
400Bad RequestMissing API credentials, invalid request format
401UnauthorizedInvalid API key/secret, expired refresh token
403ForbiddenInsufficient permissions, account suspended
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer configuration issues, database errors

Security Best Practices#

Secure Storage: Store API credentials and tokens securely
Token Rotation: Regularly refresh tokens before expiration
Scope Minimisation: Request only necessary permissions
Error Handling: Implement proper error handling for authentication failures
Monitoring: Monitor authentication patterns for anomalies
Modified at 2025-10-31 13:00:30
Previous
Nudgescribe API
Next
Authenticate
Built with