API Overview
Welcome to the Renesis Stellar DEX Vaults API documentation. This RESTful API provides comprehensive access to Stellar vault management, token holdings tracking, and trading operations without making direct smart contract calls. All data is managed through MongoDB integration with real-time token balance fetching from the Stellar network.Base URLs
- Production:
https://api.renesis.fi - Development:
http://localhost:3000/api - API Documentation:
http://localhost:3000/api/docs(development)
Authentication
API Key Authentication
All API requests require authentication using an API key. Include your API key in the request headers:Obtaining API Keys
- Access the Renesis dashboard at
https://terminal.renesis.fi - Navigate to API settings
- Generate a new API key for your application
- Store the API key securely and never expose it in client-side code
Authentication Errors
- 401 Unauthorized: Missing or invalid API key
- 403 Forbidden: API key lacks required permissions
Rate Limiting
The API implements rate limiting to ensure fair usage and system stability:Rate Limit Configuration
- Window: 15 minutes (900,000 ms)
- Maximum Requests: 100 requests per window per API key
- Burst Protection: Additional limits may apply for rapid successive requests
Rate Limit Headers
Rate limit information is included in all response headers:X-RateLimit-Limit: Maximum requests allowed per windowX-RateLimit-Remaining: Remaining requests in current windowX-RateLimit-Reset: Timestamp when the rate limit window resets
Rate Limit Exceeded
When rate limits are exceeded, the API returns:- Status Code: 429 Too Many Requests
- Retry-After: Header indicating when to retry the request
CORS Configuration
The API supports Cross-Origin Resource Sharing (CORS) for web applications:CORS Settings
- Allowed Origins: Configurable per environment (default:
http://localhost:3000,http://localhost:3001) - Allowed Methods:
GET,POST,PUT,PATCH,DELETE,OPTIONS - Allowed Headers:
Content-Type,Authorization,X-Requested-With - Credentials: Supported for authenticated requests
Environment-Specific Origins
- Development: Local development servers
- Production: Authorized production domains only
Supported Networks
The API supports both Stellar networks with automatic network detection and configuration:Network Types
- Testnet: For development, testing, and integration
- Used for development and staging environments
- Safe for testing without real asset risk
- Separate token lists and configurations
- Mainnet: For production operations
- Live network with real assets
- Production-grade reliability and security
- Complete token ecosystem support
Network Selection
Network selection is handled through thenetwork query parameter in relevant endpoints:
Network-Specific Features
- Token Lists: Different supported tokens per network
- Balance Fetching: Real-time balance updates from respective networks
- Validation: Network-appropriate address and contract validation
Response Format
All API responses follow a consistent structure for easy parsing and error handling:Success Response
Error Response
Pagination Structure
For endpoints that return multiple items, pagination information is included:page: Current page number (1-based)limit: Number of items per pagetotalItems: Total number of items availabletotalPages: Total number of pageshasNext: Boolean indicating if there are more pageshasPrev: Boolean indicating if there are previous pages
API Features
Core Capabilities
- ✅ Complete CRUD Operations: Create, read, update, and delete vault management
- ✅ MongoDB Integration: Robust data storage with Mongoose ODM
- ✅ Token Holdings Tracking: Real-time balance updates and multi-token support
- ✅ Stellar Network Integration: Direct balance fetching from Stellar network
- ✅ Data Validation: Comprehensive input validation and sanitization
- ✅ Advanced Search: Pagination, filtering, and search functionality
- ✅ Security Middleware: Rate limiting, CORS, and authentication
- ✅ Error Handling: Structured error responses and logging
- ✅ TypeScript Support: Full type safety and IntelliSense support
- ✅ Stellar Address Validation: Built-in Stellar address format validation
Data Models
The API manages two primary data models with full TypeScript support:Vault Model
Token Holdings Model
API Response Wrapper
Health Check & Utility Endpoints
Monitor API status, server health, and access comprehensive API information. For detailed documentation including response formats, examples, and integration guides, see Health Check & Utility Endpoints.Getting Started
Quick Start Guide
- Obtain API Key: Get your API key from the Renesis dashboard
- Choose Environment: Select appropriate base URL (development/production)
- Test Connection: Use health check endpoints to verify connectivity
- Create Vaults: Start with vault management endpoints
- Manage Holdings: Use token endpoints for balance tracking
- Implement Search: Add filtering and search capabilities
Development Workflow
- Setup: Configure environment variables and MongoDB connection
- Authentication: Implement API key authentication in your application
- Error Handling: Implement proper error handling for all API responses
- Rate Limiting: Respect rate limits and implement retry logic
- Testing: Use testnet for development and testing
Next Steps
Continue to the specific endpoint documentation for detailed implementation guidance:- Vault Endpoints - Core vault management operations
- Token Endpoints - Token holdings and balance management
- Search & Filtering - Advanced query capabilities
- Health Check & Utility Endpoints - API monitoring and information
- Error Handling - Error codes and troubleshooting

