Fiberwise API Reference

This is a comprehensive reference for the most essential Fiberwise platform APIs. The endpoints are organized by functional area to help developers quickly find what they need for platform adoption and integration.

🚧 Live API Documentation

For the most up-to-date API documentation, visit http://localhost:5757/api/v1/docs when running Fiberwise in development mode. The live documentation includes all available endpoints with request/response examples.

Available API Categories

  • Authentication: /api/v1/auth/* - User registration, login, logout
  • Users: /api/v1/users/* - User management
  • Apps: /api/v1/apps/* - Application management
  • Agents: /api/v1/agents/* - Agent operations
  • Activations: /api/v1/activations/* - Agent activation history
  • Functions: /api/v1/functions/* - Function management
  • Pipelines: /api/v1/pipelines/* - Pipeline workflows
  • LLM Providers: /api/v1/llm-providers/* - LLM provider configuration
  • Credentials: /api/v1/credentials/* - OAuth and credential management
  • Data: /api/v1/data/* - Dynamic app data storage
  • Worker: /api/v1/worker/* - Background worker management

Base URL and Authentication

Base URL

http://localhost:5757/api/v1 (or your deployment URL + /api/v1)

Note: All API endpoints use the /api/v1 prefix. The main application runs on port 5757.

Authentication Methods

  • Cookie Authentication: For web sessions (login required)
  • API Keys: For programmatic access (see API Key Management section)
  • Agent Keys: For agent-specific operations

🔐 Authentication

User Registration

POST /register

Request

POST /register
Content-Type: application/x-www-form-urlencoded

[email protected]&password=yourpassword&confirm_password=yourpassword&first_name=John&last_name=Doe

Response: Redirects to login page on success

User Login

POST /login
POST /login
Content-Type: application/x-www-form-urlencoded

[email protected]&password=yourpassword

Response: Sets authentication cookie and redirects to main app

Logout

POST /api/v1/auth/logout

Response: Clears authentication cookie and redirects to login

🔑 API Key Management

Essential for programmatic access to the platform.

Create API Key

POST /api/v1/user/api-keys
POST /api/v1/user/api-keys
Authorization: Bearer <session_token>
Content-Type: application/json

{
    "name": "My Integration Key",
    "scopes": ["read:all", "write:all"]
}

Available Scopes

  • read:all - Read access to all resources
  • write:all - Write access to all resources
  • admin - Administrative access
  • app:access - Application-specific access

Response

{
    "id": 1,
    "name": "My Integration Key",
    "key": "fw_key_abc123...",
    "key_prefix": "fw_key_abc1",
    "scopes": ["read:all", "write:all"],
    "expires_at": null,
    "created_at": "2024-01-01T00:00:00Z"
}

List API Keys

GET /api/v1/user/api-keys

Revoke API Key

DELETE /api/v1/user/api-keys/{key_id}

🤖 Agent Operations

Core functionality for managing and activating agents.

List Available Agents

GET /api/v1/agents

Response

{
    "agents": [
        {
            "id": "agent_123",
            "name": "Text Processor",
            "version": "1.0",
            "description": "Processes and analyzes text content",
            "is_system": false,
            "capabilities": ["text_analysis", "summarization"]
        }
    ]
}

Get Agent Details

GET /api/v1/agents/{agent_id}

Activate Agent

POST /api/v1/agents/{agent_id}/activate
POST /api/v1/agents/{agent_id}/activate
Authorization: Bearer <api_key>
Content-Type: application/json

{
    "input_data": {
        "text": "Content to process",
        "options": {
            "mode": "analyze"
        }
    },
    "context_type": "general",
    "metadata": {
        "source": "api_call"
    }
}

Response

{
    "activation_id": "activation_456",
    "status": "pending",
    "message": "Agent activation has been created successfully"
}

Get Agent Activations

GET /api/v1/agents/{agent_id}/activations?limit=10

📱 Application Management

List All Apps

GET /api/v1/apps?limit=50&offset=0

Response

{
    "apps": [
        {
            "app_id": "app_123",
            "app_slug": "text-analyzer",
            "name": "Text Analyzer",
            "description": "Advanced text analysis tool",
            "version": "1.0.0",
            "entry_point_url": "/text-analyzer",
            "marketplace_status": "active"
        }
    ],
    "total": 1,
    "limit": 50,
    "offset": 0
}
                            

Get App Details

GET /api/v1/apps/{app_id}

Install App

POST /api/v1/users/{app_id}/install

Activate App Agent

POST /api/v1/apps/{app_id}/agents/{agent_id}/activate
POST /api/v1/apps/{app_id}/agents/{agent_id}/activate
Authorization: Bearer <api_key>
Content-Type: application/json

{
    "input": {
        "message": "Hello from app context"
    },
    "context": {
        "user_preference": "detailed"
    }
}
                            

🔧 LLM Provider Management

List LLM Providers

GET /api/v1/llm-providers

Create LLM Provider

POST /api/v1/llm-providers
POST /api/v1/llm-providers
Authorization: Bearer <api_key>
Content-Type: application/json

{
    "name": "My OpenAI Provider",
    "provider_type": "openai",
    "api_endpoint": "https://api.openai.com/v1",
    "configuration": {
        "api_key": "sk-...",
        "models": ["gpt-4", "gpt-3.5-turbo"],
        "default_model": "gpt-4"
    },
    "is_active": true
}
                            

Update LLM Provider

PUT /api/v1/llm-providers/{provider_id}
PUT /api/v1/llm-providers/{provider_id}
Authorization: Bearer <api_key>
Content-Type: application/json

{
    "name": "Updated Provider Name",
    "is_active": true,
    "configuration": {
        "api_key": "new-key-here",
        "default_model": "gpt-4"
    }
}
                            

🔗 OAuth & Credential Management

Register OAuth Provider

POST /api/v1/credentials/oauth/register
POST /api/v1/credentials/oauth/register
Authorization: Bearer <api_key>
Content-Type: application/json

{
    "provider_name": "google",
    "client_id": "your-google-client-id",
    "client_secret": "your-google-client-secret",
    "token_data": {
        "authorize_url": "https://accounts.google.com/o/oauth2/auth",
        "token_url": "https://oauth2.googleapis.com/token",
        "scopes": ["email", "profile"]
    }
}
                            

Initiate OAuth Flow

GET /api/v1/credentials/auth/initiate/{provider_id}?app_id={app_id}&return_to=/dashboard

List User Connections

GET /api/v1/credentials/connections?app_id={app_id}

📊 Dynamic Data Operations

List Data Items

GET /api/v1/data/{app_id}/{model_slug}?page=1&limit=10

With Filtering

GET /api/v1/data/{app_id}/{model_slug}?filter={"status":"active","category":"important"}
                            

Create Data Item

POST /api/v1/data/{app_id}/{model_slug}
POST /api/v1/data/{app_id}/{model_slug}
Authorization: Bearer <api_key>
Content-Type: application/json

{
    "data": {
        "name": "New Item",
        "status": "active",
        "description": "Item description"
    }
}
                            

Update Data Item

PUT /api/v1/data/{app_id}/{model_slug}/{item_id}
PUT /api/v1/data/{app_id}/{model_slug}/{item_id}
Authorization: Bearer <api_key>
Content-Type: application/json

{
    "data": {
        "name": "Updated Item",
        "status": "inactive"
    }
}
                            

🔄 Real-time Communication

WebSocket Connection

const ws = new WebSocket('ws://localhost:5555/api/v1/ws/{app_id}');

// Send messages
ws.send(JSON.stringify({
    event: "subscribe",
    payload: { channel: "agent_updates" }
}));

ws.send(JSON.stringify({
    event: "broadcast",
    payload: {
        channel: "notifications",
        payload: { message: "Hello World" }
    }
}));
                    
                    

Authentication: WebSocket connections use cookie authentication (users must be logged in).

📋 Activation Management

Get Activation Details

GET /api/v1/activations/{activation_id}

Response

{
    "activation_id": "activation_123",
    "status": "completed",
    "input_data": {...},
    "output_data": {...},
    "created_at": "2024-01-01T00:00:00Z",
    "completed_at": "2024-01-01T00:01:00Z"
}
                            

🚀 Getting Started Checklist

  1. Create Account: Register at /register and login at /login
  2. Generate API Key: Create an API key with appropriate scopes
  3. List Agents: Get available agents with GET /api/v1/agents
  4. Activate Agent: Test agent activation with sample data
  5. Browse Apps: Explore available apps with GET /api/v1/apps
  6. Configure LLM Provider: Set up your preferred LLM provider
  7. Set up OAuth: Configure OAuth providers for external integrations

Error Handling

All endpoints return standard HTTP status codes:

Error Response Format

{
    "detail": "Error message describing what went wrong"
}
                    

                    

Rate Limiting

Currently, no rate limiting is implemented, but it's recommended to: