API Reference
API Overview
The platform provides a comprehensive RESTful API for integration and automation:
API Design Principles
- REST Architecture: Resource-oriented endpoints with standard HTTP methods
- JSON Format: Consistent JSON request and response format
- Authentication: JWT-based authentication for all API endpoints
- Rate Limiting: Protection against excessive requests
- Versioning: API versioning for backward compatibility
Authentication
All API requests require authentication:
Authorization: Bearer <jwt_token>
Authentication tokens can be obtained through the /api/auth/login
endpoint.
Common Endpoints
User Management
Endpoint | Method | Description |
---|---|---|
/api/users | GET | List users (with pagination) |
/api/users/{id} | GET | Get user details |
/api/users | POST | Create new user |
/api/users/{id} | PUT | Update user |
/api/users/{id} | DELETE | Delete user |
Document API
Endpoint | Method | Description |
---|---|---|
/api/documents | GET | List documents (with filtering) |
/api/documents/{id} | GET | Get document details |
/api/documents | POST | Upload new document |
/api/documents/{id} | PUT | Update document metadata |
/api/documents/{id} | DELETE | Delete document |
Blockchain Integration
Endpoint | Method | Description |
---|---|---|
/api/transactions | GET | List transactions |
/api/transactions/{id} | GET | Get transaction details |
/api/transactions | POST | Create new transaction |
/api/contracts/{address}/call | POST | Call contract method |
Response Format
All API responses follow a standard format:
{
"success": true,
"data": {
// Response data specific to the endpoint
},
"meta": {
"pagination": {
"total": 100,
"page": 1,
"limit": 10
}
}
}
Error Responses
Error responses use appropriate HTTP status codes and include:
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message",
"details": {} // Optional additional error details
}
}