API Reference Overview
The Vertical Template provides multiple API surfaces for building multi-tenant, config-driven vertical applications on the EnterpriseAI platform. This reference covers the Platform SDK, React Hooks, REST API, configuration schemas, and UI components.
Quick Reference
| API Surface | Purpose | Best For |
|---|---|---|
| Platform SDK | Type-safe JavaScript/TypeScript client | Backend services, Node.js apps |
| React Hooks | Client-side data fetching and state | Frontend components, React apps |
| REST API | Direct HTTP access | cURL, external integrations |
| Config Schema | Tenant configuration structure | JSON config files, admin tools |
| Components | Pre-built UI components | React applications |
| Interactive Tools | Dynamic UI widgets | Chat, document upload, actions |
Platform SDK
The @enterpriseaigroup/platform-sdk package provides a comprehensive TypeScript SDK for interacting with EnterpriseAI services.
Installation
npm install @enterpriseaigroup/platform-sdk
# or
yarn add @enterpriseaigroup/platform-sdk
Quick Start
import { PlatformClient } from '@enterpriseaigroup/platform-sdk';
const client = new PlatformClient({
apiKey: process.env.EAI_API_KEY,
baseURL: 'https://api.enterpriseai.com',
tenantId: 'your-tenant-id'
});
// Use SDK modules
const resources = await client.resources.list({ type: 'project' });
const chatResponse = await client.chat.sendMessage('Hello!');
SDK Modules
- Client - Initialization and configuration
- Resources - CRUD operations on typed resources
- Chat - SSE streaming chat with AI
- Documents - File upload, classification, RAG indexing
- Users - User profile management
- Auth - Token management and authentication
- Orchestrate - Workflow execution
React Hooks
The @enterpriseaigroup/core package provides React hooks for seamless integration with EnterpriseAI services in your frontend.
Installation
npm install @enterpriseaigroup/core
# or
yarn add @enterpriseaigroup/core
Quick Start
import { useResources, useChat } from '@enterpriseaigroup/core';
function MyComponent() {
const { data: projects, loading } = useResources({ type: 'project' });
const { messages, sendMessage } = useChat();
return (
<div>
{projects?.map(p => <div key={p.id}>{p.name}</div>)}
</div>
);
}
Available Hooks
- useResources - Typed CRUD for resources with caching
- useChat - SSE streaming chat with real-time updates
- useDocuments - File upload and document management
REST API
All API calls in the Vertical Template use a BFF (Backend-for-Frontend) proxy pattern. Client requests go through /api/eai/* routes where authentication tokens are injected server-side.
Base URL
https://your-app.vercel.app/api/eai/v3
Authentication
All requests require an Authorization header with a Bearer token. In the Vertical Template, this is handled automatically by the BFF proxy.
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://your-app.vercel.app/api/eai/v3/resources
API Endpoints
- Resources API - GET, POST, PUT, DELETE resources
- Chat API - POST streaming chat (SSE)
- Documents API - POST multipart uploads, GET, DELETE
- Users API - GET user profiles
- Orchestrate API - POST workflow execution
Configuration
The Vertical Template is config-driven, allowing you to define layouts, components, and data bindings in JSON configuration files.
Configuration Files
- Config Schema - Complete EAIConfig TypeScript type reference
- Components - Built-in component registry and custom registration
- Interactive Tools - ActionBar, ChatPanel, DocumentUploader
Example Configuration
{
"layout": {
"header": {
"component": "Header",
"props": {
"logo": "/logo.png",
"title": "My Vertical App"
}
},
"slots": [
{
"id": "main",
"component": "ResourceList",
"store": {
"binding": "resources.projects"
}
}
]
}
}
Backend Services
The Vertical Template integrates with the following EnterpriseAI backend services:
| Service | Purpose | SDK Module |
|---|---|---|
| PublicAPI | Resource CRUD, chat, documents | resources, chat, documents |
| Configurator | Tenant configuration management | Loaded via getConfig() |
| ResourceAPI | Advanced resource queries | resources.query() |
| AICore | LLM orchestration and RAG | chat, orchestrate |
| Authz | Authorization and access control | auth, headers |
TypeScript Support
All SDK modules and hooks are fully typed with TypeScript. Use generic type parameters for typed responses:
interface Project {
id: string;
name: string;
status: 'active' | 'archived';
}
// SDK
const projects = await client.resources.list<Project>({ type: 'project' });
// Hooks
const { data } = useResources<Project>({ type: 'project' });
Error Handling
All SDK methods and hooks return structured errors:
try {
const resource = await client.resources.create(data);
} catch (error) {
if (error.code === 'VALIDATION_ERROR') {
console.error('Invalid data:', error.details);
} else if (error.code === 'UNAUTHORIZED') {
console.error('Authentication failed');
}
}
Rate Limits
The EnterpriseAI platform enforces the following rate limits:
- Resources API: 1000 requests/minute per tenant
- Chat API: 100 concurrent streams per tenant
- Documents API: 50 uploads/minute per tenant
Rate limit headers are included in all responses:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 847
X-RateLimit-Reset: 1678886400
Next Steps
- Getting Started: See the Quick Start Guide
- Guides: Explore integration patterns
- Examples: Check out the example applications
- Support: Join our Discord community