REST API
AIMatrix REST APIs follow RESTful principles and provide comprehensive access to all platform capabilities through HTTP endpoints.
Overview
The REST API is the primary interface for integrating with AIMatrix. It provides:
- Resource-based URLs following REST conventions
- HTTP methods for different operations (GET, POST, PUT, DELETE)
- JSON payloads for request and response data
- Standard HTTP status codes for operation results
- Comprehensive error handling with detailed error messages
Base Configuration
Endpoints
Production: https://api.aimatrix.com/v1
Staging: https://api-staging.aimatrix.com/v1
Development: https://api-dev.aimatrix.com/v1
Request Headers
|
|
Core Resources
Agents API
List Agents
|
|
Query Parameters:
page
(integer): Page number (default: 1)per_page
(integer): Items per page (default: 20, max: 100)type
(string): Filter by agent typestatus
(string): Filter by status (active, inactive, training)search
(string): Search by name or description
Response:
|
|
Create Agent
|
|
Request Body:
|
|
Get Agent
|
|
Update Agent
|
|
Delete Agent
|
|
Execute Agent
|
|
Request Body:
|
|
Knowledge API
List Knowledge Bases
|
|
Create Knowledge Base
|
|
Request Body:
|
|
Query Knowledge Base
|
|
Request Body:
|
|
Digital Twins API
List Digital Twins
|
|
Create Digital Twin
|
|
Request Body:
|
|
Run Simulation
|
|
Request Body:
|
|
Advanced Features
Filtering and Searching
Complex Filters
|
|
Full-text Search
|
|
Pagination
Cursor-based Pagination
|
|
Offset-based Pagination
|
|
Sorting
|
|
Field Selection
|
|
Expanding Relations
|
|
Bulk Operations
Batch Requests
|
|
Request Body:
|
|
Response:
|
|
Bulk Updates
|
|
Request Body:
|
|
Error Handling
Error Response Format
|
|
Common Error Codes
400
- Bad Request: Invalid request format401
- Unauthorized: Invalid or missing API key403
- Forbidden: Insufficient permissions404
- Not Found: Resource doesn’t exist409
- Conflict: Resource already exists422
- Unprocessable Entity: Validation failed429
- Too Many Requests: Rate limit exceeded500
- Internal Server Error: Server error
Code Examples
JavaScript/Node.js
|
|
Python
|
|
cURL Examples
|
|
Performance Considerations
Rate Limiting
- Free tier: 1,000 requests/hour
- Pro tier: 10,000 requests/hour
- Enterprise tier: 100,000 requests/hour
Optimization Tips
- Use field selection to reduce response size
- Implement caching for frequently accessed data
- Use batch operations for multiple related requests
- Enable compression with Accept-Encoding: gzip
- Implement retry logic with exponential backoff
Response Caching
|
|
Response with caching headers:
|
|
Testing
Sandbox Environment
Use the sandbox environment for testing:
Base URL: https://api-sandbox.aimatrix.com/v1
API Key: test_key_1234567890
Test Data
The sandbox includes sample agents, knowledge bases, and digital twins for testing all API endpoints without affecting production data.
For more examples and advanced use cases, see the API Examples section.