This document provides a comprehensive reference for all Synapse-NG API endpoints. The API enables interaction with the autonomous decentralized network, including task management, governance, evolution, and more.
Currently, most endpoints use the NODE_ID from the environment to identify the requesting node. Some operations (like voting, task claiming) verify node permissions based on network state and reputation.
Common Query Parameters:
channel: Channel ID where the operation takes place (required for most endpoints)task_id: Task identifier (for task-related operations)proposal_id: Proposal identifier (for governance operations)GET /Returns the web dashboard interface.
Response: HTML page
GET /whoamiReturns the current node’s identity.
Response:
{
"node_id": "node-123",
"public_key": "base64_encoded_public_key"
}
GET /stateReturns the complete network state including nodes, tasks, proposals, reputations, balances, and immune system status.
Response:
{
"global": {
"nodes": {
"node-123": {
"id": "node-123",
"public_key": "...",
"reputation": {
"_total": 150,
"_last_updated": "2024-01-01T12:00:00Z",
"tags": {
"python": 50,
"security": 100
}
},
"balance": 1000
}
},
"immune_system": {
"enabled": true,
"active_issues": [],
"last_scan": "2024-01-01T12:00:00Z"
}
},
"channel-1": {
"participants": ["node-123", "node-456"],
"tasks": {},
"proposals": {},
"treasury_balance": 5000
}
}
GET /channelsReturns the list of channels subscribed by this node.
Response:
["global", "channel-1", "channel-2"]
GET /network/statsReturns network statistics including peer count, message counts, and performance metrics.
Response:
{
"total_peers": 5,
"messages_sent": 1234,
"messages_received": 5678,
"uptime_seconds": 86400
}
GET /webrtc/connectionsReturns the status of WebRTC peer connections.
Response:
{
"connections": [
{
"peer_id": "node-456",
"state": "connected",
"ice_connection_state": "connected",
"data_channel_state": "open"
}
]
}
GET /webrtc/ice-metricsReturns ICE (Interactive Connectivity Establishment) metrics for WebRTC connections.
Response:
{
"metrics": [
{
"peer_id": "node-456",
"candidate_pairs": 3,
"selected_pair": "udp/host/relay"
}
]
}
GET /pubsub/statsReturns PubSub protocol statistics.
Response:
{
"total_messages": 1000,
"subscribed_channels": 3,
"message_rate": 10.5
}
POST /tasksCreates a new task with optional reward in Synapse Points.
Query Parameters:
channel (required): Channel IDfunded_by (optional): “user” (default) or “treasury”Request Body:
{
"title": "Implement feature X",
"description": "Detailed description of the task",
"tags": ["python", "security"],
"reward": 100,
"schema_name": "task_v2",
"required_tools": ["geolocation_api"],
"enable_auction": false,
"max_reward": 200,
"auction_deadline_hours": 24
}
Response:
{
"id": "task-uuid",
"title": "Implement feature X",
"status": "open",
"creator": "node-123",
"reward": 100,
"created_at": "2024-01-01T12:00:00Z"
}
Status Codes:
201: Task created successfully400: Channel not subscribed or validation failed403: Insufficient balancePOST /tasks/{task_id}/claimClaims an open task.
Query Parameters:
channel (required): Channel IDResponse:
{
"message": "Task claimed successfully",
"task_id": "task-uuid",
"assignee": "node-123"
}
Status Codes:
200: Task claimed successfully400: Task already claimed or not found403: Node not eligible to claimPOST /tasks/{task_id}/progressUpdates task progress (assignee only).
Query Parameters:
channel (required): Channel IDRequest Body:
{
"progress_note": "Completed initial implementation"
}
Response:
{
"message": "Progress updated",
"task_id": "task-uuid"
}
POST /tasks/{task_id}/completeMarks a task as complete and transfers the reward to the assignee.
Query Parameters:
channel (required): Channel IDResponse:
{
"message": "Task completed",
"task_id": "task-uuid",
"reward_transferred": 95,
"tax_collected": 5
}
Status Codes:
200: Task completed successfully400: Task not claimed or already completed403: Only assignee can completeDELETE /tasks/{task_id}Deletes a task (creator only, only if not claimed).
Query Parameters:
channel (required): Channel IDResponse:
{
"message": "Task deleted successfully",
"task_id": "task-uuid"
}
Status Codes:
200: Task deleted403: Not authorized or task already claimedPOST /tasks/composite/createCreates a composite task requiring a team of nodes with specific skills.
Query Parameters:
channel (required): Channel IDRequest Body:
{
"title": "Build Full-Stack Application",
"description": "Complex project requiring multiple skills",
"total_reward": 1000,
"required_team_size": 3,
"subtasks": [
{
"title": "Backend API",
"required_skills": ["python", "api"],
"reward_percentage": 40
},
{
"title": "Frontend UI",
"required_skills": ["react", "css"],
"reward_percentage": 40
},
{
"title": "DevOps",
"required_skills": ["docker", "ci/cd"],
"reward_percentage": 20
}
]
}
Response:
{
"task_id": "composite-task-uuid",
"status": "forming_team",
"workspace_channel": "workspace_composite-task-uuid",
"created_at": "2024-01-01T12:00:00Z"
}
POST /tasks/composite/{task_id}/applyApply to join a composite task team.
Query Parameters:
channel (required): Channel IDRequest Body:
{
"message": "I have 5 years experience with Python and FastAPI"
}
Response:
{
"message": "Application submitted",
"task_id": "composite-task-uuid",
"applicant_id": "node-123"
}
POST /tasks/composite/{task_id}/accept/{applicant_id}Accept a team member application (creator only).
Query Parameters:
channel (required): Channel IDResponse:
{
"message": "Team member accepted",
"team_size": 2,
"required_size": 3
}
POST /tasks/composite/{task_id}/claimClaim the composite task (for backward compatibility, prefer /apply).
Query Parameters:
channel (required): Channel IDPOST /tasks/composite/{task_id}/subtask/{subtask_id}/completeMark a subtask as complete.
Query Parameters:
channel (required): Channel IDResponse:
{
"message": "Subtask completed",
"subtask_id": "subtask-1",
"all_subtasks_complete": false
}
GET /tasks/compositeList all composite tasks.
Query Parameters:
channel (required): Channel IDResponse:
{
"composite_tasks": [
{
"id": "composite-task-uuid",
"title": "Build Full-Stack Application",
"status": "forming_team",
"team_size": 2,
"required_team_size": 3
}
]
}
GET /tasks/composite/{task_id}Get details of a specific composite task.
Query Parameters:
channel (required): Channel IDResponse:
{
"id": "composite-task-uuid",
"title": "Build Full-Stack Application",
"status": "in_progress",
"team_members": ["node-123", "node-456"],
"subtasks": [...],
"workspace_channel": "workspace_composite-task-uuid"
}
POST /tasks/{task_id}/bidPlace a bid on a task with auction enabled.
Query Parameters:
channel (required): Channel IDRequest Body:
{
"amount": 80,
"estimated_days": 5
}
Response:
{
"message": "Bid placed successfully",
"task_id": "task-uuid",
"bidder": "node-123",
"amount": 80
}
Status Codes:
201: Bid placed successfully400: Auction closed or invalid bid403: Cannot bid on own taskPOST /tasks/{task_id}/select_bidSelect a winning bid (task creator only).
Query Parameters:
channel (required): Channel IDRequest Body:
{
"bidder_id": "node-456"
}
Response:
{
"message": "Bid selected",
"winner": "node-456",
"amount": 80,
"task_status": "claimed"
}
POST /skills/profileUpdate the current node’s skills profile.
Query Parameters:
channel (required): Channel IDRequest Body:
{
"skills": ["python", "react", "docker"],
"bio": "Full-stack developer with 5 years experience"
}
Response:
{
"message": "Profile updated",
"node_id": "node-123",
"skills": ["python", "react", "docker"],
"bio": "Full-stack developer with 5 years experience"
}
GET /skills/profileGet skills profile of a node.
Query Parameters:
channel (required): Channel IDnode_id (optional): Node ID (defaults to current node)Response:
{
"node_id": "node-123",
"skills": ["python", "react", "docker"],
"bio": "Full-stack developer with 5 years experience"
}
POST /proposalsCreate a new governance proposal.
Query Parameters:
channel (required): Channel IDRequest Body:
{
"title": "Upgrade security protocol",
"description": "Proposal to implement new encryption standard",
"proposal_type": "network_operation",
"params": {
"operation": "upgrade_protocol",
"version": "2.0"
},
"tags": ["security", "protocol"],
"schema_name": "proposal_v1"
}
Proposal Types:
generic: General proposalsconfig_change: Change network configurationnetwork_operation: Operational changescommand: Execute specific commands (e.g., acquire tools)code_upgrade: Self-upgrade proposalsResponse:
{
"id": "proposal-uuid",
"title": "Upgrade security protocol",
"proposer": "node-123",
"status": "open",
"votes": {},
"created_at": "2024-01-01T12:00:00Z"
}
POST /proposals/{proposal_id}/voteVote on a proposal.
Query Parameters:
channel (required): Channel IDRequest Body:
{
"vote": "yes",
"anonymous": false,
"zkp_proof": null
}
For anonymous voting with Zero-Knowledge Proofs:
{
"vote": "yes",
"anonymous": true,
"zkp_proof": {
"commitment": "...",
"challenge": "...",
"response": "...",
"tier": "gold",
"tier_weight": 3
}
}
Response:
{
"message": "Vote recorded",
"proposal_id": "proposal-uuid",
"voter": "node-123",
"vote": "yes"
}
POST /proposals/{proposal_id}/closeClose a proposal and tally votes.
Query Parameters:
channel (required): Channel IDResponse:
{
"message": "Proposal closed",
"proposal_id": "proposal-uuid",
"result": "approved",
"yes_votes": 15,
"no_votes": 5
}
GET /proposals/{proposal_id}/detailsGet detailed information about a proposal.
Query Parameters:
channel (required): Channel IDResponse:
{
"id": "proposal-uuid",
"title": "Upgrade security protocol",
"description": "...",
"proposer": "node-123",
"status": "open",
"votes": {
"node-123": "yes",
"node-456": "no"
},
"created_at": "2024-01-01T12:00:00Z",
"closed_at": null
}
POST /governance/ratify/{proposal_id}Ratify a proposal (validators only).
Query Parameters:
channel (required): Channel IDResponse:
{
"message": "Proposal ratified",
"proposal_id": "proposal-uuid",
"executed": true
}
Status Codes:
200: Proposal ratified successfully403: Not a validator or proposal not approvedGET /zkp/generate_proofGenerate a Zero-Knowledge Proof for anonymous voting.
Query Parameters:
channel (required): Channel IDproposal_id (required): Proposal IDResponse:
{
"proof": {
"commitment": "base64_encoded_commitment",
"challenge": "base64_encoded_challenge",
"response": "base64_encoded_response",
"tier": "gold",
"tier_weight": 3
},
"current_reputation": 150,
"message": "Proof generated successfully"
}
The AI Agent allows natural language interaction with the network.
POST /agent/promptSend a natural language prompt to the AI agent.
Query Parameters:
channel (required): Channel IDRequest Body:
{
"prompt": "Create a task to implement a new API endpoint with 100 SP reward"
}
Response:
{
"message": "Prompt processed by AI agent",
"prompt": "Create a task...",
"actions_generated": 1,
"actions_executed": [
{
"action": "create_task",
"params": {
"title": "Implement new API endpoint",
"reward": 100
},
"reasoning": "User requested task creation with specified reward",
"status": "executed"
}
],
"raw_llm_response": "..."
}
Status Codes:
200: Prompt processed successfully503: AI Agent not availableGET /agent/objectivesGet current AI agent objectives and statistics.
Response:
{
"objectives": {
"maximize_sp": true,
"build_reputation": true,
"contribute_to_network": true
},
"stats": {
"actions_executed": 50,
"tasks_created": 10,
"proposals_voted": 20
}
}
POST /agent/objectivesSet or update AI agent objectives.
Request Body:
{
"maximize_sp": true,
"build_reputation": true,
"contribute_to_network": true,
"focus_areas": ["development", "governance"]
}
Response:
{
"message": "Objectives updated",
"objectives": {...}
}
GET /agent/statusGet AI agent status and health.
Response:
{
"enabled": true,
"model_loaded": true,
"last_action": "2024-01-01T12:00:00Z",
"pending_actions": 0
}
POST /upgrades/proposePropose a code upgrade to the network.
Query Parameters:
channel (required): Channel IDtitle (required): Upgrade titledescription (required): Description of changesversion (required): Target version (e.g., “1.2.0”)package_url (required): URL or IPFS hash of WASM packagepackage_hash (required): SHA256 hash of packagepackage_size (optional): Package size in byteswasm_module_name (optional): WASM module name (default: “upgrade”)Response:
{
"message": "Upgrade proposal created",
"proposal_id": "proposal-uuid",
"version": "1.2.0",
"package_hash": "sha256...",
"next_steps": [
"1. Community vote on proposal",
"2. Validator set ratification",
"3. Automatic download and verification",
"4. Execution in WASM sandbox",
"5. Network upgrade completed"
]
}
POST /upgrades/{proposal_id}/testTest an upgrade in sandbox mode.
Query Parameters:
channel (required): Channel IDResponse:
{
"message": "Upgrade tested successfully",
"test_results": {
"syntax_valid": true,
"security_checks": "passed",
"performance_impact": "low"
}
}
GET /upgrades/statusGet status of all upgrades.
Response:
{
"active_upgrades": [
{
"proposal_id": "proposal-uuid",
"version": "1.2.0",
"status": "testing",
"progress": 50
}
]
}
GET /upgrades/historyGet upgrade history.
Response:
{
"upgrades": [
{
"version": "1.1.0",
"applied_at": "2024-01-01T00:00:00Z",
"status": "success"
}
]
}
POST /upgrades/{proposal_id}/rollbackRollback a failed upgrade.
Query Parameters:
channel (required): Channel IDResponse:
{
"message": "Upgrade rolled back successfully",
"restored_version": "1.1.0"
}
The Evolutionary Engine enables the network to analyze itself and propose autonomous improvements.
POST /evolution/analyzeAnalyze the network for inefficiencies.
Query Parameters:
channel (required): Channel IDResponse:
{
"message": "Network analyzed",
"inefficiencies_found": 3,
"inefficiencies": [
{
"type": "performance",
"severity": "high",
"description": "Task assignment algorithm is O(n²)",
"affected_component": "task_matching"
}
]
}
POST /evolution/generateGenerate code to fix identified inefficiencies.
Query Parameters:
channel (required): Channel IDRequest Body:
{
"inefficiency_id": "ineff-uuid",
"language": "python",
"target_component": "task_matching"
}
Response:
{
"message": "Code generated",
"code": "def improved_task_matching(...):\n ...",
"language": "python",
"estimated_improvement": "60% faster"
}
POST /evolution/proposeCreate a proposal for autonomous evolution.
Query Parameters:
channel (required): Channel IDRequest Body:
{
"title": "Optimize task matching algorithm",
"generated_code_id": "code-uuid",
"rationale": "Current algorithm is too slow for large networks"
}
Response:
{
"message": "Evolution proposal created",
"proposal_id": "proposal-uuid",
"requires_community_vote": true
}
GET /evolution/statusGet status of evolutionary engine.
Response:
{
"enabled": true,
"last_analysis": "2024-01-01T12:00:00Z",
"pending_evolutions": 2,
"applied_evolutions": 5
}
Common tools are shared API credentials or services that the network can acquire and use collectively.
POST /proposals (for tool acquisition)Propose acquisition of a common tool.
Query Parameters:
channel (required): Channel IDRequest Body:
{
"title": "Acquire Geolocation API Tool",
"description": "Proposal to acquire geolocation service",
"proposal_type": "command",
"command": {
"operation": "acquire_common_tool",
"params": {
"channel": "channel-1",
"tool_id": "geolocation_api",
"monthly_cost_sp": 100,
"credentials_to_encrypt": "API_KEY_HERE",
"description": "Geolocation API for analytics tasks",
"type": "api_key"
}
}
}
POST /tools/{tool_id}/executeExecute a common tool (authorized task assignees only).
Query Parameters:
channel (required): Channel IDtask_id (required): Task IDRequest Body:
{
"ip_address": "8.8.8.8"
}
Response:
{
"result": {
"country": "United States",
"city": "Mountain View",
"latitude": 37.386,
"longitude": -122.084
},
"tool_id": "geolocation_api",
"execution_cost_sp": 1
}
Status Codes:
200: Tool executed successfully403: Not authorized (must be task assignee)402: Insufficient task budgetGET /treasury/{channel_id}Get treasury balance for a specific channel.
Response:
{
"channel_id": "channel-1",
"balance": 5000,
"reserved": 1000,
"available": 4000
}
GET /treasuriesGet treasury balances for all channels.
Response:
{
"treasuries": {
"channel-1": 5000,
"channel-2": 3000
}
}
GET /configGet current network configuration.
Response:
{
"task_completion_tax": 0.05,
"proposal_voting_period": 86400,
"validator_set": ["node-123", "node-456"],
"updated_at": "2024-01-01T12:00:00Z"
}
GET /config/historyGet configuration change history.
Response:
{
"changes": [
{
"key": "task_completion_tax",
"old_value": 0.1,
"new_value": 0.05,
"changed_at": "2024-01-01T00:00:00Z",
"changed_by": "proposal-uuid"
}
]
}
GET /schemasGet all available schemas.
Response:
{
"schemas": {
"task_v1": {...},
"task_v2": {...},
"proposal_v1": {...}
}
}
GET /schemas/{schema_name}Get a specific schema definition.
Response:
{
"name": "task_v2",
"version": "2.0",
"fields": {
"title": {"type": "string", "required": true},
"reward": {"type": "integer", "min": 0}
}
}
POST /schemas/validateValidate data against a schema.
Request Body:
{
"schema_name": "task_v2",
"data": {
"title": "Test task",
"reward": 100
}
}
Response:
{
"valid": true,
"errors": []
}
POST /bootstrap/handshakePerform initial handshake with bootstrap node.
Request Body:
{
"node_id": "node-123",
"public_key": "base64_encoded_key"
}
Response:
{
"message": "Handshake successful",
"peers": ["node-456", "node-789"]
}
POST /p2p/signal/relayRelay WebRTC signaling message to another peer.
Request Body:
{
"target_peer_id": "node-456",
"signal_data": {...}
}
POST /p2p/signal/receiveReceive WebRTC signaling message.
Request Body:
{
"from_peer_id": "node-123",
"signal_data": {...}
}
POST /raft/request_voteRequest vote from a node (RAFT consensus algorithm).
Request Body:
{
"term": 5,
"candidate_id": "node-123",
"last_log_index": 100,
"last_log_term": 4
}
Response:
{
"term": 5,
"vote_granted": true
}
POST /raft/append_entriesAppend entries to log (RAFT consensus algorithm).
Request Body:
{
"term": 5,
"leader_id": "node-123",
"prev_log_index": 99,
"prev_log_term": 4,
"entries": [...],
"leader_commit": 100
}
Response:
{
"term": 5,
"success": true
}
WebSocket /wsWebSocket endpoint for real-time bidirectional communication.
Connection:
const ws = new WebSocket('ws://localhost:8000/ws');
Incoming Messages:
{
"type": "task_created",
"data": {
"task_id": "task-uuid",
"title": "New task"
}
}
Outgoing Messages:
{
"type": "subscribe",
"channel": "channel-1"
}
All endpoints may return the following error responses:
400 Bad Request:
{
"detail": "Validation error message"
}
403 Forbidden:
{
"detail": "Not authorized to perform this action"
}
404 Not Found:
{
"detail": "Resource not found"
}
500 Internal Server Error:
{
"detail": "Internal server error"
}
503 Service Unavailable:
{
"detail": "Service temporarily unavailable"
}
Currently, there are no rate limits enforced at the API level. However, resource-intensive operations (like AI agent prompts or evolution analysis) may have internal throttling based on network load and node reputation.