Skip to main content

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

EndpointMethodDescription
/api/usersGETList users (with pagination)
/api/users/{id}GETGet user details
/api/usersPOSTCreate new user
/api/users/{id}PUTUpdate user
/api/users/{id}DELETEDelete user

Document API

EndpointMethodDescription
/api/documentsGETList documents (with filtering)
/api/documents/{id}GETGet document details
/api/documentsPOSTUpload new document
/api/documents/{id}PUTUpdate document metadata
/api/documents/{id}DELETEDelete document

Blockchain Integration

EndpointMethodDescription
/api/transactionsGETList transactions
/api/transactions/{id}GETGet transaction details
/api/transactionsPOSTCreate new transaction
/api/contracts/{address}/callPOSTCall 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
}
}