API Documentation - Developer Integration Guide

Complete REST API documentation for integrating with CDAO Platform programmatically

API Documentation - Developer Integration Guide

Welcome to the CDAO Platform API documentation. Our RESTful API provides programmatic access to investment opportunities, user management, KYC verification, escrow operations, and investment groups. Build powerful integrations with our comprehensive API suite.

πŸš€ API Capabilities

  • βœ… Investment Management: Create, update, and track investments
  • βœ… User & KYC Operations: Manage user accounts and verification
  • βœ… Deal Management: CRUD operations for investment opportunities
  • βœ… Investment Groups: Create and manage exclusive investor communities
  • βœ… Escrow System: Secure fund management and compliance
  • βœ… Analytics & Reporting: Access platform metrics and insights

πŸ”‘ Authentication & Authorization

API Authentication Methods

πŸ” Security-First Approach

CDAO Platform API uses multiple authentication methods:

🎫 JWT Bearer Tokens

Most API endpoints use JWT tokens obtained via login or OAuth flow.

πŸ”‘ API Keys

For server-to-server integrations and webhooks.

Authentication Pattern Implementation

βš™οΈ Standard Authentication Pattern

All protected endpoints follow this pattern:

Key Points:

  • Use - NOT
  • The auth result contains directly
  • Always check if result is NextResponse (auth failure)
  • userId is a string - Convert to number if needed

πŸ—οΈ API Architecture

Base URL & Versioning

🌐 Endpoint Structure

  • Base URL:
  • API Version: Included in URL path ()
  • Environment: Separate URLs for staging and production
  • Rate Limiting: 1000 requests per hour per API key

Request & Response Format

πŸ“‹ Standard Format

Request Headers:

Response Format:

πŸ‘€ User Management API

User Endpoints

πŸ‘₯ User Operations

Returns authenticated user's profile information
Update user profile information

KYC Verification Endpoints

πŸ” Verification API

  • GET /api/kyc/status - Get verification status
  • POST /api/kyc/initiate - Start KYC process
  • POST /api/kyc/documents - Upload verification documents
  • PUT /api/kyc/personal-info - Update personal information
  • GET /api/kyc/requirements - Get verification requirements

πŸ’Ό Investment Management API

Investment Operations

πŸ’° Investment Endpoints

Paginated list with filtering options
DELETE /api/investments/{id} - Cancel investment

Investment Groups API

πŸ‘₯ Group Management

Public Group Discovery:

  • GET /api/groups - Public group discovery (excludes user's own groups)
  • GET /api/groups/my-groups - Groups where user is a member
  • GET /api/groups/applications - User's group applications
  • GET /api/groups/{id} - Public group details
  • POST /api/groups/{id}/apply - Submit group application
  • GET /api/groups/{id}/dashboard - Member-only dashboard

Issuer Group Management:

  • GET /api/issuer/groups - Issuer's groups (max 1)
  • POST /api/issuer/groups - Create new group (blocked if exists)
  • PUT /api/issuer/groups/{id} - Update group settings
  • GET /api/issuer/groups/{id}/manage - Group management dashboard
  • POST /api/issuer/groups/{id}/deals - Add deals to group
  • GET /api/issuer/groups/{id}/applications - Review applications

🏒 Deal Management API

Deal CRUD Operations

πŸ“Š Deal Endpoints

Respects group membership for deal visibility

Deal Visibility Logic

πŸ” Member-Exclusive Access

Important: Group deals are member-exclusive

πŸ” Escrow System API

Escrow Management

🏦 Escrow Operations

  • POST /api/escrow/create - Create escrow contract
  • POST /api/escrow/{id}/fund - Fund escrow contract
  • POST /api/escrow/{id}/approve - Approve and release funds
  • POST /api/escrow/{id}/refund - Initiate refund
  • GET /api/escrow/{id}/status - Get escrow status
  • GET /api/escrow - List user's escrows

Escrow Status Response:

πŸ“Š Analytics & Reporting API

Platform Analytics

πŸ“ˆ Insights & Metrics

  • GET /api/analytics/dashboard - User dashboard metrics
  • GET /api/analytics/investments - Investment performance
  • GET /api/analytics/deals - Deal statistics
  • GET /api/analytics/groups - Group performance metrics
  • GET /api/analytics/platform - Platform-wide statistics

Example Dashboard Response:

⚑ Webhooks

Event Notifications

πŸ”” Real-time Events

Supported Event Types:

  • investment.created - New investment made
  • investment.completed - Investment completed
  • kyc.status_changed - KYC verification status update
  • escrow.funded - Escrow contract funded
  • escrow.released - Escrow funds released
  • group.application_received - New group application
  • deal.funding_completed - Deal funding target reached

Webhook Configuration:

  • POST /api/webhooks - Create webhook endpoint
  • GET /api/webhooks - List configured webhooks
  • PUT /api/webhooks/{id} - Update webhook
  • DELETE /api/webhooks/{id} - Delete webhook

Webhook Payload Format

❌ Error Handling

Standard Error Responses

🚨 Error Format

Common HTTP Status Codes:

  • 400 - Bad Request (validation errors)
  • 401 - Unauthorized (authentication required)
  • 403 - Forbidden (insufficient permissions)
  • 404 - Not Found (resource doesn't exist)
  • 429 - Too Many Requests (rate limiting)
  • 500 - Internal Server Error

πŸ”§ SDKs & Client Libraries

Official SDKs

πŸ“¦ Available Libraries

JavaScript/TypeScript
Python

Quick Start Example

πŸ§ͺ Testing & Sandbox

Development Environment

πŸ”¬ Sandbox Features

  • Test API Keys: Separate keys for development
  • Mock Data: Realistic test data for development
  • Webhook Testing: Test webhook delivery and handling
  • Rate Limit Testing: Test rate limiting behavior
  • Error Simulation: Simulate various error conditions

πŸ“š Additional Resources

Developer Resources

  • OpenAPI Specification: Download complete API spec
  • Postman Collection: Ready-to-use API collection
  • Code Examples: Working examples in multiple languages
  • Integration Guides: Step-by-step integration tutorials
  • Best Practices: Recommended patterns and practices

πŸ†˜ API Support

πŸ“ž Developer Support

Need help with API integration?

πŸš€ Ready to Build?

The CDAO Platform API provides everything you need to build powerful investment applications. From user management to complex escrow operations, our comprehensive API suite supports all your integration needs.

Get your API keys and start building today!

🎯 Next Steps

  1. πŸ”‘ Get API Keys for development and production
  2. πŸ“– Follow Quick Start Guide
  3. πŸ§ͺ Explore Sandbox Environment
  4. πŸ“¦ Download Official SDKs
  5. πŸ’¬ Join Developer Community