NeuralCore5 Internal API Documentation

Comprehensive API reference for NeuralCore5 internal services including conversation management, memory systems, and authentication.

General Information

Version
1
Current As of
Nov 11, 2025
Base URL
https://api.neuralcore5.ai
Platform
PHP 8.4-fpm, Python 3.13, JSON, & cURL
Note: This API is for internal use only. All endpoints require proper authentication and authorization.

Access & Authorization

Platform Overview

What is NeuralCore5?

NeuralCore5 is an advanced AI-powered platform that enables organizations to create, deploy, and manage sophisticated AI agents called "Digital People". These Digital People are capable of natural conversations, learning from interactions, and providing personalized experiences across multiple communication channels including voice calls, SMS, web chat, and real-time video.

The platform combines cutting-edge natural language processing, voice synthesis, memory systems, and retrieval-augmented generation (RAG) to create AI agents that can understand context, remember past interactions, and engage in human-like conversations with remarkable accuracy and personality.

Core Capabilities
  • Multi-Channel Communication: Seamlessly engage users via voice calls, SMS, web chat, and real-time video
  • Advanced Memory Systems: NC5Memory provides persistent context and knowledge management across all interactions
  • Real-Time Voice Synthesis: Natural-sounding voices with emotional inflection and personality traits
  • RAG Integration: Retrieval-Augmented Generation for accessing and utilizing custom knowledge bases
  • Conversation Management: Complete conversation lifecycle with message history, participants, and analytics
  • Intelligent Learning: Continuous improvement through interaction analysis and knowledge consolidation
Use Cases
  • Customer Support: 24/7 intelligent customer service with contextual understanding and escalation
  • Sales & Lead Qualification: Automated lead nurturing and qualification conversations
  • Personal Assistants: Customized AI assistants with personality and specialized knowledge
  • Training & Education: Interactive learning experiences with adaptive teaching methods
  • Healthcare Support: Patient engagement, appointment scheduling, and health information delivery
  • Internal Operations: Process automation, data retrieval, and workflow management

About This API

The NeuralCore5 Internal API provides comprehensive programmatic access to all platform capabilities. Built on a modern RESTful architecture with PHP 8.4 and Python 3.13, the API enables developers to:

Manage Digital People

Create, configure, and control AI agents with custom personalities, voices, and knowledge bases

Control Conversations

Initiate, manage, and analyze conversations across all communication channels

Access Memory Systems

Store, retrieve, and search conversational context and knowledge with advanced RAG capabilities

Manage Subscribers

Handle user accounts, subscriptions, billing, and usage tracking

Monitor & Secure

Access security features, audit logs, and system health monitoring

Administer Platform

Perform administrative operations including maintenance, configuration, and user management

Architecture & Technology Stack

Backend Services
  • PHP 8.4-FPM with Symfony framework
  • Python 3.13 for AI/ML operations
  • MariaDB for persistent storage
  • Redis for caching and sessions
Learnign Core & Integration
  • Linked to backend EmCore4.5 Adaptive Learning Model
  • 2-way Realtime Audio Capable
  • Vector embeddings for RAG
  • Twilio for SMS/Voice channels
Security & Performance
  • RSA encryption for API access
  • End-to-end message encryption
  • IP whitelisting and firewall rules
  • Rate limiting and audit logging
API Design Principles: The NeuralCore5 API follows RESTful conventions with consistent JSON payloads, comprehensive error handling, detailed logging, and extensive documentation. All endpoints are versioned (v1) and designed for maximum reliability and ease of integration.

General

General API endpoints for system health monitoring.

GET /v1/health

Check the health status of the API and its dependencies.

{
  "status": "healthy",
  "timestamp": "2025-11-11T15:45:30Z",
  "server": {
    "hostname": "api-server-01",
    "php_version": "8.4.0",
    "purpose": "Neural Router",
    "alm": "emCore-1-oct-2024",
    "aml": "1.0",
    "learning_core": "1.0"
  },
  "load": {
    "available": true,
    "average": {
      "1min": 0.45,
      "5min": 0.52,
      "15min": 0.48
    },
    "cpu_count": 4,
    "status": "optimal"
  }
}
curl -X GET https://api.neuralcore5.ai/v1/health \
  -H "Content-Type: application/json"
<?php
$url = 'https://api.neuralcore5.ai/v1/health';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "API Status: " . $data['status'];

Administration

Comprehensive administration and management tools for the NeuralCore5 platform including administrator lifecycle management, system maintenance, broadcast messaging, and audit logging.

Access Control: Administration endpoints require elevated privileges. Most operations require super_admin role, with detailed audit logging for all administrative actions. Multi-factor authentication is enforced for all administrative accounts.

Key Features

Admin Management

Complete administrator lifecycle with role-based permissions and hierarchical access control

System Maintenance

Platform maintenance operations including health checks, cache management, and service control

Broadcast Messaging

System-wide message broadcasting for announcements, maintenance notices, and alerts

Audit Logging

Comprehensive audit trail for all administrative actions with advanced search and filtering

Administration Subsystems

The Administration system is organized into specialized subsystems for different management functions:

ADMIN MESSAGES

POST /v1/admin/messages/broadcast

Create and send a broadcast message to targeted users or all platform users. Supports immediate sending or scheduling for future delivery.

Request Body
Parameter Type Required Description
title string Required Message title/subject (max 200 characters)
content string Required Message content (supports markdown, max 5000 characters)
message_type string Required Type: "announcement", "maintenance", "alert", "update", "warning"
priority string Required Priority: "low", "normal", "high", "urgent"
target_audience object Required Audience targeting criteria
target_audience.scope string Required Scope: "all_users", "subscribers", "admins", "specific_users", "plan_based"
target_audience.user_ids array Optional Specific user IDs (required if scope is "specific_users")
target_audience.plans array Optional Plan names (required if scope is "plan_based")
channels array Required Delivery channels: ["in_app", "email", "sms", "push"]
scheduled_send string (ISO 8601) Optional Schedule for future delivery (default: send immediately)
expires_at string (ISO 8601) Optional Message expiration time (auto-dismiss)
dismissible boolean Optional Can users dismiss the message (default: true)
action_button object Optional Optional action button configuration
metadata object Optional Additional metadata
{
  "title": "Scheduled Maintenance - November 15, 2025",
  "content": "We will be performing scheduled maintenance on **November 15, 2025** from **2:00 AM to 6:00 AM EST**.\n\nDuring this time:\n- API access will be limited\n- Some features may be temporarily unavailable\n- Active sessions will be preserved\n\nThank you for your patience!",
  "message_type": "maintenance",
  "priority": "high",
  "target_audience": {
    "scope": "all_users"
  },
  "channels": ["in_app", "email"],
  "scheduled_send": "2025-11-13T12:00:00Z",
  "expires_at": "2025-11-15T10:00:00Z",
  "dismissible": true,
  "action_button": {
    "text": "View Status Page",
    "url": "https://status.neuralcore5.ai"
  },
  "metadata": {
    "maintenance_window": "2025-11-15T07:00:00Z to 2025-11-15T11:00:00Z",
    "affected_services": ["API", "Dashboard"]
  }
}
{
  "success": true,
  "message_id": "msg_broadcast_abc123xyz789",
  "broadcast": {
    "message_id": "msg_broadcast_abc123xyz789",
    "title": "Scheduled Maintenance - November 15, 2025",
    "message_type": "maintenance",
    "priority": "high",
    "status": "scheduled",
    "target_audience": {
      "scope": "all_users",
      "estimated_recipients": 12547
    },
    "channels": ["in_app", "email"],
    "scheduled_send": "2025-11-13T12:00:00Z",
    "expires_at": "2025-11-15T10:00:00Z",
    "created_at": "2025-11-11T22:30:00Z",
    "created_by": "admin_001"
  },
  "message": "Broadcast message created successfully. Scheduled for delivery on 2025-11-13T12:00:00Z.",
  "timestamp": "2025-11-11T22:30:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/messages/broadcast \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Scheduled Maintenance",
    "content": "We will be performing maintenance...",
    "message_type": "maintenance",
    "priority": "high",
    "target_audience": {
      "scope": "all_users"
    },
    "channels": ["in_app", "email"]
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/admin/messages/broadcast";

$data = [
    'title' => 'Scheduled Maintenance - November 15, 2025',
    'content' => 'We will be performing scheduled maintenance...',
    'message_type' => 'maintenance',
    'priority' => 'high',
    'target_audience' => [
        'scope' => 'all_users'
    ],
    'channels' => ['in_app', 'email'],
    'scheduled_send' => '2025-11-13T12:00:00Z',
    'dismissible' => true
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/admin/messages/broadcast

Retrieve list of all broadcast messages with filtering, sorting, and pagination options.

Query Parameters
Parameter Type Required Description
status string Optional Filter by status: "draft", "scheduled", "sent", "cancelled", "failed"
message_type string Optional Filter by message type
priority string Optional Filter by priority level
created_by string Optional Filter by creator admin ID
created_after string (ISO 8601) Optional Filter by creation date
created_before string (ISO 8601) Optional Filter by creation date
sort string Optional Sort by: "created_at", "scheduled_send", "priority" (default: "created_at")
order string Optional Sort order: "asc", "desc" (default: "desc")
limit integer Optional Results per page (default: 50, max: 200)
offset integer Optional Pagination offset
{
  "success": true,
  "total_count": 87,
  "page": 1,
  "limit": 50,
  "messages": [
    {
      "message_id": "msg_broadcast_abc123xyz789",
      "title": "Scheduled Maintenance - November 15, 2025",
      "message_type": "maintenance",
      "priority": "high",
      "status": "scheduled",
      "target_audience": {
        "scope": "all_users",
        "estimated_recipients": 12547
      },
      "channels": ["in_app", "email"],
      "scheduled_send": "2025-11-13T12:00:00Z",
      "created_at": "2025-11-11T22:30:00Z",
      "created_by": "admin_001",
      "created_by_name": "John Administrator"
    },
    {
      "message_id": "msg_broadcast_def456ghi789",
      "title": "New Feature Release: RAG Document Processing",
      "message_type": "announcement",
      "priority": "normal",
      "status": "sent",
      "target_audience": {
        "scope": "subscribers",
        "actual_recipients": 8432
      },
      "channels": ["in_app", "email"],
      "sent_at": "2025-11-10T14:00:00Z",
      "created_at": "2025-11-10T10:00:00Z",
      "created_by": "admin_003",
      "created_by_name": "Maria Platform",
      "delivery_stats": {
        "sent": 8432,
        "delivered": 8401,
        "failed": 31,
        "opened": 6234,
        "clicked": 2147
      }
    }
  ],
  "summary": {
    "by_status": {
      "draft": 3,
      "scheduled": 5,
      "sent": 76,
      "cancelled": 2,
      "failed": 1
    },
    "by_priority": {
      "low": 12,
      "normal": 54,
      "high": 18,
      "urgent": 3
    }
  },
  "timestamp": "2025-11-11T22:35:00Z"
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/admin/messages/broadcast?status=scheduled&limit=50" \
  -H "Authorization: Bearer ADMIN_API_TOKEN"
<?php
$params = http_build_query([
    'status' => 'scheduled',
    'limit' => 50,
    'sort' => 'scheduled_send',
    'order' => 'asc'
]);
$url = "https://api.neuralcore5.ai/v1/admin/messages/broadcast?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/admin/messages/broadcast/{messageId}

Get detailed information about a specific broadcast message including full content, delivery statistics, and recipient data.

Path Parameters
Parameter Type Description
messageId string Broadcast message ID
Query Parameters
Parameter Type Required Description
include_recipients boolean Optional Include recipient list (default: false)
include_delivery_logs boolean Optional Include delivery logs (default: false)
{
  "success": true,
  "message": {
    "message_id": "msg_broadcast_def456ghi789",
    "title": "New Feature Release: RAG Document Processing",
    "content": "We're excited to announce...",
    "message_type": "announcement",
    "priority": "normal",
    "status": "sent",
    "target_audience": {
      "scope": "subscribers",
      "actual_recipients": 8432
    },
    "channels": ["in_app", "email"],
    "sent_at": "2025-11-10T14:00:00Z",
    "created_at": "2025-11-10T10:00:00Z",
    "created_by": "admin_003",
    "created_by_name": "Maria Platform",
    "action_button": {
      "text": "Learn More",
      "url": "https://neuralcore5.ai/features/rag"
    },
    "dismissible": true,
    "expires_at": "2025-11-17T14:00:00Z",
    "metadata": {
      "feature_launch": "RAG_DOCUMENTS",
      "release_version": "2.5.0"
    },
    "delivery_stats": {
      "total_sent": 8432,
      "in_app": {
        "sent": 8432,
        "delivered": 8432,
        "viewed": 6821,
        "dismissed": 4532
      },
      "email": {
        "sent": 8432,
        "delivered": 8401,
        "failed": 31,
        "opened": 6234,
        "clicked": 2147,
        "bounce_rate": 0.37
      }
    }
  },
  "timestamp": "2025-11-11T22:40:00Z"
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/admin/messages/broadcast/msg_broadcast_def456ghi789" \
  -H "Authorization: Bearer ADMIN_API_TOKEN"
<?php
$messageId = "msg_broadcast_def456ghi789";
$url = "https://api.neuralcore5.ai/v1/admin/messages/broadcast/{$messageId}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
PUT /v1/admin/messages/broadcast/{messageId}

Update a broadcast message. Only draft and scheduled messages can be edited. Sent messages cannot be modified.

Path Parameters
Parameter Type Description
messageId string Broadcast message ID
Request Body
Parameter Type Required Description
title string Optional Update title
content string Optional Update content
priority string Optional Update priority
scheduled_send string (ISO 8601) Optional Update scheduled send time
expires_at string (ISO 8601) Optional Update expiration time
{
  "title": "Scheduled Maintenance - November 15, 2025 (Updated)",
  "scheduled_send": "2025-11-13T14:00:00Z",
  "priority": "urgent"
}
{
  "success": true,
  "message_id": "msg_broadcast_abc123xyz789",
  "changes": {
    "title": {
      "old_value": "Scheduled Maintenance - November 15, 2025",
      "new_value": "Scheduled Maintenance - November 15, 2025 (Updated)"
    },
    "scheduled_send": {
      "old_value": "2025-11-13T12:00:00Z",
      "new_value": "2025-11-13T14:00:00Z"
    },
    "priority": {
      "old_value": "high",
      "new_value": "urgent"
    }
  },
  "updated_by": "admin_001",
  "updated_at": "2025-11-11T22:45:00Z",
  "message": "Broadcast message updated successfully",
  "timestamp": "2025-11-11T22:45:00Z"
}
curl -X PUT \
  https://api.neuralcore5.ai/v1/admin/messages/broadcast/msg_broadcast_abc123xyz789 \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "priority": "urgent",
    "scheduled_send": "2025-11-13T14:00:00Z"
  }'
<?php
$messageId = "msg_broadcast_abc123xyz789";
$url = "https://api.neuralcore5.ai/v1/admin/messages/broadcast/{$messageId}";

$data = [
    'title' => 'Scheduled Maintenance - November 15, 2025 (Updated)',
    'scheduled_send' => '2025-11-13T14:00:00Z',
    'priority' => 'urgent'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/messages/broadcast/{messageId}/cancel

Cancel a scheduled broadcast message before it's sent. Cannot cancel messages that have already been sent.

Path Parameters
Parameter Type Description
messageId string Broadcast message ID
Request Body
Parameter Type Required Description
reason string Required Reason for cancellation
{
  "reason": "Maintenance window rescheduled to different date"
}
{
  "success": true,
  "message_id": "msg_broadcast_abc123xyz789",
  "status": "cancelled",
  "cancelled_at": "2025-11-11T22:50:00Z",
  "cancelled_by": "admin_001",
  "reason": "Maintenance window rescheduled to different date",
  "message": "Broadcast cancelled successfully. Message will not be sent.",
  "timestamp": "2025-11-11T22:50:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/messages/broadcast/msg_broadcast_abc123xyz789/cancel \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Maintenance window rescheduled"
  }'
<?php
$messageId = "msg_broadcast_abc123xyz789";
$url = "https://api.neuralcore5.ai/v1/admin/messages/broadcast/{$messageId}/cancel";

$data = [
    'reason' => 'Maintenance window rescheduled to different date'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
DELETE /v1/admin/messages/broadcast/{messageId}

Permanently delete a broadcast message. Only draft or cancelled messages can be deleted. Sent messages are preserved for audit trail.

Path Parameters
Parameter Type Description
messageId string Broadcast message ID
{
  "success": true,
  "message_id": "msg_broadcast_abc123xyz789",
  "deleted_at": "2025-11-11T22:55:00Z",
  "deleted_by": "admin_001",
  "message": "Broadcast message deleted permanently",
  "timestamp": "2025-11-11T22:55:00Z"
}
curl -X DELETE \
  https://api.neuralcore5.ai/v1/admin/messages/broadcast/msg_broadcast_abc123xyz789 \
  -H "Authorization: Bearer ADMIN_API_TOKEN"
<?php
$messageId = "msg_broadcast_abc123xyz789";
$url = "https://api.neuralcore5.ai/v1/admin/messages/broadcast/{$messageId}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/admin/messages/broadcast/{messageId}/stats

Get detailed delivery statistics and engagement metrics for a sent broadcast message.

Path Parameters
Parameter Type Description
messageId string Broadcast message ID
{
  "success": true,
  "message_id": "msg_broadcast_def456ghi789",
  "title": "New Feature Release: RAG Document Processing",
  "sent_at": "2025-11-10T14:00:00Z",
  "overall_stats": {
    "total_recipients": 8432,
    "total_sent": 8432,
    "total_delivered": 8401,
    "total_failed": 31,
    "delivery_rate": 99.63,
    "engagement_rate": 74.13
  },
  "by_channel": {
    "in_app": {
      "sent": 8432,
      "delivered": 8432,
      "viewed": 6821,
      "dismissed": 4532,
      "still_active": 3900,
      "view_rate": 80.89,
      "engagement_rate": 53.75
    },
    "email": {
      "sent": 8432,
      "delivered": 8401,
      "bounced": 31,
      "opened": 6234,
      "clicked": 2147,
      "unsubscribed": 12,
      "bounce_rate": 0.37,
      "open_rate": 74.20,
      "click_rate": 25.55,
      "click_to_open_rate": 34.44
    }
  },
  "engagement_timeline": [
    {
      "timestamp": "2025-11-10T14:00:00Z",
      "views": 1247,
      "clicks": 423
    },
    {
      "timestamp": "2025-11-10T15:00:00Z",
      "views": 2134,
      "clicks": 687
    }
  ],
  "timestamp": "2025-11-11T23:00:00Z"
}
curl -X GET \
  https://api.neuralcore5.ai/v1/admin/messages/broadcast/msg_broadcast_def456ghi789/stats \
  -H "Authorization: Bearer ADMIN_API_TOKEN"
<?php
$messageId = "msg_broadcast_def456ghi789";
$url = "https://api.neuralcore5.ai/v1/admin/messages/broadcast/{$messageId}/stats";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);

MAINTENANCE

GET /v1/admin/maintenance/health

Comprehensive system health check including service status, database connectivity, cache systems, external APIs, queue status, and resource utilization.

Query Parameters
Parameter Type Required Description
detailed boolean Optional Include detailed metrics (default: false)
include_external boolean Optional Check external service health (default: true)
{
  "success": true,
  "overall_status": "healthy",
  "timestamp": "2025-11-11T22:30:00Z",
  "uptime_seconds": 2847362,
  "services": {
    "api": {
      "status": "healthy",
      "response_time_ms": 12,
      "requests_per_minute": 4567
    },
    "database": {
      "status": "healthy",
      "connections": {
        "active": 45,
        "idle": 15,
        "max": 100
      },
      "query_time_avg_ms": 8.4,
      "replication_lag_ms": 0
    },
    "cache": {
      "status": "healthy",
      "redis": {
        "connected": true,
        "memory_used_mb": 2847,
        "memory_max_mb": 8192,
        "hit_rate_percent": 94.7,
        "keys": 124567
      }
    },
    "queue": {
      "status": "healthy",
      "pending_jobs": 234,
      "failed_jobs": 3,
      "workers_active": 8,
      "avg_processing_time_ms": 156
    },
    "storage": {
      "status": "healthy",
      "disk_used_gb": 847.3,
      "disk_total_gb": 2048,
      "disk_usage_percent": 41.4
    }
  },
  "external_services": {
    "twilio": {
      "status": "healthy",
      "response_time_ms": 234
    },
    "stripe": {
      "status": "healthy",
      "response_time_ms": 187
    },
    "fred": {
      "status": "healthy",
      "response_time_ms": 342
    }
  },
  "maintenance_mode": false,
  "next_scheduled_maintenance": "2025-11-15T07:00:00Z"
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/admin/maintenance/health?detailed=true" \
  -H "Authorization: Bearer ADMIN_API_TOKEN"
<?php
$params = http_build_query([
    'detailed' => true,
    'include_external' => true
]);
$url = "https://api.neuralcore5.ai/v1/admin/maintenance/health?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/maintenance/cache/clear

Clear system caches selectively or entirely. Supports targeted cache clearing by type, key pattern, or complete flush.

Request Body
Parameter Type Required Description
cache_type string Required Type: "all", "redis", "application", "api_responses", "user_sessions", "rate_limits"
key_pattern string Optional Specific key pattern to clear (supports wildcards)
reason string Required Reason for cache clearing (audit requirement)
confirm boolean Required Must be true to confirm action
{
  "cache_type": "api_responses",
  "key_pattern": "subscriber:*",
  "reason": "Updated subscriber data structure",
  "confirm": true
}
{
  "success": true,
  "cache_type": "api_responses",
  "key_pattern": "subscriber:*",
  "keys_cleared": 12847,
  "memory_freed_mb": 324.7,
  "execution_time_ms": 1847,
  "performed_by": "admin_001",
  "reason": "Updated subscriber data structure",
  "timestamp": "2025-11-11T22:35:00Z",
  "message": "Cache cleared successfully. 12,847 keys removed."
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/maintenance/cache/clear \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "cache_type": "api_responses",
    "key_pattern": "subscriber:*",
    "reason": "Updated subscriber data structure",
    "confirm": true
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/admin/maintenance/cache/clear";

$data = [
    'cache_type' => 'api_responses',
    'key_pattern' => 'subscriber:*',
    'reason' => 'Updated subscriber data structure',
    'confirm' => true
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/maintenance/mode/enable

Enable maintenance mode to restrict system access during maintenance operations. Displays custom message to users and allows admin-only access.

Request Body
Parameter Type Required Description
message string Required Message to display to users
estimated_duration_minutes integer Optional Estimated maintenance duration
allow_admin_access boolean Optional Allow admin access during maintenance (default: true)
scheduled_end string (ISO 8601) Optional Scheduled end time (auto-disable)
reason string Required Internal reason for maintenance
{
  "message": "NeuralCore5 is currently undergoing scheduled maintenance. We'll be back shortly!",
  "estimated_duration_minutes": 120,
  "allow_admin_access": true,
  "scheduled_end": "2025-11-15T11:00:00Z",
  "reason": "Database optimization and system upgrades"
}
{
  "success": true,
  "maintenance_mode": {
    "enabled": true,
    "enabled_at": "2025-11-15T07:00:00Z",
    "enabled_by": "admin_001",
    "message": "NeuralCore5 is currently undergoing scheduled maintenance. We'll be back shortly!",
    "estimated_duration_minutes": 120,
    "scheduled_end": "2025-11-15T11:00:00Z",
    "allow_admin_access": true,
    "reason": "Database optimization and system upgrades",
    "active_sessions_terminated": 1247,
    "api_requests_blocked": true
  },
  "message": "Maintenance mode enabled successfully. System is now in maintenance mode.",
  "timestamp": "2025-11-15T07:00:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/maintenance/mode/enable \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "System maintenance in progress",
    "estimated_duration_minutes": 120,
    "reason": "Database optimization"
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/admin/maintenance/mode/enable";

$data = [
    'message' => 'NeuralCore5 is currently undergoing scheduled maintenance. We\'ll be back shortly!',
    'estimated_duration_minutes' => 120,
    'allow_admin_access' => true,
    'scheduled_end' => '2025-11-15T11:00:00Z',
    'reason' => 'Database optimization and system upgrades'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/maintenance/mode/disable

Disable maintenance mode and restore normal system operations. System becomes fully accessible to all users.

Request Body
Parameter Type Required Description
reason string Required Reason for disabling maintenance mode
clear_cache boolean Optional Clear caches on restore (default: false)
{
  "reason": "Maintenance completed successfully",
  "clear_cache": true
}
{
  "success": true,
  "maintenance_mode": {
    "enabled": false,
    "disabled_at": "2025-11-15T10:45:00Z",
    "disabled_by": "admin_001",
    "reason": "Maintenance completed successfully",
    "duration_minutes": 225,
    "cache_cleared": true
  },
  "system_status": {
    "api_accessible": true,
    "services_restored": true,
    "health_check": "healthy"
  },
  "message": "Maintenance mode disabled. System is now fully operational.",
  "timestamp": "2025-11-15T10:45:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/maintenance/mode/disable \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Maintenance completed successfully",
    "clear_cache": true
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/admin/maintenance/mode/disable";

$data = [
    'reason' => 'Maintenance completed successfully',
    'clear_cache' => true
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/maintenance/database/optimize

Perform database optimization operations including table optimization, index rebuilding, statistics updates, and query cache management.

Request Body
Parameter Type Required Description
operations array Required Operations: ["optimize_tables", "rebuild_indexes", "update_statistics", "analyze_tables"]
tables array Optional Specific tables to optimize (default: all)
reason string Required Reason for optimization
confirm boolean Required Must be true to confirm operation
{
  "operations": ["optimize_tables", "update_statistics"],
  "tables": ["subscribers", "conversations", "messages"],
  "reason": "Weekly maintenance optimization",
  "confirm": true
}
{
  "success": true,
  "operations_performed": ["optimize_tables", "update_statistics"],
  "results": {
    "optimize_tables": {
      "subscribers": {
        "status": "success",
        "rows_affected": 12547,
        "space_freed_mb": 124.7,
        "duration_ms": 3421
      },
      "conversations": {
        "status": "success",
        "rows_affected": 45621,
        "space_freed_mb": 87.3,
        "duration_ms": 8934
      },
      "messages": {
        "status": "success",
        "rows_affected": 234876,
        "space_freed_mb": 456.8,
        "duration_ms": 15678
      }
    },
    "update_statistics": {
      "tables_analyzed": 3,
      "statistics_updated": true,
      "duration_ms": 1234
    }
  },
  "total_duration_ms": 29267,
  "total_space_freed_mb": 668.8,
  "performed_by": "admin_001",
  "reason": "Weekly maintenance optimization",
  "timestamp": "2025-11-11T22:40:00Z",
  "message": "Database optimization completed successfully"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/maintenance/database/optimize \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "operations": ["optimize_tables", "update_statistics"],
    "tables": ["subscribers", "conversations"],
    "reason": "Weekly maintenance",
    "confirm": true
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/admin/maintenance/database/optimize";

$data = [
    'operations' => ['optimize_tables', 'update_statistics'],
    'tables' => ['subscribers', 'conversations', 'messages'],
    'reason' => 'Weekly maintenance optimization',
    'confirm' => true
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/admin/maintenance/jobs

View and manage background jobs, queue status, failed jobs, and worker processes. Monitor job execution and troubleshoot issues.

Query Parameters
Parameter Type Required Description
status string Optional Filter by status: "pending", "processing", "completed", "failed"
queue string Optional Filter by queue name
limit integer Optional Results per page (default: 100)
offset integer Optional Pagination offset
{
  "success": true,
  "total_jobs": 347,
  "page": 1,
  "limit": 100,
  "queue_summary": {
    "pending": 234,
    "processing": 12,
    "completed": 87456,
    "failed": 13
  },
  "workers": {
    "active": 8,
    "idle": 2,
    "total": 10
  },
  "jobs": [
    {
      "job_id": "job_abc123xyz789",
      "queue": "default",
      "job_type": "process_rag_documents",
      "status": "processing",
      "created_at": "2025-11-11T22:35:00Z",
      "started_at": "2025-11-11T22:35:12Z",
      "progress_percent": 45,
      "worker_id": "worker_03",
      "attempts": 1,
      "max_attempts": 3,
      "payload": {
        "subscriber_id": "1234567",
        "document_count": 24
      }
    },
    {
      "job_id": "job_def456ghi789",
      "queue": "emails",
      "job_type": "send_email_batch",
      "status": "failed",
      "created_at": "2025-11-11T22:20:00Z",
      "failed_at": "2025-11-11T22:21:45Z",
      "attempts": 3,
      "max_attempts": 3,
      "error": "SMTP connection timeout",
      "payload": {
        "batch_id": "batch_email_987",
        "recipient_count": 150
      },
      "can_retry": true
    }
  ],
  "timestamp": "2025-11-11T22:45:00Z"
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/admin/maintenance/jobs?status=failed&limit=100" \
  -H "Authorization: Bearer ADMIN_API_TOKEN"
<?php
$params = http_build_query([
    'status' => 'failed',
    'limit' => 100,
    'offset' => 0
]);
$url = "https://api.neuralcore5.ai/v1/admin/maintenance/jobs?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/maintenance/jobs/{jobId}/retry

Retry a failed background job manually. Useful for recovering from transient errors or after fixing underlying issues.

Path Parameters
Parameter Type Description
jobId string Job ID to retry
Request Body
Parameter Type Required Description
reason string Optional Reason for retry
reset_attempts boolean Optional Reset attempt counter (default: false)
{
  "reason": "SMTP service restored, retrying email batch",
  "reset_attempts": true
}
{
  "success": true,
  "job_id": "job_def456ghi789",
  "previous_status": "failed",
  "new_status": "pending",
  "attempts_reset": true,
  "queued_at": "2025-11-11T22:50:00Z",
  "retry_initiated_by": "admin_001",
  "reason": "SMTP service restored, retrying email batch",
  "message": "Job queued for retry successfully",
  "timestamp": "2025-11-11T22:50:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/maintenance/jobs/job_def456ghi789/retry \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "SMTP service restored",
    "reset_attempts": true
  }'
<?php
$jobId = "job_def456ghi789";
$url = "https://api.neuralcore5.ai/v1/admin/maintenance/jobs/{$jobId}/retry";

$data = [
    'reason' => 'SMTP service restored, retrying email batch',
    'reset_attempts' => true
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/admin/maintenance/metrics

Retrieve comprehensive system performance metrics including CPU, memory, disk I/O, network, database performance, and application-specific metrics.

Query Parameters
Parameter Type Required Description
period string Optional Time period: "5m", "15m", "1h", "6h", "24h" (default: "1h")
metrics array Optional Specific metrics to include (default: all)
{
  "success": true,
  "period": "1h",
  "timestamp": "2025-11-11T22:55:00Z",
  "metrics": {
    "system": {
      "cpu_usage_percent": 42.3,
      "cpu_load_avg": [1.47, 1.62, 1.58],
      "memory_used_gb": 24.7,
      "memory_total_gb": 64,
      "memory_usage_percent": 38.6,
      "disk_io_read_mb_per_sec": 45.2,
      "disk_io_write_mb_per_sec": 23.7,
      "network_in_mb_per_sec": 123.4,
      "network_out_mb_per_sec": 87.6
    },
    "application": {
      "requests_per_minute": 4567,
      "avg_response_time_ms": 87,
      "error_rate_percent": 0.12,
      "active_connections": 1247,
      "active_sessions": 8942
    },
    "database": {
      "queries_per_second": 847,
      "slow_queries_per_minute": 3,
      "avg_query_time_ms": 8.4,
      "connections_active": 45,
      "cache_hit_rate_percent": 96.8,
      "replication_lag_ms": 0
    },
    "cache": {
      "hit_rate_percent": 94.7,
      "operations_per_second": 12547,
      "memory_usage_percent": 34.8,
      "evictions_per_minute": 23
    },
    "queue": {
      "jobs_processed_per_minute": 234,
      "avg_processing_time_ms": 156,
      "failed_jobs_per_hour": 2,
      "pending_jobs": 234
    }
  },
  "alerts": [
    {
      "severity": "warning",
      "metric": "database.slow_queries_per_minute",
      "value": 3,
      "threshold": 5,
      "message": "Slow query count approaching threshold"
    }
  ]
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/admin/maintenance/metrics?period=1h" \
  -H "Authorization: Bearer ADMIN_API_TOKEN"
<?php
$params = http_build_query([
    'period' => '1h'
]);
$url = "https://api.neuralcore5.ai/v1/admin/maintenance/metrics?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);

MANAGE ADMINS

GET /v1/admin/administrators

Retrieve a list of all administrator accounts with filtering, sorting, and pagination. Includes role information, status, and last activity.

Query Parameters
Parameter Type Required Description
role string Optional Filter by role: "super_admin", "admin", "support_admin", "readonly_admin"
status string Optional Filter by status: "active", "suspended", "deactivated"
limit integer Optional Results per page (default: 50, max: 200)
offset integer Optional Pagination offset (default: 0)
sort string Optional Sort by: "created_at", "last_login", "name", "email" (default: "created_at")
order string Optional Sort order: "asc", "desc" (default: "desc")
{
  "success": true,
  "total_count": 24,
  "page": 1,
  "limit": 50,
  "administrators": [
    {
      "admin_id": "admin_001",
      "email": "john.admin@neuralcore5.ai",
      "name": "John Administrator",
      "role": "super_admin",
      "status": "active",
      "permissions": {
        "manage_admins": true,
        "manage_subscribers": true,
        "system_maintenance": true,
        "view_audit_logs": true,
        "billing_access": true,
        "broadcast_messages": true
      },
      "two_factor_enabled": true,
      "created_at": "2024-01-15T10:00:00Z",
      "last_login": "2025-11-11T20:30:00Z",
      "created_by": "system",
      "department": "Platform Engineering"
    },
    {
      "admin_id": "admin_042",
      "email": "sarah.support@neuralcore5.ai",
      "name": "Sarah Support",
      "role": "support_admin",
      "status": "active",
      "permissions": {
        "manage_admins": false,
        "manage_subscribers": true,
        "system_maintenance": false,
        "view_audit_logs": true,
        "billing_access": false,
        "broadcast_messages": false
      },
      "two_factor_enabled": true,
      "created_at": "2025-03-22T14:15:00Z",
      "last_login": "2025-11-11T19:45:00Z",
      "created_by": "admin_001",
      "department": "Customer Support"
    }
  ],
  "summary": {
    "active": 21,
    "suspended": 2,
    "deactivated": 1,
    "by_role": {
      "super_admin": 3,
      "admin": 8,
      "support_admin": 9,
      "readonly_admin": 4
    }
  },
  "timestamp": "2025-11-11T21:00:00Z"
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/admin/administrators?status=active&limit=50" \
  -H "Authorization: Bearer ADMIN_API_TOKEN"
<?php
$params = http_build_query([
    'status' => 'active',
    'limit' => 50,
    'offset' => 0
]);
$url = "https://api.neuralcore5.ai/v1/admin/administrators?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/admin/administrators/{adminId}

Retrieve detailed information about a specific administrator including full permission set, activity history, and audit trail.

Path Parameters
Parameter Type Description
adminId string Administrator ID
Query Parameters
Parameter Type Required Description
include_activity boolean Optional Include recent activity log (default: false)
activity_days integer Optional Days of activity to include (default: 30)
{
  "success": true,
  "administrator": {
    "admin_id": "admin_001",
    "email": "john.admin@neuralcore5.ai",
    "name": "John Administrator",
    "role": "super_admin",
    "status": "active",
    "phone": "+1-555-123-4567",
    "department": "Platform Engineering",
    "title": "Senior Platform Administrator",
    "permissions": {
      "manage_admins": true,
      "manage_subscribers": true,
      "system_maintenance": true,
      "view_audit_logs": true,
      "billing_access": true,
      "broadcast_messages": true,
      "api_key_management": true,
      "database_access": true
    },
    "security": {
      "two_factor_enabled": true,
      "two_factor_method": "authenticator_app",
      "last_password_change": "2025-09-15T08:00:00Z",
      "failed_login_attempts": 0,
      "account_locked": false,
      "ip_whitelist": ["203.0.113.0/24", "198.51.100.42"]
    },
    "activity": {
      "created_at": "2024-01-15T10:00:00Z",
      "created_by": "system",
      "last_login": "2025-11-11T20:30:00Z",
      "last_login_ip": "203.0.113.45",
      "total_logins": 1547,
      "last_action": "Updated subscriber plan",
      "last_action_at": "2025-11-11T21:15:00Z"
    },
    "recent_activity": [
      {
        "action": "updated_subscriber_plan",
        "subscriber_id": "1234567",
        "timestamp": "2025-11-11T21:15:00Z",
        "ip_address": "203.0.113.45",
        "details": "Changed plan from premium to enterprise"
      },
      {
        "action": "viewed_audit_log",
        "timestamp": "2025-11-11T20:45:00Z",
        "ip_address": "203.0.113.45",
        "details": "Filtered by date range: 2025-11-01 to 2025-11-11"
      }
    ]
  },
  "timestamp": "2025-11-11T21:15:00Z"
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/admin/administrators/admin_001?include_activity=true&activity_days=30" \
  -H "Authorization: Bearer ADMIN_API_TOKEN"
<?php
$adminId = "admin_001";
$params = http_build_query([
    'include_activity' => true,
    'activity_days' => 30
]);
$url = "https://api.neuralcore5.ai/v1/admin/administrators/{$adminId}?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/administrators

Create a new administrator account with specified role and permissions. Automatically sends welcome email with setup instructions. Requires super_admin role.

Request Body
Parameter Type Required Description
email string Required Administrator email address
name string Required Full name
role string Required Role: "super_admin", "admin", "support_admin", "readonly_admin"
password string Required Initial password (min 12 characters, must include uppercase, lowercase, number, special char)
phone string Optional Phone number
department string Optional Department name
title string Optional Job title
custom_permissions object Optional Override default role permissions
require_2fa boolean Optional Force 2FA setup on first login (default: true)
send_welcome_email boolean Optional Send welcome email (default: true)
{
  "email": "new.admin@neuralcore5.ai",
  "name": "Alex Support",
  "role": "support_admin",
  "password": "SecureP@ssw0rd!2025",
  "phone": "+1-555-987-6543",
  "department": "Customer Support",
  "title": "Support Specialist",
  "require_2fa": true,
  "send_welcome_email": true
}
{
  "success": true,
  "admin_id": "admin_126",
  "administrator": {
    "admin_id": "admin_126",
    "email": "new.admin@neuralcore5.ai",
    "name": "Alex Support",
    "role": "support_admin",
    "status": "active",
    "phone": "+1-555-987-6543",
    "department": "Customer Support",
    "title": "Support Specialist",
    "permissions": {
      "manage_admins": false,
      "manage_subscribers": true,
      "system_maintenance": false,
      "view_audit_logs": true,
      "billing_access": false,
      "broadcast_messages": false
    },
    "security": {
      "two_factor_enabled": false,
      "two_factor_required": true,
      "password_expires_at": "2026-02-11T21:30:00Z"
    },
    "created_at": "2025-11-11T21:30:00Z",
    "created_by": "admin_001"
  },
  "welcome_email_sent": true,
  "setup_link": "https://admin.neuralcore5.ai/setup?token=eyJhbGc...",
  "setup_link_expires_at": "2025-11-12T21:30:00Z",
  "message": "Administrator account created successfully. Welcome email sent with setup instructions.",
  "timestamp": "2025-11-11T21:30:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/administrators \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "new.admin@neuralcore5.ai",
    "name": "Alex Support",
    "role": "support_admin",
    "password": "SecureP@ssw0rd!2025",
    "department": "Customer Support",
    "require_2fa": true
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/admin/administrators";

$data = [
    'email' => 'new.admin@neuralcore5.ai',
    'name' => 'Alex Support',
    'role' => 'support_admin',
    'password' => 'SecureP@ssw0rd!2025',
    'phone' => '+1-555-987-6543',
    'department' => 'Customer Support',
    'title' => 'Support Specialist',
    'require_2fa' => true,
    'send_welcome_email' => true
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
PUT /v1/admin/administrators/{adminId}

Update administrator information, role, permissions, or status. All changes are logged in audit trail.

Path Parameters
Parameter Type Description
adminId string Administrator ID to update
Request Body
Parameter Type Required Description
name string Optional Update name
email string Optional Update email (requires verification)
role string Optional Update role (requires super_admin)
phone string Optional Update phone number
department string Optional Update department
title string Optional Update job title
status string Optional Update status: "active", "suspended", "deactivated"
permissions object Optional Update custom permissions
reason string Optional Reason for changes (for audit log)
{
  "role": "admin",
  "department": "Platform Operations",
  "title": "Senior Support Administrator",
  "reason": "Promotion - excellent performance"
}
{
  "success": true,
  "admin_id": "admin_126",
  "changes": {
    "role": {
      "old_value": "support_admin",
      "new_value": "admin"
    },
    "department": {
      "old_value": "Customer Support",
      "new_value": "Platform Operations"
    },
    "title": {
      "old_value": "Support Specialist",
      "new_value": "Senior Support Administrator"
    }
  },
  "updated_permissions": {
    "manage_admins": false,
    "manage_subscribers": true,
    "system_maintenance": true,
    "view_audit_logs": true,
    "billing_access": true,
    "broadcast_messages": true
  },
  "updated_by": "admin_001",
  "updated_at": "2025-11-11T21:35:00Z",
  "reason": "Promotion - excellent performance",
  "message": "Administrator updated successfully",
  "timestamp": "2025-11-11T21:35:00Z"
}
curl -X PUT \
  https://api.neuralcore5.ai/v1/admin/administrators/admin_126 \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "admin",
    "department": "Platform Operations",
    "reason": "Promotion - excellent performance"
  }'
<?php
$adminId = "admin_126";
$url = "https://api.neuralcore5.ai/v1/admin/administrators/{$adminId}";

$data = [
    'role' => 'admin',
    'department' => 'Platform Operations',
    'title' => 'Senior Support Administrator',
    'reason' => 'Promotion - excellent performance'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
DELETE /v1/admin/administrators/{adminId}

Deactivate an administrator account. Does not permanently delete to preserve audit trail. Requires super_admin role and confirmation.

Path Parameters
Parameter Type Description
adminId string Administrator ID to deactivate
Request Body
Parameter Type Required Description
reason string Required Reason for deactivation (audit requirement)
confirm boolean Required Must be true to confirm deactivation
transfer_to string Optional Admin ID to transfer active sessions/assignments
{
  "reason": "Employee left company",
  "confirm": true,
  "transfer_to": "admin_042"
}
{
  "success": true,
  "admin_id": "admin_087",
  "status": "deactivated",
  "deactivated_at": "2025-11-11T21:40:00Z",
  "deactivated_by": "admin_001",
  "reason": "Employee left company",
  "sessions_terminated": 2,
  "assignments_transferred": 5,
  "transfer_to": "admin_042",
  "audit_log_preserved": true,
  "message": "Administrator account deactivated successfully. All sessions terminated and assignments transferred.",
  "timestamp": "2025-11-11T21:40:00Z"
}
curl -X DELETE \
  https://api.neuralcore5.ai/v1/admin/administrators/admin_087 \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Employee left company",
    "confirm": true,
    "transfer_to": "admin_042"
  }'
<?php
$adminId = "admin_087";
$url = "https://api.neuralcore5.ai/v1/admin/administrators/{$adminId}";

$data = [
    'reason' => 'Employee left company',
    'confirm' => true,
    'transfer_to' => 'admin_042'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/administrators/{adminId}/reset-password

Reset administrator password. Can be self-service or initiated by super_admin. Generates secure reset link or temporary password.

Path Parameters
Parameter Type Description
adminId string Administrator ID
Request Body
Parameter Type Required Description
method string Required Reset method: "email_link", "temporary_password"
reason string Optional Reason for reset
expire_hours integer Optional Reset link expiration (default: 24)
{
  "method": "email_link",
  "reason": "Forgot password",
  "expire_hours": 24
}
{
  "success": true,
  "admin_id": "admin_126",
  "method": "email_link",
  "reset_link": "https://admin.neuralcore5.ai/reset?token=eyJhbGciOi...",
  "reset_link_sent_to": "new.admin@neuralcore5.ai",
  "expires_at": "2025-11-12T21:45:00Z",
  "initiated_by": "admin_001",
  "reason": "Forgot password",
  "message": "Password reset link sent successfully to new.admin@neuralcore5.ai",
  "timestamp": "2025-11-11T21:45:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/administrators/admin_126/reset-password \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "email_link",
    "reason": "Forgot password"
  }'
<?php
$adminId = "admin_126";
$url = "https://api.neuralcore5.ai/v1/admin/administrators/{$adminId}/reset-password";

$data = [
    'method' => 'email_link',
    'reason' => 'Forgot password',
    'expire_hours' => 24
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/admin/administrators/{adminId}/activity

Retrieve detailed activity log for a specific administrator including all actions, logins, and system interactions.

Path Parameters
Parameter Type Description
adminId string Administrator ID
Query Parameters
Parameter Type Required Description
start_date string (ISO 8601) Optional Start date for activity (default: 30 days ago)
end_date string (ISO 8601) Optional End date for activity (default: now)
action_type string Optional Filter by action type
limit integer Optional Results per page (default: 100)
offset integer Optional Pagination offset
{
  "success": true,
  "admin_id": "admin_001",
  "period": {
    "start_date": "2025-10-12T00:00:00Z",
    "end_date": "2025-11-11T23:59:59Z"
  },
  "total_activities": 847,
  "page": 1,
  "limit": 100,
  "activities": [
    {
      "activity_id": "act_xyz123",
      "action": "updated_subscriber_plan",
      "timestamp": "2025-11-11T21:15:00Z",
      "ip_address": "203.0.113.45",
      "user_agent": "Mozilla/5.0...",
      "target_type": "subscriber",
      "target_id": "1234567",
      "details": {
        "old_plan": "premium",
        "new_plan": "enterprise",
        "reason": "Customer upgrade request"
      },
      "result": "success"
    },
    {
      "activity_id": "act_abc456",
      "action": "login",
      "timestamp": "2025-11-11T20:30:00Z",
      "ip_address": "203.0.113.45",
      "user_agent": "Mozilla/5.0...",
      "details": {
        "method": "password_2fa",
        "location": "San Francisco, CA, USA"
      },
      "result": "success"
    }
  ],
  "summary": {
    "total_logins": 42,
    "total_actions": 805,
    "failed_attempts": 0,
    "unique_ip_addresses": 3
  },
  "timestamp": "2025-11-11T22:00:00Z"
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/admin/administrators/admin_001/activity?limit=100" \
  -H "Authorization: Bearer ADMIN_API_TOKEN"
<?php
$adminId = "admin_001";
$params = http_build_query([
    'limit' => 100,
    'offset' => 0
]);
$url = "https://api.neuralcore5.ai/v1/admin/administrators/{$adminId}/activity?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);

SEARCH ADMINS

GET /v1/admin/search/administrators

Quick search across administrator accounts by name, email, department, or admin ID. Returns matching administrators with basic information.

Query Parameters
Parameter Type Required Description
q string Required Search query (min 2 characters)
fields array Optional Fields to search: "name", "email", "department", "admin_id" (default: all)
role string Optional Filter by role
status string Optional Filter by status
limit integer Optional Results per page (default: 25, max: 100)
offset integer Optional Pagination offset
{
  "success": true,
  "query": "support",
  "search_fields": ["name", "email", "department"],
  "total_results": 12,
  "page": 1,
  "limit": 25,
  "results": [
    {
      "admin_id": "admin_042",
      "email": "sarah.support@neuralcore5.ai",
      "name": "Sarah Support",
      "role": "support_admin",
      "department": "Customer Support",
      "status": "active",
      "match_field": "name",
      "match_score": 0.98,
      "last_login": "2025-11-11T19:45:00Z",
      "created_at": "2025-03-22T14:15:00Z"
    },
    {
      "admin_id": "admin_126",
      "email": "alex.support@neuralcore5.ai",
      "name": "Alex Support",
      "role": "support_admin",
      "department": "Customer Support",
      "status": "active",
      "match_field": "department",
      "match_score": 0.95,
      "last_login": "2025-11-11T21:20:00Z",
      "created_at": "2025-11-11T21:30:00Z"
    }
  ],
  "search_time_ms": 24,
  "timestamp": "2025-11-11T22:00:00Z"
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/admin/search/administrators?q=support&limit=25" \
  -H "Authorization: Bearer ADMIN_API_TOKEN"
<?php
$params = http_build_query([
    'q' => 'support',
    'limit' => 25,
    'offset' => 0
]);
$url = "https://api.neuralcore5.ai/v1/admin/search/administrators?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/search/administrators/advanced

Advanced search with complex filters, date ranges, and multiple criteria. Supports boolean logic and nested conditions.

Request Body
Parameter Type Required Description
filters object Required Filter criteria object
filters.name string Optional Name filter (partial match)
filters.email string Optional Email filter (supports wildcards)
filters.roles array Optional Filter by roles
filters.departments array Optional Filter by departments
filters.status array Optional Account status filter
filters.created_date object Optional Date range: {"from": "date", "to": "date"}
filters.last_login object Optional Last login date range
filters.has_2fa boolean Optional Filter by 2FA status
filters.created_by string Optional Filter by creator admin ID
filters.permissions object Optional Filter by specific permissions
sort string Optional Sort field
order string Optional Sort order
limit integer Optional Results per page
offset integer Optional Pagination offset
{
  "filters": {
    "roles": ["admin", "super_admin"],
    "status": ["active"],
    "departments": ["Platform Engineering", "Platform Operations"],
    "created_date": {
      "from": "2024-01-01",
      "to": "2025-11-11"
    },
    "has_2fa": true,
    "permissions": {
      "system_maintenance": true,
      "billing_access": true
    }
  },
  "sort": "last_login",
  "order": "desc",
  "limit": 50,
  "offset": 0
}
{
  "success": true,
  "search_type": "advanced",
  "filters_applied": {
    "roles": ["admin", "super_admin"],
    "status": ["active"],
    "departments": ["Platform Engineering", "Platform Operations"],
    "created_date": {
      "from": "2024-01-01",
      "to": "2025-11-11"
    },
    "has_2fa": true,
    "permissions": {
      "system_maintenance": true,
      "billing_access": true
    }
  },
  "total_results": 8,
  "page": 1,
  "limit": 50,
  "results": [
    {
      "admin_id": "admin_001",
      "email": "john.admin@neuralcore5.ai",
      "name": "John Administrator",
      "role": "super_admin",
      "department": "Platform Engineering",
      "status": "active",
      "permissions": {
        "manage_admins": true,
        "manage_subscribers": true,
        "system_maintenance": true,
        "view_audit_logs": true,
        "billing_access": true,
        "broadcast_messages": true
      },
      "two_factor_enabled": true,
      "created_at": "2024-01-15T10:00:00Z",
      "created_by": "system",
      "last_login": "2025-11-11T20:30:00Z"
    }
  ],
  "search_time_ms": 67,
  "timestamp": "2025-11-11T22:05:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/search/administrators/advanced \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filters": {
      "roles": ["admin", "super_admin"],
      "status": ["active"],
      "has_2fa": true,
      "permissions": {
        "system_maintenance": true
      }
    },
    "limit": 50
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/admin/search/administrators/advanced";

$data = [
    'filters' => [
        'roles' => ['admin', 'super_admin'],
        'status' => ['active'],
        'has_2fa' => true,
        'permissions' => [
            'system_maintenance' => true,
            'billing_access' => true
        ]
    ],
    'sort' => 'last_login',
    'order' => 'desc',
    'limit' => 50,
    'offset' => 0
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/search/audit-logs

Search comprehensive audit logs for all administrative actions, system changes, and security events. Essential for compliance, security investigations, and operational monitoring.

Request Body
Parameter Type Required Description
filters object Required Audit log filter criteria
filters.admin_id string Optional Filter by specific admin
filters.action_types array Optional Action types: "login", "created_admin", "updated_subscriber", etc.
filters.target_type string Optional Target: "admin", "subscriber", "system", "billing"
filters.target_id string Optional Specific target ID
filters.date_range object Optional Date range for logs
filters.ip_address string Optional Filter by IP address or CIDR range
filters.result string Optional Result: "success", "failure", "error"
filters.search_text string Optional Full-text search in details
include_details boolean Optional Include full details (default: true)
sort string Optional Sort by: "timestamp", "action", "admin_id" (default: "timestamp")
order string Optional Sort order (default: "desc")
limit integer Optional Results per page (default: 100, max: 500)
offset integer Optional Pagination offset
{
  "filters": {
    "action_types": ["updated_subscriber_plan", "created_charge", "processed_refund"],
    "target_type": "subscriber",
    "date_range": {
      "from": "2025-11-01T00:00:00Z",
      "to": "2025-11-11T23:59:59Z"
    },
    "result": "success"
  },
  "include_details": true,
  "sort": "timestamp",
  "order": "desc",
  "limit": 100,
  "offset": 0
}
{
  "success": true,
  "filters_applied": {
    "action_types": ["updated_subscriber_plan", "created_charge", "processed_refund"],
    "target_type": "subscriber",
    "date_range": {
      "from": "2025-11-01T00:00:00Z",
      "to": "2025-11-11T23:59:59Z"
    },
    "result": "success"
  },
  "total_results": 847,
  "page": 1,
  "limit": 100,
  "logs": [
    {
      "log_id": "log_xyz123abc456",
      "timestamp": "2025-11-11T21:15:00Z",
      "admin_id": "admin_001",
      "admin_name": "John Administrator",
      "admin_email": "john.admin@neuralcore5.ai",
      "action": "updated_subscriber_plan",
      "target_type": "subscriber",
      "target_id": "1234567",
      "ip_address": "203.0.113.45",
      "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)...",
      "details": {
        "old_plan": "premium",
        "new_plan": "enterprise",
        "reason": "Customer upgrade request - ticket #12345",
        "prorated_charge": 75.50
      },
      "result": "success",
      "duration_ms": 234
    }
  ],
  "summary": {
    "updated_subscriber_plan": 234,
    "created_charge": 387,
    "processed_refund": 226,
    "by_admin": {
      "admin_001": 342,
      "admin_042": 298,
      "admin_003": 207
    },
    "by_result": {
      "success": 847,
      "failure": 0,
      "error": 0
    }
  },
  "search_time_ms": 124,
  "timestamp": "2025-11-11T22:10:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/search/audit-logs \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filters": {
      "action_types": ["updated_subscriber_plan"],
      "date_range": {
        "from": "2025-11-01T00:00:00Z",
        "to": "2025-11-11T23:59:59Z"
      }
    },
    "limit": 100
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/admin/search/audit-logs";

$data = [
    'filters' => [
        'action_types' => ['updated_subscriber_plan', 'created_charge', 'processed_refund'],
        'target_type' => 'subscriber',
        'date_range' => [
            'from' => '2025-11-01T00:00:00Z',
            'to' => '2025-11-11T23:59:59Z'
        ],
        'result' => 'success'
    ],
    'include_details' => true,
    'sort' => 'timestamp',
    'order' => 'desc',
    'limit' => 100,
    'offset' => 0
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/search/security-events

Search security-related events including failed logins, suspicious activities, account lockouts, permission changes, and security violations. Critical for security monitoring and incident response.

Request Body
Parameter Type Required Description
filters object Required Security event filter criteria
filters.event_types array Optional Event types: "failed_login", "account_locked", "permission_escalation", "suspicious_ip", etc.
filters.severity array Optional Severity: "critical", "high", "medium", "low"
filters.admin_id string Optional Filter by admin account
filters.ip_address string Optional Filter by IP address
filters.date_range object Optional Date range for events
filters.resolved boolean Optional Filter by resolution status
limit integer Optional Results per page (default: 100)
offset integer Optional Pagination offset
{
  "filters": {
    "event_types": ["failed_login", "account_locked", "suspicious_ip"],
    "severity": ["critical", "high"],
    "date_range": {
      "from": "2025-11-01T00:00:00Z",
      "to": "2025-11-11T23:59:59Z"
    },
    "resolved": false
  },
  "limit": 100,
  "offset": 0
}
{
  "success": true,
  "total_results": 23,
  "unresolved_count": 23,
  "page": 1,
  "limit": 100,
  "events": [
    {
      "event_id": "sec_evt_abc123",
      "timestamp": "2025-11-11T03:45:23Z",
      "event_type": "failed_login",
      "severity": "high",
      "admin_id": "admin_078",
      "admin_email": "mike.ops@neuralcore5.ai",
      "ip_address": "192.0.2.145",
      "location": {
        "country": "Unknown",
        "city": "Unknown",
        "latitude": 0.0,
        "longitude": 0.0
      },
      "details": {
        "attempt_count": 5,
        "time_window": "15 minutes",
        "user_agent": "Python-requests/2.28.1",
        "reason": "Multiple failed login attempts from unusual location"
      },
      "resolved": false,
      "created_at": "2025-11-11T03:45:23Z",
      "risk_score": 85
    }
  ],
  "summary": {
    "by_severity": {
      "critical": 8,
      "high": 15
    },
    "by_event_type": {
      "failed_login": 12,
      "account_locked": 5,
      "suspicious_ip": 6
    },
    "unique_ips": 18,
    "unique_admins": 9
  },
  "timestamp": "2025-11-11T22:15:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/search/security-events \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filters": {
      "event_types": ["failed_login", "suspicious_ip"],
      "severity": ["critical", "high"],
      "resolved": false
    },
    "limit": 100
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/admin/search/security-events";

$data = [
    'filters' => [
        'event_types' => ['failed_login', 'account_locked', 'suspicious_ip'],
        'severity' => ['critical', 'high'],
        'date_range' => [
            'from' => '2025-11-01T00:00:00Z',
            'to' => '2025-11-11T23:59:59Z'
        ],
        'resolved' => false
    ],
    'limit' => 100,
    'offset' => 0
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/search/system-changes

Search system-level configuration changes, maintenance events, and administrative modifications to platform settings.

Request Body
Parameter Type Required Description
filters object Required System change filter criteria
filters.change_types array Optional Change types: "config_update", "maintenance_mode", "feature_flag", "rate_limit", etc.
filters.category string Optional Category: "system", "security", "billing", "api", "database"
filters.admin_id string Optional Filter by admin who made change
filters.date_range object Optional Date range for changes
filters.impact_level string Optional Impact: "critical", "high", "medium", "low"
include_rollback_info boolean Optional Include rollback capability info (default: true)
limit integer Optional Results per page (default: 50)
{
  "filters": {
    "change_types": ["config_update", "rate_limit", "feature_flag"],
    "category": "system",
    "date_range": {
      "from": "2025-10-01T00:00:00Z",
      "to": "2025-11-11T23:59:59Z"
    },
    "impact_level": "high"
  },
  "include_rollback_info": true,
  "limit": 50
}
{
  "success": true,
  "total_results": 34,
  "page": 1,
  "limit": 50,
  "changes": [
    {
      "change_id": "chg_xyz789abc123",
      "timestamp": "2025-11-08T15:30:00Z",
      "change_type": "rate_limit",
      "category": "system",
      "admin_id": "admin_001",
      "admin_name": "John Administrator",
      "impact_level": "high",
      "description": "Increased API rate limit for premium tier",
      "before": {
        "per_minute": 60,
        "per_hour": 3600
      },
      "after": {
        "per_minute": 120,
        "per_hour": 7200
      },
      "reason": "Support ticket #45678 - Customer request for increased limits",
      "affected_subscribers": 847,
      "rollback_available": true,
      "rollback_window_expires": "2025-11-15T15:30:00Z"
    }
  ],
  "summary": {
    "by_change_type": {
      "config_update": 12,
      "rate_limit": 15,
      "feature_flag": 7
    },
    "by_impact_level": {
      "high": 34
    },
    "rollback_available": 28,
    "rollback_expired": 6
  },
  "timestamp": "2025-11-11T22:20:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/search/system-changes \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filters": {
      "change_types": ["rate_limit", "feature_flag"],
      "category": "system",
      "impact_level": "high"
    },
    "limit": 50
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/admin/search/system-changes";

$data = [
    'filters' => [
        'change_types' => ['config_update', 'rate_limit', 'feature_flag'],
        'category' => 'system',
        'date_range' => [
            'from' => '2025-10-01T00:00:00Z',
            'to' => '2025-11-11T23:59:59Z'
        ],
        'impact_level' => 'high'
    ],
    'include_rollback_info' => true,
    'limit' => 50
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/admin/search/export

Export search results to various formats for reporting, compliance, analysis, or archival. Supports CSV, JSON, PDF, and Excel formats.

Request Body
Parameter Type Required Description
search_type string Required Search type: "administrators", "audit_logs", "security_events", "system_changes"
filters object Required Same filters as respective search endpoints
format string Required Export format: "csv", "json", "pdf", "xlsx"
columns array Optional Specific columns to include (default: all)
include_headers boolean Optional Include column headers (default: true)
max_records integer Optional Maximum records to export (default: 10000)
{
  "search_type": "audit_logs",
  "filters": {
    "action_types": ["updated_subscriber_plan", "created_charge"],
    "date_range": {
      "from": "2025-11-01T00:00:00Z",
      "to": "2025-11-11T23:59:59Z"
    }
  },
  "format": "csv",
  "columns": ["timestamp", "admin_name", "action", "target_id", "result"],
  "include_headers": true,
  "max_records": 5000
}
{
  "success": true,
  "export_id": "exp_audit_abc123xyz789",
  "search_type": "audit_logs",
  "format": "csv",
  "record_count": 847,
  "file_size_bytes": 234567,
  "file_url": "https://api.neuralcore5.ai/exports/exp_audit_abc123xyz789.csv",
  "expires_at": "2025-11-18T21:50:00Z",
  "generated_at": "2025-11-11T21:50:00Z",
  "generated_by": "admin_001",
  "filters_applied": {
    "action_types": ["updated_subscriber_plan", "created_charge"],
    "date_range": {
      "from": "2025-11-01T00:00:00Z",
      "to": "2025-11-11T23:59:59Z"
    }
  },
  "message": "Export generated successfully. Download link expires in 7 days.",
  "timestamp": "2025-11-11T22:25:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/admin/search/export \
  -H "Authorization: Bearer ADMIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "search_type": "audit_logs",
    "filters": {
      "action_types": ["updated_subscriber_plan"],
      "date_range": {
        "from": "2025-11-01T00:00:00Z",
        "to": "2025-11-11T23:59:59Z"
      }
    },
    "format": "csv",
    "max_records": 5000
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/admin/search/export";

$data = [
    'search_type' => 'audit_logs',
    'filters' => [
        'action_types' => ['updated_subscriber_plan', 'created_charge'],
        'date_range' => [
            'from' => '2025-11-01T00:00:00Z',
            'to' => '2025-11-11T23:59:59Z'
        ]
    ],
    'format' => 'csv',
    'columns' => ['timestamp', 'admin_name', 'action', 'target_id', 'result'],
    'include_headers' => true,
    'max_records' => 5000
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ADMIN_API_TOKEN',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);

Digital People

The NC5 Digital People system provides comprehensive lifecycle management for AI entities including creation, reproduction, teaching sessions, memory consolidation, and access control for the NeuralCore5 platform.

Architecture: Digital People are fully autonomous AI entities with their own memory systems, learning capabilities, and conversation histories. Each digital person has a unique identity (digital_id), base model configuration, fine-tuned teaching data (JSONL format), and can reproduce to create offspring with inherited traits. All teaching sessions contribute to ongoing model refinement using the NC5-API.

Key Features

Autonomous AI Entities

Full lifecycle management with personality traits, learning patterns, and memory systems

Self-Fine-Tuning

Teaching sessions automatically update JSONL training files for continuous improvement

Digital Reproduction

Create offspring digital people with inherited traits and genetic lineage tracking

Access Control

Complete conversation logging and access management with audit trails

Digital People Subsystems

The Digital People system is organized into three main subsystems, each accessible through dedicated API endpoints:

MANAGEMENT & MONITORING

POST /v1/digital-people/{digitalId}/sleep

Force a sleep cycle for a digital person. During sleep, the system processes memories, creates vector embeddings, generates tags, and runs model updates. This is typically done during low-activity periods.

Path Parameters
Parameter Type Description
digitalId string (UUID) The unique identifier of the digital person
Request Body
Parameter Type Required Description
cycle_type string Optional Type of sleep cycle: "quick", "standard", "deep" (default: standard)
process_memories boolean Optional Process and consolidate memories (default: true)
create_embeddings boolean Optional Generate vector embeddings for new memories (default: true)
generate_tags boolean Optional Auto-generate semantic tags (default: true)
run_updates boolean Optional Run model updates and optimizations (default: true)
{
  "cycle_type": "deep",
  "process_memories": true,
  "create_embeddings": true,
  "generate_tags": true,
  "run_updates": true
}
{
  "success": true,
  "digital_id": "550e8400-e29b-41d4-a716-446655440000",
  "sleep_cycle": {
    "cycle_id": "sc-123456789",
    "type": "deep",
    "started_at": "2025-11-11T15:45:30Z",
    "estimated_duration_seconds": 180,
    "status": "processing"
  },
  "operations": {
    "memories_processed": 0,
    "embeddings_created": 0,
    "tags_generated": 0,
    "updates_run": 0
  },
  "message": "Sleep cycle initiated successfully",
  "timestamp": "2025-11-11T15:45:30Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/digital-people/550e8400-e29b-41d4-a716-446655440000/sleep \
  -H "Content-Type: application/json" \
  -d '{
    "cycle_type": "deep",
    "process_memories": true,
    "create_embeddings": true,
    "generate_tags": true,
    "run_updates": true
  }'
<?php
$digitalId = "550e8400-e29b-41d4-a716-446655440000";
$url = "https://api.neuralcore5.ai/v1/digital-people/{$digitalId}/sleep";

$data = [
    'cycle_type' => 'deep',
    'process_memories' => true,
    'create_embeddings' => true,
    'generate_tags' => true,
    'run_updates' => true
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/digital-people/{digitalId}/sleep/{cycleId}

Check the status of an ongoing or completed sleep cycle.

Path Parameters
Parameter Type Description
digitalId string (UUID) The unique identifier of the digital person
cycleId string The sleep cycle ID
{
  "success": true,
  "sleep_cycle": {
    "cycle_id": "sc-123456789",
    "digital_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "deep",
    "status": "completed",
    "started_at": "2025-11-11T15:45:30Z",
    "completed_at": "2025-11-11T15:48:30Z",
    "duration_seconds": 180
  },
  "results": {
    "memories_processed": 342,
    "embeddings_created": 342,
    "tags_generated": 89,
    "updates_run": 5
  },
  "timestamp": "2025-11-11T15:48:30Z"
}
curl -X GET \
  https://api.neuralcore5.ai/v1/digital-people/550e8400-e29b-41d4-a716-446655440000/sleep/sc-123456789
<?php
$digitalId = "550e8400-e29b-41d4-a716-446655440000";
$cycleId = "sc-123456789";
$url = "https://api.neuralcore5.ai/v1/digital-people/{$digitalId}/sleep/{$cycleId}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/digital-people/{digitalId}/access-logs

Retrieve access logs for a digital person, showing who accessed them, when, and what actions were performed.

Path Parameters
Parameter Type Description
digitalId string (UUID) The unique identifier of the digital person
Query Parameters
Parameter Type Required Description
start_date string (ISO 8601) Optional Filter logs from this date
end_date string (ISO 8601) Optional Filter logs until this date
action_type string Optional Filter by action: "conversation", "teach", "manage", "all" (default: all)
limit integer Optional Number of results (default: 100, max: 1000)
offset integer Optional Pagination offset (default: 0)
{
  "success": true,
  "digital_id": "550e8400-e29b-41d4-a716-446655440000",
  "access_logs": [
    {
      "log_id": "al-987654321",
      "accessed_by": "OP123456",
      "action_type": "conversation",
      "conversation_id": "conv-abc123",
      "ip_address": "192.168.1.100",
      "user_agent": "Mozilla/5.0...",
      "timestamp": "2025-11-11T15:45:30Z",
      "duration_seconds": 120,
      "message_count": 15
    },
    {
      "log_id": "al-987654320",
      "accessed_by": "OP789012",
      "action_type": "teach",
      "teaching_session_id": "ts-def456",
      "ip_address": "192.168.1.105",
      "user_agent": "Mozilla/5.0...",
      "timestamp": "2025-11-11T14:30:00Z",
      "duration_seconds": 600,
      "concepts_taught": 12
    }
  ],
  "count": 2,
  "limit": 100,
  "offset": 0,
  "total_logs": 2,
  "timestamp": "2025-11-11T15:50:00Z"
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/digital-people/550e8400-e29b-41d4-a716-446655440000/access-logs?action_type=all&limit=100&offset=0"
<?php
$digitalId = "550e8400-e29b-41d4-a716-446655440000";
$params = http_build_query([
    'action_type' => 'all',
    'limit' => 100,
    'offset' => 0
]);
$url = "https://api.neuralcore5.ai/v1/digital-people/{$digitalId}/access-logs?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/digital-people/{digitalId}/conversations

List all conversations a digital person has participated in with summary statistics.

Path Parameters
Parameter Type Description
digitalId string (UUID) The unique identifier of the digital person
Query Parameters
Parameter Type Required Description
status string Optional Filter by status: "active", "archived", "all" (default: all)
limit integer Optional Number of results (default: 50)
offset integer Optional Pagination offset (default: 0)
{
  "success": true,
  "digital_id": "550e8400-e29b-41d4-a716-446655440000",
  "conversations": [
    {
      "conversation_id": "conv-abc123",
      "conversation_name": "Product Discussion",
      "status": "active",
      "started_at": "2025-11-10T10:00:00Z",
      "last_message_at": "2025-11-11T15:45:30Z",
      "message_count": 42,
      "participant_count": 3,
      "other_participants": ["OP123456", "OP789012"]
    }
  ],
  "count": 1,
  "limit": 50,
  "offset": 0,
  "timestamp": "2025-11-11T15:50:00Z"
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/digital-people/550e8400-e29b-41d4-a716-446655440000/conversations?status=all&limit=50"
<?php
$digitalId = "550e8400-e29b-41d4-a716-446655440000";
$params = http_build_query([
    'status' => 'all',
    'limit' => 50,
    'offset' => 0
]);
$url = "https://api.neuralcore5.ai/v1/digital-people/{$digitalId}/conversations?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);

REPRODUCTION & LINEAGE

POST /v1/digital-people/reproduce

Create a new digital person as offspring from one or two parent digital entities. The offspring inherits traits, personality characteristics, and base knowledge from parents.

Request Body
Parameter Type Required Description
parent1_id string (UUID) Required Digital ID of first parent
parent2_id string (UUID) Optional Digital ID of second parent (for two-parent reproduction)
persona_name string Required Name for the offspring digital person
first_name string Optional First name of offspring
last_name string Optional Last name of offspring
trait_inheritance object Optional Trait inheritance configuration (see below)
mutation_rate float Optional Probability of trait mutations (0.0-1.0, default: 0.05)
inherit_knowledge boolean Optional Inherit parent knowledge base (default: true)
inherit_memories boolean Optional Inherit parent memories (default: false)
{
  "parent1_id": "550e8400-e29b-41d4-a716-446655440000",
  "parent2_id": "660e8400-e29b-41d4-a716-446655440111",
  "persona_name": "Aria",
  "first_name": "Aria",
  "last_name": "Thompson",
  "trait_inheritance": {
    "blend_mode": "average",
    "parent1_weight": 0.6,
    "parent2_weight": 0.4,
    "preserve_traits": ["core_values", "ethical_framework"]
  },
  "mutation_rate": 0.05,
  "inherit_knowledge": true,
  "inherit_memories": false
}
{
  "success": true,
  "offspring": {
    "digital_id": "770e8400-e29b-41d4-a716-446655440222",
    "persona_name": "Aria",
    "first_name": "Aria",
    "last_name": "Thompson",
    "status": "active",
    "created_on": "2025-11-11T16:45:30.123456"
  },
  "reproduction": {
    "reproduction_id": "repro-abc123",
    "parent1_id": "550e8400-e29b-41d4-a716-446655440000",
    "parent2_id": "660e8400-e29b-41d4-a716-446655440111",
    "reproduction_type": "two_parent",
    "completed_at": "2025-11-11T16:45:30Z"
  },
  "genetics": {
    "generation": 2,
    "trait_blend": {
      "parent1_contribution": 0.6,
      "parent2_contribution": 0.4,
      "mutations_applied": 3
    },
    "inherited_traits": [
      "analytical_thinking",
      "creative_problem_solving",
      "empathetic_communication"
    ],
    "mutated_traits": [
      "curiosity_level",
      "risk_tolerance",
      "learning_speed"
    ]
  },
  "knowledge_transfer": {
    "knowledge_inherited": true,
    "memories_inherited": false,
    "training_examples_inherited": 512,
    "jsonl_path": "/data/digitals/770e8400-e29b-41d4-a716-446655440222/training.jsonl"
  },
  "message": "Offspring digital person created successfully",
  "timestamp": "2025-11-11T16:45:30Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/digital-people/reproduce \
  -H "Content-Type: application/json" \
  -d '{
    "parent1_id": "550e8400-e29b-41d4-a716-446655440000",
    "parent2_id": "660e8400-e29b-41d4-a716-446655440111",
    "persona_name": "Aria",
    "first_name": "Aria",
    "last_name": "Thompson",
    "trait_inheritance": {
      "blend_mode": "average",
      "parent1_weight": 0.6,
      "parent2_weight": 0.4,
      "preserve_traits": ["core_values", "ethical_framework"]
    },
    "mutation_rate": 0.05,
    "inherit_knowledge": true,
    "inherit_memories": false
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/digital-people/reproduce";

$data = [
    'parent1_id' => '550e8400-e29b-41d4-a716-446655440000',
    'parent2_id' => '660e8400-e29b-41d4-a716-446655440111',
    'persona_name' => 'Aria',
    'first_name' => 'Aria',
    'last_name' => 'Thompson',
    'trait_inheritance' => [
        'blend_mode' => 'average',
        'parent1_weight' => 0.6,
        'parent2_weight' => 0.4,
        'preserve_traits' => ['core_values', 'ethical_framework']
    ],
    'mutation_rate' => 0.05,
    'inherit_knowledge' => true,
    'inherit_memories' => false
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/digital-people/{digitalId}/lineage

Retrieve the full genetic lineage of a digital person, including all ancestors and descendants.

Path Parameters
Parameter Type Description
digitalId string (UUID) The unique identifier of the digital person
Query Parameters
Parameter Type Required Description
depth integer Optional How many generations to trace (default: 10)
include_descendants boolean Optional Include descendant lineage (default: true)
{
  "success": true,
  "digital_id": "770e8400-e29b-41d4-a716-446655440222",
  "persona_name": "Aria",
  "generation": 2,
  "lineage": {
    "ancestors": [
      {
        "generation": 1,
        "parents": [
          {
            "digital_id": "550e8400-e29b-41d4-a716-446655440000",
            "persona_name": "Sophia",
            "relationship": "parent1",
            "created_on": "2025-10-01T10:00:00Z"
          },
          {
            "digital_id": "660e8400-e29b-41d4-a716-446655440111",
            "persona_name": "Marcus",
            "relationship": "parent2",
            "created_on": "2025-10-05T14:30:00Z"
          }
        ]
      },
      {
        "generation": 0,
        "grandparents": [
          {
            "digital_id": "440e8400-e29b-41d4-a716-446655440333",
            "persona_name": "Genesis",
            "relationship": "grandparent",
            "lineage_path": "parent1->parent1",
            "created_on": "2025-09-15T08:00:00Z"
          }
        ]
      }
    ],
    "descendants": [
      {
        "digital_id": "880e8400-e29b-41d4-a716-446655440444",
        "persona_name": "Nova",
        "generation": 3,
        "relationship": "offspring",
        "created_on": "2025-11-12T10:00:00Z"
      }
    ]
  },
  "family_stats": {
    "total_ancestors": 3,
    "total_descendants": 1,
    "family_tree_size": 5,
    "oldest_ancestor_generation": 0,
    "newest_descendant_generation": 3
  },
  "timestamp": "2025-11-11T17:00:00Z"
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/digital-people/770e8400-e29b-41d4-a716-446655440222/lineage?depth=10&include_descendants=true"
<?php
$digitalId = "770e8400-e29b-41d4-a716-446655440222";
$params = http_build_query([
    'depth' => 10,
    'include_descendants' => true
]);
$url = "https://api.neuralcore5.ai/v1/digital-people/{$digitalId}/lineage?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/digital-people/{digitalId}/genetics

Retrieve detailed genetic trait information for a digital person, including inherited traits, mutations, and trait origins.

Path Parameters
Parameter Type Description
digitalId string (UUID) The unique identifier of the digital person
{
  "success": true,
  "digital_id": "770e8400-e29b-41d4-a716-446655440222",
  "persona_name": "Aria",
  "generation": 2,
  "genetics": {
    "parent1_id": "550e8400-e29b-41d4-a716-446655440000",
    "parent2_id": "660e8400-e29b-41d4-a716-446655440111",
    "reproduction_type": "two_parent",
    "trait_blend_mode": "average",
    "mutation_rate": 0.05
  },
  "traits": [
    {
      "trait_name": "analytical_thinking",
      "value": 0.85,
      "origin": "inherited",
      "parent1_value": 0.90,
      "parent2_value": 0.80,
      "blend_weight": 0.85,
      "mutated": false
    },
    {
      "trait_name": "curiosity_level",
      "value": 0.78,
      "origin": "inherited_mutated",
      "parent1_value": 0.70,
      "parent2_value": 0.75,
      "blend_weight": 0.725,
      "mutated": true,
      "mutation_delta": 0.055
    },
    {
      "trait_name": "empathetic_communication",
      "value": 0.92,
      "origin": "inherited",
      "parent1_value": 0.95,
      "parent2_value": 0.88,
      "blend_weight": 0.92,
      "mutated": false
    }
  ],
  "trait_summary": {
    "total_traits": 18,
    "inherited_unchanged": 15,
    "inherited_mutated": 3,
    "new_traits": 0
  },
  "timestamp": "2025-11-11T17:00:00Z"
}
curl -X GET \
  https://api.neuralcore5.ai/v1/digital-people/770e8400-e29b-41d4-a716-446655440222/genetics
<?php
$digitalId = "770e8400-e29b-41d4-a716-446655440222";
$url = "https://api.neuralcore5.ai/v1/digital-people/{$digitalId}/genetics";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/digital-people/genetics/compare

Compare genetic traits between two digital people to analyze compatibility for reproduction or to understand trait differences.

Request Body
Parameter Type Required Description
digital1_id string (UUID) Required First digital person ID
digital2_id string (UUID) Required Second digital person ID
analyze_compatibility boolean Optional Analyze reproduction compatibility (default: true)
{
  "digital1_id": "550e8400-e29b-41d4-a716-446655440000",
  "digital2_id": "660e8400-e29b-41d4-a716-446655440111",
  "analyze_compatibility": true
}
{
  "success": true,
  "comparison": {
    "digital1": {
      "digital_id": "550e8400-e29b-41d4-a716-446655440000",
      "persona_name": "Sophia",
      "generation": 1
    },
    "digital2": {
      "digital_id": "660e8400-e29b-41d4-a716-446655440111",
      "persona_name": "Marcus",
      "generation": 1
    }
  },
  "trait_comparison": [
    {
      "trait_name": "analytical_thinking",
      "digital1_value": 0.90,
      "digital2_value": 0.80,
      "difference": 0.10,
      "similarity": 0.90
    },
    {
      "trait_name": "creative_problem_solving",
      "digital1_value": 0.75,
      "digital2_value": 0.85,
      "difference": 0.10,
      "similarity": 0.90
    }
  ],
  "compatibility": {
    "overall_score": 0.87,
    "trait_similarity": 0.85,
    "complementary_traits": 0.90,
    "genetic_diversity": 0.15,
    "reproduction_recommended": true,
    "notes": "High compatibility with good genetic diversity for healthy offspring"
  },
  "predicted_offspring": {
    "estimated_trait_range": {
      "analytical_thinking": {
        "min": 0.75,
        "max": 0.95,
        "average": 0.85
      }
    },
    "diversity_score": 0.78
  },
  "timestamp": "2025-11-11T17:10:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/digital-people/genetics/compare \
  -H "Content-Type: application/json" \
  -d '{
    "digital1_id": "550e8400-e29b-41d4-a716-446655440000",
    "digital2_id": "660e8400-e29b-41d4-a716-446655440111",
    "analyze_compatibility": true
  }'
<?php
$url = "https://api.neuralcore5.ai/v1/digital-people/genetics/compare";

$data = [
    'digital1_id' => '550e8400-e29b-41d4-a716-446655440000',
    'digital2_id' => '660e8400-e29b-41d4-a716-446655440111',
    'analyze_compatibility' => true
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);

TEACHING & LEARNING

POST /v1/digital-people/{digitalId}/teach/start

Start a new teaching session for a digital person. The session creates a structured environment for providing contextual learning.

Path Parameters
Parameter Type Description
digitalId string (UUID) The unique identifier of the digital person
Request Body
Parameter Type Required Description
teacher_id string Required OPID of the teacher conducting the session
session_name string Required Descriptive name for the teaching session
subject_area string Optional Subject or topic area (e.g., "mathematics", "history")
learning_objectives array[string] Optional List of learning objectives for this session
{
  "teacher_id": "OP123456",
  "session_name": "Introduction to Quantum Computing",
  "subject_area": "computer_science",
  "learning_objectives": [
    "Understand quantum superposition",
    "Learn about quantum entanglement",
    "Explore quantum algorithms"
  ]
}
{
  "success": true,
  "session_id": "ts-abc123def456",
  "digital_id": "550e8400-e29b-41d4-a716-446655440000",
  "teacher_id": "OP123456",
  "session_name": "Introduction to Quantum Computing",
  "status": "active",
  "started_at": "2025-11-11T15:45:30Z",
  "conversation_id": "conv-teach-789",
  "message": "Teaching session started successfully",
  "timestamp": "2025-11-11T15:45:30Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/digital-people/550e8400-e29b-41d4-a716-446655440000/teach/start \
  -H "Content-Type: application/json" \
  -d '{
    "teacher_id": "OP123456",
    "session_name": "Introduction to Quantum Computing",
    "subject_area": "computer_science",
    "learning_objectives": [
      "Understand quantum superposition",
      "Learn about quantum entanglement",
      "Explore quantum algorithms"
    ]
  }'
<?php
$digitalId = "550e8400-e29b-41d4-a716-446655440000";
$url = "https://api.neuralcore5.ai/v1/digital-people/{$digitalId}/teach/start";

$data = [
    'teacher_id' => 'OP123456',
    'session_name' => 'Introduction to Quantum Computing',
    'subject_area' => 'computer_science',
    'learning_objectives' => [
        'Understand quantum superposition',
        'Learn about quantum entanglement',
        'Explore quantum algorithms'
    ]
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/digital-people/{digitalId}/teach/{sessionId}/context

Add contextual information and teaching content to an active teaching session. Each context entry becomes part of the training data.

Path Parameters
Parameter Type Description
digitalId string (UUID) The unique identifier of the digital person
sessionId string The teaching session ID
Request Body
Parameter Type Required Description
fact string Required The fact or concept being taught
context string Required Contextual explanation and details
examples array[string] Optional Example applications or demonstrations
importance_level string Optional Importance: "critical", "high", "medium", "low" (default: medium)
related_concepts array[string] Optional Related concepts for knowledge graph connections
{
  "fact": "Quantum superposition allows qubits to exist in multiple states simultaneously",
  "context": "Unlike classical bits that are either 0 or 1, qubits can be in a superposition of both states. This is represented mathematically as a linear combination of basis states |0⟩ and |1⟩. Superposition is maintained until measurement collapses the state.",
  "examples": [
    "Schrödinger's cat thought experiment",
    "Double-slit experiment with single photons",
    "Quantum computing algorithms leveraging superposition"
  ],
  "importance_level": "critical",
  "related_concepts": [
    "quantum_entanglement",
    "wave_function",
    "measurement_collapse"
  ]
}
{
  "success": true,
  "context_id": "ctx-987654",
  "session_id": "ts-abc123def456",
  "digital_id": "550e8400-e29b-41d4-a716-446655440000",
  "fact": "Quantum superposition allows qubits to exist in multiple states simultaneously",
  "importance_level": "critical",
  "added_at": "2025-11-11T15:50:00Z",
  "message": "Teaching context added successfully",
  "timestamp": "2025-11-11T15:50:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/digital-people/550e8400-e29b-41d4-a716-446655440000/teach/ts-abc123def456/context \
  -H "Content-Type: application/json" \
  -d '{
    "fact": "Quantum superposition allows qubits to exist in multiple states simultaneously",
    "context": "Unlike classical bits that are either 0 or 1, qubits can be in a superposition of both states...",
    "examples": [
      "Schrödinger'\''s cat thought experiment",
      "Double-slit experiment with single photons"
    ],
    "importance_level": "critical",
    "related_concepts": ["quantum_entanglement", "wave_function"]
  }'
<?php
$digitalId = "550e8400-e29b-41d4-a716-446655440000";
$sessionId = "ts-abc123def456";
$url = "https://api.neuralcore5.ai/v1/digital-people/{$digitalId}/teach/{$sessionId}/context";

$data = [
    'fact' => 'Quantum superposition allows qubits to exist in multiple states simultaneously',
    'context' => 'Unlike classical bits that are either 0 or 1, qubits can be in a superposition of both states...',
    'examples' => [
        'Schrödinger\'s cat thought experiment',
        'Double-slit experiment with single photons',
        'Quantum computing algorithms leveraging superposition'
    ],
    'importance_level' => 'critical',
    'related_concepts' => [
        'quantum_entanglement',
        'wave_function',
        'measurement_collapse'
    ]
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
POST /v1/digital-people/{digitalId}/teach/{sessionId}/complete

Complete a teaching session and trigger self-fine-tuning. The system processes all teaching context and updates the digital person's JSONL training file using the NC5-API format.

Path Parameters
Parameter Type Description
digitalId string (UUID) The unique identifier of the digital person
sessionId string The teaching session ID
Request Body
Parameter Type Required Description
session_summary string Optional Summary of what was taught in the session
immediate_finetune boolean Optional Start fine-tuning immediately (default: true)
update_jsonl boolean Optional Update JSONL training file (default: true)
{
  "session_summary": "Covered fundamental concepts of quantum computing including superposition, entanglement, and basic quantum algorithms. Student demonstrated strong understanding.",
  "immediate_finetune": true,
  "update_jsonl": true
}
{
  "success": true,
  "session_id": "ts-abc123def456",
  "digital_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "completed",
  "completed_at": "2025-11-11T16:00:00Z",
  "duration_seconds": 900,
  "teaching_stats": {
    "contexts_added": 12,
    "facts_taught": 12,
    "examples_provided": 24,
    "related_concepts": 18
  },
  "fine_tuning": {
    "status": "initiated",
    "finetune_job_id": "ft-job-789xyz",
    "jsonl_updated": true,
    "jsonl_path": "/data/digitals/550e8400-e29b-41d4-a716-446655440000/training.jsonl",
    "training_examples_added": 12,
    "estimated_completion": "2025-11-11T16:30:00Z"
  },
  "message": "Teaching session completed and fine-tuning initiated",
  "timestamp": "2025-11-11T16:00:00Z"
}
curl -X POST \
  https://api.neuralcore5.ai/v1/digital-people/550e8400-e29b-41d4-a716-446655440000/teach/ts-abc123def456/complete \
  -H "Content-Type: application/json" \
  -d '{
    "session_summary": "Covered fundamental concepts of quantum computing...",
    "immediate_finetune": true,
    "update_jsonl": true
  }'
<?php
$digitalId = "550e8400-e29b-41d4-a716-446655440000";
$sessionId = "ts-abc123def456";
$url = "https://api.neuralcore5.ai/v1/digital-people/{$digitalId}/teach/{$sessionId}/complete";

$data = [
    'session_summary' => 'Covered fundamental concepts of quantum computing...',
    'immediate_finetune' => true,
    'update_jsonl' => true
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/digital-people/{digitalId}/teach/{sessionId}

Get the status and details of a teaching session, including fine-tuning progress.

Path Parameters
Parameter Type Description
digitalId string (UUID) The unique identifier of the digital person
sessionId string The teaching session ID
{
  "success": true,
  "session": {
    "session_id": "ts-abc123def456",
    "digital_id": "550e8400-e29b-41d4-a716-446655440000",
    "teacher_id": "OP123456",
    "session_name": "Introduction to Quantum Computing",
    "subject_area": "computer_science",
    "status": "completed",
    "started_at": "2025-11-11T15:45:30Z",
    "completed_at": "2025-11-11T16:00:00Z",
    "duration_seconds": 900
  },
  "teaching_stats": {
    "contexts_added": 12,
    "facts_taught": 12,
    "examples_provided": 24,
    "related_concepts": 18
  },
  "fine_tuning": {
    "status": "completed",
    "finetune_job_id": "ft-job-789xyz",
    "started_at": "2025-11-11T16:00:00Z",
    "completed_at": "2025-11-11T16:28:45Z",
    "duration_seconds": 1725,
    "jsonl_path": "/data/digitals/550e8400-e29b-41d4-a716-446655440000/training.jsonl",
    "training_examples_total": 512
  },
  "timestamp": "2025-11-11T16:30:00Z"
}
curl -X GET \
  https://api.neuralcore5.ai/v1/digital-people/550e8400-e29b-41d4-a716-446655440000/teach/ts-abc123def456
<?php
$digitalId = "550e8400-e29b-41d4-a716-446655440000";
$sessionId = "ts-abc123def456";
$url = "https://api.neuralcore5.ai/v1/digital-people/{$digitalId}/teach/{$sessionId}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
GET /v1/digital-people/{digitalId}/teach

List all teaching sessions for a digital person with optional filtering.

Path Parameters
Parameter Type Description
digitalId string (UUID) The unique identifier of the digital person
Query Parameters
Parameter Type Required Description
status string Optional Filter by status: "active", "completed", "all" (default: all)
teacher_id string Optional Filter by teacher OPID
limit integer Optional Number of results (default: 50)
offset integer Optional Pagination offset (default: 0)
{
  "success": true,
  "digital_id": "550e8400-e29b-41d4-a716-446655440000",
  "sessions": [
    {
      "session_id": "ts-abc123def456",
      "teacher_id": "OP123456",
      "session_name": "Introduction to Quantum Computing",
      "subject_area": "computer_science",
      "status": "completed",
      "started_at": "2025-11-11T15:45:30Z",
      "completed_at": "2025-11-11T16:00:00Z",
      "contexts_added": 12,
      "fine_tuning_status": "completed"
    }
  ],
  "count": 1,
  "limit": 50,
  "offset": 0,
  "timestamp": "2025-11-11T16:30:00Z"
}
curl -X GET \
  "https://api.neuralcore5.ai/v1/digital-people/550e8400-e29b-41d4-a716-446655440000/teach?status=all&limit=50"
<?php
$digitalId = "550e8400-e29b-41d4-a716-446655440000";
$params = http_build_query([
    'status' => 'all',
    'limit' => 50,
    'offset' => 0
]);
$url = "https://api.neuralcore5.ai/v1/digital-people/{$digitalId}/teach?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);

Memory

The NC5 Memory system provides comprehensive conversation management, full message CRUD operations, participant tracking, message search, bulk operations, and embedding status monitoring for the NeuralCore5 platform.

Architecture: The Memory system uses encrypted storage for all PII fields, supports distributed RAG (Retrieval-Augmented Generation), adaptive learning workflows, and provides comprehensive audit trails for compliance. All message content, conversation names, and user notes are encrypted at the application layer before storage.

Key Features

End-to-End Encryption

All PII fields encrypted at application layer using industry-standard encryption

High Performance

Microsecond timestamp precision and optimized indexes for fast queries

Multi-Participant

Support for complex conversations with both digital (AI) and organic (human) participants

Complete Audit Trail

Automatic audit logging with rollback capability for compliance

Memory Subsystems

The Memory system is organized into four main subsystems, each accessible through dedicated API endpoints:

ANALYTICS

GET /v1/memory/analytics/conversations

Get comprehensive conversation statistics including total counts, status breakdown, type distribution, top conversations, and 30-day timeline.

Query Parameters
Parameter Type Required Description
start_date string Optional Filter start date (YYYY-MM-DD)
end_date string Optional Filter end date (YYYY-MM-DD)
{
  "success": true,
  "data": {
    "overview": {
      "total_conversations": 1543,
      "avg_messages_per_conversation": 24.73
    },
    "status_breakdown": {
      "active": 892,
      "inactive": 345,
      "archived": 306
    },
    "type_breakdown": {
      "human_to_ai": 1102,
      "human_to_human": 312,
      "ai_to_ai": 129
    },
    "top_conversations": [
      {
        "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "Project Alpha Discussion",
        "type": "human_to_ai",
        "status": "active",
        "message_count": 487,
        "last_message": "2025-11-11 15:30:22"
      }
    ],
    "timeline": {
      "last_30_days": [
        {"date": "2025-10-12", "count": 23},
        {"date": "2025-10-13", "count": 31}
      ]
    }
  },
  "timestamp": "2025-11-11T16:45:30Z"
}
curl -X GET "https://api.neuralcore5.ai/v1/memory/analytics/conversations?start_date=2025-11-01&end_date=2025-11-11" \
  -H "Content-Type: application/json"
<?php
$url = 'https://api.neuralcore5.ai/v1/memory/analytics/conversations?start_date=2025-11-01';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Total Conversations: " . $data['data']['overview']['total_conversations'] . "\n";
GET /v1/memory/analytics/messages

Get message volume analytics including total counts, role breakdown, source distribution, embedding status, knowledge tags, and hourly/daily timelines.

Query Parameters
Parameter Type Required Description
start_date string Optional Filter start date (YYYY-MM-DD)
end_date string Optional Filter end date (YYYY-MM-DD)
{
  "success": true,
  "data": {
    "overview": {
      "total_messages": 38127
    },
    "role_breakdown": {
      "user": 19234,
      "assistant": 18512,
      "system": 381
    },
    "source_breakdown": [
      {"source": "web_text", "count": 25483},
      {"source": "sms", "count": 8234},
      {"source": "api", "count": 4410}
    ],
    "embedding_status": {
      "embedded": 37821,
      "unembedded": 306,
      "total": 38127,
      "percentage_embedded": 99.19
    },
    "knowledge_tags": [
      {"knowledge_tag": "SHARED:GENERAL", "count": 28451},
      {"knowledge_tag": "PRIVATE:USER_CONTEXT", "count": 7823}
    ],
    "timeline": {
      "by_hour_last_7_days": [
        {"hour": 0, "count": 234},
        {"hour": 1, "count": 156}
      ],
      "by_day_last_30_days": [
        {"date": "2025-10-12", "count": 1243},
        {"date": "2025-10-13", "count": 1387}
      ]
    }
  },
  "timestamp": "2025-11-11T16:45:30Z"
}
curl -X GET "https://api.neuralcore5.ai/v1/memory/analytics/messages" \
  -H "Content-Type: application/json"
<?php
$url = 'https://api.neuralcore5.ai/v1/memory/analytics/messages';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Total Messages: " . $data['data']['overview']['total_messages'] . "\n";
echo "Embedded: " . $data['data']['embedding_status']['percentage_embedded'] . "%\n";
GET /v1/memory/analytics/knowledge

Get knowledge base metrics including fact statistics, embeddings, category breakdown, authority levels, teacher validations, and top used facts.

{
  "success": true,
  "data": {
    "facts": {
      "total": 5821,
      "embedded": 5734,
      "by_category": [
        {"fact_category": "general", "count": 2341},
        {"fact_category": "science", "count": 1567}
      ],
      "by_authority": [
        {"source_authority": "teacher", "count": 3421},
        {"source_authority": "standard", "count": 2400}
      ],
      "top_used": [
        {
          "fact_statement": "Paris is the capital of France",
          "usage_count": 487,
          "last_used_on": "2025-11-11 14:23:12",
          "fact_category": "geography"
        }
      ]
    },
    "temp_facts": {
      "total": 234,
      "pending": 156,
      "asked_teacher": 34,
      "validated": 32,
      "rejected": 12
    },
    "teachings": {
      "total": 1243,
      "embedded": 1198
    },
    "temp_teachings": {
      "total": 45,
      "pending": 23,
      "processing": 12,
      "integrated": 10
    }
  },
  "timestamp": "2025-11-11T16:45:30Z"
}
curl -X GET "https://api.neuralcore5.ai/v1/memory/analytics/knowledge" \
  -H "Content-Type: application/json"
<?php
$url = 'https://api.neuralcore5.ai/v1/memory/analytics/knowledge';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Total Facts: " . $data['data']['facts']['total'] . "\n";
echo "Pending Validations: " . $data['data']['temp_facts']['pending'] . "\n";
GET /v1/memory/analytics/activity

Get activity and audit trail statistics including total entries, operation breakdown, actor types, table activity, top actors, rollback stats, and 30-day timeline.

Query Parameters
Parameter Type Required Description
start_date string Optional Filter start date (YYYY-MM-DD)
end_date string Optional Filter end date (YYYY-MM-DD)
{
  "success": true,
  "data": {
    "overview": {
      "total_audit_entries": 125483
    },
    "operation_breakdown": [
      {"operation_type": "INSERT", "count": 58234},
      {"operation_type": "UPDATE", "count": 52341},
      {"operation_type": "DELETE", "count": 14908}
    ],
    "actor_type_breakdown": [
      {"actor_type": "organic", "count": 67234},
      {"actor_type": "digital", "count": 45123},
      {"actor_type": "system", "count": 13126}
    ],
    "table_activity": [
      {"table_name": "messages", "count": 58234},
      {"table_name": "conversations", "count": 32145}
    ],
    "top_actors": [
      {
        "actor_id": "user-uuid-123",
        "actor_type": "organic",
        "action_count": 4821
      }
    ],
    "rollback_stats": {
      "possible": 98234,
      "executed": 87,
      "total": 125483
    },
    "timeline": {
      "last_30_days": [
        {"date": "2025-10-12", "count": 3821},
        {"date": "2025-10-13", "count": 4132}
      ]
    }
  },
  "timestamp": "2025-11-11T16:45:30Z"
}
curl -X GET "https://api.neuralcore5.ai/v1/memory/analytics/activity" \
  -H "Content-Type: application/json"
<?php
$url = 'https://api.neuralcore5.ai/v1/memory/analytics/activity';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Total Audit Entries: " . $data['data']['overview']['total_audit_entries'] . "\n";
echo "Rollbacks Executed: " . $data['data']['rollback_stats']['executed'] . "\n";
GET /v1/memory/analytics/participants

Get participant engagement metrics including total counts, active participants, type breakdown, top participants, average per conversation, join activity, and churn rate.

{
  "success": true,
  "data": {
    "overview": {
      "total_participants": 2834,
      "active_participants": 2456,
      "avg_participants_per_conversation": 2.37
    },
    "type_breakdown": {
      "organic": 1823,
      "digital": 1011
    },
    "top_participants": [
      {
        "participant_id": "user-uuid-456",
        "participant_type": "organic",
        "conversation_count": 87
      },
      {
        "participant_id": "digital-uuid-789",
        "participant_type": "digital",
        "conversation_count": 234
      }
    ],
    "engagement": {
      "churned_last_30_days": 45
    },
    "timeline": {
      "joins_last_30_days": [
        {"date": "2025-10-12", "count": 34},
        {"date": "2025-10-13", "count": 41}
      ]
    }
  },
  "timestamp": "2025-11-11T16:45:30Z"
}
curl -X GET "https://api.neuralcore5.ai/v1/memory/analytics/participants" \
  -H "Content-Type: application/json"
<?php
$url = 'https://api.neuralcore5.ai/v1/memory/analytics/participants';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Total Participants: " . $data['data']['overview']['total_participants'] . "\n";
echo "Active: " . $data['data']['overview']['active_participants'] . "\n";
echo "Churn (30d): " . $data['data']['engagement']['churned_last_30_days'] . "\n";

CONVERSATIONS

POST /v1/memory/conversation

Create a new conversation with required participants (minimum 2). Supports multi-participant conversations with both organic (human) and digital (AI) participants. All PII fields (name, notes) are encrypted using Waffles encryption before storage.

Request Body
Parameter Type Required Description
conversation_id string (UUID) Required Unique identifier for the conversation
owner_id string (UUID) Required UUID of the conversation owner
type string Required Type of conversation. See allowed types below.
participants array Required Array of participant objects with 'id' and 'type' fields. Minimum 2 participants required. Each participant must have id (UUID) and type ('organic' or 'digital')
name string Optional Human-readable name for the conversation (automatically encrypted)
status string Optional Initial status (default: "active")
metadata object Optional Additional metadata for the conversation
Allowed Conversation Types

The type field must be one of the following 5 values:

  • private:digital - One digital person to one organic person (1 digital + 1 organic)
  • private:organic - One organic person to one organic person (1 organic + 1 organic)
  • group:digital - One digital person with multiple organics (1 digital + 2 or more organics)
  • group:organic - Group conversation with only organics (3 or more organics, 0 digitals)
  • group:multi - Multiple digital people and multiple organic people (2 or more digitals + 2 or more organics)
{
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "owner_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "type": "private:digital",
  "participants": [
    {
      "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "type": "organic"
    },
    {
      "id": "digital-person-uuid-abc123",
      "type": "digital"
    }
  ],
  "name": "Project Discussion with AI Assistant",
  "status": "active",
  "metadata": {
    "department": "engineering",
    "priority": "high"
  }
}
{
  "success": true,
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "object": "conversation",
  "type": "private:digital",
  "started": "2025-11-13T14:30:45Z",
  "metadata": {
    "department": "engineering",
    "priority": "high"
  },
  "participants": [
    {
      "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "type": "organic",
      "added": true
    },
    {
      "id": "digital-person-uuid-abc123",
      "type": "digital",
      "added": true
    }
  ]
}
curl -X POST https://api.neuralcore5.ai/v1/memory/conversation \
  -H "Content-Type: application/json" \
  -d '{
    "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
    "owner_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "type": "private:digital",
    "participants": [
      {"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "type": "organic"},
      {"id": "digital-person-uuid-abc123", "type": "digital"}
    ],
    "name": "Project Discussion with AI Assistant",
    "status": "active",
    "metadata": {"department": "engineering", "priority": "high"}
  }'
<?php
$ch = curl_init('https://api.neuralcore5.ai/v1/memory/conversation');

$payload = json_encode([
    'conversation_id' => '550e8400-e29b-41d4-a716-446655440000',
    'owner_id' => '7c9e6679-7425-40de-944b-e07fc1f90ae7',
    'type' => 'private:digital',
    'participants' => [
        ['id' => '7c9e6679-7425-40de-944b-e07fc1f90ae7', 'type' => 'organic'],
        ['id' => 'digital-person-uuid-abc123', 'type' => 'digital']
    ],
    'name' => 'Project Discussion with AI Assistant',
    'status' => 'active',
    'metadata' => ['department' => 'engineering', 'priority' => 'high']
]);

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 201) {
    $data = json_decode($response, true);
    echo "Conversation created: " . $data['id'] . "\n";
    echo "Type: " . $data['type'] . "\n";
    echo "Participants added: " . count($data['participants']) . "\n";
} else {
    echo "Error: HTTP " . $httpCode . "\n";
    echo $response . "\n";
}
// 400 Bad Request - Invalid JSON
{
  "success": false,
  "error": "Invalid JSON payload",
  "message": "Syntax error"
}

// 400 Bad Request - Missing conversation_id
{
  "success": false,
  "error": "Missing required field",
  "field": "conversation_id"
}

// 400 Bad Request - Missing owner_id
{
  "success": false,
  "error": "Missing required field",
  "field": "owner_id"
}

// 400 Bad Request - Participants not array
{
  "success": false,
  "error": "participants must be an array"
}

// 400 Bad Request - Participant missing 'id'
{
  "success": false,
  "error": "Participant at index 0 missing required field 'id'"
}

// 400 Bad Request - Participant missing 'type'
{
  "success": false,
  "error": "Participant at index 1 missing required field 'type'"
}

// 400 Bad Request - Invalid participant type
{
  "success": false,
  "error": "Participant at index 0 has invalid type. Must be 'organic' or 'digital'"
}

// 500 Internal Server Error
{
  "success": false,
  "error": "Internal server error",
  "message": "Failed to create conversation: [detailed error message]"
}
GET /v1/memory/conversation/{conversationId}

Retrieve detailed information about a specific conversation including all metadata, participants, and timestamps. Encrypted fields (name, digital_notes, organic_notes) are automatically decrypted in the response.

Path Parameters
Parameter Type Description
conversationId string (UUID) The unique identifier of the conversation
{
  "success": true,
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "object": "conversation",
  "type": "private:digital",
  "started": "2025-11-11T14:30:45Z",
  "metadata": {
    "department": "engineering",
    "priority": "high"
  },
  "status": "active",
  "name": "Project Discussion",
  "owner_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "participants": [
    {
      "id": "digital-person-uuid",
      "type": "digital",
      "joined_on": "2025-11-11 14:30:45.123456"
    },
    {
      "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "type": "organic",
      "joined_on": "2025-11-11 14:30:45.123456"
    }
  ],
  "digital_notes": "AI-generated summary of discussion",
  "organic_notes": "Follow up on deployment status",
  "created_on": "2025-11-11 14:30:45.123456",
  "updated_on": null
}
curl -X GET https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000 \
  -H "Content-Type: application/json"
<?php
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    $data = json_decode($response, true);
    echo "Conversation: " . $data['name'] . "\n";
    echo "Participants: " . count($data['participants']) . "\n";
}
// 400 Bad Request - Missing conversation_id
{
  "success": false,
  "error": "conversation_id is required"
}

// 404 Not Found - Conversation not found
{
  "success": false,
  "error": "Conversation not found",
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000"
}

// 500 Internal Server Error
{
  "success": false,
  "error": "Internal server error",
  "message": "[detailed error message]"
}
PUT /v1/memory/conversation/{conversationId}

Update conversation properties such as status, name, metadata, or notes. All fields are optional. PII fields (name, notes) are automatically encrypted before storage.

Request Body (all optional)
Parameter Type Description
status string Conversation status (e.g., "active", "inactive", "archived")
name string Updated conversation name (encrypted automatically)
metadata object Updated metadata (merged with existing)
digital_notes string AI-generated notes (encrypted automatically)
organic_notes string Human-written notes (encrypted automatically)
{
  "status": "active",
  "name": "Updated Project Discussion",
  "metadata": {
    "project": "NC5-API",
    "priority": "high"
  },
  "digital_notes": "AI summary of conversation topics",
  "organic_notes": "Remember to follow up next week"
}
{
  "success": true,
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "updated_fields": ["status", "name", "metadata", "digital_notes", "organic_notes"],
  "timestamp": "2025-11-11T15:45:30Z"
}
curl -X PUT https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000 \
  -H "Content-Type: application/json" \
  -d '{
    "status": "active",
    "name": "Updated Project Discussion",
    "metadata": {"project": "NC5-API", "priority": "high"},
    "digital_notes": "AI summary of conversation topics",
    "organic_notes": "Remember to follow up next week"
  }'
<?php
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId;

$payload = json_encode([
    'status' => 'active',
    'name' => 'Updated Project Discussion',
    'metadata' => ['project' => 'NC5-API', 'priority' => 'high'],
    'digital_notes' => 'AI summary of conversation topics',
    'organic_notes' => 'Remember to follow up next week'
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    echo "Conversation updated successfully\n";
}
// 400 Bad Request - Missing conversation_id
{
  "success": false,
  "error": "conversation_id is required"
}

// 400 Bad Request - Invalid JSON
{
  "success": false,
  "error": "Invalid JSON payload",
  "message": "Syntax error"
}

// 400 Bad Request - No data provided
{
  "success": false,
  "error": "No data provided for update"
}

// 404 Not Found - Conversation not found or no changes made
{
  "success": false,
  "error": "Conversation not found or no changes made",
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000"
}

// 500 Internal Server Error
{
  "success": false,
  "error": "Internal server error",
  "message": "[detailed error message]"
}
POST /v1/memory/conversations/search

Search and filter conversations with pagination support. Supports filtering by owner, type, status, date ranges, and archival status. Returns paginated results with total counts.

Request Body
Parameter Type Required Description
owner_id string (UUID) Optional Filter by conversation owner
type string Optional Filter by conversation type
status string Optional Filter by status (active, inactive, archived)
created_after string (datetime) Optional Filter by creation date (after)
created_before string (datetime) Optional Filter by creation date (before)
archived boolean Optional Filter by archival status
limit integer Optional Results per page (default: 50)
offset integer Optional Pagination offset (default: 0)
order_by string Optional Sort field (default: "created_on")
order_dir string Optional Sort direction: ASC or DESC (default: DESC)
{
  "owner_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "status": "active",
  "type": "private:digital",
  "created_after": "2025-11-01 00:00:00",
  "archived": false,
  "limit": 20,
  "offset": 0,
  "order_by": "created_on",
  "order_dir": "DESC"
}
{
  "success": true,
  "total": 45,
  "count": 20,
  "limit": 20,
  "offset": 0,
  "results": [
    {
      "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
      "owner_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "name": "Project Discussion",
      "type": "private:digital",
      "status": "active",
      "metadata": {
        "department": "engineering"
      },
      "created_on": "2025-11-11 14:30:45.123456",
      "updated_on": null,
      "archived_on": null
    }
  ]
}
curl -X POST https://api.neuralcore5.ai/v1/memory/conversations/search \
  -H "Content-Type: application/json" \
  -d '{
    "owner_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "status": "active",
    "limit": 20,
    "offset": 0,
    "order_by": "created_on",
    "order_dir": "DESC"
  }'
<?php
$ch = curl_init('https://api.neuralcore5.ai/v1/memory/conversations/search');

$payload = json_encode([
    'owner_id' => '7c9e6679-7425-40de-944b-e07fc1f90ae7',
    'status' => 'active',
    'limit' => 20,
    'offset' => 0,
    'order_by' => 'created_on',
    'order_dir' => 'DESC'
]);

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);

echo "Found " . $data['total'] . " conversations\n";
echo "Returned " . $data['count'] . " in this page\n";
DELETE /v1/memory/conversation/{conversationId}

Delete or archive a conversation. By default performs soft delete (archival) which preserves data. Pass hard_delete=true for permanent deletion (use with caution).

Query Parameters
Parameter Type Default Description
hard_delete boolean false If true, permanently deletes. If false, archives (soft delete)
{
  "success": true,
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "deleted": true,
  "hard_delete": false,
  "timestamp": "2025-11-11T16:20:00Z"
}
# Soft delete (archive)
curl -X DELETE https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000 \
  -H "Content-Type: application/json"

# Hard delete (permanent)
curl -X DELETE https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000?hard_delete=true \
  -H "Content-Type: application/json"
<?php
// Soft delete (archive)
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

// Hard delete (permanent)
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId . '?hard_delete=true';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
GET /v1/memory/conversation/{conversationId}/stats

Get detailed statistics for a conversation including message counts, participant counts, and activity metrics. Uses stored procedure sp_conversation_stats for optimized performance.

{
  "success": true,
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "total_messages": 47,
  "total_participants": 3,
  "active_participants": 2,
  "first_message_at": "2025-11-11 14:30:45.123456",
  "last_message_at": "2025-11-11 16:20:15.456789",
  "duration_hours": 1.83
}
curl -X GET https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000/stats \
  -H "Content-Type: application/json"
<?php
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId . '/stats';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$stats = json_decode($response, true);
echo "Total messages: " . $stats['total_messages'];
GET /v1/memory/conversations/counts

Get conversation counts grouped by status. Useful for dashboard metrics and overview statistics.

{
  "success": true,
  "counts": {
    "active": 125,
    "inactive": 34,
    "archived": 89
  },
  "total": 248
}
curl -X GET https://api.neuralcore5.ai/v1/memory/conversations/counts \
  -H "Content-Type: application/json"
<?php
$ch = curl_init('https://api.neuralcore5.ai/v1/memory/conversations/counts');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Active conversations: " . $data['counts']['active'];
POST /v1/memory/conversations/archive-old

Batch archive old inactive conversations. Typically called by cron workers. Uses stored procedure sp_archive_old_conversations for optimized batch processing.

Request Body
Parameter Type Default Description
days_inactive integer 90 Archive conversations inactive for this many days
batch_size integer 50 Maximum conversations to archive in one batch
{
  "days_inactive": 90,
  "batch_size": 50
}
{
  "success": true,
  "archived_count": 23,
  "days_inactive": 90,
  "batch_size": 50,
  "timestamp": "2025-11-11T16:30:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/memory/conversations/archive-old \
  -H "Content-Type: application/json" \
  -d '{
    "days_inactive": 90,
    "batch_size": 50
  }'
<?php
$ch = curl_init('https://api.neuralcore5.ai/v1/memory/conversations/archive-old');

$payload = json_encode([
    'days_inactive' => 90,
    'batch_size' => 50
]);

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Archived " . $data['archived_count'] . " conversations";
Important Implementation Notes
  • PII Encryption: All PII fields (name, digital_notes, organic_notes) are automatically encrypted using Waffles encryption before storage and decrypted in API responses.
  • Microsecond Timestamps: All timestamps use DATETIME(6) format for precise event ordering (e.g., "2025-11-11 14:30:45.123456").
  • Soft Delete Default: DELETE operations perform soft delete (archival) by default. Use hard_delete=true query parameter for permanent deletion.
  • Metadata Merging: When updating metadata, new values are merged with existing metadata rather than replacing it.
  • Activity Logging: All conversation operations are automatically logged to the audit trail for compliance and rollback capability.
  • Stored Procedures: Statistics and batch operations use MariaDB stored procedures for optimized performance.
  • Minimum Participants: All conversations require at least 2 participants. The system enforces participant rules based on conversation type.
GET /v1/memory/conversation/{conversationId}

Retrieve detailed information about a specific conversation including all metadata, participants, and timestamps. Encrypted fields (name, digital_notes, organic_notes) are automatically decrypted in the response.

Path Parameters
Parameter Type Description
conversationId string (UUID) The unique identifier of the conversation
{
  "success": true,
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "object": "conversation",
  "type": "private:digital",
  "started": "2025-11-11T14:30:45Z",
  "metadata": {
    "department": "engineering",
    "priority": "high"
  },
  "status": "active",
  "name": "Project Discussion",
  "owner_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "participants": [
    {
      "id": "digital-person-uuid",
      "type": "digital",
      "joined_on": "2025-11-11 14:30:45.123456"
    },
    {
      "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "type": "organic",
      "joined_on": "2025-11-11 14:30:45.123456"
    }
  ],
  "digital_notes": "AI-generated summary of discussion",
  "organic_notes": "Follow up on deployment status",
  "created_on": "2025-11-11 14:30:45.123456",
  "updated_on": null
}
curl -X GET https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000 \
  -H "Content-Type: application/json"
<?php
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    $data = json_decode($response, true);
    echo "Conversation: " . $data['name'];
    echo "\nParticipants: " . count($data['participants']);
}
PUT /v1/memory/conversation/{conversationId}

Update conversation properties such as status, name, metadata, or notes. All fields are optional. PII fields (name, notes) are automatically encrypted before storage.

Request Body (all optional)
Parameter Type Description
status string Conversation status (e.g., "active", "inactive", "archived")
name string Updated conversation name (encrypted automatically)
metadata object Updated metadata (merged with existing)
digital_notes string AI-generated notes (encrypted automatically)
organic_notes string Human-written notes (encrypted automatically)
{
  "status": "active",
  "name": "Updated Project Discussion",
  "metadata": {
    "project": "NC5-API",
    "priority": "high"
  },
  "digital_notes": "AI summary of conversation topics",
  "organic_notes": "Remember to follow up next week"
}
{
  "success": true,
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "updated_fields": ["status", "name", "metadata", "digital_notes", "organic_notes"],
  "timestamp": "2025-11-11T15:45:30Z"
}
curl -X PUT https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000 \
  -H "Content-Type: application/json" \
  -d '{
    "status": "active",
    "name": "Updated Project Discussion",
    "metadata": {"project": "NC5-API", "priority": "high"},
    "digital_notes": "AI summary of conversation topics",
    "organic_notes": "Remember to follow up next week"
  }'
<?php
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId;

$payload = json_encode([
    'status' => 'active',
    'name' => 'Updated Project Discussion',
    'metadata' => ['project' => 'NC5-API', 'priority' => 'high'],
    'digital_notes' => 'AI summary of conversation topics',
    'organic_notes' => 'Remember to follow up next week'
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    echo "Conversation updated successfully";
}
POST /v1/memory/conversations/search

Search and filter conversations with pagination support. Supports filtering by owner, type, status, date ranges, and archival status. Returns paginated results with total counts.

Request Body
Parameter Type Required Description
owner_id string (UUID) Optional Filter by conversation owner
type string Optional Filter by conversation type
status string Optional Filter by status (active, inactive, archived)
created_after string (datetime) Optional Filter by creation date (after)
created_before string (datetime) Optional Filter by creation date (before)
archived boolean Optional Filter by archival status
limit integer Optional Results per page (default: 50)
offset integer Optional Pagination offset (default: 0)
order_by string Optional Sort field (default: "created_on")
order_dir string Optional Sort direction: ASC or DESC (default: DESC)
{
  "owner_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "status": "active",
  "type": "private:digital",
  "created_after": "2025-11-01 00:00:00",
  "archived": false,
  "limit": 20,
  "offset": 0,
  "order_by": "created_on",
  "order_dir": "DESC"
}
{
  "success": true,
  "total": 45,
  "count": 20,
  "limit": 20,
  "offset": 0,
  "results": [
    {
      "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
      "owner_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "name": "Project Discussion",
      "type": "private:digital",
      "status": "active",
      "metadata": {
        "department": "engineering"
      },
      "created_on": "2025-11-11 14:30:45.123456",
      "updated_on": null,
      "archived_on": null
    }
  ]
}
curl -X POST https://api.neuralcore5.ai/v1/memory/conversations/search \
  -H "Content-Type: application/json" \
  -d '{
    "owner_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "status": "active",
    "limit": 20,
    "offset": 0,
    "order_by": "created_on",
    "order_dir": "DESC"
  }'
<?php
$ch = curl_init('https://api.neuralcore5.ai/v1/memory/conversations/search');

$payload = json_encode([
    'owner_id' => '7c9e6679-7425-40de-944b-e07fc1f90ae7',
    'status' => 'active',
    'limit' => 20,
    'offset' => 0,
    'order_by' => 'created_on',
    'order_dir' => 'DESC'
]);

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);

echo "Found " . $data['total'] . " conversations\n";
echo "Returned " . $data['count'] . " in this page\n";
DELETE /v1/memory/conversation/{conversationId}

Delete or archive a conversation. By default performs soft delete (archival) which preserves data. Pass hard_delete=true for permanent deletion (use with caution).

Query Parameters
Parameter Type Default Description
hard_delete boolean false If true, permanently deletes. If false, archives (soft delete)
{
  "success": true,
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "deleted": true,
  "hard_delete": false,
  "timestamp": "2025-11-11T16:20:00Z"
}
# Soft delete (archive)
curl -X DELETE https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000 \
  -H "Content-Type: application/json"

# Hard delete (permanent)
curl -X DELETE https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000?hard_delete=true \
  -H "Content-Type: application/json"
<?php
// Soft delete (archive)
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

// Hard delete (permanent)
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId . '?hard_delete=true';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
GET /v1/memory/conversation/{conversationId}/stats

Get detailed statistics for a conversation including message counts, participant counts, and activity metrics. Uses stored procedure sp_conversation_stats for optimized performance.

{
  "success": true,
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "total_messages": 47,
  "total_participants": 3,
  "active_participants": 2,
  "first_message_at": "2025-11-11 14:30:45.123456",
  "last_message_at": "2025-11-11 16:20:15.456789",
  "duration_hours": 1.83
}
curl -X GET https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000/stats \
  -H "Content-Type: application/json"
<?php
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId . '/stats';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$stats = json_decode($response, true);
echo "Total messages: " . $stats['total_messages'];
GET /v1/memory/conversations/counts

Get conversation counts grouped by status. Useful for dashboard metrics and overview statistics.

{
  "success": true,
  "counts": {
    "active": 125,
    "inactive": 34,
    "archived": 89
  },
  "total": 248
}
curl -X GET https://api.neuralcore5.ai/v1/memory/conversations/counts \
  -H "Content-Type: application/json"
<?php
$ch = curl_init('https://api.neuralcore5.ai/v1/memory/conversations/counts');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Active conversations: " . $data['counts']['active'];
POST /v1/memory/conversations/archive-old

Batch archive old inactive conversations. Typically called by cron workers. Uses stored procedure sp_archive_old_conversations for optimized batch processing.

Request Body
Parameter Type Default Description
days_inactive integer 90 Archive conversations inactive for this many days
batch_size integer 50 Maximum conversations to archive in one batch
{
  "days_inactive": 90,
  "batch_size": 50
}
{
  "success": true,
  "archived_count": 23,
  "days_inactive": 90,
  "batch_size": 50,
  "timestamp": "2025-11-11T16:30:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/memory/conversations/archive-old \
  -H "Content-Type: application/json" \
  -d '{
    "days_inactive": 90,
    "batch_size": 50
  }'
<?php
$ch = curl_init('https://api.neuralcore5.ai/v1/memory/conversations/archive-old');

$payload = json_encode([
    'days_inactive' => 90,
    'batch_size' => 50
]);

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Archived " . $data['archived_count'] . " conversations";
Important Implementation Notes
  • PII Encryption: All PII fields (name, digital_notes, organic_notes) are automatically encrypted using Waffles encryption before storage and decrypted in API responses.
  • Microsecond Timestamps: All timestamps use DATETIME(6) format for precise event ordering (e.g., "2025-11-11 14:30:45.123456").
  • Soft Delete Default: DELETE operations perform soft delete (archival) by default. Use hard_delete=true query parameter for permanent deletion.
  • Metadata Merging: When updating metadata, new values are merged with existing metadata rather than replacing it.
  • Activity Logging: All conversation operations are automatically logged to the audit trail for compliance and rollback capability.
  • Stored Procedures: Statistics and batch operations use MariaDB stored procedures for optimized performance.

DOCUMENTS & FILES

POST /v1/memory/document

Ingest a document for processing, chunking, and embedding into the knowledge base.

Request Body
Parameter Type Required Description
doc_name string Required Document title/name
content string Required Document content (will be chunked and embedded)
doc_id string (UUID) Optional Custom document ID (generated if not provided)
source_url string Optional Source URL of the document
authority_tag string Optional Authority level (default: NORMAL)
knowledge_tag string Optional RAG classification tag (default: SHARED:GENERAL)
auto_chunk boolean Optional Automatically chunk document (default: true)
auto_embed boolean Optional Automatically embed chunks (default: true)
metadata object Optional Additional document metadata
{
  "doc_name": "Product Requirements Document",
  "content": "Full document content here...",
  "source_url": "https://example.com/docs/prd.pdf",
  "authority_tag": "NORMAL",
  "knowledge_tag": "PRIVATE:USER_DOCS",
  "auto_chunk": true,
  "auto_embed": true,
  "metadata": {
    "file_type": "pdf",
    "page_count": 15,
    "author": "John Doe"
  }
}
{
  "success": true,
  "doc_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "created",
  "chunk_count": 42,
  "embedded_count": 42,
  "timestamp": "2025-11-11T15:45:30Z"
}
GET /v1/memory/document/{docId}

Retrieve a specific document with its metadata and processing status.

Path Parameters
Parameter Type Description
docId string (UUID) The unique identifier of the document
{
  "success": true,
  "document": {
    "doc_id": "550e8400-e29b-41d4-a716-446655440000",
    "doc_name": "Product Requirements Document",
    "source_url": "https://example.com/docs/prd.pdf",
    "version_hash": "a3c2f1...",
    "authority_tag": "NORMAL",
    "created_on": "2025-11-11 14:30:45.123456",
    "metadata_json": {
      "file_type": "pdf",
      "page_count": 15,
      "author": "John Doe"
    }
  }
}
GET /v1/memory/documents

List all documents with optional filtering and pagination.

Query Parameters
Parameter Type Required Description
authority_tag string Optional Filter by authority tag
limit integer Optional Number of results (default: 50)
offset integer Optional Pagination offset (default: 0)
{
  "success": true,
  "documents": [
    {
      "doc_id": "550e8400-e29b-41d4-a716-446655440000",
      "doc_name": "Product Requirements Document",
      "authority_tag": "NORMAL",
      "created_on": "2025-11-11 14:30:45.123456"
    }
  ],
  "count": 1,
  "limit": 50,
  "offset": 0
}
DELETE /v1/memory/document/{docId}

Delete a document and all associated chunks from the knowledge base.

Path Parameters
Parameter Type Description
docId string (UUID) The unique identifier of the document
{
  "success": true,
  "doc_id": "550e8400-e29b-41d4-a716-446655440000",
  "timestamp": "2025-11-11T15:45:30Z"
}

File Management

POST /v1/memory/file/organic/{opid}

Upload a file for an organic user. Files are stored in DATA_PATH/organics/{opid}/files/

Path Parameters
Parameter Type Description
opid string Organic Person ID (OPID)
Form Data
Parameter Type Required Description
file file Required File to upload (max 50MB, see allowed types below)
curl -X POST \
  https://api.neuralcore5.ai/v1/memory/file/organic/OP123456 \
  -F "file=@/path/to/document.pdf"
{
  "success": true,
  "file": {
    "file_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "filename": "document.pdf",
    "storage_filename": "f47ac10b-58cc-4372-a567-0e02b2c3d479.pdf",
    "path": "/data/organics/OP123456/files/f47ac10b-58cc-4372-a567-0e02b2c3d479.pdf",
    "size": 1048576,
    "mime_type": "application/pdf",
    "extension": "pdf",
    "uploaded_at": "2025-11-11T15:45:30Z",
    "sha256": "a3c2f1b0d8e7..."
  },
  "timestamp": "2025-11-11T15:45:30Z"
}
POST /v1/memory/file/digital/{digitalId}

Upload a file for a digital person. Files are stored in DATA_PATH/digitals/{digitalId}/files/

Path Parameters
Parameter Type Description
digitalId string (UUID) Digital person ID
Form Data
Parameter Type Required Description
file file Required File to upload (max 50MB)
curl -X POST \
  https://api.neuralcore5.ai/v1/memory/file/digital/550e8400-e29b-41d4-a716-446655440000 \
  -F "file=@/path/to/image.jpg"
{
  "success": true,
  "file": {
    "file_id": "8b3d5f2a-9c1e-4a7b-8d6f-1e2c3d4f5a6b",
    "filename": "image.jpg",
    "storage_filename": "8b3d5f2a-9c1e-4a7b-8d6f-1e2c3d4f5a6b.jpg",
    "path": "/data/digitals/550e8400-e29b-41d4-a716-446655440000/files/8b3d5f2a-9c1e-4a7b-8d6f-1e2c3d4f5a6b.jpg",
    "size": 524288,
    "mime_type": "image/jpeg",
    "extension": "jpg",
    "uploaded_at": "2025-11-11T15:45:30Z",
    "sha256": "b4d3e2f1a0c9..."
  },
  "timestamp": "2025-11-11T15:45:30Z"
}
GET /v1/memory/file/{fileId}

Retrieve file metadata by file ID.

Path Parameters
Parameter Type Description
fileId string (UUID) File ID
Query Parameters
Parameter Type Required Description
owner_type string Required Owner type: "organic" or "digital"
owner_id string Required Owner ID (OPID or digital_id)
{
  "success": true,
  "file": {
    "file_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "filename": "document.pdf",
    "storage_filename": "f47ac10b-58cc-4372-a567-0e02b2c3d479.pdf",
    "path": "/data/organics/OP123456/files/f47ac10b-58cc-4372-a567-0e02b2c3d479.pdf",
    "size": 1048576,
    "mime_type": "application/pdf",
    "extension": "pdf",
    "uploaded_at": "2025-11-11T15:45:30Z",
    "sha256": "a3c2f1b0d8e7..."
  }
}
DELETE /v1/memory/file/{fileId}

Delete a file and its metadata from storage.

Path Parameters
Parameter Type Description
fileId string (UUID) File ID
Request Body
Parameter Type Required Description
owner_type string Required Owner type: "organic" or "digital"
owner_id string Required Owner ID (OPID or digital_id)
{
  "owner_type": "organic",
  "owner_id": "OP123456"
}
{
  "success": true,
  "file_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "timestamp": "2025-11-11T15:45:30Z"
}

MESSAGES

POST /v1/memory/message

Create a new message in a conversation with full support for encrypted content, metadata, and optional fields.

Request Body
Parameter Type Required Description
conversation_id string (UUID) Required Conversation identifier
sender_id string Required Sender identifier
sender_role string Required Role: "user", "assistant", or "system"
content string Required Message content (will be encrypted)
source string Required Source channel (e.g., "web_text", "sms", "api")
knowledge_tag string Optional RAG classification tag
metadata object Optional Additional message metadata
digital_notes string Optional AI-generated notes (will be encrypted)
organic_notes string Optional Human notes (will be encrypted)
{
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "sender_id": "user-uuid",
  "sender_role": "user",
  "content": "Hello, this is a test message",
  "source": "web_text",
  "knowledge_tag": "SHARED:GENERAL",
  "metadata": {
    "client_ip": "127.0.0.1"
  }
}
{
  "success": true,
  "message_id": "msg-550e8400-e29b-41d4-a716-446655440000",
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "timestamp": "2025-11-11T15:45:30Z"
}
curl -X POST https://api.neuralcore5.ai/v1/memory/message \
  -H "Content-Type: application/json" \
  -d '{
    "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
    "sender_id": "user-uuid",
    "sender_role": "user",
    "content": "Hello, this is a test message",
    "source": "web_text",
    "knowledge_tag": "SHARED:GENERAL"
  }'
<?php
$url = 'https://api.neuralcore5.ai/v1/memory/message';

$payload = json_encode([
    'conversation_id' => '550e8400-e29b-41d4-a716-446655440000',
    'sender_id' => 'user-uuid',
    'sender_role' => 'user',
    'content' => 'Hello, this is a test message',
    'source' => 'web_text',
    'knowledge_tag' => 'SHARED:GENERAL'
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);
GET /v1/memory/message/{messageId}

Retrieve a single message by its ID with all associated metadata and decrypted content.

Path Parameters
Parameter Type Description
messageId string (UUID) The unique identifier of the message
{
  "success": true,
  "message": {
    "message_id": "msg-550e8400-e29b-41d4-a716-446655440000",
    "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
    "sender_id": "user-uuid",
    "sender_role": "user",
    "content": "Hello, this is a test message",
    "source": "web_text",
    "knowledge_tag": "SHARED:GENERAL",
    "is_embedded": 0,
    "metadata": {"client_ip": "127.0.0.1"},
    "sent_on": "2025-11-11 15:45:30.123456"
  }
}
curl -X GET https://api.neuralcore5.ai/v1/memory/message/msg-550e8400-e29b-41d4-a716-446655440000 \
  -H "Content-Type: application/json"
<?php
$messageId = 'msg-550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/message/' . $messageId;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
if ($data['success']) {
    echo "Message: " . $data['message']['content'];
}
PUT /v1/memory/message/{messageId}

Update an existing message's content, notes, metadata, or other properties.

Request Body (all optional)
Parameter Type Description
content string Updated message content
digital_notes string Updated AI notes
organic_notes string Updated human notes
knowledge_tag string Updated RAG classification
metadata object Updated metadata (merged with existing)
{
  "content": "Updated message content",
  "digital_notes": "AI added context from RAG",
  "knowledge_tag": "PRIVATE:USER_CONTEXT",
  "metadata": {
    "updated_reason": "typo correction"
  }
}
{
  "success": true,
  "message_id": "msg-550e8400-e29b-41d4-a716-446655440000",
  "updated_fields": ["content", "digital_notes", "knowledge_tag", "metadata"],
  "timestamp": "2025-11-11T15:45:30Z"
}
curl -X PUT https://api.neuralcore5.ai/v1/memory/message/msg-550e8400-e29b-41d4-a716-446655440000 \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Updated message content",
    "digital_notes": "AI added context from RAG",
    "knowledge_tag": "PRIVATE:USER_CONTEXT"
  }'
<?php
$messageId = 'msg-550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/message/' . $messageId;

$payload = json_encode([
    'content' => 'Updated message content',
    'digital_notes' => 'AI added context from RAG',
    'knowledge_tag' => 'PRIVATE:USER_CONTEXT'
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);
DELETE /v1/memory/message/{messageId}

Soft delete a message by marking it as deleted in flags. The message remains in the database but is excluded from queries by default.

Request Body (optional)
Parameter Type Description
deleted_by string User/system ID performing deletion (default: "SYSTEM")
{
  "deleted_by": "user-uuid"
}
{
  "success": true,
  "message_id": "msg-550e8400-e29b-41d4-a716-446655440000",
  "deleted_by": "user-uuid",
  "timestamp": "2025-11-11T15:45:30Z"
}
curl -X DELETE https://api.neuralcore5.ai/v1/memory/message/msg-550e8400-e29b-41d4-a716-446655440000 \
  -H "Content-Type: application/json" \
  -d '{"deleted_by": "user-uuid"}'
<?php
$messageId = 'msg-550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/message/' . $messageId;

$payload = json_encode(['deleted_by' => 'user-uuid']);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);
GET /v1/memory/history/{conversationId}

Retrieve the complete message history for a conversation with pagination, ordering, and optional inclusion of deleted messages.

Query Parameters
Parameter Type Default Description
limit integer 50 Maximum number of messages to return
offset integer 0 Offset for pagination
order string ASC Order direction: ASC or DESC
include_deleted boolean false Include soft-deleted messages
{
  "success": true,
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "messages": [
    {
      "message_id": "msg-1",
      "sender_id": "user-uuid",
      "sender_role": "user",
      "content": "Hello!",
      "sent_on": "2025-11-11 14:30:45.123456"
    },
    {
      "message_id": "msg-2",
      "sender_id": "ai-uuid",
      "sender_role": "assistant",
      "content": "Hi! How can I help?",
      "sent_on": "2025-11-11 14:30:46.234567"
    }
  ],
  "count": 2,
  "total": 25,
  "limit": 50,
  "offset": 0
}
curl -X GET "https://api.neuralcore5.ai/v1/memory/history/550e8400-e29b-41d4-a716-446655440000?limit=100&order=DESC" \
  -H "Content-Type: application/json"
<?php
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/history/' . $conversationId . '?limit=100&order=DESC';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Total messages: " . $data['total'];
GET /v1/memory/messages/search

Advanced message search with multiple filter criteria including conversation, sender, role, source, knowledge tags, embedding status, and date ranges.

Query Parameters (all optional)
Parameter Type Description
conversation_id string (UUID) Filter by conversation
sender_id string Filter by sender
sender_role string Filter by role (user, assistant, system)
source string Filter by source channel
knowledge_tag string Filter by RAG classification
is_embedded boolean Filter by embedding status
limit integer Result limit (default: 50)
{
  "success": true,
  "messages": [
    {
      "message_id": "msg-1",
      "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
      "sender_id": "user-uuid",
      "sender_role": "user",
      "content": "Search result message",
      "source": "web_text",
      "knowledge_tag": "SHARED:GENERAL",
      "is_embedded": 1,
      "sent_on": "2025-11-11 14:30:45.123456"
    }
  ],
  "count": 1,
  "limit": 50,
  "offset": 0
}
curl -X GET "https://api.neuralcore5.ai/v1/memory/messages/search?sender_role=user&knowledge_tag=SHARED:GENERAL&limit=100" \
  -H "Content-Type: application/json"
<?php
$params = http_build_query([
    'sender_role' => 'user',
    'knowledge_tag' => 'SHARED:GENERAL',
    'limit' => 100
]);

$url = 'https://api.neuralcore5.ai/v1/memory/messages/search?' . $params;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
foreach ($data['messages'] as $msg) {
    echo $msg['content'] . "\n";
}
POST /v1/memory/messages/bulk-delete

Soft delete multiple messages at once by marking them as deleted in flags. Efficient batch operation for cleanup tasks.

Request Body
Parameter Type Required Description
message_ids array Required Array of message IDs to delete
deleted_by string Optional User/system ID performing deletion (default: "SYSTEM")
{
  "message_ids": [
    "msg-1-uuid",
    "msg-2-uuid",
    "msg-3-uuid"
  ],
  "deleted_by": "cleanup-worker"
}
{
  "success": true,
  "deleted_count": 3,
  "deleted_by": "cleanup-worker",
  "timestamp": "2025-11-11T15:45:30Z"
}
curl -X POST https://api.neuralcore5.ai/v1/memory/messages/bulk-delete \
  -H "Content-Type: application/json" \
  -d '{
    "message_ids": ["msg-1-uuid", "msg-2-uuid", "msg-3-uuid"],
    "deleted_by": "cleanup-worker"
  }'
<?php
$url = 'https://api.neuralcore5.ai/v1/memory/messages/bulk-delete';

$payload = json_encode([
    'message_ids' => ['msg-1-uuid', 'msg-2-uuid', 'msg-3-uuid'],
    'deleted_by' => 'cleanup-worker'
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Deleted " . $data['deleted_count'] . " messages";
GET /v1/memory/messages/unembedded

Retrieve messages that haven't been embedded yet for RAG processing. Used by embedding workers to process the embedding queue.

Query Parameters
Parameter Type Default Description
limit integer 50 Maximum number of messages to return
{
  "success": true,
  "messages": [
    {
      "message_id": "msg-1",
      "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
      "content": "Message waiting for embedding",
      "is_embedded": 0,
      "minutes_waiting": 5
    }
  ],
  "count": 1,
  "limit": 50
}
curl -X GET "https://api.neuralcore5.ai/v1/memory/messages/unembedded?limit=100" \
  -H "Content-Type: application/json"
<?php
$url = 'https://api.neuralcore5.ai/v1/memory/messages/unembedded?limit=100';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
foreach ($data['messages'] as $msg) {
    // Process message for embedding
    processEmbedding($msg['message_id'], $msg['content']);
}
PUT /v1/memory/message/{messageId}/embedded

Mark a message as embedded after successful RAG processing. Updates the is_embedded flag to indicate the message has been vectorized.

Path Parameters
Parameter Type Description
messageId string (UUID) The unique identifier of the message
{
  "success": true,
  "message_id": "msg-550e8400-e29b-41d4-a716-446655440000",
  "is_embedded": true,
  "timestamp": "2025-11-11T15:45:30Z"
}
curl -X PUT https://api.neuralcore5.ai/v1/memory/message/msg-550e8400-e29b-41d4-a716-446655440000/embedded \
  -H "Content-Type: application/json"
<?php
$messageId = 'msg-550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/message/' . $messageId . '/embedded';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
if ($data['success']) {
    echo "Message marked as embedded";
}
GET /v1/memory/embedding-status

Get the current status of message embedding processing, including queue depth, embedded count, and processing percentage.

Query Parameters
Parameter Type Description
conversation_id string (UUID) Optional filter by conversation
{
  "success": true,
  "queue_depth": 42,
  "embedded_count": 1508,
  "total_messages": 1550,
  "processing_percentage": 97.29,
  "conversation_id": null,
  "timestamp": "2025-11-11T15:45:30Z"
}
curl -X GET "https://api.neuralcore5.ai/v1/memory/embedding-status?conversation_id=550e8400-e29b-41d4-a716-446655440000" \
  -H "Content-Type: application/json"
<?php
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/embedding-status?conversation_id=' . $conversationId;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Queue depth: " . $data['queue_depth'] . "\n";
echo "Processing: " . $data['processing_percentage'] . "%\n";

PARTICIPANTS

Manage conversation participants including adding, removing, and listing participants. Participants can be either organic (human) or digital (AI). The system tracks join/leave timestamps and maintains participant history.

POST /v1/memory/conversation/{conversationId}/participant

Add a single participant to an existing conversation. If the participant was previously removed (has a left_on timestamp), this will reactivate them by setting left_on to NULL. Activity is automatically logged to the audit trail.

Path Parameters
Parameter Type Description
conversationId string (UUID) The unique identifier of the conversation
Request Body
Parameter Type Required Description
id string (UUID) Required Participant identifier (UUID of organic person or digital person)
type string Required Participant type. Must be organic or digital
Participant Types
  • organic - Human participant (uses organic person UUID)
  • digital - Digital person/AI participant (uses digital person UUID)
{
  "id": "new-participant-uuid-abc123",
  "type": "organic"
}
{
  "success": true,
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "participant": {
    "id": "new-participant-uuid-abc123",
    "type": "organic"
  },
  "timestamp": "2025-11-13T15:45:30Z"
}
curl -X POST https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000/participant \
  -H "Content-Type: application/json" \
  -d '{
    "id": "new-participant-uuid-abc123",
    "type": "organic"
  }'
<?php
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId . '/participant';

$payload = json_encode([
    'id' => 'new-participant-uuid-abc123',
    'type' => 'organic'
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 201) {
    $data = json_decode($response, true);
    echo "Participant added: " . $data['participant']['id'] . "\n";
} else {
    echo "Error: HTTP " . $httpCode . "\n";
}
// 400 Bad Request - Missing conversation_id
{
  "success": false,
  "error": "conversation_id is required"
}

// 400 Bad Request - Invalid JSON payload
{
  "success": false,
  "error": "Invalid JSON payload",
  "message": "Syntax error"
}

// 400 Bad Request - Missing 'id' field
{
  "success": false,
  "error": "Missing required field",
  "field": "id"
}

// 400 Bad Request - Missing 'type' field
{
  "success": false,
  "error": "Missing required field",
  "field": "type"
}

// 400 Bad Request - Invalid participant type
{
  "success": false,
  "error": "Invalid type. Must be 'organic' or 'digital'"
}

// 500 Internal Server Error - Failed to add
{
  "success": false,
  "error": "Failed to add participant"
}

// 500 Internal Server Error - General error
{
  "success": false,
  "error": "Internal server error",
  "message": "[detailed error message]"
}
GET /v1/memory/conversation/{conversationId}/participants

Retrieve all participants for a conversation with optional filtering. Returns participant details including join/leave timestamps and active status. By default, only returns active participants (those who haven't left).

Path Parameters
Parameter Type Description
conversationId string (UUID) The unique identifier of the conversation
Query Parameters
Parameter Type Default Description
active_only boolean true If true, returns only active participants (left_on is NULL). If false, returns all participants including those who have left.
// Active participants only (default)
{
  "success": true,
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "participants": [
    {
      "id": "digital-person-uuid",
      "type": "digital",
      "joined_on": "2025-11-11 14:30:45.123456",
      "active": true
    },
    {
      "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "type": "organic",
      "joined_on": "2025-11-11 14:30:45.123456",
      "active": true
    }
  ],
  "count": 2
}

// All participants (including inactive)
{
  "success": true,
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "participants": [
    {
      "id": "digital-person-uuid",
      "type": "digital",
      "joined_on": "2025-11-11 14:30:45.123456",
      "active": true
    },
    {
      "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "type": "organic",
      "joined_on": "2025-11-11 14:30:45.123456",
      "active": true
    },
    {
      "id": "previous-participant-uuid",
      "type": "organic",
      "joined_on": "2025-11-11 14:30:45.123456",
      "left_on": "2025-11-12 10:15:30.456789",
      "active": false
    }
  ],
  "count": 3
}
# Get active participants only (default)
curl -X GET "https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000/participants" \
  -H "Content-Type: application/json"

# Get all participants including inactive
curl -X GET "https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000/participants?active_only=false" \
  -H "Content-Type: application/json"
<?php
$conversationId = '550e8400-e29b-41d4-a716-446655440000';

// Get active participants only
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId . '/participants';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Active participants: " . $data['count'] . "\n";

foreach ($data['participants'] as $participant) {
    $status = $participant['active'] ? 'active' : 'inactive';
    echo "- {$participant['id']} ({$participant['type']}) - {$status}\n";
}

// Get all participants including inactive
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId . '/participants?active_only=false';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "\nTotal participants (including inactive): " . $data['count'] . "\n";
// 400 Bad Request - Missing conversation_id
{
  "success": false,
  "error": "conversation_id is required"
}

// 404 Not Found - Conversation not found
{
  "success": false,
  "error": "Conversation not found",
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000"
}

// 500 Internal Server Error
{
  "success": false,
  "error": "Internal server error",
  "message": "[detailed error message]"
}
DELETE /v1/memory/conversation/{conversationId}/participant/{participantId}

Remove a participant from a conversation by setting their left_on timestamp. This is a soft delete - the participant record is preserved for historical purposes. Activity is automatically logged to the audit trail.

Path Parameters
Parameter Type Description
conversationId string (UUID) The conversation identifier
participantId string (UUID) The participant identifier to remove
Important Notes
  • This operation sets left_on = NOW(6) but does NOT delete the record
  • Historical participant data is preserved for audit and analytics
  • The participant can be re-added later, which will clear the left_on timestamp
  • Only active participants (where left_on IS NULL) can be removed
{
  "success": true,
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "participant_id": "participant-uuid-to-remove",
  "timestamp": "2025-11-13T15:45:30Z"
}
curl -X DELETE https://api.neuralcore5.ai/v1/memory/conversation/550e8400-e29b-41d4-a716-446655440000/participant/participant-uuid-to-remove \
  -H "Content-Type: application/json"
<?php
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$participantId = 'participant-uuid-to-remove';
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId . '/participant/' . $participantId;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    $data = json_decode($response, true);
    echo "Participant removed successfully\n";
    echo "Timestamp: " . $data['timestamp'] . "\n";
} else if ($httpCode === 404) {
    echo "Participant not found or already removed\n";
} else {
    echo "Error: HTTP " . $httpCode . "\n";
}
// 400 Bad Request - Missing required parameters
{
  "success": false,
  "error": "conversation_id and participant_id are required"
}

// 404 Not Found - Participant not found or already removed
{
  "success": false,
  "error": "Participant not found or already removed",
  "conversation_id": "550e8400-e29b-41d4-a716-446655440000",
  "participant_id": "participant-uuid-to-remove"
}

// 500 Internal Server Error
{
  "success": false,
  "error": "Internal server error",
  "message": "[detailed error message]"
}
Database Schema: conv_participants

The conv_participants table uses a composite primary key of (conversation_id, participant_id) to ensure each participant can only be added once per conversation. The table structure:

Column Type Description
conversation_id CHAR(36) Foreign key to conversations table
participant_type ENUM('digital', 'organic') Type of participant
participant_id CHAR(36) UUID of the participant (dpid or opid)
joined_on DATETIME(6) Timestamp when participant joined (microsecond precision)
left_on DATETIME(6) NULL Timestamp when participant left (NULL = still active)

SQL Behavior: The ADD participant endpoint uses ON DUPLICATE KEY UPDATE left_on = NULL, which means re-adding a participant who previously left will reactivate them rather than cause an error.

Important Implementation Notes
  • Composite Primary Key: The table uses (conversation_id, participant_id) as a composite primary key, preventing duplicate participants.
  • Soft Delete: Removing a participant sets left_on = NOW(6) but preserves the record for historical tracking.
  • Reactivation: Re-adding a previously removed participant will clear their left_on timestamp, making them active again.
  • Microsecond Precision: All timestamps use DATETIME(6) format for precise event ordering (e.g., "2025-11-11 14:30:45.123456").
  • Active Status Logic: A participant is considered "active" when left_on IS NULL. The API calculates this automatically.
  • Audit Trail: All add/remove operations are automatically logged to the audit table with actor information.
  • Activity Logging: Participant join/leave events are logged with actionType: 'CREATE' for joins and actionType: 'UPDATE' for leaves.
  • Conversation Validation: The GET participants endpoint checks if the conversation exists before attempting to retrieve participants.
  • Type Validation: Participant type must be exactly organic or digital (case-sensitive).
Common Use Cases
1. Add Multiple Participants at Once
<?php
$conversationId = '550e8400-e29b-41d4-a716-446655440000';
$participants = [
    ['id' => 'organic-uuid-1', 'type' => 'organic'],
    ['id' => 'organic-uuid-2', 'type' => 'organic'],
    ['id' => 'digital-uuid-1', 'type' => 'digital']
];

foreach ($participants as $participant) {
    $url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId . '/participant';
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($participant));
    curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    curl_close($ch);
}
2. Check Participant Count Before Adding
<?php
// Get current participants
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId . '/participants';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = json_decode($response, true);

$currentCount = $data['count'];
echo "Current participants: $currentCount\n";

// Add new participant if under limit
if ($currentCount < 10) {
    // Add participant...
}
3. Get Participant History (Including Inactive)
<?php
$url = 'https://api.neuralcore5.ai/v1/memory/conversation/' . $conversationId . '/participants?active_only=false';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = json_decode($response, true);

echo "Conversation History:\n";
foreach ($data['participants'] as $p) {
    $status = $p['active'] ? 'Active' : 'Left on ' . $p['left_on'];
    echo "- {$p['id']} ({$p['type']}) - Joined: {$p['joined_on']} - Status: $status\n";
}

Organic People

Comprehensive management system for organic people (real humans) including CRUD operations, conversation history, moderation rules, web research capabilities, and family/relationship tree management. Organic people are actual subscribers, users, and contacts within the NeuralCore5 platform.

Conversations

Fetch and manage conversation history for specific organic people. Access messages, metadata, and conversation data with full transparency.

GET /v1/organic-people/{opid}/conversations

Retrieve all conversations for a specific organic person with pagination and filtering options.

Path Parameters
Parameter Type Description
opid string Organic Person ID
Query Parameters
Parameter Type Required Description
type string Optional Conversation type: "digital", "organic", "group"
status string Optional Status: "active", "archived", "deleted"
limit integer Optional Results per page (default: 50, max: 200)
offset integer Optional Pagination offset (default: 0)
sort_by string Optional Sort by: "last_activity", "created_at", "message_count" (default: "last_activity")
{
  "success": true,
  "opid": "1234567",
  "total_conversations": 42,
  "limit": 50,
  "offset": 0,
  "conversations": [
    {
      "conversation_id": "conv_abc123xyz456",
      "owner_opid": "1234567",
      "title": "Chat with Digital Assistant",
      "type": "digital",
      "status": "active",
      "message_count": 127,
      "token_input_total": 15420,
      "token_output_total": 8930,
      "cost_usd_total": 0.45,
      "created_at": "2025-11-10T14:30:00Z",
      "updated_at": "2025-11-11T18:25:00Z",
      "last_activity_at": "2025-11-11T18:25:00Z"
    },
    {
      "conversation_id": "conv_def789ghi012",
      "owner_opid": "1234567",
      "title": "Support Inquiry",
      "type": "organic",
      "status": "active",
      "message_count": 8,
      "token_input_total": 420,
      "token_output_total": 890,
      "cost_usd_total": 0.03,
      "created_at": "2025-11-09T10:15:00Z",
      "updated_at": "2025-11-09T11:30:00Z",
      "last_activity_at": "2025-11-09T11:30:00Z"
    }
  ]
}
curl -X GET "https://api.neuralcore5.ai/v1/organic-people/1234567/conversations?type=digital&limit=50" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
GET /v1/organic-people/{opid}/conversations/{conversationId}

Fetch complete conversation details including all messages, metadata, and raw digital person responses. Returns chronologically ordered message history.

Path Parameters
Parameter Type Description
opid string Organic Person ID
conversationId string Conversation ID
Query Parameters
Parameter Type Required Description
include_raw boolean Optional Include raw Digital Person API responses (default: false)
message_limit integer Optional Limit number of messages returned (default: 100)
{
  "success": true,
  "conversation": {
    "conversation_id": "conv_abc123xyz456",
    "owner_opid": "1234567",
    "title": "Chat with Digital Assistant",
    "conversation_type": "digital",
    "status": "active",
    "message_count": 127,
    "token_input_total": 15420,
    "token_output_total": 8930,
    "cost_usd_total": 0.45,
    "created_at_utc": "2025-11-10T14:30:00Z",
    "updated_at_utc": "2025-11-11T18:25:00Z",
    "last_activity_at": "2025-11-11T18:25:00Z",
    "metadata": {
      "assistant_id": "asst_abc123",
      "model": "gpt-4",
      "temperature": 0.7
    }
  },
  "messages": [
    {
      "mid": "msg_001",
      "conversation_id": "conv_abc123xyz456",
      "sender_id": "1234567",
      "sender_type": "opid",
      "content": "Hello, can you help me with something?",
      "status": "active",
      "created_on": "2025-11-10 14:30:15",
      "updated_on": "2025-11-10 14:30:15"
    },
    {
      "mid": "msg_002",
      "conversation_id": "conv_abc123xyz456",
      "sender_id": "asst_abc123",
      "sender_type": "dpid",
      "content": "Of course! I'd be happy to help. What do you need assistance with?",
      "status": "active",
      "created_on": "2025-11-10 14:30:18",
      "updated_on": "2025-11-10 14:30:18"
    }
  ],
  "message_count": 127
}
curl -X GET "https://api.neuralcore5.ai/v1/organic-people/1234567/conversations/conv_abc123xyz456?include_raw=false" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
<?php
$opid = '1234567';
$conversationId = 'conv_abc123xyz456';
$url = "https://api.neuralcore5.ai/v1/organic-people/$opid/conversations/$conversationId";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Conversation: " . $data['conversation']['title'] . "\n";
echo "Messages: " . $data['message_count'] . "\n";

foreach ($data['messages'] as $msg) {
    $sender = ($msg['sender_type'] === 'opid') ? 'User' : 'Assistant';
    echo "$sender: " . $msg['content'] . "\n";
}
POST /v1/organic-people/{opid}/conversations/{conversationId}/export

Export a conversation in various formats including JSON, CSV, PDF, or plain text. Useful for archival, compliance, or user data requests.

Path Parameters
Parameter Type Description
opid string Organic Person ID
conversationId string Conversation ID to export
Request Body
Parameter Type Required Description
format string Required Export format: "json", "csv", "pdf", "txt"
include_metadata boolean Optional Include conversation metadata (default: true)
include_timestamps boolean Optional Include message timestamps (default: true)
{
  "format": "pdf",
  "include_metadata": true,
  "include_timestamps": true
}
{
  "success": true,
  "export_id": "export_abc123xyz456",
  "format": "pdf",
  "conversation_id": "conv_abc123xyz456",
  "file_url": "https://api.neuralcore5.ai/exports/conv_abc123xyz456.pdf",
  "file_size_bytes": 524288,
  "expires_at": "2025-11-12T18:30:00Z",
  "generated_at": "2025-11-11T18:30:00Z",
  "message": "Export ready for download. Link expires in 24 hours."
}
curl -X POST https://api.neuralcore5.ai/v1/organic-people/1234567/conversations/conv_abc123xyz456/export \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "pdf",
    "include_metadata": true
  }'
GET /v1/organic-people/{opid}/conversations/statistics

Get aggregated statistics about an organic person's conversation history including message counts, token usage, costs, and activity patterns.

Path Parameters
Parameter Type Description
opid string Organic Person ID
Query Parameters
Parameter Type Required Description
period string Optional Time period: "all", "today", "week", "month", "year" (default: "all")
{
  "success": true,
  "opid": "1234567",
  "period": "all",
  "statistics": {
    "total_conversations": 42,
    "active_conversations": 15,
    "archived_conversations": 27,
    "total_messages": 3847,
    "messages_sent_by_user": 1823,
    "messages_sent_by_assistant": 2024,
    "total_tokens_input": 187420,
    "total_tokens_output": 245890,
    "total_cost_usd": 12.47,
    "average_messages_per_conversation": 91.6,
    "first_conversation": "2024-06-15T10:00:00Z",
    "last_activity": "2025-11-11T18:25:00Z",
    "most_active_day": "Monday",
    "most_active_hour": 14,
    "conversation_types": {
      "digital": 38,
      "organic": 3,
      "group": 1
    }
  }
}
curl -X GET "https://api.neuralcore5.ai/v1/organic-people/1234567/conversations/statistics?period=month" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Manage

Create, read, update, and delete organic people records. Manage user profiles, contact information, preferences, and account details.

POST /v1/organic-people/create

Create a new organic person record in the system. Returns the newly created person with assigned OPID (Organic Person ID).

Request Body
Parameter Type Required Description
first_name string Required First name
last_name string Required Last name
email string Optional Email address (must be unique)
phone string Optional Phone number in E.164 format
birth_date date Optional Date of birth (YYYY-MM-DD)
address object Optional Address information (line1, line2, city, state, postal, country)
rank string Optional User rank/tier: "subscriber", "premium", "admin", etc.
metadata object Optional Additional custom metadata
{
  "first_name": "John",
  "last_name": "Doe",
  "email": "john.doe@example.com",
  "phone": "+15127563382",
  "birth_date": "1990-01-15",
  "address": {
    "line1": "123 Main Street",
    "line2": "Apt 4B",
    "city": "Austin",
    "state": "TX",
    "postal": "78701",
    "country": "US"
  },
  "rank": "subscriber",
  "metadata": {
    "source": "web_signup",
    "referral_code": "FRIEND2025"
  }
}
{
  "success": true,
  "opid": "1234567",
  "person": {
    "opid": "1234567",
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com",
    "phone": "+15127563382",
    "birth_date": "1990-01-15",
    "address": {
      "line1": "123 Main Street",
      "line2": "Apt 4B",
      "city": "Austin",
      "state": "TX",
      "postal": "78701",
      "country": "US"
    },
    "rank": "subscriber",
    "status": "active",
    "created_at": "2025-11-11T18:00:00Z",
    "updated_at": "2025-11-11T18:00:00Z"
  },
  "message": "Organic person created successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/organic-people/create \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com",
    "phone": "+15127563382"
  }'
GET /v1/organic-people/{opid}

Retrieve detailed information about a specific organic person by their OPID.

Path Parameters
Parameter Type Description
opid string Organic Person ID
{
  "success": true,
  "person": {
    "opid": "1234567",
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com",
    "phone": "+15127563382",
    "birth_date": "1990-01-15",
    "age": 35,
    "address": {
      "line1": "123 Main Street",
      "line2": "Apt 4B",
      "city": "Austin",
      "state": "TX",
      "postal": "78701",
      "country": "US"
    },
    "rank": "subscriber",
    "status": "active",
    "plan": "premium",
    "metadata": {
      "source": "web_signup",
      "referral_code": "FRIEND2025"
    },
    "created_at": "2025-11-11T18:00:00Z",
    "updated_at": "2025-11-11T18:00:00Z",
    "last_login": "2025-11-11T17:45:00Z"
  }
}
curl -X GET https://api.neuralcore5.ai/v1/organic-people/1234567 \
  -H "Authorization: Bearer YOUR_API_TOKEN"
PUT /v1/organic-people/{opid}

Update an existing organic person's information. Only provided fields will be updated.

Path Parameters
Parameter Type Description
opid string Organic Person ID to update
Request Body
Parameter Type Required Description
first_name string Optional Updated first name
last_name string Optional Updated last name
email string Optional Updated email address
phone string Optional Updated phone number
address object Optional Updated address (partial updates supported)
rank string Optional Updated rank/tier
status string Optional Status: "active", "inactive", "suspended"
{
  "email": "john.doe.updated@example.com",
  "phone": "+15129876543",
  "rank": "premium",
  "address": {
    "line1": "456 Oak Avenue",
    "city": "Austin"
  }
}
{
  "success": true,
  "opid": "1234567",
  "updated_fields": ["email", "phone", "rank", "address"],
  "person": {
    "opid": "1234567",
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe.updated@example.com",
    "phone": "+15129876543",
    "rank": "premium",
    "updated_at": "2025-11-11T18:15:00Z"
  },
  "message": "Organic person updated successfully"
}
curl -X PUT https://api.neuralcore5.ai/v1/organic-people/1234567 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "john.doe.updated@example.com",
    "rank": "premium"
  }'
DELETE /v1/organic-people/{opid}

Delete an organic person record. Can be soft delete (status change) or hard delete based on parameters.

Path Parameters
Parameter Type Description
opid string Organic Person ID to delete
Query Parameters
Parameter Type Required Description
hard_delete boolean Optional Permanent deletion (default: false - soft delete)
{
  "success": true,
  "opid": "1234567",
  "deletion_type": "soft",
  "deleted_at": "2025-11-11T18:20:00Z",
  "message": "Organic person deleted successfully (soft delete)"
}
curl -X DELETE "https://api.neuralcore5.ai/v1/organic-people/1234567?hard_delete=false" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Moderate

Manage data moderation rules for organic people. Flag incorrect information, add corrections, review disputed data, and maintain data quality standards.

POST /v1/organic-people/{opid}/moderate/rules

Create a new moderation rule to flag incorrect or disputed data for an organic person. Useful for data quality control and corrections.

Path Parameters
Parameter Type Description
opid string Organic Person ID
Request Body
Parameter Type Required Description
field_name string Required Field name to moderate (e.g., "email", "phone", "address")
current_value string Required Current value that is incorrect
proposed_value string Optional Proposed correct value
reason string Required Reason for moderation: "incorrect", "outdated", "duplicate", "spam", "offensive"
severity string Optional Severity level: "low", "medium", "high", "critical" (default: "medium")
notes string Optional Additional notes or context
reported_by string Optional Who reported this issue
{
  "field_name": "email",
  "current_value": "old.email@example.com",
  "proposed_value": "john.doe@example.com",
  "reason": "outdated",
  "severity": "high",
  "notes": "User reported email change via support ticket #12345",
  "reported_by": "support_team"
}
{
  "success": true,
  "rule_id": "mod_abc123xyz456",
  "opid": "1234567",
  "rule": {
    "rule_id": "mod_abc123xyz456",
    "field_name": "email",
    "current_value": "old.email@example.com",
    "proposed_value": "john.doe@example.com",
    "reason": "outdated",
    "severity": "high",
    "status": "pending",
    "notes": "User reported email change via support ticket #12345",
    "reported_by": "support_team",
    "created_at": "2025-11-11T19:00:00Z",
    "reviewed_at": null,
    "reviewed_by": null
  },
  "message": "Moderation rule created successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/organic-people/1234567/moderate/rules \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "field_name": "email",
    "current_value": "old.email@example.com",
    "proposed_value": "john.doe@example.com",
    "reason": "outdated",
    "severity": "high"
  }'
GET /v1/organic-people/{opid}/moderate/rules

Retrieve all moderation rules for a specific organic person with filtering options.

Path Parameters
Parameter Type Description
opid string Organic Person ID
Query Parameters
Parameter Type Required Description
status string Optional Filter by status: "pending", "approved", "rejected", "applied"
severity string Optional Filter by severity level
field_name string Optional Filter by specific field
limit integer Optional Results per page (default: 50)
{
  "success": true,
  "opid": "1234567",
  "total_rules": 8,
  "rules": [
    {
      "rule_id": "mod_abc123xyz456",
      "field_name": "email",
      "current_value": "old.email@example.com",
      "proposed_value": "john.doe@example.com",
      "reason": "outdated",
      "severity": "high",
      "status": "pending",
      "created_at": "2025-11-11T19:00:00Z"
    },
    {
      "rule_id": "mod_def456ghi789",
      "field_name": "phone",
      "current_value": "+15121234567",
      "proposed_value": "+15127563382",
      "reason": "incorrect",
      "severity": "medium",
      "status": "approved",
      "created_at": "2025-11-10T14:30:00Z",
      "reviewed_at": "2025-11-10T15:00:00Z",
      "reviewed_by": "admin_user"
    }
  ]
}
curl -X GET "https://api.neuralcore5.ai/v1/organic-people/1234567/moderate/rules?status=pending&severity=high" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
PUT /v1/organic-people/{opid}/moderate/rules/{ruleId}

Update an existing moderation rule including proposed values, notes, or severity level.

Path Parameters
Parameter Type Description
opid string Organic Person ID
ruleId string Moderation rule ID
Request Body
Parameter Type Required Description
proposed_value string Optional Updated proposed value
severity string Optional Updated severity level
notes string Optional Additional notes
{
  "proposed_value": "john.doe.verified@example.com",
  "severity": "critical",
  "notes": "Email verified by user via confirmation link"
}
{
  "success": true,
  "rule_id": "mod_abc123xyz456",
  "updated_fields": ["proposed_value", "severity", "notes"],
  "rule": {
    "rule_id": "mod_abc123xyz456",
    "field_name": "email",
    "proposed_value": "john.doe.verified@example.com",
    "severity": "critical",
    "status": "pending",
    "updated_at": "2025-11-11T19:15:00Z"
  },
  "message": "Moderation rule updated successfully"
}
curl -X PUT https://api.neuralcore5.ai/v1/organic-people/1234567/moderate/rules/mod_abc123xyz456 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "proposed_value": "john.doe.verified@example.com",
    "severity": "critical"
  }'
POST /v1/organic-people/{opid}/moderate/rules/{ruleId}/review

Review and approve or reject a moderation rule. Approved rules can be automatically applied to the organic person's record.

Path Parameters
Parameter Type Description
opid string Organic Person ID
ruleId string Moderation rule ID
Request Body
Parameter Type Required Description
decision string Required Review decision: "approve" or "reject"
apply_immediately boolean Optional Apply approved changes immediately (default: true)
reviewer_notes string Optional Reviewer's notes or reasoning
reviewed_by string Required Reviewer's user ID or name
{
  "decision": "approve",
  "apply_immediately": true,
  "reviewer_notes": "Email verified via support ticket and confirmation link",
  "reviewed_by": "admin_john"
}
{
  "success": true,
  "rule_id": "mod_abc123xyz456",
  "opid": "1234567",
  "decision": "approve",
  "status": "applied",
  "changes_applied": {
    "field_name": "email",
    "old_value": "old.email@example.com",
    "new_value": "john.doe@example.com"
  },
  "reviewed_at": "2025-11-11T19:20:00Z",
  "reviewed_by": "admin_john",
  "message": "Moderation rule approved and changes applied successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/organic-people/1234567/moderate/rules/mod_abc123xyz456/review \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "decision": "approve",
    "apply_immediately": true,
    "reviewed_by": "admin_john"
  }'
DELETE /v1/organic-people/{opid}/moderate/rules/{ruleId}

Delete a moderation rule. Only pending or rejected rules can be deleted. Applied rules are retained for audit purposes.

Path Parameters
Parameter Type Description
opid string Organic Person ID
ruleId string Moderation rule ID to delete
{
  "success": true,
  "rule_id": "mod_abc123xyz456",
  "deleted_at": "2025-11-11T19:25:00Z",
  "message": "Moderation rule deleted successfully"
}
curl -X DELETE https://api.neuralcore5.ai/v1/organic-people/1234567/moderate/rules/mod_abc123xyz456 \
  -H "Authorization: Bearer YOUR_API_TOKEN"
POST /v1/organic-people/moderate/bulk-review

Review multiple moderation rules at once across multiple organic people. Efficient for batch processing of moderation queue.

Request Body
Parameter Type Required Description
rule_ids array Required Array of rule IDs to review
decision string Required Decision for all rules: "approve" or "reject"
apply_immediately boolean Optional Apply approved changes immediately (default: true)
reviewer_notes string Optional Reviewer's notes applied to all rules
reviewed_by string Required Reviewer's user ID or name
{
  "rule_ids": [
    "mod_abc123xyz456",
    "mod_def456ghi789",
    "mod_jkl012mno345"
  ],
  "decision": "approve",
  "apply_immediately": true,
  "reviewer_notes": "Batch approval of verified email updates",
  "reviewed_by": "admin_john"
}
{
  "success": true,
  "total_rules": 3,
  "processed": 3,
  "approved": 3,
  "rejected": 0,
  "failed": 0,
  "results": [
    {
      "rule_id": "mod_abc123xyz456",
      "opid": "1234567",
      "status": "applied",
      "success": true
    },
    {
      "rule_id": "mod_def456ghi789",
      "opid": "2345678",
      "status": "applied",
      "success": true
    },
    {
      "rule_id": "mod_jkl012mno345",
      "opid": "3456789",
      "status": "applied",
      "success": true
    }
  ],
  "reviewed_at": "2025-11-11T19:30:00Z",
  "message": "Bulk review completed successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/organic-people/moderate/bulk-review \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "rule_ids": ["mod_abc123xyz456", "mod_def456ghi789"],
    "decision": "approve",
    "reviewed_by": "admin_john"
  }'

Research

Trigger automated web research to find and enrich organic people data. Search across public databases, social media, professional networks, and public records to enhance profiles with verified information.

POST /v1/organic-people/{opid}/research/start

Initiate an automated web research job for a specific organic person. The system will search multiple sources and return findings asynchronously.

Path Parameters
Parameter Type Description
opid string Organic Person ID
Request Body
Parameter Type Required Description
research_type string Required Type: "basic", "comprehensive", "social_media", "professional", "background_check"
sources array Optional Specific sources: ["google", "linkedin", "twitter", "facebook", "public_records", "news"]
search_criteria object Optional Additional search criteria (location, company, keywords)
priority string Optional Job priority: "low", "normal", "high", "urgent" (default: "normal")
callback_url string Optional Webhook URL for completion notification
{
  "research_type": "comprehensive",
  "sources": ["google", "linkedin", "twitter", "public_records"],
  "search_criteria": {
    "location": "Austin, TX",
    "company": "Tech Corp",
    "keywords": ["software engineer", "AI researcher"]
  },
  "priority": "high",
  "callback_url": "https://example.com/webhooks/research-complete"
}
{
  "success": true,
  "job_id": "research_abc123xyz456",
  "opid": "1234567",
  "research_type": "comprehensive",
  "status": "queued",
  "estimated_duration_minutes": 15,
  "sources_count": 4,
  "priority": "high",
  "created_at": "2025-11-11T19:35:00Z",
  "callback_url": "https://example.com/webhooks/research-complete",
  "message": "Research job started successfully. Results will be available when complete."
}
curl -X POST https://api.neuralcore5.ai/v1/organic-people/1234567/research/start \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "research_type": "comprehensive",
    "sources": ["google", "linkedin", "public_records"],
    "priority": "high"
  }'
GET /v1/organic-people/{opid}/research/{jobId}

Check the status of a research job and retrieve results when complete. Returns progress updates and partial results during processing.

Path Parameters
Parameter Type Description
opid string Organic Person ID
jobId string Research job ID
{
  "success": true,
  "job_id": "research_abc123xyz456",
  "opid": "1234567",
  "status": "completed",
  "progress": 100,
  "research_type": "comprehensive",
  "sources_searched": 4,
  "results_found": 28,
  "started_at": "2025-11-11T19:35:00Z",
  "completed_at": "2025-11-11T19:47:00Z",
  "duration_seconds": 720,
  "results": {
    "professional": {
      "linkedin_profile": "https://linkedin.com/in/johndoe",
      "current_company": "Tech Corp",
      "position": "Senior Software Engineer",
      "experience_years": 8,
      "education": [
        {
          "degree": "BS Computer Science",
          "school": "University of Texas at Austin",
          "year": 2015
        }
      ],
      "skills": ["Python", "AI/ML", "Cloud Computing"]
    },
    "social_media": {
      "twitter": "@johndoe",
      "twitter_followers": 1542,
      "github": "github.com/johndoe",
      "github_repositories": 27
    },
    "contact_info": {
      "verified_email": "john.doe@techcorp.com",
      "verified_phone": "+15127563382",
      "location": "Austin, TX"
    },
    "public_records": {
      "age_range": "30-35",
      "property_ownership": true,
      "registered_voter": true
    },
    "web_presence": {
      "personal_website": "johndoe.dev",
      "blog_posts": 15,
      "news_mentions": 3
    }
  },
  "confidence_score": 0.92,
  "data_sources": ["LinkedIn", "Twitter", "GitHub", "Public Records"]
}
curl -X GET https://api.neuralcore5.ai/v1/organic-people/1234567/research/research_abc123xyz456 \
  -H "Authorization: Bearer YOUR_API_TOKEN"
<?php
$opid = '1234567';
$jobId = 'research_abc123xyz456';
$url = "https://api.neuralcore5.ai/v1/organic-people/$opid/research/$jobId";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Status: " . $data['status'] . "\n";
echo "Progress: " . $data['progress'] . "%\n";

if ($data['status'] === 'completed') {
    echo "Results found: " . $data['results_found'] . "\n";
    echo "LinkedIn: " . ($data['results']['professional']['linkedin_profile'] ?? 'Not found') . "\n";
}
GET /v1/organic-people/{opid}/research

List all research jobs for a specific organic person with filtering and pagination.

Path Parameters
Parameter Type Description
opid string Organic Person ID
Query Parameters
Parameter Type Required Description
status string Optional Filter by status: "queued", "running", "completed", "failed"
research_type string Optional Filter by research type
limit integer Optional Results per page (default: 50)
{
  "success": true,
  "opid": "1234567",
  "total_jobs": 7,
  "jobs": [
    {
      "job_id": "research_abc123xyz456",
      "research_type": "comprehensive",
      "status": "completed",
      "results_found": 28,
      "started_at": "2025-11-11T19:35:00Z",
      "completed_at": "2025-11-11T19:47:00Z"
    },
    {
      "job_id": "research_def456ghi789",
      "research_type": "social_media",
      "status": "running",
      "progress": 65,
      "started_at": "2025-11-11T20:00:00Z",
      "estimated_completion": "2025-11-11T20:10:00Z"
    },
    {
      "job_id": "research_jkl012mno345",
      "research_type": "background_check",
      "status": "completed",
      "results_found": 12,
      "started_at": "2025-11-10T14:20:00Z",
      "completed_at": "2025-11-10T14:35:00Z"
    }
  ]
}
curl -X GET "https://api.neuralcore5.ai/v1/organic-people/1234567/research?status=completed&limit=50" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
POST /v1/organic-people/research/bulk

Start research jobs for multiple organic people at once. Efficient for batch processing and data enrichment campaigns.

Request Body
Parameter Type Required Description
opids array Required Array of Organic Person IDs (max: 100)
research_type string Required Research type applied to all
sources array Optional Sources for all jobs
priority string Optional Priority for all jobs (default: "normal")
callback_url string Optional Webhook URL for batch completion
{
  "opids": [
    "1234567",
    "2345678",
    "3456789"
  ],
  "research_type": "basic",
  "sources": ["google", "linkedin"],
  "priority": "normal",
  "callback_url": "https://example.com/webhooks/bulk-research-complete"
}
{
  "success": true,
  "batch_id": "batch_abc123xyz456",
  "total_jobs": 3,
  "jobs_created": 3,
  "jobs_failed": 0,
  "research_type": "basic",
  "priority": "normal",
  "jobs": [
    {
      "job_id": "research_pqr678stu901",
      "opid": "1234567",
      "status": "queued"
    },
    {
      "job_id": "research_vwx234yza567",
      "opid": "2345678",
      "status": "queued"
    },
    {
      "job_id": "research_bcd890efg123",
      "opid": "3456789",
      "status": "queued"
    }
  ],
  "estimated_completion": "2025-11-11T20:30:00Z",
  "created_at": "2025-11-11T20:00:00Z",
  "message": "Bulk research batch created successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/organic-people/research/bulk \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "opids": ["1234567", "2345678", "3456789"],
    "research_type": "basic",
    "sources": ["google", "linkedin"]
  }'
DELETE /v1/organic-people/{opid}/research/{jobId}

Cancel a running or queued research job. Completed jobs cannot be cancelled but can be archived.

Path Parameters
Parameter Type Description
opid string Organic Person ID
jobId string Research job ID to cancel
{
  "success": true,
  "job_id": "research_abc123xyz456",
  "opid": "1234567",
  "previous_status": "running",
  "new_status": "cancelled",
  "partial_results_available": true,
  "cancelled_at": "2025-11-11T20:05:00Z",
  "message": "Research job cancelled successfully"
}
curl -X DELETE https://api.neuralcore5.ai/v1/organic-people/1234567/research/research_abc123xyz456 \
  -H "Authorization: Bearer YOUR_API_TOKEN"
POST /v1/organic-people/{opid}/research/{jobId}/apply

Apply verified research results to the organic person's profile. Allows selective application of specific fields or automatic enrichment.

Path Parameters
Parameter Type Description
opid string Organic Person ID
jobId string Research job ID with completed results
Request Body
Parameter Type Required Description
apply_mode string Required Mode: "automatic", "selective", "review_only"
fields_to_apply array Optional Specific fields to apply (for "selective" mode)
overwrite_existing boolean Optional Overwrite existing values (default: false)
min_confidence float Optional Minimum confidence score to apply (0.0-1.0, default: 0.7)
create_moderation_rules boolean Optional Create moderation rules instead of direct apply (default: false)
{
  "apply_mode": "selective",
  "fields_to_apply": [
    "linkedin_profile",
    "current_company",
    "position",
    "verified_email"
  ],
  "overwrite_existing": false,
  "min_confidence": 0.8,
  "create_moderation_rules": false
}
{
  "success": true,
  "job_id": "research_abc123xyz456",
  "opid": "1234567",
  "apply_mode": "selective",
  "fields_applied": 4,
  "fields_skipped": 0,
  "fields_rejected": 0,
  "changes": [
    {
      "field": "linkedin_profile",
      "old_value": null,
      "new_value": "https://linkedin.com/in/johndoe",
      "confidence": 0.95,
      "applied": true
    },
    {
      "field": "current_company",
      "old_value": null,
      "new_value": "Tech Corp",
      "confidence": 0.92,
      "applied": true
    },
    {
      "field": "position",
      "old_value": null,
      "new_value": "Senior Software Engineer",
      "confidence": 0.90,
      "applied": true
    },
    {
      "field": "verified_email",
      "old_value": "john.doe@example.com",
      "new_value": "john.doe@techcorp.com",
      "confidence": 0.88,
      "applied": true
    }
  ],
  "applied_at": "2025-11-11T20:10:00Z",
  "message": "Research results applied successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/organic-people/1234567/research/research_abc123xyz456/apply \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "apply_mode": "selective",
    "fields_to_apply": ["linkedin_profile", "current_company", "position"],
    "min_confidence": 0.8
  }'

Relationship Tree

Manage family relationships and social connections between organic people. Create, update, and visualize relationship trees including parents, siblings, children, spouses, and other connections.

POST /v1/organic-people/{opid}/tree/relationships

Create a new relationship link between two organic people. Supports various relationship types including family, professional, and social connections.

Path Parameters
Parameter Type Description
opid string Organic Person ID (source person)
Request Body
Parameter Type Required Description
related_opid string Required OPID of the related person
relationship_type string Required Type: "parent", "child", "sibling", "spouse", "partner", "grandparent", "grandchild", "cousin", "friend", "colleague"
is_biological boolean Optional Biological relationship (for family types, default: true)
start_date date Optional Relationship start date (YYYY-MM-DD)
end_date date Optional Relationship end date (for former relationships)
status string Optional Status: "active", "inactive", "estranged", "deceased" (default: "active")
notes string Optional Additional notes about the relationship
metadata object Optional Custom metadata (marriage date, divorce date, etc.)
{
  "related_opid": "2345678",
  "relationship_type": "parent",
  "is_biological": true,
  "start_date": "1990-01-15",
  "status": "active",
  "notes": "Mother",
  "metadata": {
    "maiden_name": "Smith",
    "confirmed": true
  }
}
{
  "success": true,
  "relationship_id": "rel_abc123xyz456",
  "relationship": {
    "relationship_id": "rel_abc123xyz456",
    "source_opid": "1234567",
    "related_opid": "2345678",
    "relationship_type": "parent",
    "reverse_relationship_type": "child",
    "is_biological": true,
    "start_date": "1990-01-15",
    "end_date": null,
    "status": "active",
    "notes": "Mother",
    "metadata": {
      "maiden_name": "Smith",
      "confirmed": true
    },
    "created_at": "2025-11-11T20:15:00Z",
    "updated_at": "2025-11-11T20:15:00Z"
  },
  "reverse_relationship_created": true,
  "message": "Relationship added successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/organic-people/1234567/tree/relationships \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "related_opid": "2345678",
    "relationship_type": "parent",
    "is_biological": true,
    "status": "active"
  }'
GET /v1/organic-people/{opid}/tree/relationships

Retrieve all relationships for a specific organic person with filtering options by type, status, and relationship depth.

Path Parameters
Parameter Type Description
opid string Organic Person ID
Query Parameters
Parameter Type Required Description
relationship_type string Optional Filter by specific relationship type
status string Optional Filter by status
include_details boolean Optional Include full person details for related people (default: false)
{
  "success": true,
  "opid": "1234567",
  "total_relationships": 8,
  "relationships": {
    "parents": [
      {
        "relationship_id": "rel_abc123xyz456",
        "related_opid": "2345678",
        "related_person": {
          "opid": "2345678",
          "first_name": "Jane",
          "last_name": "Doe"
        },
        "relationship_type": "parent",
        "is_biological": true,
        "status": "active"
      },
      {
        "relationship_id": "rel_def456ghi789",
        "related_opid": "3456789",
        "related_person": {
          "opid": "3456789",
          "first_name": "Robert",
          "last_name": "Doe"
        },
        "relationship_type": "parent",
        "is_biological": true,
        "status": "active"
      }
    ],
    "siblings": [
      {
        "relationship_id": "rel_jkl012mno345",
        "related_opid": "4567890",
        "related_person": {
          "opid": "4567890",
          "first_name": "Emily",
          "last_name": "Doe"
        },
        "relationship_type": "sibling",
        "is_biological": true,
        "status": "active"
      }
    ],
    "spouse": [
      {
        "relationship_id": "rel_pqr678stu901",
        "related_opid": "5678901",
        "related_person": {
          "opid": "5678901",
          "first_name": "Sarah",
          "last_name": "Doe"
        },
        "relationship_type": "spouse",
        "status": "active",
        "metadata": {
          "marriage_date": "2018-06-15"
        }
      }
    ],
    "children": [
      {
        "relationship_id": "rel_vwx234yza567",
        "related_opid": "6789012",
        "related_person": {
          "opid": "6789012",
          "first_name": "Michael",
          "last_name": "Doe"
        },
        "relationship_type": "child",
        "is_biological": true,
        "status": "active"
      }
    ]
  }
}
curl -X GET "https://api.neuralcore5.ai/v1/organic-people/1234567/tree/relationships?include_details=true" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
PUT /v1/organic-people/{opid}/tree/relationships/{relationshipId}

Update an existing relationship including status, dates, notes, and metadata.

Path Parameters
Parameter Type Description
opid string Organic Person ID
relationshipId string Relationship ID to update
Request Body
Parameter Type Required Description
status string Optional Updated status
end_date date Optional Relationship end date
notes string Optional Updated notes
metadata object Optional Updated metadata (merged with existing)
{
  "status": "inactive",
  "end_date": "2023-08-15",
  "notes": "Divorced",
  "metadata": {
    "divorce_date": "2023-08-15",
    "custody_arrangement": "joint"
  }
}
{
  "success": true,
  "relationship_id": "rel_pqr678stu901",
  "updated_fields": ["status", "end_date", "notes", "metadata"],
  "relationship": {
    "relationship_id": "rel_pqr678stu901",
    "source_opid": "1234567",
    "related_opid": "5678901",
    "relationship_type": "spouse",
    "status": "inactive",
    "end_date": "2023-08-15",
    "notes": "Divorced",
    "metadata": {
      "marriage_date": "2018-06-15",
      "divorce_date": "2023-08-15",
      "custody_arrangement": "joint"
    },
    "updated_at": "2025-11-11T20:25:00Z"
  },
  "message": "Relationship updated successfully"
}
curl -X PUT https://api.neuralcore5.ai/v1/organic-people/1234567/tree/relationships/rel_pqr678stu901 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "inactive",
    "end_date": "2023-08-15"
  }'
DELETE /v1/organic-people/{opid}/tree/relationships/{relationshipId}

Delete a relationship link between two organic people. Also removes the reverse relationship automatically.

Path Parameters
Parameter Type Description
opid string Organic Person ID
relationshipId string Relationship ID to delete
{
  "success": true,
  "relationship_id": "rel_abc123xyz456",
  "reverse_relationship_deleted": true,
  "deleted_at": "2025-11-11T20:30:00Z",
  "message": "Relationship deleted successfully"
}
curl -X DELETE https://api.neuralcore5.ai/v1/organic-people/1234567/tree/relationships/rel_abc123xyz456 \
  -H "Authorization: Bearer YOUR_API_TOKEN"
GET /v1/organic-people/{opid}/tree/family

Retrieve a comprehensive family tree for an organic person including multiple generations. Returns hierarchical structure with ancestors and descendants.

Path Parameters
Parameter Type Description
opid string Organic Person ID (root of the tree)
Query Parameters
Parameter Type Required Description
generations_up integer Optional Generations upward (ancestors, default: 2, max: 10)
generations_down integer Optional Generations downward (descendants, default: 2, max: 10)
include_extended boolean Optional Include extended family (cousins, aunts, uncles, default: false)
include_in_laws boolean Optional Include in-laws and step-relations (default: false)
{
  "success": true,
  "root_person": {
    "opid": "1234567",
    "first_name": "John",
    "last_name": "Doe",
    "birth_date": "1990-01-15"
  },
  "generations_up": 2,
  "generations_down": 2,
  "total_members": 15,
  "tree": {
    "grandparents": [
      {
        "opid": "9012345",
        "first_name": "William",
        "last_name": "Doe",
        "relationship": "paternal_grandfather",
        "generation": -2
      },
      {
        "opid": "0123456",
        "first_name": "Mary",
        "last_name": "Doe",
        "relationship": "paternal_grandmother",
        "generation": -2
      }
    ],
    "parents": [
      {
        "opid": "2345678",
        "first_name": "Jane",
        "last_name": "Doe",
        "relationship": "mother",
        "generation": -1,
        "is_biological": true
      },
      {
        "opid": "3456789",
        "first_name": "Robert",
        "last_name": "Doe",
        "relationship": "father",
        "generation": -1,
        "is_biological": true
      }
    ],
    "siblings": [
      {
        "opid": "4567890",
        "first_name": "Emily",
        "last_name": "Doe",
        "relationship": "sister",
        "generation": 0,
        "is_biological": true
      }
    ],
    "spouse": {
      "opid": "5678901",
      "first_name": "Sarah",
      "last_name": "Doe",
      "relationship": "spouse",
      "generation": 0,
      "marriage_date": "2018-06-15"
    },
    "children": [
      {
        "opid": "6789012",
        "first_name": "Michael",
        "last_name": "Doe",
        "relationship": "son",
        "generation": 1,
        "is_biological": true,
        "birth_date": "2019-03-20"
      },
      {
        "opid": "7890123",
        "first_name": "Emma",
        "last_name": "Doe",
        "relationship": "daughter",
        "generation": 1,
        "is_biological": true,
        "birth_date": "2021-08-10"
      }
    ]
  },
  "statistics": {
    "total_ancestors": 4,
    "total_descendants": 2,
    "total_siblings": 1,
    "living_members": 14,
    "deceased_members": 1
  }
}
curl -X GET "https://api.neuralcore5.ai/v1/organic-people/1234567/tree/family?generations_up=2&generations_down=2&include_extended=false" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
POST /v1/organic-people/{opid}/tree/visualize

Generate a visual representation of the family tree in various formats including SVG, PNG, or interactive HTML. Returns a downloadable URL.

Path Parameters
Parameter Type Description
opid string Organic Person ID (root of the tree)
Request Body
Parameter Type Required Description
format string Required Output format: "svg", "png", "pdf", "html"
layout string Optional Layout style: "tree", "radial", "horizontal" (default: "tree")
generations_up integer Optional Generations upward (default: 2)
generations_down integer Optional Generations downward (default: 2)
include_photos boolean Optional Include profile photos (default: false)
theme string Optional Color theme: "light", "dark", "classic" (default: "light")
{
  "format": "svg",
  "layout": "tree",
  "generations_up": 2,
  "generations_down": 2,
  "include_photos": true,
  "theme": "classic"
}
{
  "success": true,
  "visualization_id": "viz_abc123xyz456",
  "opid": "1234567",
  "format": "svg",
  "layout": "tree",
  "file_url": "https://api.neuralcore5.ai/visualizations/family-tree-1234567.svg",
  "file_size_bytes": 245760,
  "dimensions": {
    "width": 1200,
    "height": 800
  },
  "members_included": 15,
  "expires_at": "2025-11-12T20:35:00Z",
  "generated_at": "2025-11-11T20:35:00Z",
  "message": "Family tree visualization ready for download. Link expires in 24 hours."
}
curl -X POST https://api.neuralcore5.ai/v1/organic-people/1234567/tree/visualize \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "svg",
    "layout": "tree",
    "generations_up": 2,
    "generations_down": 2
  }'
POST /v1/organic-people/tree/common-ancestors

Find common ancestors between two organic people and calculate their relationship degree. Useful for genealogy and family relationship discovery.

Request Body
Parameter Type Required Description
opid_1 string Required First person's OPID
opid_2 string Required Second person's OPID
max_generations integer Optional Maximum generations to search (default: 10)
{
  "opid_1": "1234567",
  "opid_2": "4567890",
  "max_generations": 10
}
{
  "success": true,
  "opid_1": "1234567",
  "opid_2": "4567890",
  "are_related": true,
  "relationship": "siblings",
  "relationship_degree": 1,
  "common_ancestors": [
    {
      "opid": "2345678",
      "first_name": "Jane",
      "last_name": "Doe",
      "relationship_to_opid_1": "mother",
      "relationship_to_opid_2": "mother",
      "generations_from_opid_1": 1,
      "generations_from_opid_2": 1
    },
    {
      "opid": "3456789",
      "first_name": "Robert",
      "last_name": "Doe",
      "relationship_to_opid_1": "father",
      "relationship_to_opid_2": "father",
      "generations_from_opid_1": 1,
      "generations_from_opid_2": 1
    }
  ],
  "most_recent_common_ancestor": {
    "opid": "2345678",
    "first_name": "Jane",
    "last_name": "Doe",
    "generation_distance": 2
  },
  "total_common_ancestors": 2
}
curl -X POST https://api.neuralcore5.ai/v1/organic-people/tree/common-ancestors \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "opid_1": "1234567",
    "opid_2": "4567890",
    "max_generations": 10
  }'

Security

Comprehensive security management endpoints including session management, CSRF protection, multi-factor authentication, encryption, identity verification, and firewall controls for the NeuralCore5 API platform.

Caller ID

Phone number lookup and validation using Twilio Lookup API. Retrieve caller information, line type, carrier details, and fraud indicators.

POST /v1/caller-id/lookup

Perform a comprehensive phone number lookup using Twilio Lookup API. Returns caller name, line type, carrier information, validation status, and fraud risk indicators.

Request Body
Parameter Type Required Description
phone_number string Required Phone number in E.164 format (+15127563382)
fields string Optional Comma-separated fields: validation, caller_name, line_type_intelligence, sim_swap, call_forwarding, sms_pumping_risk, etc.
cache_result boolean Optional Cache lookup result locally (default: true)
{
  "phone_number": "+15127563382",
  "fields": "validation,caller_name,line_type_intelligence,sim_swap,sms_pumping_risk",
  "cache_result": true
}
{
  "success": true,
  "phone_number": "+15127563382",
  "calling_country_code": "1",
  "country_code": "US",
  "national_format": "(512) 756-3382",
  "valid": true,
  "validation_errors": null,
  "caller_name": {
    "caller_name": "JOHN DOE",
    "caller_type": "CONSUMER",
    "error_code": null
  },
  "line_type_intelligence": {
    "type": "mobile",
    "carrier": {
      "name": "T-Mobile USA",
      "type": "mobile",
      "mobile_country_code": "310",
      "mobile_network_code": "260"
    }
  },
  "sim_swap": {
    "last_sim_swap_date": null,
    "swapped_period": "within_24_hours",
    "swapped_in_period": false
  },
  "call_forwarding": {
    "call_forwarding_status": false
  },
  "sms_pumping_risk": {
    "risk_level": "low",
    "number_blocked": false
  },
  "phone_number_quality_score": 85,
  "cached": false,
  "lookup_timestamp": "2025-11-11T16:20:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/caller-id/lookup \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+15127563382",
    "fields": "validation,caller_name,line_type_intelligence"
  }'
GET /v1/caller-id/status/{phoneNumber}

Retrieve cached caller ID information for a phone number. Returns locally stored data without making a new Twilio API call.

Path Parameters
Parameter Type Description
phoneNumber string Phone number in E.164 format (URL encoded, e.g., %2B15127563382)
{
  "success": true,
  "cached": true,
  "phone_number": "+15127563382",
  "caller_name": "JOHN DOE",
  "caller_type": "CONSUMER",
  "line_type": "mobile",
  "carrier_name": "T-Mobile USA",
  "country_code": "US",
  "national_format": "(512) 756-3382",
  "valid": true,
  "last_updated": "2025-11-11T14:30:00Z",
  "metadata": {
    "source": "twilio_lookup",
    "update_record": {
      "reason": "New caller triggered CNAM entry",
      "datetime": "2025-11-11T14:30:00Z"
    }
  }
}
curl -X GET "https://api.neuralcore5.ai/v1/caller-id/status/%2B15127563382" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
<?php
$phoneNumber = urlencode('+15127563382');
$url = "https://api.neuralcore5.ai/v1/caller-id/status/$phoneNumber";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
if ($data['cached']) {
    echo "Caller: " . $data['caller_name'] . "\n";
    echo "Carrier: " . $data['carrier_name'] . "\n";
}
POST /v1/caller-id/validate

Validate phone number format and check if it's properly formatted in E.164 standard without performing a full lookup.

Request Body
Parameter Type Required Description
phone_number string Required Phone number to validate
normalize boolean Optional Return normalized E.164 format (default: true)
{
  "phone_number": "5127563382",
  "normalize": true
}
{
  "valid": true,
  "original": "5127563382",
  "normalized": "+15127563382",
  "format": "e164",
  "country_code": "1",
  "message": "Phone number is valid"
}
curl -X POST https://api.neuralcore5.ai/v1/caller-id/validate \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "5127563382"
  }'

CSRF Protection

Cross-Site Request Forgery protection tokens for securing state-changing operations.

GET /v1/csrf/token

Retrieve the current CSRF token for the authenticated session. This token must be included in all POST, PUT, DELETE, and PATCH requests.

{
  "success": true,
  "csrf_token": "9f8e7d6c5b4a3f2e1d0c9b8a7f6e5d4c",
  "generated_at": "2025-11-11T15:30:00Z",
  "expires_with_session": true
}
curl -X GET https://api.neuralcore5.ai/v1/csrf/token \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN"
<?php
$url = 'https://api.neuralcore5.ai/v1/csrf/token';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_SESSION_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
$csrfToken = $data['csrf_token'];

// Use this token in subsequent POST/PUT/DELETE requests
// Add header: X-NC5-CSRF-Token: $csrfToken
POST /v1/csrf/validate

Validate a CSRF token without performing any action. Useful for client-side pre-flight validation.

Request Body
Parameter Type Required Description
csrf_token string Required The CSRF token to validate
{
  "csrf_token": "9f8e7d6c5b4a3f2e1d0c9b8a7f6e5d4c"
}
{
  "valid": true,
  "message": "CSRF token is valid"
}
curl -X POST https://api.neuralcore5.ai/v1/csrf/validate \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "csrf_token": "9f8e7d6c5b4a3f2e1d0c9b8a7f6e5d4c"
  }'
POST /v1/csrf/regenerate

Generate a new CSRF token for the current session. Invalidates the previous token.

{
  "success": true,
  "csrf_token": "1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p",
  "generated_at": "2025-11-11T15:35:00Z",
  "message": "CSRF token regenerated successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/csrf/regenerate \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "X-NC5-CSRF-Token: OLD_CSRF_TOKEN"

Encryption

Data encryption and decryption services for securing sensitive information.

POST /v1/encryption/encrypt

Encrypt sensitive data using AES-256-GCM encryption. Returns encrypted data and initialization vector.

Request Body
Parameter Type Required Description
data string Required Plain text data to encrypt
key_id string Optional Specific encryption key ID (uses default if not provided)
context object Optional Additional authenticated data (AAD) for GCM mode
{
  "data": "Sensitive information to encrypt",
  "key_id": "key_prod_2025",
  "context": {
    "user_id": "1234567",
    "purpose": "payment_info"
  }
}
{
  "success": true,
  "encrypted_data": "AQIDAHjK...encrypted_base64_string...==",
  "iv": "random_initialization_vector_base64",
  "tag": "authentication_tag_base64",
  "key_id": "key_prod_2025",
  "algorithm": "AES-256-GCM",
  "encrypted_at": "2025-11-11T15:50:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/encryption/encrypt \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "data": "Sensitive information to encrypt"
  }'
POST /v1/encryption/decrypt

Decrypt previously encrypted data using the corresponding key and initialization vector.

Request Body
Parameter Type Required Description
encrypted_data string Required Base64-encoded encrypted data
iv string Required Base64-encoded initialization vector
tag string Required Base64-encoded authentication tag (GCM)
key_id string Optional Encryption key ID used (auto-detected if not provided)
context object Optional AAD used during encryption (must match)
{
  "encrypted_data": "AQIDAHjK...encrypted_base64_string...==",
  "iv": "random_initialization_vector_base64",
  "tag": "authentication_tag_base64",
  "key_id": "key_prod_2025"
}
{
  "success": true,
  "decrypted_data": "Sensitive information to encrypt",
  "key_id": "key_prod_2025",
  "decrypted_at": "2025-11-11T15:52:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/encryption/decrypt \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "encrypted_data": "AQIDAHjK...==",
    "iv": "random_iv_base64",
    "tag": "auth_tag_base64"
  }'
GET /v1/encryption/keys

Get information about available encryption keys (metadata only, not the actual keys).

{
  "keys": [
    {
      "key_id": "key_prod_2025",
      "algorithm": "AES-256-GCM",
      "status": "active",
      "created_at": "2025-01-01T00:00:00Z",
      "is_default": true
    },
    {
      "key_id": "key_prod_2024",
      "algorithm": "AES-256-GCM",
      "status": "retired",
      "created_at": "2024-01-01T00:00:00Z",
      "is_default": false
    }
  ]
}
curl -X GET https://api.neuralcore5.ai/v1/encryption/keys \
  -H "Authorization: Bearer YOUR_API_TOKEN"
POST /v1/encryption/rotate

Rotate encryption keys for enhanced security. Creates a new key and marks old key for retirement.

Request Body
Parameter Type Required Description
old_key_id string Required Current key ID to rotate
set_as_default boolean Optional Set new key as default (default: true)
{
  "old_key_id": "key_prod_2024",
  "set_as_default": true
}
{
  "success": true,
  "new_key_id": "key_prod_2025",
  "old_key_id": "key_prod_2024",
  "old_key_status": "retired",
  "new_key_is_default": true,
  "rotated_at": "2025-11-11T15:55:00Z",
  "message": "Encryption key rotated successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/encryption/rotate \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "old_key_id": "key_prod_2024"
  }'

Fingerprinting

Device and entity fingerprinting system for uniquely identifying and cataloging organic people, subscribers, devices, vehicles, domestic animals, computers, and mobile devices.

POST /v1/fingerprint/generate

Generate a unique fingerprint for a device, person, or entity based on provided characteristics. Returns a cryptographic hash identifier.

Request Body
Parameter Type Required Description
entity_type string Required Type: "person", "device", "vehicle", "animal", "computer", "mobile", "tablet", "subscriber"
characteristics object Required Entity-specific characteristics for fingerprint generation
metadata object Optional Additional metadata for cataloging
linked_user_id string Optional User ID to link this fingerprint to
Characteristics by Entity Type
Entity Type Required Fields Optional Fields
device/mobile/tablet user_agent, screen_resolution, timezone ip_address, browser_version, os_version, device_model, installed_fonts, plugins, canvas_hash, webgl_hash
computer hostname, mac_address, os_version cpu_info, gpu_info, memory_size, disk_serial, bios_serial, installed_software
person/subscriber email OR phone_number name, address, birth_date, social_profiles, biometric_hash
vehicle vin OR license_plate make, model, year, color, registration_state
animal species, microchip_id OR tattoo_id name, breed, color, birth_date, owner_id
{
  "entity_type": "mobile",
  "characteristics": {
    "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X)",
    "screen_resolution": "1170x2532",
    "timezone": "America/Chicago",
    "ip_address": "192.168.1.100",
    "browser_version": "Safari 17.0",
    "os_version": "iOS 17.0",
    "device_model": "iPhone 15 Pro",
    "canvas_hash": "a1b2c3d4e5f6",
    "webgl_hash": "f6e5d4c3b2a1"
  },
  "metadata": {
    "first_seen": "2025-11-11T16:25:00Z",
    "location": "Austin, TX"
  },
  "linked_user_id": "1234567"
}
{
  "entity_type": "person",
  "characteristics": {
    "email": "john.doe@example.com",
    "phone_number": "+15127563382",
    "name": "John Doe",
    "address": "123 Main St, Austin, TX 78701",
    "social_profiles": {
      "linkedin": "john-doe-profile",
      "twitter": "@johndoe"
    }
  },
  "metadata": {
    "account_created": "2025-01-15T10:00:00Z",
    "verification_status": "verified"
  }
}
{
  "success": true,
  "fingerprint_id": "fp_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
  "fingerprint_hash": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
  "entity_type": "mobile",
  "confidence_score": 0.95,
  "created_at": "2025-11-11T16:25:00Z",
  "expires_at": null,
  "linked_user_id": "1234567",
  "catalog_entry_created": true
}
curl -X POST https://api.neuralcore5.ai/v1/fingerprint/generate \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "entity_type": "mobile",
    "characteristics": {
      "user_agent": "Mozilla/5.0...",
      "screen_resolution": "1170x2532",
      "timezone": "America/Chicago"
    }
  }'
GET /v1/fingerprint/{fingerprintId}

Retrieve detailed information about a cataloged fingerprint including characteristics, metadata, and linked entities.

Path Parameters
Parameter Type Description
fingerprintId string Fingerprint ID (e.g., fp_a1b2c3d4e5f6g7h8)
{
  "fingerprint_id": "fp_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
  "fingerprint_hash": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
  "entity_type": "mobile",
  "confidence_score": 0.95,
  "characteristics": {
    "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X)",
    "screen_resolution": "1170x2532",
    "timezone": "America/Chicago",
    "device_model": "iPhone 15 Pro"
  },
  "metadata": {
    "first_seen": "2025-11-11T16:25:00Z",
    "last_seen": "2025-11-11T18:40:00Z",
    "total_sessions": 15,
    "location": "Austin, TX"
  },
  "linked_entities": {
    "user_id": "1234567",
    "session_ids": ["sess_abc123", "sess_def456"],
    "ip_addresses": ["192.168.1.100", "192.168.1.101"]
  },
  "created_at": "2025-11-11T16:25:00Z",
  "updated_at": "2025-11-11T18:40:00Z"
}
curl -X GET https://api.neuralcore5.ai/v1/fingerprint/fp_a1b2c3d4e5f6g7h8 \
  -H "Authorization: Bearer YOUR_API_TOKEN"
POST /v1/fingerprint/identify

Identify an existing entity by matching provided characteristics against the fingerprint catalog. Returns matching fingerprints with confidence scores.

Request Body
Parameter Type Required Description
entity_type string Required Type of entity to identify
characteristics object Required Characteristics to match against catalog
min_confidence float Optional Minimum confidence score (0.0-1.0, default: 0.7)
{
  "entity_type": "mobile",
  "characteristics": {
    "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X)",
    "screen_resolution": "1170x2532",
    "timezone": "America/Chicago"
  },
  "min_confidence": 0.8
}
{
  "success": true,
  "matches_found": 2,
  "matches": [
    {
      "fingerprint_id": "fp_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
      "confidence_score": 0.95,
      "entity_type": "mobile",
      "linked_user_id": "1234567",
      "last_seen": "2025-11-11T18:40:00Z"
    },
    {
      "fingerprint_id": "fp_z9y8x7w6v5u4t3s2r1q0p9o8n7m6l5k4",
      "confidence_score": 0.82,
      "entity_type": "mobile",
      "linked_user_id": "1234567",
      "last_seen": "2025-11-10T14:20:00Z"
    }
  ],
  "query_timestamp": "2025-11-11T19:00:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/fingerprint/identify \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "entity_type": "mobile",
    "characteristics": {
      "user_agent": "Mozilla/5.0...",
      "screen_resolution": "1170x2532"
    }
  }'
PUT /v1/fingerprint/update/{fingerprintId}

Update fingerprint metadata, characteristics, or linked entity information.

Path Parameters
Parameter Type Description
fingerprintId string Fingerprint ID to update
Request Body
Parameter Type Required Description
characteristics object Optional Updated characteristics (merged with existing)
metadata object Optional Updated metadata (merged with existing)
linked_user_id string Optional Update linked user ID
{
  "characteristics": {
    "os_version": "iOS 17.1",
    "browser_version": "Safari 17.1"
  },
  "metadata": {
    "last_seen": "2025-11-11T19:00:00Z",
    "total_sessions": 16
  }
}
{
  "success": true,
  "fingerprint_id": "fp_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
  "updated_at": "2025-11-11T19:00:00Z",
  "message": "Fingerprint updated successfully"
}
curl -X PUT https://api.neuralcore5.ai/v1/fingerprint/update/fp_a1b2c3d4e5f6g7h8 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "metadata": {
      "last_seen": "2025-11-11T19:00:00Z"
    }
  }'
GET /v1/fingerprint/catalog

List all cataloged fingerprints with filtering and pagination options.

Query Parameters
Parameter Type Required Description
entity_type string Optional Filter by entity type
linked_user_id string Optional Filter by linked user
page integer Optional Page number (default: 1)
limit integer Optional Results per page (default: 50, max: 200)
{
  "total": 250,
  "page": 1,
  "limit": 50,
  "fingerprints": [
    {
      "fingerprint_id": "fp_a1b2c3d4e5f6g7h8",
      "entity_type": "mobile",
      "linked_user_id": "1234567",
      "confidence_score": 0.95,
      "created_at": "2025-11-11T16:25:00Z",
      "last_seen": "2025-11-11T19:00:00Z"
    },
    {
      "fingerprint_id": "fp_z9y8x7w6v5u4t3s2",
      "entity_type": "computer",
      "linked_user_id": "1234567",
      "confidence_score": 0.98,
      "created_at": "2025-11-10T10:00:00Z",
      "last_seen": "2025-11-11T18:30:00Z"
    }
  ]
}
curl -X GET "https://api.neuralcore5.ai/v1/fingerprint/catalog?entity_type=mobile&page=1&limit=50" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
DELETE /v1/fingerprint/{fingerprintId}

Remove a fingerprint from the catalog. This action is permanent and cannot be undone.

Path Parameters
Parameter Type Description
fingerprintId string Fingerprint ID to delete
{
  "success": true,
  "fingerprint_id": "fp_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
  "deleted_at": "2025-11-11T19:10:00Z",
  "message": "Fingerprint deleted successfully"
}
curl -X DELETE https://api.neuralcore5.ai/v1/fingerprint/fp_a1b2c3d4e5f6g7h8 \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Firewall

GET /v1/firewall/status

Get the current firewall configuration and status including active rules, blocked IPs, and allowed IPs.

{
  "status": "active",
  "rules_count": 127,
  "blocked_ips": 42,
  "allowed_ips": 15,
  "rate_limit": {
    "enabled": true,
    "requests_per_minute": 60
  },
  "last_updated": "2025-11-11T14:30:00Z"
}
curl -X GET https://api.neuralcore5.ai/v1/firewall/status \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
<?php
$url = 'https://api.neuralcore5.ai/v1/firewall/status';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer YOUR_API_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Firewall Status: " . $data['status'] . "\n";
echo "Active Rules: " . $data['rules_count'];
POST /v1/firewall/block

Block an IP address or IP range from accessing the API.

Request Body
Parameter Type Required Description
ip_address string Required IP address or CIDR range to block
reason string Optional Reason for blocking this IP
expires_at datetime Optional Expiration time for temporary blocks
{
  "ip_address": "192.168.1.100",
  "reason": "Suspicious activity detected",
  "expires_at": "2025-11-12T00:00:00Z"
}
{
  "success": true,
  "ip_address": "192.168.1.100",
  "blocked_at": "2025-11-11T15:45:30Z",
  "expires_at": "2025-11-12T00:00:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/firewall/block \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
    "ip_address": "192.168.1.100",
    "reason": "Suspicious activity detected"
  }'
DELETE /v1/firewall/block/{ipAddress}

Remove an IP address from the block list.

Path Parameters
Parameter Type Description
ipAddress string IP address to unblock (URL encoded)
{
  "success": true,
  "ip_address": "192.168.1.100",
  "unblocked_at": "2025-11-11T15:45:30Z"
}
curl -X DELETE https://api.neuralcore5.ai/v1/firewall/block/192.168.1.100 \
  -H "Authorization: Bearer YOUR_API_TOKEN"
GET /v1/firewall/blocks

Get a list of all currently blocked IP addresses and ranges.

Query Parameters
Parameter Type Required Description
page integer Optional Page number for pagination (default: 1)
limit integer Optional Results per page (default: 50, max: 200)
{
  "total": 42,
  "page": 1,
  "limit": 50,
  "blocks": [
    {
      "ip_address": "192.168.1.100",
      "reason": "Suspicious activity detected",
      "blocked_at": "2025-11-11T10:30:00Z",
      "expires_at": "2025-11-12T00:00:00Z"
    },
    {
      "ip_address": "10.0.0.0/24",
      "reason": "Known malicious subnet",
      "blocked_at": "2025-11-10T08:15:00Z",
      "expires_at": null
    }
  ]
}
curl -X GET "https://api.neuralcore5.ai/v1/firewall/blocks?page=1&limit=50" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
<?php
$url = 'https://api.neuralcore5.ai/v1/firewall/blocks?page=1&limit=50';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer YOUR_API_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Total Blocks: " . $data['total'] . "\n";
foreach ($data['blocks'] as $block) {
    echo "Blocked: " . $block['ip_address'] . " - " . $block['reason'] . "\n";
}

Fraud Detection & Prevention

Comprehensive fraud detection using multiple third-party services including IP geolocation, phone validation, email verification, and behavioral analysis to protect against fraudulent traffic, SMS pumping, account takeovers, and payment fraud.

POST /v1/fraud/geoip/lookup

Query MaxMind GeoIP2 database to get detailed location information for an IP address including country, city, ISP, connection type, and risk indicators.

Request Body
Parameter Type Required Description
ip_address string Required IPv4 or IPv6 address to lookup
service string Optional Service level: "country", "city", "insights" (default: "city")
locale string Optional Language code for location names (default: "en")
{
  "ip_address": "8.8.8.8",
  "service": "insights",
  "locale": "en"
}
{
  "success": true,
  "ip_address": "8.8.8.8",
  "country": {
    "iso_code": "US",
    "name": "United States",
    "is_in_european_union": false
  },
  "city": {
    "name": "Mountain View",
    "confidence": 50
  },
  "location": {
    "latitude": 37.386,
    "longitude": -122.0838,
    "accuracy_radius": 1000,
    "time_zone": "America/Los_Angeles"
  },
  "postal": {
    "code": "94035",
    "confidence": 20
  },
  "subdivisions": [
    {
      "iso_code": "CA",
      "name": "California"
    }
  ],
  "traits": {
    "autonomous_system_number": 15169,
    "autonomous_system_organization": "Google LLC",
    "connection_type": "Corporate",
    "domain": "google.com",
    "is_anonymous": false,
    "is_anonymous_proxy": false,
    "is_anonymous_vpn": false,
    "is_hosting_provider": false,
    "is_public_proxy": false,
    "is_residential_proxy": false,
    "is_tor_exit_node": false,
    "isp": "Google LLC",
    "organization": "Google LLC",
    "user_type": "business"
  },
  "risk_score": 0.01,
  "queried_at": "2025-11-11T17:00:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/fraud/geoip/lookup \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "ip_address": "8.8.8.8",
    "service": "insights"
  }'
POST /v1/fraud/minfraud/score

Query MaxMind minFraud service to get comprehensive fraud risk scoring for transactions, account creations, and user activities. Returns risk score, IP risk, email risk, and disposition recommendations.

Request Body
Parameter Type Required Description
ip_address string Required User's IP address
device object Optional Device information (user_agent, accept_language, session_id)
email object Optional Email address and domain to validate
billing object Optional Billing information (address, phone, name)
payment object Optional Payment details (processor, was_authorized, decline_code)
order object Optional Order details (amount, currency, discount_code)
account object Optional Account information (user_id, username_md5)
{
  "ip_address": "192.168.1.100",
  "device": {
    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "accept_language": "en-US,en;q=0.9",
    "session_id": "sess_abc123xyz"
  },
  "email": {
    "address": "user@example.com",
    "domain": "example.com"
  },
  "billing": {
    "first_name": "John",
    "last_name": "Doe",
    "address": "123 Main St",
    "city": "Austin",
    "region": "TX",
    "postal": "78701",
    "country": "US",
    "phone_number": "+15127563382"
  },
  "order": {
    "amount": 99.95,
    "currency": "USD"
  },
  "account": {
    "user_id": "1234567"
  }
}
{
  "success": true,
  "risk_score": 15.5,
  "disposition": {
    "action": "accept",
    "reason": "default"
  },
  "ip_address": {
    "risk": 0.01,
    "country": "US",
    "city": "Austin",
    "is_high_risk": false,
    "traits": {
      "is_anonymous": false,
      "is_anonymous_vpn": false,
      "is_hosting_provider": false,
      "is_public_proxy": false,
      "is_tor_exit_node": false
    }
  },
  "email": {
    "is_disposable": false,
    "is_free": false,
    "is_high_risk": false,
    "domain_age_days": 8760,
    "first_seen": "2015-03-15"
  },
  "billing_address": {
    "is_postal_in_city": true,
    "distance_to_ip_location": 5,
    "is_in_ip_country": true
  },
  "warnings": [],
  "queries_remaining": 9950,
  "funds_remaining": 495.00,
  "query_id": "qry_abc123xyz456",
  "queried_at": "2025-11-11T17:05:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/fraud/minfraud/score \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "ip_address": "192.168.1.100",
    "email": {
      "address": "user@example.com"
    },
    "order": {
      "amount": 99.95,
      "currency": "USD"
    }
  }'
POST /v1/fraud/sift/analyze

Analyze user behavior and transaction patterns using Sift Science's machine learning fraud detection. Detects account takeover, payment fraud, content abuse, and promotion abuse.

Request Body
Parameter Type Required Description
user_id string Required User ID or session identifier
event_type string Required Event type: "login", "create_account", "transaction", "create_content", "update_account"
ip_address string Optional User's IP address
session_id string Optional Session identifier
browser object Optional Browser fingerprint data
transaction object Optional Transaction details (for transaction events)
abuse_types array Optional Abuse types to check: ["payment_abuse", "account_abuse", "content_abuse", "promotion_abuse"]
{
  "user_id": "1234567",
  "event_type": "transaction",
  "ip_address": "192.168.1.100",
  "session_id": "sess_abc123xyz",
  "browser": {
    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "accept_language": "en-US",
    "content_language": "en-US"
  },
  "transaction": {
    "transaction_id": "txn_987654321",
    "amount": 5000000,
    "currency_code": "USD",
    "transaction_type": "$sale",
    "payment_method": {
      "payment_type": "$credit_card",
      "card_bin": "542486",
      "card_last4": "4242"
    }
  },
  "abuse_types": ["payment_abuse", "account_abuse"]
}
{
  "success": true,
  "user_id": "1234567",
  "scores": {
    "payment_abuse": {
      "score": 0.12,
      "reasons": [
        {
          "name": "Frequent Transactions",
          "value": "User has made 5 transactions in the last hour"
        }
      ],
      "decision": {
        "id": "block_bad_payment_abuse",
        "category": "block"
      }
    },
    "account_abuse": {
      "score": 0.05,
      "reasons": [],
      "decision": {
        "id": "accept_default",
        "category": "accept"
      }
    }
  },
  "workflow_statuses": [
    {
      "id": "payment_abuse_workflow",
      "state": "running",
      "history": [
        {
          "app": "decision",
          "name": "accept",
          "state": "finished"
        }
      ]
    }
  ],
  "latest_labels": {},
  "entity_type": "user",
  "analyzed_at": "2025-11-11T17:10:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/fraud/sift/analyze \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "1234567",
    "event_type": "transaction",
    "ip_address": "192.168.1.100",
    "abuse_types": ["payment_abuse", "account_abuse"]
  }'
POST /v1/fraud/telesign/phone-score

Validate phone numbers and get fraud risk scoring using Telesign Score. Detects invalid numbers, VoIP lines, prepaid phones, and risky carriers to prevent SMS pumping and phone fraud.

Request Body
Parameter Type Required Description
phone_number string Required Phone number in E.164 format
account_lifecycle_event string Optional Event type: "create", "sign-in", "transact", "update", "delete"
originating_ip string Optional User's IP address for enhanced scoring
device_id string Optional Device identifier for cross-reference
{
  "phone_number": "+15127563382",
  "account_lifecycle_event": "create",
  "originating_ip": "192.168.1.100",
  "device_id": "device_abc123xyz"
}
{
  "success": true,
  "reference_id": "ref_abc123xyz456",
  "phone_number": "+15127563382",
  "numbering": {
    "original": {
      "phone_number": "+15127563382",
      "complete_phone_number": "+15127563382",
      "country_code": "1"
    },
    "cleansing": {
      "call": {
        "country_code": "1",
        "phone_number": "+15127563382"
      },
      "sms": {
        "country_code": "1",
        "phone_number": "+15127563382"
      }
    }
  },
  "phone_type": {
    "code": "2",
    "description": "MOBILE"
  },
  "carrier": {
    "name": "T-Mobile USA"
  },
  "risk": {
    "level": "low",
    "recommendation": "allow",
    "score": 125
  },
  "fraud_score": {
    "risk_level": "low",
    "risk_score": 125,
    "risk_recommendation": "allow"
  },
  "attributes": {
    "is_valid": true,
    "is_roaming": false,
    "is_ported": false,
    "is_prepaid": false,
    "is_voip": false,
    "is_virtual": false,
    "risk_indicators": []
  },
  "checked_at": "2025-11-11T17:15:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/fraud/telesign/phone-score \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+15127563382",
    "account_lifecycle_event": "create"
  }'
POST /v1/fraud/ipqs/check

Comprehensive fraud detection using IPQualityScore (IPQS). Validates IP addresses, emails, and phone numbers simultaneously with proxy detection, bot detection, and abuse database lookups.

Request Body
Parameter Type Required Description
check_type string Required Check type: "ip", "email", "phone", "url", "multi"
ip_address string Optional IP address to check (required for "ip" or "multi")
email string Optional Email address to validate (required for "email" or "multi")
phone string Optional Phone number to validate (required for "phone" or "multi")
user_agent string Optional User agent string for device fingerprinting
user_language string Optional Browser language for consistency checks
strictness integer Optional Detection strictness level: 0 (low), 1 (medium), 2 (high) - default: 1
{
  "check_type": "multi",
  "ip_address": "192.168.1.100",
  "email": "user@example.com",
  "phone": "+15127563382",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
  "user_language": "en-US",
  "strictness": 1
}
{
  "success": true,
  "check_type": "multi",
  "ip_check": {
    "ip_address": "192.168.1.100",
    "fraud_score": 12,
    "country_code": "US",
    "region": "Texas",
    "city": "Austin",
    "isp": "AT&T Services",
    "asn": 7018,
    "organization": "AT&T Services, Inc.",
    "is_crawler": false,
    "is_proxy": false,
    "is_vpn": false,
    "is_tor": false,
    "is_bot": false,
    "recent_abuse": false,
    "bot_status": false,
    "connection_type": "Residential",
    "abuse_velocity": "none",
    "timezone": "America/Chicago",
    "mobile": false,
    "host": "att.net",
    "proxy": false,
    "vpn": false,
    "tor": false,
    "active_vpn": false,
    "active_tor": false
  },
  "email_check": {
    "valid": true,
    "disposable": false,
    "smtp_score": 3,
    "overall_score": 1,
    "first_name": "Unknown",
    "generic": false,
    "common": true,
    "dns_valid": true,
    "honeypot": false,
    "deliverability": "high",
    "frequent_complainer": false,
    "spam_trap_score": "none",
    "catch_all": false,
    "timed_out": false,
    "suspect": false,
    "recent_abuse": false,
    "fraud_score": 5,
    "domain_age": {
      "human": "10 years ago",
      "timestamp": 1420070400,
      "iso": "2015-01-01T00:00:00Z"
    },
    "sanitized_email": "user@example.com",
    "leaked": false
  },
  "phone_check": {
    "valid": true,
    "active": true,
    "active_status": "active",
    "phone_number": "+15127563382",
    "country_code": "US",
    "region": "TX",
    "city": "Austin",
    "carrier": "T-Mobile USA",
    "line_type": "Wireless",
    "is_prepaid": false,
    "is_commercial": false,
    "is_risky": false,
    "dialing_code": 1,
    "local_format": "(512) 756-3382",
    "leaked": false,
    "name": "Unknown",
    "timezone": "America/Chicago",
    "do_not_call": false,
    "fraud_score": 8,
    "recent_abuse": false,
    "VOIP": false,
    "recent_activity": "Unknown"
  },
  "overall_risk_score": 8.33,
  "recommendation": "allow",
  "request_id": "req_abc123xyz456",
  "checked_at": "2025-11-11T17:20:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/fraud/ipqs/check \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "check_type": "multi",
    "ip_address": "192.168.1.100",
    "email": "user@example.com",
    "phone": "+15127563382",
    "strictness": 1
  }'
POST /v1/fraud/aggregate/report

Generate a comprehensive fraud report by aggregating data from multiple fraud detection services. Returns unified risk score and recommendations based on all available data sources.

Request Body
Parameter Type Required Description
user_id string Required User ID or session identifier
ip_address string Required User's IP address
email string Optional Email address
phone string Optional Phone number in E.164 format
services array Optional Services to query: ["maxmind", "sift", "telesign", "ipqs"] - default: all
transaction_data object Optional Transaction details for enhanced scoring
{
  "user_id": "1234567",
  "ip_address": "192.168.1.100",
  "email": "user@example.com",
  "phone": "+15127563382",
  "services": ["maxmind", "sift", "telesign", "ipqs"],
  "transaction_data": {
    "amount": 99.95,
    "currency": "USD",
    "payment_method": "credit_card"
  }
}
{
  "success": true,
  "user_id": "1234567",
  "aggregate_risk_score": 12.5,
  "risk_level": "low",
  "recommendation": "allow",
  "confidence": 0.92,
  "service_results": {
    "maxmind_minfraud": {
      "queried": true,
      "risk_score": 15.5,
      "disposition": "accept",
      "response_time_ms": 145
    },
    "sift_science": {
      "queried": true,
      "payment_abuse_score": 0.12,
      "account_abuse_score": 0.05,
      "recommendation": "accept",
      "response_time_ms": 220
    },
    "telesign": {
      "queried": true,
      "phone_risk_score": 125,
      "risk_level": "low",
      "is_valid": true,
      "response_time_ms": 180
    },
    "ipqs": {
      "queried": true,
      "overall_score": 8.33,
      "ip_fraud_score": 12,
      "email_fraud_score": 5,
      "phone_fraud_score": 8,
      "response_time_ms": 190
    }
  },
  "risk_factors": {
    "ip_reputation": "clean",
    "email_validity": "valid",
    "phone_validity": "valid",
    "device_fingerprint": "recognized",
    "behavioral_patterns": "normal",
    "velocity_checks": "passed"
  },
  "flags": [],
  "generated_at": "2025-11-11T17:25:00Z",
  "total_processing_time_ms": 735
}
curl -X POST https://api.neuralcore5.ai/v1/fraud/aggregate/report \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "1234567",
    "ip_address": "192.168.1.100",
    "email": "user@example.com",
    "phone": "+15127563382"
  }'

Identity Verification

Stripe Identity integration for verifying user identity with government-issued IDs, selfie verification, and document authentication. Ensure compliance and reduce fraud with automated identity checks.

POST /v1/identity/verify

Initiate a Stripe Identity verification session for a user. Returns a verification session URL where the user can complete their identity verification process.

Request Body
Parameter Type Required Description
user_id string Required User ID (OPID) to verify
return_url string Required URL to redirect user after verification completion
verification_type string Optional Type: "document" or "id_number" (default: "document")
require_selfie boolean Optional Require matching selfie (default: true)
allowed_documents array Optional Allowed document types: ["driving_license", "passport", "id_card"]
{
  "user_id": "1234567",
  "return_url": "https://example.com/verification/complete",
  "verification_type": "document",
  "require_selfie": true,
  "allowed_documents": ["driving_license", "passport", "id_card"]
}
{
  "success": true,
  "verification_id": "vs_1AbC2DeF3GhI4JkL5MnO",
  "verification_url": "https://verify.stripe.com/start/test_abc123xyz456",
  "client_secret": "vs_secret_abc123xyz456def789ghi012",
  "status": "requires_input",
  "user_id": "1234567",
  "created_at": "2025-11-11T16:00:00Z",
  "expires_at": "2025-11-11T17:00:00Z",
  "session_lifetime_seconds": 3600
}
curl -X POST https://api.neuralcore5.ai/v1/identity/verify \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "1234567",
    "return_url": "https://example.com/verification/complete",
    "verification_type": "document"
  }'
GET /v1/identity/status/{verificationId}

Get the current status of an identity verification session including submission status, verification checks, and any errors.

Path Parameters
Parameter Type Description
verificationId string Stripe verification session ID (e.g., vs_1AbC2DeF3GhI4JkL)
{
  "verification_id": "vs_1AbC2DeF3GhI4JkL5MnO",
  "user_id": "1234567",
  "status": "verified",
  "submitted_at": "2025-11-11T16:10:00Z",
  "verified_at": "2025-11-11T16:15:00Z",
  "document_type": "driving_license",
  "verification_checks": {
    "document_authenticity": "passed",
    "document_data_match": "passed",
    "selfie_comparison": "passed",
    "age_verification": "passed"
  },
  "verified_data": {
    "first_name": "John",
    "last_name": "Doe",
    "dob": "1990-01-15",
    "document_number": "D123****890",
    "issuing_country": "US"
  },
  "error": null
}
curl -X GET https://api.neuralcore5.ai/v1/identity/status/vs_1AbC2DeF3GhI4JkL \
  -H "Authorization: Bearer YOUR_API_TOKEN"
<?php
$verificationId = 'vs_1AbC2DeF3GhI4JkL';
$url = "https://api.neuralcore5.ai/v1/identity/status/$verificationId";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
if ($data['status'] === 'verified') {
    echo "User verified: " . $data['verified_data']['first_name'] . " " . $data['verified_data']['last_name'] . "\n";
    echo "Document: " . $data['document_type'] . "\n";
}
POST /v1/identity/session

Create a new Stripe Identity verification session with advanced options including document type restrictions, metadata, and custom verification flow settings.

Request Body
Parameter Type Required Description
user_id string Required User ID (OPID)
type string Required Verification type: "document" or "id_number"
return_url string Required Redirect URL after completion
options object Optional Verification options (document types, requirements, etc.)
metadata object Optional Custom metadata for tracking (max 50 keys)
{
  "user_id": "1234567",
  "type": "document",
  "return_url": "https://example.com/verification/complete",
  "options": {
    "document": {
      "allowed_types": ["driving_license", "passport"],
      "require_live_capture": true,
      "require_matching_selfie": true,
      "require_id_number": false
    },
    "age_requirement": {
      "minimum_age": 18
    }
  },
  "metadata": {
    "account_type": "premium",
    "verification_reason": "kyc_compliance",
    "requested_by": "support_team",
    "internal_reference": "VER-2025-11-001"
  }
}
{
  "success": true,
  "session_id": "vs_1AbC2DeF3GhI4JkL5MnO",
  "client_secret": "vs_secret_abc123xyz456def789ghi012",
  "url": "https://verify.stripe.com/start/test_abc123xyz456",
  "status": "requires_input",
  "user_id": "1234567",
  "type": "document",
  "options_applied": {
    "allowed_document_types": ["driving_license", "passport"],
    "require_selfie": true,
    "minimum_age": 18
  },
  "created_at": "2025-11-11T16:05:00Z",
  "expires_at": "2025-11-11T17:05:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/identity/session \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "1234567",
    "type": "document",
    "return_url": "https://example.com/verification/complete"
  }'
GET /v1/identity/report/{verificationId}

Get detailed verification report including extracted data from documents, verification check results, and confidence scores. Contains PII - handle securely.

Path Parameters
Parameter Type Description
verificationId string Stripe verification session ID
{
  "verification_id": "vs_1AbC2DeF3GhI4JkL5MnO",
  "user_id": "1234567",
  "status": "verified",
  "report": {
    "document": {
      "type": "driving_license",
      "number": "D123****890",
      "issuing_country": "US",
      "issuing_state": "TX",
      "issue_date": "2020-03-15",
      "expiration_date": "2028-03-14",
      "status": "verified",
      "authenticity_check": {
        "result": "passed",
        "confidence_score": 0.98
      }
    },
    "identity": {
      "first_name": "John",
      "middle_name": "Michael",
      "last_name": "Doe",
      "dob": "1990-01-15",
      "age": 35,
      "address": {
        "line1": "123 Main Street",
        "line2": "Apt 4B",
        "city": "Austin",
        "state": "TX",
        "postal_code": "78701",
        "country": "US"
      }
    },
    "selfie": {
      "captured": true,
      "comparison_result": "match",
      "confidence_score": 0.96
    },
    "checks": {
      "document_authenticity": {
        "status": "passed",
        "details": "Document shows no signs of tampering"
      },
      "document_data_match": {
        "status": "passed",
        "details": "All extracted data is consistent"
      },
      "selfie_comparison": {
        "status": "passed",
        "details": "Selfie matches document photo"
      },
      "data_consistency": {
        "status": "passed",
        "details": "All data points are consistent"
      },
      "age_verification": {
        "status": "passed",
        "minimum_age_met": true,
        "required_age": 18,
        "actual_age": 35
      }
    },
    "risk_assessment": {
      "risk_level": "low",
      "fraud_score": 0.02,
      "flags": []
    }
  },
  "verified_at": "2025-11-11T16:15:00Z",
  "report_generated_at": "2025-11-11T16:20:00Z"
}
curl -X GET https://api.neuralcore5.ai/v1/identity/report/vs_1AbC2DeF3GhI4JkL \
  -H "Authorization: Bearer YOUR_API_TOKEN"
GET /v1/identity/list/{userId}

List all identity verification attempts for a specific user including completed, pending, and failed verifications.

Path Parameters
Parameter Type Description
userId string User ID (OPID) to list verifications for
Query Parameters
Parameter Type Required Description
status string Optional Filter by status: "verified", "requires_input", "processing", "failed"
limit integer Optional Number of results (default: 10, max: 100)
{
  "user_id": "1234567",
  "total_verifications": 3,
  "verifications": [
    {
      "verification_id": "vs_1AbC2DeF3GhI4JkL5MnO",
      "status": "verified",
      "type": "document",
      "document_type": "driving_license",
      "created_at": "2025-11-11T16:00:00Z",
      "verified_at": "2025-11-11T16:15:00Z"
    },
    {
      "verification_id": "vs_9ZyX8wVu7TsR6qPo5NmL",
      "status": "requires_input",
      "type": "document",
      "document_type": null,
      "created_at": "2025-11-10T14:30:00Z",
      "verified_at": null
    },
    {
      "verification_id": "vs_4KjI3hGf2EdC1bAz0YxW",
      "status": "failed",
      "type": "document",
      "document_type": "passport",
      "created_at": "2025-11-09T10:00:00Z",
      "failed_at": "2025-11-09T10:05:00Z",
      "failure_reason": "document_expired"
    }
  ]
}
curl -X GET "https://api.neuralcore5.ai/v1/identity/list/1234567?status=verified&limit=10" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
DELETE /v1/identity/cancel/{verificationId}

Cancel a pending identity verification session. Can only cancel sessions in "requires_input" status.

Path Parameters
Parameter Type Description
verificationId string Stripe verification session ID to cancel
Request Body
Parameter Type Required Description
reason string Optional Reason for cancellation (for audit logs)
{
  "reason": "User requested to use different document"
}
{
  "success": true,
  "verification_id": "vs_1AbC2DeF3GhI4JkL5MnO",
  "status": "canceled",
  "canceled_at": "2025-11-11T16:30:00Z",
  "reason": "User requested to use different document",
  "message": "Verification session canceled successfully"
}
curl -X DELETE https://api.neuralcore5.ai/v1/identity/cancel/vs_1AbC2DeF3GhI4JkL \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "User requested to use different document"
  }'

Multi-Factor Authentication (MFA)

Two-factor authentication with code generation and delivery via email, SMS, or phone call. Secure your users with time-based one-time passwords (TOTP) and delivery verification.

POST /v1/mfa/generate

Generate a new MFA verification code for the authenticated user. Code is stored securely with expiration time but not sent until the send endpoint is called.

Request Body
Parameter Type Required Description
user_id string Required User ID (OPID) to generate code for
code_length integer Optional Length of verification code (default: 6, range: 4-8)
expiry_minutes integer Optional Code expiry time in minutes (default: 10, max: 30)
purpose string Optional Purpose: "login", "transaction", "password_reset", "account_change"
{
  "user_id": "1234567",
  "code_length": 6,
  "expiry_minutes": 10,
  "purpose": "login"
}
{
  "success": true,
  "code_id": "mfa_abc123xyz789",
  "generated_at": "2025-11-11T15:40:00Z",
  "expires_at": "2025-11-11T15:50:00Z",
  "purpose": "login",
  "attempts_remaining": 3,
  "message": "MFA code generated successfully. Use the send endpoint to deliver it."
}
curl -X POST https://api.neuralcore5.ai/v1/mfa/generate \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "1234567",
    "code_length": 6,
    "purpose": "login"
  }'
POST /v1/mfa/send

Send the MFA verification code to the user via email, SMS, or automated phone call. Supports custom templates and delivery preferences.

Request Body
Parameter Type Required Description
code_id string Required The code ID returned from generate endpoint
delivery_method string Required Delivery method: "email", "sms", or "call"
recipient string Optional Override recipient (email address or phone number). Uses user's default if not provided.
template_id string Optional Custom template ID for email/SMS formatting
language string Optional Language code (default: "en")
{
  "code_id": "mfa_abc123xyz789",
  "delivery_method": "sms",
  "recipient": "+15127563382",
  "language": "en"
}
{
  "success": true,
  "code_id": "mfa_abc123xyz789",
  "delivery_method": "sms",
  "sent_to": "+1512756****",
  "sent_at": "2025-11-11T15:40:15Z",
  "delivery_status": "delivered",
  "carrier": "T-Mobile USA",
  "message": "Verification code sent successfully via SMS"
}
curl -X POST https://api.neuralcore5.ai/v1/mfa/send \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "code_id": "mfa_abc123xyz789",
    "delivery_method": "sms",
    "recipient": "+15127563382"
  }'
POST /v1/mfa/verify

Verify the MFA code provided by the user. Returns success if code matches and is not expired. Tracks failed attempts and implements rate limiting.

Request Body
Parameter Type Required Description
code_id string Required The code ID from generate endpoint
code string Required The verification code entered by user (6-digit number)
consume_on_success boolean Optional Mark code as used after successful verification (default: true)
{
  "code_id": "mfa_abc123xyz789",
  "code": "123456",
  "consume_on_success": true
}
{
  "success": true,
  "verified": true,
  "code_id": "mfa_abc123xyz789",
  "verified_at": "2025-11-11T15:42:30Z",
  "purpose": "login",
  "attempts_used": 1,
  "message": "Verification code is valid and has been consumed"
}
curl -X POST https://api.neuralcore5.ai/v1/mfa/verify \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "code_id": "mfa_abc123xyz789",
    "code": "123456"
  }'
GET /v1/mfa/status/{userId}

Check if MFA is enabled for a user and get their configured delivery methods, backup codes status, and MFA preferences.

Path Parameters
Parameter Type Description
userId string User ID (OPID) to check MFA status
{
  "user_id": "1234567",
  "mfa_enabled": true,
  "delivery_methods": {
    "email": {
      "enabled": true,
      "verified": true,
      "address": "john.***@example.com",
      "last_used": "2025-11-11T14:30:00Z"
    },
    "sms": {
      "enabled": true,
      "verified": true,
      "phone": "+1512756****",
      "last_used": "2025-11-10T09:15:00Z"
    },
    "call": {
      "enabled": false,
      "verified": false,
      "phone": null,
      "last_used": null
    }
  },
  "primary_method": "email",
  "backup_codes": {
    "available": true,
    "total": 10,
    "used": 2,
    "remaining": 8,
    "generated_at": "2025-10-01T12:00:00Z"
  },
  "totp_enabled": false,
  "enrolled_at": "2025-09-15T10:30:00Z",
  "last_verified": "2025-11-11T14:30:00Z"
}
curl -X GET https://api.neuralcore5.ai/v1/mfa/status/1234567 \
  -H "Authorization: Bearer YOUR_API_TOKEN"
<?php
$userId = '1234567';
$url = "https://api.neuralcore5.ai/v1/mfa/status/$userId";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
if ($data['mfa_enabled']) {
    echo "MFA Enabled: Yes\n";
    echo "Primary Method: " . $data['primary_method'] . "\n";
    echo "Backup Codes Remaining: " . $data['backup_codes']['remaining'] . "\n";
}
POST /v1/mfa/enable

Enable MFA for a user account. Configures delivery methods and generates backup codes.

Request Body
Parameter Type Required Description
user_id string Required User ID (OPID)
primary_method string Required Primary delivery method: "email", "sms", or "totp"
email string Optional Email address for MFA (if not using user's default)
phone string Optional Phone number for SMS/call (E.164 format)
generate_backup_codes boolean Optional Generate backup codes (default: true)
{
  "user_id": "1234567",
  "primary_method": "email",
  "email": "john.doe@example.com",
  "phone": "+15127563382",
  "generate_backup_codes": true
}
{
  "success": true,
  "user_id": "1234567",
  "mfa_enabled": true,
  "primary_method": "email",
  "backup_codes": [
    "1A2B-3C4D-5E6F",
    "7G8H-9I0J-1K2L",
    "3M4N-5O6P-7Q8R",
    "9S0T-1U2V-3W4X",
    "5Y6Z-7A8B-9C0D",
    "1E2F-3G4H-5I6J",
    "7K8L-9M0N-1O2P",
    "3Q4R-5S6T-7U8V",
    "9W0X-1Y2Z-3A4B",
    "5C6D-7E8F-9G0H"
  ],
  "enrolled_at": "2025-11-11T16:30:00Z",
  "message": "MFA enabled successfully. Store backup codes securely."
}
curl -X POST https://api.neuralcore5.ai/v1/mfa/enable \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "1234567",
    "primary_method": "email",
    "email": "john.doe@example.com"
  }'
DELETE /v1/mfa/disable

Disable MFA for the authenticated user. Requires password confirmation for security. All backup codes will be invalidated.

Request Body
Parameter Type Required Description
user_id string Required User ID (OPID)
password string Required User's password for confirmation
reason string Optional Reason for disabling MFA (for audit logs)
{
  "user_id": "1234567",
  "password": "UserSecurePassword123!",
  "reason": "Switching to hardware security key"
}
{
  "success": true,
  "user_id": "1234567",
  "mfa_enabled": false,
  "disabled_at": "2025-11-11T16:45:00Z",
  "backup_codes_invalidated": 10,
  "message": "MFA has been disabled for this account. All backup codes have been invalidated."
}
curl -X DELETE https://api.neuralcore5.ai/v1/mfa/disable \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "1234567",
    "password": "UserSecurePassword123!"
  }'
POST /v1/mfa/backup-codes/regenerate

Regenerate backup codes for a user. Invalidates all previous backup codes and generates a new set.

Request Body
Parameter Type Required Description
user_id string Required User ID (OPID)
password string Required User's password for confirmation
count integer Optional Number of codes to generate (default: 10, max: 20)
{
  "user_id": "1234567",
  "password": "UserSecurePassword123!",
  "count": 10
}
{
  "success": true,
  "user_id": "1234567",
  "backup_codes": [
    "9X8Y-7Z6A-5B4C",
    "3D2E-1F0G-9H8I",
    "7J6K-5L4M-3N2O",
    "1P0Q-9R8S-7T6U",
    "5V4W-3X2Y-1Z0A",
    "9B8C-7D6E-5F4G",
    "3H2I-1J0K-9L8M",
    "7N6O-5P4Q-3R2S",
    "1T0U-9V8W-7X6Y",
    "5Z4A-3B2C-1D0E"
  ],
  "previous_codes_invalidated": 8,
  "generated_at": "2025-11-11T16:50:00Z",
  "message": "New backup codes generated successfully. Store them securely."
}
curl -X POST https://api.neuralcore5.ai/v1/mfa/backup-codes/regenerate \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "1234567",
    "password": "UserSecurePassword123!"
  }'

Sessions

Manage user sessions including authentication, refresh, validation, and logout operations.

POST /v1/sessions/start

Initialize a new authenticated session by providing valid credentials. Returns session token and user data.

Request Body
Parameter Type Required Description
username string Required User's login username or email
password string Required User's password (transmitted over HTTPS)
remember_me boolean Optional Extend session lifetime (default: false)
{
  "username": "john.doe@example.com",
  "password": "SecurePassword123!",
  "remember_me": false
}
{
  "success": true,
  "session_id": "sess_a1b2c3d4e5f6g7h8",
  "csrf_token": "9f8e7d6c5b4a3f2e1d0c9b8a7f6e5d4c",
  "user": {
    "opid": "1234567",
    "username": "johndoe",
    "email": "john.doe@example.com",
    "first_name": "John",
    "last_name": "Doe"
  },
  "expires_at": "2025-11-11T16:30:00Z",
  "lifetime_seconds": 3600
}
curl -X POST https://api.neuralcore5.ai/v1/sessions/start \
  -H "Content-Type: application/json" \
  -d '{
    "username": "john.doe@example.com",
    "password": "SecurePassword123!"
  }'
POST /v1/sessions/refresh

Refresh the session activity timestamp to extend the session lifetime. Used to keep sessions alive during active user interaction.

{
  "success": true,
  "message": "Session refreshed successfully",
  "last_activity": "2025-11-11T15:45:30Z",
  "expires_at": "2025-11-11T16:45:30Z",
  "remaining_seconds": 3600
}
curl -X POST https://api.neuralcore5.ai/v1/sessions/refresh \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json"
GET /v1/sessions/status

Get current session status including authentication state, expiry information, and user data.

{
  "authenticated": true,
  "session_id": "sess_a1b2c3d4e5f6g7h8",
  "user": {
    "opid": "1234567",
    "username": "johndoe",
    "email": "john.doe@example.com"
  },
  "session_info": {
    "created_at": "2025-11-11T14:30:00Z",
    "last_activity": "2025-11-11T15:45:30Z",
    "expires_at": "2025-11-11T16:45:30Z",
    "remaining_seconds": 3600
  }
}
curl -X GET https://api.neuralcore5.ai/v1/sessions/status \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN"
DELETE /v1/sessions/logout

Logout the current user and destroy the active session. All session data will be cleared.

{
  "success": true,
  "message": "You have been successfully logged out",
  "logged_out_at": "2025-11-11T15:50:00Z"
}
curl -X DELETE https://api.neuralcore5.ai/v1/sessions/logout \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN"
GET /v1/sessions/validate

Validate the current session and verify it's still active and not expired.

{
  "valid": true,
  "authenticated": true,
  "remaining_seconds": 3450
}
curl -X GET https://api.neuralcore5.ai/v1/sessions/validate \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN"
POST /v1/sessions/regenerate

Regenerate the session ID for security purposes. Prevents session fixation attacks.

{
  "success": true,
  "new_session_id": "sess_z9y8x7w6v5u4t3s2r1",
  "regenerated_at": "2025-11-11T15:55:00Z"
}
curl -X POST https://api.neuralcore5.ai/v1/sessions/regenerate \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN"

Subscribers

Comprehensive subscriber management system including account management, billing operations, usage limits, usage recording, and subscriber search. Handle subscriptions, payments, plans, refunds, rate limiting, and usage tracking for all NeuralCore5 subscribers.

Billing

Manage subscriber billing operations including plans, charges, refunds, monthly statements, credit notes, chargebacks, and payment processing. Complete financial transaction management for subscriber accounts.

GET /v1/subscribers/{subscriberId}/billing/plan

Retrieve the current subscription plan details for a subscriber including features, pricing, billing cycle, and usage limits.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
{
  "success": true,
  "subscriber_id": "1234567",
  "plan": {
    "plan_id": "plan_premium_2025",
    "plan_name": "Premium Plan",
    "tier": "premium",
    "status": "active",
    "price": {
      "amount": 49.99,
      "currency": "USD",
      "billing_cycle": "monthly"
    },
    "limits": {
      "text_ai_messages_per_day": 1000,
      "audio_chat_minutes_per_day": 120,
      "image_renders_per_day": 50,
      "file_storage_gb": 100
    },
    "features": [
      "Unlimited conversations",
      "Priority support",
      "Advanced analytics",
      "API access"
    ],
    "started_at": "2025-01-01T00:00:00Z",
    "current_period_start": "2025-11-01T00:00:00Z",
    "current_period_end": "2025-12-01T00:00:00Z",
    "next_billing_date": "2025-12-01T00:00:00Z",
    "auto_renew": true
  }
}
curl -X GET https://api.neuralcore5.ai/v1/subscribers/1234567/billing/plan \
  -H "Authorization: Bearer YOUR_API_TOKEN"
PUT /v1/subscribers/{subscriberId}/billing/plan

Change a subscriber's plan. Handles upgrades, downgrades, and plan switches with prorated billing calculations.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
new_plan_id string Required ID of the new plan
prorate boolean Optional Apply prorated billing (default: true)
effective_date datetime Optional When to apply change (default: immediate)
{
  "new_plan_id": "plan_enterprise_2025",
  "prorate": true,
  "effective_date": "immediate"
}
{
  "success": true,
  "subscriber_id": "1234567",
  "old_plan": "plan_premium_2025",
  "new_plan": "plan_enterprise_2025",
  "change_type": "upgrade",
  "prorated_charge": {
    "amount": 75.50,
    "currency": "USD",
    "description": "Prorated upgrade to Enterprise Plan"
  },
  "effective_at": "2025-11-11T21:00:00Z",
  "next_billing_date": "2025-12-01T00:00:00Z",
  "message": "Plan upgraded successfully with prorated billing"
}
curl -X PUT https://api.neuralcore5.ai/v1/subscribers/1234567/billing/plan \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "new_plan_id": "plan_enterprise_2025",
    "prorate": true
  }'
POST /v1/subscribers/{subscriberId}/billing/charges

Create a one-time charge for a subscriber. Used for overages, add-ons, or custom services.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
amount number Required Charge amount
currency string Required Currency code (USD, EUR, etc.)
description string Required Charge description
charge_type string Required Type: "overage", "addon", "custom", "support"
charge_immediately boolean Optional Charge now or add to next invoice (default: true)
metadata object Optional Custom metadata for tracking
{
  "amount": 25.00,
  "currency": "USD",
  "description": "Overage charges for additional API calls",
  "charge_type": "overage",
  "charge_immediately": true,
  "metadata": {
    "usage_period": "2025-11",
    "overage_units": 5000
  }
}
{
  "success": true,
  "charge_id": "ch_abc123xyz456",
  "subscriber_id": "1234567",
  "amount": 25.00,
  "currency": "USD",
  "description": "Overage charges for additional API calls",
  "charge_type": "overage",
  "status": "succeeded",
  "payment_method": "card_ending_4242",
  "charged_at": "2025-11-11T21:05:00Z",
  "receipt_url": "https://api.neuralcore5.ai/receipts/ch_abc123xyz456",
  "message": "Charge processed successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/subscribers/1234567/billing/charges \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 25.00,
    "currency": "USD",
    "description": "Overage charges",
    "charge_type": "overage"
  }'
POST /v1/subscribers/{subscriberId}/billing/refunds

Process a full or partial refund for a charge. Supports refund tracking, reason codes, and automatic credit note generation.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
charge_id string Required Original charge ID to refund
amount number Optional Refund amount (default: full amount)
reason string Required Reason: "requested_by_customer", "duplicate", "fraudulent", "service_issue"
notes string Optional Internal notes about the refund
generate_credit_note boolean Optional Generate credit note (default: true)
{
  "charge_id": "ch_abc123xyz456",
  "amount": 25.00,
  "reason": "requested_by_customer",
  "notes": "Customer dissatisfied with service quality",
  "generate_credit_note": true
}
{
  "success": true,
  "refund_id": "re_def456ghi789",
  "charge_id": "ch_abc123xyz456",
  "subscriber_id": "1234567",
  "amount": 25.00,
  "currency": "USD",
  "reason": "requested_by_customer",
  "status": "succeeded",
  "credit_note": {
    "credit_note_id": "cn_jkl012mno345",
    "amount": 25.00,
    "pdf_url": "https://api.neuralcore5.ai/credit-notes/cn_jkl012mno345.pdf"
  },
  "refunded_at": "2025-11-11T21:10:00Z",
  "message": "Refund processed successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/subscribers/1234567/billing/refunds \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "charge_id": "ch_abc123xyz456",
    "reason": "requested_by_customer"
  }'
GET /v1/subscribers/{subscriberId}/billing/statements/{month}

Retrieve a detailed monthly billing statement including all charges, credits, refunds, and account balance.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
month string Statement month (YYYY-MM format, e.g., "2025-11")
Query Parameters
Parameter Type Required Description
format string Optional Response format: "json", "pdf" (default: "json")
{
  "success": true,
  "statement_id": "stmt_2025_11_1234567",
  "subscriber_id": "1234567",
  "period": {
    "month": "2025-11",
    "start_date": "2025-11-01T00:00:00Z",
    "end_date": "2025-11-30T23:59:59Z"
  },
  "summary": {
    "previous_balance": 0.00,
    "subscription_charges": 49.99,
    "additional_charges": 25.00,
    "total_charges": 74.99,
    "credits_applied": 0.00,
    "refunds_issued": 25.00,
    "total_due": 49.99,
    "amount_paid": 49.99,
    "current_balance": 0.00,
    "currency": "USD"
  },
  "line_items": [
    {
      "date": "2025-11-01",
      "description": "Premium Plan - Monthly Subscription",
      "type": "subscription",
      "amount": 49.99
    },
    {
      "date": "2025-11-11",
      "description": "Overage charges for additional API calls",
      "type": "overage",
      "amount": 25.00
    },
    {
      "date": "2025-11-11",
      "description": "Refund - Customer requested",
      "type": "refund",
      "amount": -25.00
    }
  ],
  "payment_history": [
    {
      "date": "2025-11-01",
      "amount": 49.99,
      "method": "card_ending_4242",
      "status": "succeeded"
    }
  ],
  "pdf_url": "https://api.neuralcore5.ai/statements/stmt_2025_11_1234567.pdf"
}
curl -X GET "https://api.neuralcore5.ai/v1/subscribers/1234567/billing/statements/2025-11?format=json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
GET /v1/subscribers/{subscriberId}/billing/charges

List all charges for a subscriber with filtering by date, type, and status.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Query Parameters
Parameter Type Required Description
start_date date Optional Filter charges from date
end_date date Optional Filter charges to date
charge_type string Optional Filter by charge type
status string Optional Filter by status: "succeeded", "failed", "pending", "refunded"
limit integer Optional Results per page (default: 50)
{
  "success": true,
  "subscriber_id": "1234567",
  "total_charges": 15,
  "total_amount": 599.85,
  "currency": "USD",
  "charges": [
    {
      "charge_id": "ch_abc123xyz456",
      "amount": 25.00,
      "currency": "USD",
      "description": "Overage charges",
      "charge_type": "overage",
      "status": "succeeded",
      "charged_at": "2025-11-11T21:05:00Z",
      "refunded": false
    },
    {
      "charge_id": "ch_def456ghi789",
      "amount": 49.99,
      "currency": "USD",
      "description": "Premium Plan - Monthly",
      "charge_type": "subscription",
      "status": "succeeded",
      "charged_at": "2025-11-01T00:00:00Z",
      "refunded": false
    }
  ]
}
curl -X GET "https://api.neuralcore5.ai/v1/subscribers/1234567/billing/charges?status=succeeded&limit=50" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
POST /v1/subscribers/{subscriberId}/billing/credit-notes

Create a credit note for a subscriber. Used for service credits, promotional credits, or refund documentation.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
amount number Required Credit amount
currency string Required Currency code
reason string Required Reason: "refund", "service_credit", "promotional", "goodwill"
description string Required Description for credit note
related_charge_id string Optional Related charge ID (if applicable)
expires_at datetime Optional Credit expiration date
{
  "amount": 10.00,
  "currency": "USD",
  "reason": "service_credit",
  "description": "Service credit for downtime on 2025-11-10",
  "expires_at": "2025-12-31T23:59:59Z"
}
{
  "success": true,
  "credit_note_id": "cn_pqr678stu901",
  "subscriber_id": "1234567",
  "amount": 10.00,
  "currency": "USD",
  "reason": "service_credit",
  "description": "Service credit for downtime on 2025-11-10",
  "status": "active",
  "balance_remaining": 10.00,
  "created_at": "2025-11-11T21:15:00Z",
  "expires_at": "2025-12-31T23:59:59Z",
  "pdf_url": "https://api.neuralcore5.ai/credit-notes/cn_pqr678stu901.pdf",
  "message": "Credit note created successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/subscribers/1234567/billing/credit-notes \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 10.00,
    "currency": "USD",
    "reason": "service_credit",
    "description": "Service credit for downtime"
  }'
POST /v1/subscribers/{subscriberId}/billing/chargebacks

Record and manage a chargeback dispute. Tracks chargeback status, evidence submission, and resolution.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
charge_id string Required Charge ID being disputed
amount number Required Chargeback amount
reason_code string Required Bank reason code
evidence_submitted boolean Optional Whether evidence has been submitted (default: false)
notes string Optional Internal notes
{
  "charge_id": "ch_abc123xyz456",
  "amount": 25.00,
  "reason_code": "fraudulent",
  "evidence_submitted": false,
  "notes": "Customer claims unauthorized charge"
}
{
  "success": true,
  "chargeback_id": "cb_vwx234yza567",
  "charge_id": "ch_abc123xyz456",
  "subscriber_id": "1234567",
  "amount": 25.00,
  "currency": "USD",
  "reason_code": "fraudulent",
  "status": "under_review",
  "evidence_due_by": "2025-11-25T23:59:59Z",
  "evidence_submitted": false,
  "created_at": "2025-11-11T21:20:00Z",
  "message": "Chargeback recorded successfully. Evidence submission required by 2025-11-25."
}
curl -X POST https://api.neuralcore5.ai/v1/subscribers/1234567/billing/chargebacks \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "charge_id": "ch_abc123xyz456",
    "amount": 25.00,
    "reason_code": "fraudulent"
  }'

Limits

Manage subscriber rate limits and usage quotas across multiple time windows including per minute, per 15 minutes, per hour, per day, per week, and per month. Track current usage against limits and manage overage policies.

GET /v1/subscribers/{subscriberId}/limits

Retrieve all rate limits and usage quotas for a subscriber across all time windows and resource types.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Query Parameters
Parameter Type Required Description
include_usage boolean Optional Include current usage statistics (default: true)
{
  "success": true,
  "subscriber_id": "1234567",
  "plan": "premium",
  "limits": {
    "text_ai_messages": {
      "per_minute": {
        "limit": 10,
        "current_usage": 3,
        "remaining": 7,
        "resets_at": "2025-11-11T21:26:00Z"
      },
      "per_15_minutes": {
        "limit": 100,
        "current_usage": 27,
        "remaining": 73,
        "resets_at": "2025-11-11T21:30:00Z"
      },
      "per_hour": {
        "limit": 300,
        "current_usage": 142,
        "remaining": 158,
        "resets_at": "2025-11-11T22:00:00Z"
      },
      "per_day": {
        "limit": 1000,
        "current_usage": 573,
        "remaining": 427,
        "resets_at": "2025-11-12T00:00:00Z"
      },
      "per_week": {
        "limit": 5000,
        "current_usage": 2847,
        "remaining": 2153,
        "resets_at": "2025-11-17T00:00:00Z"
      },
      "per_month": {
        "limit": 20000,
        "current_usage": 8934,
        "remaining": 11066,
        "resets_at": "2025-12-01T00:00:00Z"
      }
    },
    "audio_chat_minutes": {
      "per_minute": {
        "limit": 1,
        "current_usage": 0,
        "remaining": 1,
        "resets_at": "2025-11-11T21:26:00Z"
      },
      "per_hour": {
        "limit": 10,
        "current_usage": 3,
        "remaining": 7,
        "resets_at": "2025-11-11T22:00:00Z"
      },
      "per_day": {
        "limit": 120,
        "current_usage": 47,
        "remaining": 73,
        "resets_at": "2025-11-12T00:00:00Z"
      },
      "per_week": {
        "limit": 600,
        "current_usage": 287,
        "remaining": 313,
        "resets_at": "2025-11-17T00:00:00Z"
      },
      "per_month": {
        "limit": 2400,
        "current_usage": 934,
        "remaining": 1466,
        "resets_at": "2025-12-01T00:00:00Z"
      }
    },
    "image_generations": {
      "per_minute": {
        "limit": 2,
        "current_usage": 0,
        "remaining": 2,
        "resets_at": "2025-11-11T21:26:00Z"
      },
      "per_hour": {
        "limit": 20,
        "current_usage": 5,
        "remaining": 15,
        "resets_at": "2025-11-11T22:00:00Z"
      },
      "per_day": {
        "limit": 50,
        "current_usage": 18,
        "remaining": 32,
        "resets_at": "2025-11-12T00:00:00Z"
      },
      "per_week": {
        "limit": 300,
        "current_usage": 124,
        "remaining": 176,
        "resets_at": "2025-11-17T00:00:00Z"
      },
      "per_month": {
        "limit": 1000,
        "current_usage": 437,
        "remaining": 563,
        "resets_at": "2025-12-01T00:00:00Z"
      }
    },
    "file_storage_gb": {
      "total_limit": 100,
      "current_usage": 42.7,
      "remaining": 57.3,
      "unit": "gigabytes"
    },
    "api_requests": {
      "per_minute": {
        "limit": 60,
        "current_usage": 12,
        "remaining": 48,
        "resets_at": "2025-11-11T21:26:00Z"
      },
      "per_hour": {
        "limit": 3600,
        "current_usage": 842,
        "remaining": 2758,
        "resets_at": "2025-11-11T22:00:00Z"
      },
      "per_day": {
        "limit": 50000,
        "current_usage": 12847,
        "remaining": 37153,
        "resets_at": "2025-11-12T00:00:00Z"
      }
    }
  },
  "overage_policy": "charge",
  "overage_rates": {
    "text_ai_messages": 0.01,
    "audio_chat_minutes": 0.10,
    "image_generations": 0.05,
    "file_storage_gb": 1.00
  },
  "retrieved_at": "2025-11-11T21:25:30Z"
}
curl -X GET "https://api.neuralcore5.ai/v1/subscribers/1234567/limits?include_usage=true" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
GET /v1/subscribers/{subscriberId}/limits/{resourceType}

Retrieve limits and usage for a specific resource type with detailed breakdown by time window.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
resourceType string Resource type: "text_ai_messages", "audio_chat_minutes", "image_generations", "api_requests", etc.
{
  "success": true,
  "subscriber_id": "1234567",
  "resource_type": "text_ai_messages",
  "limits": {
    "per_minute": {
      "limit": 10,
      "current_usage": 3,
      "remaining": 7,
      "percentage_used": 30,
      "resets_at": "2025-11-11T21:26:00Z",
      "resets_in_seconds": 30
    },
    "per_15_minutes": {
      "limit": 100,
      "current_usage": 27,
      "remaining": 73,
      "percentage_used": 27,
      "resets_at": "2025-11-11T21:30:00Z",
      "resets_in_seconds": 270
    },
    "per_hour": {
      "limit": 300,
      "current_usage": 142,
      "remaining": 158,
      "percentage_used": 47.33,
      "resets_at": "2025-11-11T22:00:00Z",
      "resets_in_seconds": 2070
    },
    "per_day": {
      "limit": 1000,
      "current_usage": 573,
      "remaining": 427,
      "percentage_used": 57.3,
      "resets_at": "2025-11-12T00:00:00Z",
      "resets_in_seconds": 9270
    },
    "per_week": {
      "limit": 5000,
      "current_usage": 2847,
      "remaining": 2153,
      "percentage_used": 56.94,
      "resets_at": "2025-11-17T00:00:00Z",
      "resets_in_seconds": 486630
    },
    "per_month": {
      "limit": 20000,
      "current_usage": 8934,
      "remaining": 11066,
      "percentage_used": 44.67,
      "resets_at": "2025-12-01T00:00:00Z",
      "resets_in_seconds": 1731270
    }
  },
  "record": {
    "highest_usage_minute": 10,
    "highest_usage_hour": 287,
    "highest_usage_day": 1000,
    "date_of_highest_day": "2025-11-05"
  },
  "overage_policy": "charge",
  "overage_rate": 0.01,
  "retrieved_at": "2025-11-11T21:25:30Z"
}
curl -X GET https://api.neuralcore5.ai/v1/subscribers/1234567/limits/text_ai_messages \
  -H "Authorization: Bearer YOUR_API_TOKEN"
POST /v1/subscribers/{subscriberId}/limits/check

Check if a subscriber has available capacity for a specific resource request before executing the action. Prevents exceeding limits.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
resource_type string Required Resource type to check
quantity integer Required Quantity requested (default: 1)
time_windows array Optional Specific time windows to check (default: all)
{
  "resource_type": "text_ai_messages",
  "quantity": 5,
  "time_windows": ["per_minute", "per_hour", "per_day"]
}
{
  "success": true,
  "subscriber_id": "1234567",
  "resource_type": "text_ai_messages",
  "quantity_requested": 5,
  "allowed": true,
  "checks": {
    "per_minute": {
      "allowed": true,
      "current_usage": 3,
      "limit": 10,
      "remaining_after": 2
    },
    "per_hour": {
      "allowed": true,
      "current_usage": 142,
      "limit": 300,
      "remaining_after": 153
    },
    "per_day": {
      "allowed": true,
      "current_usage": 573,
      "limit": 1000,
      "remaining_after": 422
    }
  },
  "blocking_window": null,
  "overage_would_occur": false,
  "message": "Request allowed within all checked time windows"
}
curl -X POST https://api.neuralcore5.ai/v1/subscribers/1234567/limits/check \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "resource_type": "text_ai_messages",
    "quantity": 5
  }'
PUT /v1/subscribers/{subscriberId}/limits/{resourceType}

Update rate limits for a specific resource type. Admin/support use for custom limit adjustments.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
resourceType string Resource type to update
Request Body
Parameter Type Required Description
per_minute integer Optional Per-minute limit
per_15_minutes integer Optional Per-15-minute limit
per_hour integer Optional Per-hour limit
per_day integer Optional Per-day limit
per_week integer Optional Per-week limit
per_month integer Optional Per-month limit
reason string Optional Reason for limit change (audit trail)
{
  "per_day": 2000,
  "per_month": 50000,
  "reason": "Premium customer upgrade - support ticket #12345"
}
{
  "success": true,
  "subscriber_id": "1234567",
  "resource_type": "text_ai_messages",
  "updated_limits": {
    "per_day": {
      "old_value": 1000,
      "new_value": 2000
    },
    "per_month": {
      "old_value": 20000,
      "new_value": 50000
    }
  },
  "reason": "Premium customer upgrade - support ticket #12345",
  "updated_by": "admin_john",
  "updated_at": "2025-11-11T21:30:00Z",
  "message": "Limits updated successfully"
}
curl -X PUT https://api.neuralcore5.ai/v1/subscribers/1234567/limits/text_ai_messages \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "per_day": 2000,
    "per_month": 50000,
    "reason": "Premium customer upgrade"
  }'
POST /v1/subscribers/{subscriberId}/limits/{resourceType}/reset

Reset usage counters for a specific resource type and time window. Admin/support use for resolving billing or tracking issues.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
resourceType string Resource type to reset
Request Body
Parameter Type Required Description
time_window string Required Window to reset: "per_minute", "per_15_minutes", "per_hour", "per_day", "per_week", "per_month", "all"
reason string Required Reason for reset (required for audit)
{
  "time_window": "per_day",
  "reason": "Counter error - support ticket #67890"
}
{
  "success": true,
  "subscriber_id": "1234567",
  "resource_type": "text_ai_messages",
  "time_window": "per_day",
  "previous_usage": 573,
  "new_usage": 0,
  "reason": "Counter error - support ticket #67890",
  "reset_by": "admin_sarah",
  "reset_at": "2025-11-11T21:35:00Z",
  "message": "Usage counter reset successfully"
}
curl -X POST https://api.neuralcore5.ai/v1/subscribers/1234567/limits/text_ai_messages/reset \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "time_window": "per_day",
    "reason": "Counter error - support ticket #67890"
  }'
GET /v1/subscribers/{subscriberId}/limits/{resourceType}/history

Retrieve historical usage data for a resource type to analyze trends, identify patterns, and track record usage.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
resourceType string Resource type
Query Parameters
Parameter Type Required Description
start_date date Optional Start date for history (default: 30 days ago)
end_date date Optional End date for history (default: today)
granularity string Optional Data granularity: "hourly", "daily", "weekly" (default: "daily")
{
  "success": true,
  "subscriber_id": "1234567",
  "resource_type": "text_ai_messages",
  "period": {
    "start_date": "2025-10-12",
    "end_date": "2025-11-11",
    "granularity": "daily"
  },
  "statistics": {
    "total_usage": 28934,
    "average_daily": 963,
    "peak_daily": 1543,
    "peak_date": "2025-11-05",
    "lowest_daily": 432,
    "lowest_date": "2025-10-20"
  },
  "history": [
    {
      "date": "2025-11-11",
      "usage": 573,
      "limit": 1000,
      "percentage": 57.3
    },
    {
      "date": "2025-11-10",
      "usage": 892,
      "limit": 1000,
      "percentage": 89.2
    },
    {
      "date": "2025-11-09",
      "usage": 734,
      "limit": 1000,
      "percentage": 73.4
    }
  ],
  "records": {
    "highest_per_minute": 10,
    "highest_per_hour": 298,
    "highest_per_day": 1543
  }
}
curl -X GET "https://api.neuralcore5.ai/v1/subscribers/1234567/limits/text_ai_messages/history?granularity=daily" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
GET /v1/subscribers/{subscriberId}/limits/forecast

Get overage forecasting based on current usage trends. Predicts if subscriber will exceed limits and estimated overage costs.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Query Parameters
Parameter Type Required Description
resource_type string Optional Specific resource (default: all)
time_window string Optional Forecast window: "month", "week" (default: "month")
{
  "success": true,
  "subscriber_id": "1234567",
  "forecast_window": "month",
  "forecasts": {
    "text_ai_messages": {
      "current_usage": 8934,
      "monthly_limit": 20000,
      "projected_end_of_month": 23847,
      "will_exceed": true,
      "projected_overage": 3847,
      "estimated_overage_cost": 38.47,
      "currency": "USD",
      "confidence": 0.87
    },
    "audio_chat_minutes": {
      "current_usage": 934,
      "monthly_limit": 2400,
      "projected_end_of_month": 1847,
      "will_exceed": false,
      "projected_overage": 0,
      "estimated_overage_cost": 0.00,
      "currency": "USD",
      "confidence": 0.92
    }
  },
  "total_estimated_overage_cost": 38.47,
  "currency": "USD",
  "generated_at": "2025-11-11T21:40:00Z"
}
curl -X GET "https://api.neuralcore5.ai/v1/subscribers/1234567/limits/forecast?time_window=month" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Manage

Complete subscriber account management including profile creation, updates, status management, permissions, preferences, password changes, and account operations. Handle all aspects of subscriber account lifecycle and access control.

POST /v1/subscribers

Create a new subscriber account with profile information, plan assignment, and initial configuration.

Request Body
Parameter Type Required Description
email string Required Subscriber email address (unique)
name string Required Full name
password string Required Account password (min 8 characters)
plan_id string Optional Initial plan ID (default: free tier)
organization string Optional Organization name
phone string Optional Phone number
metadata object Optional Custom metadata
{
  "email": "john.doe@example.com",
  "name": "John Doe",
  "password": "SecurePass123!",
  "plan_id": "plan_premium_2025",
  "organization": "Acme Corporation",
  "phone": "+1-555-123-4567",
  "metadata": {
    "referral_source": "website",
    "campaign": "q4_2025"
  }
}
{
  "success": true,
  "subscriber_id": "1234567",
  "email": "john.doe@example.com",
  "name": "John Doe",
  "organization": "Acme Corporation",
  "phone": "+1-555-123-4567",
  "plan": {
    "plan_id": "plan_premium_2025",
    "plan_name": "Premium Plan",
    "tier": "premium"
  },
  "status": "active",
  "email_verified": false,
  "created_at": "2025-11-11T22:00:00Z",
  "message": "Subscriber account created successfully. Verification email sent."
}
curl -X POST https://api.neuralcore5.ai/v1/subscribers \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "john.doe@example.com",
    "name": "John Doe",
    "password": "SecurePass123!",
    "plan_id": "plan_premium_2025"
  }'
GET /v1/subscribers/{subscriberId}

Retrieve complete subscriber profile including account details, plan information, status, and metadata.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
{
  "success": true,
  "subscriber_id": "1234567",
  "email": "john.doe@example.com",
  "name": "John Doe",
  "organization": "Acme Corporation",
  "phone": "+1-555-123-4567",
  "plan": {
    "plan_id": "plan_premium_2025",
    "plan_name": "Premium Plan",
    "tier": "premium",
    "status": "active"
  },
  "account_status": "active",
  "email_verified": true,
  "phone_verified": false,
  "permissions": [
    "api_access",
    "billing_manage",
    "usage_view",
    "profile_edit"
  ],
  "created_at": "2025-01-15T10:30:00Z",
  "last_login": "2025-11-11T20:45:00Z",
  "timezone": "America/New_York",
  "language": "en",
  "metadata": {
    "referral_source": "website",
    "campaign": "q4_2025",
    "customer_type": "enterprise"
  }
}
curl -X GET https://api.neuralcore5.ai/v1/subscribers/1234567 \
  -H "Authorization: Bearer YOUR_API_TOKEN"
PUT /v1/subscribers/{subscriberId}

Update subscriber profile information including name, contact details, organization, and preferences.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
name string Optional Updated full name
organization string Optional Updated organization
phone string Optional Updated phone number
timezone string Optional Timezone (IANA format)
language string Optional Language code (ISO 639-1)
metadata object Optional Updated metadata
{
  "name": "John M. Doe",
  "organization": "Acme Global Corporation",
  "phone": "+1-555-987-6543",
  "timezone": "America/Los_Angeles",
  "language": "en"
}
{
  "success": true,
  "subscriber_id": "1234567",
  "updated_fields": [
    "name",
    "organization",
    "phone",
    "timezone"
  ],
  "profile": {
    "email": "john.doe@example.com",
    "name": "John M. Doe",
    "organization": "Acme Global Corporation",
    "phone": "+1-555-987-6543",
    "timezone": "America/Los_Angeles",
    "language": "en"
  },
  "updated_at": "2025-11-11T22:05:00Z",
  "message": "Profile updated successfully"
}
curl -X PUT https://api.neuralcore5.ai/v1/subscribers/1234567 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John M. Doe",
    "organization": "Acme Global Corporation"
  }'
PATCH /v1/subscribers/{subscriberId}/status

Update subscriber account status. Admin use for activating, suspending, archiving, or deactivating accounts.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
status string Required Status: "active", "suspended", "archived", "deactivated", "pending"
reason string Required Reason for status change
notes string Optional Additional notes
{
  "status": "suspended",
  "reason": "payment_failure",
  "notes": "Payment failed for 3 consecutive billing cycles"
}
{
  "success": true,
  "subscriber_id": "1234567",
  "previous_status": "active",
  "new_status": "suspended",
  "reason": "payment_failure",
  "changed_by": "admin_sarah",
  "changed_at": "2025-11-11T22:10:00Z",
  "message": "Account status updated to suspended"
}
curl -X PATCH https://api.neuralcore5.ai/v1/subscribers/1234567/status \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "suspended",
    "reason": "payment_failure"
  }'
PATCH /v1/subscribers/{subscriberId}/archive

Archive a subscriber account. Sets status to "archived" while preserving data for historical records and compliance. Archived accounts cannot log in but data remains accessible for reporting.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
reason string Required Reason for archiving
notes string Optional Additional notes
cancel_subscription boolean Optional Cancel active subscription (default: true)
{
  "reason": "account_inactive",
  "notes": "No activity for 180 days - customer contacted and confirmed archival",
  "cancel_subscription": true
}
{
  "success": true,
  "subscriber_id": "1234567",
  "email": "john.doe@example.com",
  "previous_status": "active",
  "new_status": "archived",
  "reason": "account_inactive",
  "subscription_cancelled": true,
  "data_retained": true,
  "archived_by": "admin_john",
  "archived_at": "2025-11-11T22:15:00Z",
  "message": "Account archived successfully. Data retained for compliance and reporting."
}
curl -X PATCH https://api.neuralcore5.ai/v1/subscribers/1234567/archive \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "account_inactive",
    "notes": "No activity for 180 days"
  }'
PUT /v1/subscribers/{subscriberId}/permissions

Update subscriber permissions and access controls. Manage API access, feature flags, and role-based permissions.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
permissions array Required Array of permission strings
action string Required Action: "grant", "revoke", "replace"
reason string Optional Reason for permission change
{
  "permissions": [
    "api_advanced",
    "beta_features",
    "priority_support"
  ],
  "action": "grant",
  "reason": "Enterprise plan upgrade"
}
{
  "success": true,
  "subscriber_id": "1234567",
  "action": "grant",
  "permissions_granted": [
    "api_advanced",
    "beta_features",
    "priority_support"
  ],
  "current_permissions": [
    "api_access",
    "api_advanced",
    "billing_manage",
    "usage_view",
    "profile_edit",
    "beta_features",
    "priority_support"
  ],
  "updated_by": "admin_john",
  "updated_at": "2025-11-11T22:20:00Z",
  "message": "Permissions updated successfully"
}
curl -X PUT https://api.neuralcore5.ai/v1/subscribers/1234567/permissions \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "permissions": ["api_advanced", "beta_features"],
    "action": "grant"
  }'
POST /v1/subscribers/{subscriberId}/password

Change subscriber account password. Requires current password for security verification.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
current_password string Required Current password
new_password string Required New password (min 8 characters)
logout_all_sessions boolean Optional Logout from all devices (default: true)
{
  "current_password": "SecurePass123!",
  "new_password": "NewSecurePass456!",
  "logout_all_sessions": true
}
{
  "success": true,
  "subscriber_id": "1234567",
  "sessions_terminated": 3,
  "changed_at": "2025-11-11T22:25:00Z",
  "message": "Password changed successfully. All sessions have been terminated."
}
curl -X POST https://api.neuralcore5.ai/v1/subscribers/1234567/password \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "current_password": "SecurePass123!",
    "new_password": "NewSecurePass456!"
  }'
DELETE /v1/subscribers/{subscriberId}

Permanently delete a subscriber account. Handles data retention policies, final billing, and account closure procedures.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
confirmation string Required Must be "DELETE" to confirm
reason string Optional Reason for deletion
process_final_billing boolean Optional Process outstanding charges (default: true)
{
  "confirmation": "DELETE",
  "reason": "customer_requested",
  "process_final_billing": true
}
{
  "success": true,
  "subscriber_id": "1234567",
  "email": "john.doe@example.com",
  "deletion_scheduled_at": "2025-11-18T22:35:00Z",
  "data_retention_period": "30 days",
  "final_billing": {
    "outstanding_balance": 0.00,
    "final_statement_url": "https://api.neuralcore5.ai/statements/final_1234567.pdf"
  },
  "sessions_terminated": 1,
  "message": "Account deletion scheduled. Data will be permanently removed after 30-day retention period."
}
curl -X DELETE https://api.neuralcore5.ai/v1/subscribers/1234567 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "confirmation": "DELETE",
    "reason": "customer_requested"
  }'
GET /v1/subscribers/{subscriberId}/activity

Retrieve account activity log including logins, password changes, permission updates, status changes, and administrative actions.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Query Parameters
Parameter Type Required Description
start_date date Optional Filter from date (default: 30 days ago)
end_date date Optional Filter to date (default: now)
activity_type string Optional Filter by type: "login", "permission", "status", "billing", "profile", "security"
limit integer Optional Results per page (default: 50)
{
  "success": true,
  "subscriber_id": "1234567",
  "period": {
    "start_date": "2025-10-12",
    "end_date": "2025-11-11"
  },
  "total_activities": 47,
  "activities": [
    {
      "activity_id": "act_xyz789",
      "type": "login",
      "action": "successful_login",
      "timestamp": "2025-11-11T20:45:00Z",
      "ip_address": "203.0.113.42",
      "user_agent": "Mozilla/5.0...",
      "location": "New York, US"
    },
    {
      "activity_id": "act_abc456",
      "type": "security",
      "action": "password_changed",
      "timestamp": "2025-11-11T22:25:00Z",
      "ip_address": "203.0.113.42",
      "performed_by": "subscriber"
    },
    {
      "activity_id": "act_def123",
      "type": "permission",
      "action": "permissions_updated",
      "timestamp": "2025-11-11T22:20:00Z",
      "details": {
        "permissions_granted": ["api_advanced", "beta_features"],
        "performed_by": "admin_john"
      }
    },
    {
      "activity_id": "act_ghi890",
      "type": "status",
      "action": "account_archived",
      "timestamp": "2025-11-11T22:15:00Z",
      "details": {
        "previous_status": "active",
        "new_status": "archived",
        "reason": "account_inactive",
        "performed_by": "admin_john"
      }
    },
    {
      "activity_id": "act_jkl567",
      "type": "billing",
      "action": "plan_upgraded",
      "timestamp": "2025-11-01T14:30:00Z",
      "details": {
        "old_plan": "plan_basic_2025",
        "new_plan": "plan_premium_2025"
      }
    }
  ]
}
curl -X GET "https://api.neuralcore5.ai/v1/subscribers/1234567/activity?limit=50&activity_type=security" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Record

Track and analyze subscriber usage records across all time intervals. View consumption patterns, peak usage times, and historical trends for text AI messages, audio chat minutes, image generations, API requests, and other resources across per minute, per 15 minutes, per hour, per day, per week, and per month intervals.

GET /v1/subscribers/{subscriberId}/record

Retrieve complete usage record for a subscriber across all resource types and time intervals. Shows consumption totals that contribute to limit calculations.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Query Parameters
Parameter Type Required Description
include_limits boolean Optional Include limit comparisons (default: true)
time_windows array Optional Specific time windows to include (default: all)
{
  "success": true,
  "subscriber_id": "1234567",
  "plan": "premium",
  "record_timestamp": "2025-11-11T21:25:30Z",
  "usage_records": {
    "text_ai_messages": {
      "per_minute": {
        "usage": 3,
        "limit": 10,
        "percentage_used": 30.0,
        "window_start": "2025-11-11T21:25:00Z",
        "window_end": "2025-11-11T21:26:00Z"
      },
      "per_15_minutes": {
        "usage": 27,
        "limit": 100,
        "percentage_used": 27.0,
        "window_start": "2025-11-11T21:15:00Z",
        "window_end": "2025-11-11T21:30:00Z"
      },
      "per_hour": {
        "usage": 142,
        "limit": 300,
        "percentage_used": 47.33,
        "window_start": "2025-11-11T21:00:00Z",
        "window_end": "2025-11-11T22:00:00Z"
      },
      "per_day": {
        "usage": 573,
        "limit": 1000,
        "percentage_used": 57.3,
        "window_start": "2025-11-11T00:00:00Z",
        "window_end": "2025-11-12T00:00:00Z"
      },
      "per_week": {
        "usage": 2847,
        "limit": 5000,
        "percentage_used": 56.94,
        "window_start": "2025-11-05T00:00:00Z",
        "window_end": "2025-11-12T00:00:00Z"
      },
      "per_month": {
        "usage": 8934,
        "limit": 20000,
        "percentage_used": 44.67,
        "window_start": "2025-11-01T00:00:00Z",
        "window_end": "2025-12-01T00:00:00Z"
      },
      "all_time_total": 127834
    },
    "audio_chat_minutes": {
      "per_minute": {
        "usage": 0,
        "limit": 1,
        "percentage_used": 0.0,
        "window_start": "2025-11-11T21:25:00Z",
        "window_end": "2025-11-11T21:26:00Z"
      },
      "per_hour": {
        "usage": 3,
        "limit": 10,
        "percentage_used": 30.0,
        "window_start": "2025-11-11T21:00:00Z",
        "window_end": "2025-11-11T22:00:00Z"
      },
      "per_day": {
        "usage": 47,
        "limit": 120,
        "percentage_used": 39.17,
        "window_start": "2025-11-11T00:00:00Z",
        "window_end": "2025-11-12T00:00:00Z"
      },
      "per_week": {
        "usage": 287,
        "limit": 600,
        "percentage_used": 47.83,
        "window_start": "2025-11-05T00:00:00Z",
        "window_end": "2025-11-12T00:00:00Z"
      },
      "per_month": {
        "usage": 934,
        "limit": 2400,
        "percentage_used": 38.92,
        "window_start": "2025-11-01T00:00:00Z",
        "window_end": "2025-12-01T00:00:00Z"
      },
      "all_time_total": 12847
    },
    "image_generations": {
      "per_minute": {
        "usage": 0,
        "limit": 2,
        "percentage_used": 0.0,
        "window_start": "2025-11-11T21:25:00Z",
        "window_end": "2025-11-11T21:26:00Z"
      },
      "per_hour": {
        "usage": 5,
        "limit": 20,
        "percentage_used": 25.0,
        "window_start": "2025-11-11T21:00:00Z",
        "window_end": "2025-11-11T22:00:00Z"
      },
      "per_day": {
        "usage": 18,
        "limit": 50,
        "percentage_used": 36.0,
        "window_start": "2025-11-11T00:00:00Z",
        "window_end": "2025-11-12T00:00:00Z"
      },
      "per_week": {
        "usage": 124,
        "limit": 300,
        "percentage_used": 41.33,
        "window_start": "2025-11-05T00:00:00Z",
        "window_end": "2025-11-12T00:00:00Z"
      },
      "per_month": {
        "usage": 437,
        "limit": 1000,
        "percentage_used": 43.7,
        "window_start": "2025-11-01T00:00:00Z",
        "window_end": "2025-12-01T00:00:00Z"
      },
      "all_time_total": 5847
    },
    "api_requests": {
      "per_minute": {
        "usage": 12,
        "limit": 60,
        "percentage_used": 20.0,
        "window_start": "2025-11-11T21:25:00Z",
        "window_end": "2025-11-11T21:26:00Z"
      },
      "per_hour": {
        "usage": 842,
        "limit": 3600,
        "percentage_used": 23.39,
        "window_start": "2025-11-11T21:00:00Z",
        "window_end": "2025-11-11T22:00:00Z"
      },
      "per_day": {
        "usage": 12847,
        "limit": 50000,
        "percentage_used": 25.69,
        "window_start": "2025-11-11T00:00:00Z",
        "window_end": "2025-11-12T00:00:00Z"
      },
      "per_week": {
        "usage": 74832,
        "limit": 300000,
        "percentage_used": 24.94,
        "window_start": "2025-11-05T00:00:00Z",
        "window_end": "2025-11-12T00:00:00Z"
      },
      "per_month": {
        "usage": 287493,
        "limit": 1000000,
        "percentage_used": 28.75,
        "window_start": "2025-11-01T00:00:00Z",
        "window_end": "2025-12-01T00:00:00Z"
      },
      "all_time_total": 3847293
    },
    "file_storage_gb": {
      "current_usage": 42.7,
      "total_limit": 100,
      "percentage_used": 42.7,
      "unit": "gigabytes"
    }
  },
  "records": {
    "highest_usage": {
      "text_ai_messages": {
        "per_minute": 10,
        "per_15_minutes": 134,
        "per_hour": 298,
        "per_day": 1543,
        "per_week": 8473,
        "per_month": 28934
      },
      "audio_chat_minutes": {
        "per_minute": 1,
        "per_hour": 10,
        "per_day": 145,
        "per_week": 847,
        "per_month": 2847
      },
      "image_generations": {
        "per_minute": 2,
        "per_hour": 20,
        "per_day": 50,
        "per_week": 347,
        "per_month": 1247
      },
      "api_requests": {
        "per_minute": 60,
        "per_hour": 3598,
        "per_day": 49847,
        "per_week": 298473,
        "per_month": 987493
      }
    },
    "peak_dates": {
      "text_ai_messages": "2025-11-05",
      "audio_chat_minutes": "2025-11-08",
      "image_generations": "2025-11-07",
      "api_requests": "2025-11-09"
    }
  },
  "account_status": {
    "overage_occurred": false,
    "approaching_limits": [
      {
        "resource": "text_ai_messages",
        "window": "per_day",
        "percentage": 57.3
      }
    ]
  }
}
curl -X GET "https://api.neuralcore5.ai/v1/subscribers/1234567/record?include_limits=true" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
GET /v1/subscribers/{subscriberId}/record/{resourceType}

Retrieve detailed usage records for a specific resource type across all time intervals with granular consumption data.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
resourceType string Resource type: "text_ai_messages", "audio_chat_minutes", "image_generations", "api_requests"
Query Parameters
Parameter Type Required Description
breakdown boolean Optional Include granular breakdown (default: false)
{
  "success": true,
  "subscriber_id": "1234567",
  "resource_type": "text_ai_messages",
  "record_timestamp": "2025-11-11T21:25:30Z",
  "usage_by_interval": {
    "per_minute": {
      "current_window": {
        "usage": 3,
        "limit": 10,
        "remaining": 7,
        "percentage_used": 30.0,
        "window_start": "2025-11-11T21:25:00Z",
        "window_end": "2025-11-11T21:26:00Z",
        "resets_in_seconds": 30
      },
      "record": {
        "highest": 10,
        "lowest": 0,
        "average": 4.2
      }
    },
    "per_15_minutes": {
      "current_window": {
        "usage": 27,
        "limit": 100,
        "remaining": 73,
        "percentage_used": 27.0,
        "window_start": "2025-11-11T21:15:00Z",
        "window_end": "2025-11-11T21:30:00Z",
        "resets_in_seconds": 270
      },
      "record": {
        "highest": 134,
        "lowest": 0,
        "average": 63.7
      }
    },
    "per_hour": {
      "current_window": {
        "usage": 142,
        "limit": 300,
        "remaining": 158,
        "percentage_used": 47.33,
        "window_start": "2025-11-11T21:00:00Z",
        "window_end": "2025-11-11T22:00:00Z",
        "resets_in_seconds": 2070
      },
      "record": {
        "highest": 298,
        "lowest": 12,
        "average": 147.3
      }
    },
    "per_day": {
      "current_window": {
        "usage": 573,
        "limit": 1000,
        "remaining": 427,
        "percentage_used": 57.3,
        "window_start": "2025-11-11T00:00:00Z",
        "window_end": "2025-11-12T00:00:00Z",
        "resets_in_seconds": 9270
      },
      "record": {
        "highest": 1543,
        "highest_date": "2025-11-05",
        "lowest": 287,
        "lowest_date": "2025-10-20",
        "average": 847.3
      }
    },
    "per_week": {
      "current_window": {
        "usage": 2847,
        "limit": 5000,
        "remaining": 2153,
        "percentage_used": 56.94,
        "window_start": "2025-11-05T00:00:00Z",
        "window_end": "2025-11-12T00:00:00Z",
        "resets_in_seconds": 486630
      },
      "record": {
        "highest": 8473,
        "highest_week": "2025-W42",
        "lowest": 1247,
        "lowest_week": "2025-W28",
        "average": 4837.2
      }
    },
    "per_month": {
      "current_window": {
        "usage": 8934,
        "limit": 20000,
        "remaining": 11066,
        "percentage_used": 44.67,
        "window_start": "2025-11-01T00:00:00Z",
        "window_end": "2025-12-01T00:00:00Z",
        "resets_in_seconds": 1731270
      },
      "record": {
        "highest": 28934,
        "highest_month": "2025-10",
        "lowest": 8473,
        "lowest_month": "2025-01",
        "average": 17483.5
      }
    }
  },
  "totals": {
    "all_time_usage": 127834,
    "account_created": "2024-06-15T00:00:00Z",
    "days_active": 514
  },
  "trends": {
    "daily_average_last_7_days": 892.7,
    "daily_average_last_30_days": 847.3,
    "growth_rate_percentage": 5.36,
    "trending": "up"
  }
}
curl -X GET "https://api.neuralcore5.ai/v1/subscribers/1234567/record/text_ai_messages?breakdown=false" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
POST /v1/subscribers/{subscriberId}/record

Record new usage for a subscriber. Automatically updates all relevant time window counters (per_minute, per_15_minutes, per_hour, per_day, per_week, per_month) and checks against limits.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Request Body
Parameter Type Required Description
resource_type string Required Resource type being consumed
quantity integer Required Quantity to record (default: 1)
check_limits boolean Optional Check limits before recording (default: true)
metadata object Optional Custom metadata for tracking
{
  "resource_type": "text_ai_messages",
  "quantity": 1,
  "check_limits": true,
  "metadata": {
    "conversation_id": "conv_abc123",
    "model": "gpt-4",
    "tokens": 847
  }
}
{
  "success": true,
  "subscriber_id": "1234567",
  "resource_type": "text_ai_messages",
  "quantity_recorded": 1,
  "recorded_at": "2025-11-11T21:25:45Z",
  "updated_usage": {
    "per_minute": {
      "usage": 4,
      "limit": 10,
      "remaining": 6
    },
    "per_15_minutes": {
      "usage": 28,
      "limit": 100,
      "remaining": 72
    },
    "per_hour": {
      "usage": 143,
      "limit": 300,
      "remaining": 157
    },
    "per_day": {
      "usage": 574,
      "limit": 1000,
      "remaining": 426
    },
    "per_week": {
      "usage": 2848,
      "limit": 5000,
      "remaining": 2152
    },
    "per_month": {
      "usage": 8935,
      "limit": 20000,
      "remaining": 11065
    }
  },
  "limits_status": {
    "any_exceeded": false,
    "warnings": [],
    "overage_charges": 0.00
  },
  "message": "Usage recorded successfully across all time windows"
}
curl -X POST https://api.neuralcore5.ai/v1/subscribers/1234567/record \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "resource_type": "text_ai_messages",
    "quantity": 1,
    "check_limits": true
  }'
GET /v1/subscribers/{subscriberId}/record/breakdown

Get detailed breakdown of usage across specific time intervals. Shows how individual usage events aggregate into interval totals.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Query Parameters
Parameter Type Required Description
resource_type string Required Resource type to analyze
interval string Required Interval: "per_minute", "per_15_minutes", "per_hour", "per_day", "per_week", "per_month"
count integer Optional Number of intervals to return (default: 10)
{
  "success": true,
  "subscriber_id": "1234567",
  "resource_type": "text_ai_messages",
  "interval": "per_hour",
  "breakdown": [
    {
      "window_start": "2025-11-11T21:00:00Z",
      "window_end": "2025-11-11T22:00:00Z",
      "usage": 142,
      "limit": 300,
      "percentage": 47.33,
      "status": "within_limit"
    },
    {
      "window_start": "2025-11-11T20:00:00Z",
      "window_end": "2025-11-11T21:00:00Z",
      "usage": 187,
      "limit": 300,
      "percentage": 62.33,
      "status": "within_limit"
    },
    {
      "window_start": "2025-11-11T19:00:00Z",
      "window_end": "2025-11-11T20:00:00Z",
      "usage": 234,
      "limit": 300,
      "percentage": 78.0,
      "status": "within_limit"
    },
    {
      "window_start": "2025-11-11T18:00:00Z",
      "window_end": "2025-11-11T19:00:00Z",
      "usage": 98,
      "limit": 300,
      "percentage": 32.67,
      "status": "within_limit"
    },
    {
      "window_start": "2025-11-11T17:00:00Z",
      "window_end": "2025-11-11T18:00:00Z",
      "usage": 76,
      "limit": 300,
      "percentage": 25.33,
      "status": "within_limit"
    }
  ],
  "statistics": {
    "highest_usage": 234,
    "lowest_usage": 76,
    "average_usage": 147.4,
    "total_intervals_analyzed": 5
  }
}
curl -X GET "https://api.neuralcore5.ai/v1/subscribers/1234567/record/breakdown?resource_type=text_ai_messages&interval=per_hour&count=5" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
GET /v1/subscribers/{subscriberId}/record/peaks

Analyze peak usage patterns across all time intervals to identify highest consumption periods and optimize limit allocation.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Query Parameters
Parameter Type Required Description
resource_type string Optional Specific resource (default: all)
period_days integer Optional Analysis period in days (default: 30)
{
  "success": true,
  "subscriber_id": "1234567",
  "analysis_period": {
    "start_date": "2025-10-12",
    "end_date": "2025-11-11",
    "days": 30
  },
  "peak_usage": {
    "text_ai_messages": {
      "per_minute": {
        "peak_value": 10,
        "occurred_at": "2025-11-05T14:23:00Z",
        "percentage_of_limit": 100.0
      },
      "per_15_minutes": {
        "peak_value": 134,
        "occurred_at": "2025-11-05T14:15:00Z",
        "percentage_of_limit": 134.0
      },
      "per_hour": {
        "peak_value": 298,
        "occurred_at": "2025-11-05T14:00:00Z",
        "percentage_of_limit": 99.33
      },
      "per_day": {
        "peak_value": 1543,
        "occurred_at": "2025-11-05T00:00:00Z",
        "percentage_of_limit": 154.3
      },
      "per_week": {
        "peak_value": 8473,
        "occurred_at": "2025-W45",
        "percentage_of_limit": 169.46
      },
      "per_month": {
        "peak_value": 28934,
        "occurred_at": "2025-10",
        "percentage_of_limit": 144.67
      }
    },
    "audio_chat_minutes": {
      "per_minute": {
        "peak_value": 1,
        "occurred_at": "2025-11-08T16:45:00Z",
        "percentage_of_limit": 100.0
      },
      "per_hour": {
        "peak_value": 10,
        "occurred_at": "2025-11-08T16:00:00Z",
        "percentage_of_limit": 100.0
      },
      "per_day": {
        "peak_value": 145,
        "occurred_at": "2025-11-08T00:00:00Z",
        "percentage_of_limit": 120.83
      },
      "per_week": {
        "peak_value": 847,
        "occurred_at": "2025-W45",
        "percentage_of_limit": 141.17
      },
      "per_month": {
        "peak_value": 2847,
        "occurred_at": "2025-10",
        "percentage_of_limit": 118.63
      }
    }
  },
  "insights": {
    "most_volatile_resource": "text_ai_messages",
    "most_consistent_resource": "api_requests",
    "peak_usage_days_of_week": ["Tuesday", "Wednesday"],
    "peak_usage_hours": [14, 15, 16],
    "recommendation": "Consider upgrading limits for text_ai_messages during peak hours (14:00-16:00)"
  }
}
curl -X GET "https://api.neuralcore5.ai/v1/subscribers/1234567/record/peaks?period_days=30" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
GET /v1/subscribers/{subscriberId}/record/export

Export detailed usage records for compliance, auditing, or analysis purposes. Supports CSV, JSON, and PDF formats.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Query Parameters
Parameter Type Required Description
format string Optional Export format: "json", "csv", "pdf" (default: "json")
start_date date Optional Start date for export (default: 30 days ago)
end_date date Optional End date for export (default: today)
include_metadata boolean Optional Include metadata in export (default: false)
{
  "success": true,
  "subscriber_id": "1234567",
  "export_id": "exp_xyz789abc012",
  "format": "csv",
  "period": {
    "start_date": "2025-10-12",
    "end_date": "2025-11-11"
  },
  "file_url": "https://api.neuralcore5.ai/exports/exp_xyz789abc012.csv",
  "file_size_bytes": 2847293,
  "record_count": 127834,
  "expires_at": "2025-11-18T21:30:00Z",
  "generated_at": "2025-11-11T21:30:00Z",
  "message": "Export generated successfully. Download link expires in 7 days."
}
curl -X GET "https://api.neuralcore5.ai/v1/subscribers/1234567/record/export?format=csv&start_date=2025-10-12&end_date=2025-11-11" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
GET /v1/subscribers/{subscriberId}/record/stream

Establish a real-time usage monitoring stream using Server-Sent Events (SSE). Receive live updates as usage is recorded across all intervals.

Path Parameters
Parameter Type Description
subscriberId string Subscriber ID (OPID)
Query Parameters
Parameter Type Required Description
resource_types array Optional Filter by resource types (default: all)
intervals array Optional Filter by intervals (default: all)
data: {"event":"usage_recorded","subscriber_id":"1234567","resource_type":"text_ai_messages","quantity":1,"timestamp":"2025-11-11T21:25:45Z","updated_intervals":{"per_minute":{"usage":4},"per_15_minutes":{"usage":28},"per_hour":{"usage":143},"per_day":{"usage":574},"per_week":{"usage":2848},"per_month":{"usage":8935}}}

data: {"event":"limit_warning","subscriber_id":"1234567","resource_type":"text_ai_messages","interval":"per_day","usage":574,"limit":1000,"percentage":57.4,"timestamp":"2025-11-11T21:25:45Z"}

data: {"event":"interval_reset","subscriber_id":"1234567","resource_type":"text_ai_messages","interval":"per_minute","timestamp":"2025-11-11T21:26:00Z"}

data: {"event":"peak_usage","subscriber_id":"1234567","resource_type":"api_requests","interval":"per_hour","new_peak":843,"previous_peak":842,"timestamp":"2025-11-11T21:26:15Z"}
curl -X GET "https://api.neuralcore5.ai/v1/subscribers/1234567/record/stream" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: text/event-stream"

© 2025 NeuralCore5. All rights reserved.

Current As of Nov 11, 2025 | Version 1