Skip to main content

Cloud API - API Endpoints

Documentation complète des endpoints API.


πŸ“‘ Authentication​

POST /api/auth/register​

interface RegisterRequest {
email: string;
password: string;
publicKey: string;
}

interface RegisterResponse {
user: {
id: string;
email: string;
publicKey: string;
};
accessToken: string;
refreshToken: string;
}

POST /api/auth/login​

interface LoginRequest {
email: string;
password: string;
}

interface LoginResponse {
user: User;
accessToken: string;
refreshToken: string;
mfaRequired?: boolean;
}

POST /api/auth/refresh​

interface RefreshRequest {
refreshToken: string;
}

interface RefreshResponse {
accessToken: string;
refreshToken: string;
}

πŸ”„ Sync​

POST /api/sync/push​

interface PushStateRequest {
type: 'workflow' | 'agent' | 'settings';
entityId: string;
encryptedData: string;
version: string;
vectorClock: Record<string, number>;
}

interface PushStateResponse {
success: boolean;
version: string;
}

GET /api/sync/pull​

interface PullStateRequest {
since?: string; // Timestamp
type?: string; // Filter by type
}

interface PullStateResponse {
states: Array<{
type: string;
entityId: string;
encryptedData: string;
version: string;
updatedAt: string;
}>;
hasMore: boolean;
}

πŸ“ Workflows​

GET /api/workflows​

interface ListWorkflowsRequest {
status?: 'draft' | 'running' | 'completed' | 'failed';
limit?: number;
offset?: number;
}

interface ListWorkflowsResponse {
workflows: Workflow[];
total: number;
hasMore: boolean;
}

POST /api/workflows​

interface CreateWorkflowRequest {
name: string;
description?: string;
encryptedData: string;
encryptionKey: string;
}

interface CreateWorkflowResponse {
workflow: Workflow;
}

POST /api/workflows/:id/execute​

interface ExecuteWorkflowRequest {
input?: any;
}

interface ExecuteWorkflowResponse {
executionId: string;
status: 'running' | 'completed' | 'failed';
result?: any;
}

πŸ” Security Headers​

// Tous les endpoints requièrent
headers: {
'Authorization': 'Bearer <JWT_TOKEN>',
'X-Agent-ID': '<AGENT_ID>',
'Content-Type': 'application/json',
}

πŸ“Š Rate Limiting​

EndpointLimite
Auth10 req/min
Sync100 req/min
Workflows50 req/min
General1000 req/min

Version : 1.0.0