Skip to main content

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 SurfacePurposeBest For
Platform SDKType-safe JavaScript/TypeScript clientBackend services, Node.js apps
React HooksClient-side data fetching and stateFrontend components, React apps
REST APIDirect HTTP accesscURL, external integrations
Config SchemaTenant configuration structureJSON config files, admin tools
ComponentsPre-built UI componentsReact applications
Interactive ToolsDynamic UI widgetsChat, 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

Configuration

The Vertical Template is config-driven, allowing you to define layouts, components, and data bindings in JSON configuration files.

Configuration Files

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:

ServicePurposeSDK Module
PublicAPIResource CRUD, chat, documentsresources, chat, documents
ConfiguratorTenant configuration managementLoaded via getConfig()
ResourceAPIAdvanced resource queriesresources.query()
AICoreLLM orchestration and RAGchat, orchestrate
AuthzAuthorization and access controlauth, 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