Oui Compose
Non défini
AI-powered content generation with multi-provider support, brand context, and semantic style matching
Version 1.0.0 • 80+ Endpoints • PHP 8.1+
Base URL: https://oui-compose:8890
Introduction
Oui Compose API is a powerful content generation platform with multi-provider AI support. It features a modular skills system, brand context engine, semantic style matching, and RAG (Retrieval Augmented Generation) capabilities.
Authentication
The Compose API supports two authentication methods:
Rate Limits
| Tier | Requests/Min | Requests/Month | Tokens/Month |
|---|---|---|---|
| Starter | 30 | 10,000 | 1,000,000 |
| Professional | 60 | 100,000 | 5,000,000 |
| Enterprise | 300 | 1,000,000 | 50,000,000 |
| Unlimited | Unlimited | Unlimited | Unlimited |
Content Generation
POST /api/generate
Generate AI-powered content with customizable options.
Parameters
| Parameter | Type | Description |
|---|---|---|
| user_prompt required | string | The content prompt/request |
| content_type optional | string | social_media, blog_post |
| brand_id optional | string | Brand context identifier |
| style_id optional | string | Writing style identifier |
| provider optional | string | anthropic, openai, openrouter |
| model optional | string | Specific model name |
| skills optional | array | Skills to apply: social_media, blog_writer, seo, copywriting, email_marketing, storytelling, newsletter |
| use_rag optional | boolean | Use RAG knowledge base |
| rag_query optional | string | RAG search query (if use_rag=true) |
| options optional | object | temperature, max_tokens, top_p |
Response
{
"success": true,
"content": {
"text": "AI is revolutionizing marketing in ways we never imagined...",
"platform": "linkedin",
"hashtags": ["#AIMarketing", "#DigitalTransformation"],
"cta": "What AI tools are you using in your marketing strategy?"
},
"metadata": {
"content_type": "social_media",
"provider": "anthropic",
"model": "claude-3-sonnet-20240229",
"skills_used": ["social_media", "copywriting"],
"response_time_ms": 2340,
"tokens_used": {
"input": 150,
"output": 280,
"total": 430
}
},
"_meta": {
"response_time_ms": 2345,
"version": "1.0.0"
}
}
POST /api/generate/batch
Generate multiple content pieces in a single request.
Response
{
"success": true,
"count": 2,
"results": [
{ "success": true, "content": {...} },
{ "success": true, "content": {...} }
],
"summary": {
"successful": 2,
"failed": 0
}
}
GET /api/content-types
List all available content types and their configurations.
Response
{
"content_types": {
"social_media": {
"name": "social_media",
"display_name": "Social Media Post",
"description": "Platform-specific social media content",
"required_fields": ["user_prompt"],
"optional_fields": ["platform", "hashtags", "tone"],
"defaults": {
"max_tokens": 280
}
},
"blog_post": {
"name": "blog_post",
"display_name": "Blog Post",
"description": "Long-form blog article content",
"required_fields": ["user_prompt"],
"optional_fields": ["title", "sections", "seo_keywords"],
"defaults": {
"max_tokens": 2000
}
}
}
}
Brand Management
GET /api/brands/{brandId}
Retrieve brand context and settings.
Response
{
"brand_name": "Acme Corporation",
"industry": "Technology",
"target_audience": "B2B SaaS decision makers",
"products": ["Product A", "Product B"],
"voice": {
"tone": "Professional yet approachable",
"vocabulary": ["innovation", "efficiency", "growth"],
"personality_traits": ["trustworthy", "expert", "friendly"]
},
"metadata": {
"website": "https://acme.com",
"social_handles": {
"twitter": "@acme",
"linkedin": "acme-corporation"
}
}
}
PUT /api/brands/{brandId}
Update brand context.
Request Body
{
"brand_name": "Acme Corporation",
"industry": "Technology",
"target_audience": "Enterprise software buyers",
"products": ["Product A", "Product B", "Product C"],
"voice": {
"tone": "Professional and authoritative",
"vocabulary": ["enterprise", "scalable", "secure"],
"personality_traits": ["innovative", "reliable"]
}
}
POST /api/brands/{brandId}/analyze-style
Analyze writing samples to extract brand voice and style patterns using AI.
Request Body
{
"samples": [
"First sample of brand content to analyze...",
"Second sample of brand content...",
"Third sample text showing brand voice..."
]
}
Response
{
"success": true,
"analysis": {
"tone": "Professional with friendly undertones",
"vocabulary_level": "Advanced but accessible",
"common_phrases": ["drive results", "empower teams", "innovative solutions"],
"sentence_structure": "Mix of short impactful sentences and detailed explanations",
"key_patterns": {
"opening_style": "Question or bold statement",
"closing_style": "Call to action",
"transition_words": ["moreover", "consequently", "indeed"]
}
},
"style_id": "style_abc123"
}
Content Strategy
GET /api/brands/{brandId}/strategy
Retrieve content strategy for a brand.
Response
{
"brand_id": "acme-corp",
"content_pillars": [
{
"name": "Thought Leadership",
"description": "Industry insights and trends",
"weight": 0.3,
"themes": ["AI trends", "Future of work", "Digital transformation"]
},
{
"name": "Product Education",
"description": "How-to guides and tutorials",
"weight": 0.4,
"themes": ["Feature highlights", "Use cases", "Best practices"]
},
{
"name": "Company Culture",
"description": "Behind the scenes and team stories",
"weight": 0.3,
"themes": ["Team spotlights", "Company values", "Events"]
}
],
"monthly_themes": {
"January": "New Year, New Goals",
"February": "Love Your Data"
}
}
PUT /api/brands/{brandId}/strategy
Update content strategy.
Request Body
{
"content_pillars": [
{
"name": "Thought Leadership",
"description": "Industry insights",
"weight": 0.35,
"themes": ["AI trends", "Innovation"]
}
],
"monthly_themes": {
"March": "Spring Cleaning Your Tech Stack"
}
}
POST /api/brands/{brandId}/schedule
Build content schedule based on strategy.
Request Body
{
"start_date": "2024-02-01",
"end_date": "2024-02-28",
"frequency": "daily",
"content_types": ["social_media", "blog_post"],
"num_items": 30
}
Response
{
"success": true,
"schedule": [
{
"date": "2024-02-01",
"content_type": "social_media",
"theme": "Product Education",
"suggested_topics": ["New feature announcement", "Tutorial teaser"]
},
{
"date": "2024-02-02",
"content_type": "blog_post",
"theme": "Thought Leadership",
"suggested_topics": ["AI trends in 2024"]
}
]
}
POST /api/brands/{brandId}/calendar
Generate full content calendar with optional auto-generation.
Request Body
{
"month": 3,
"year": 2024,
"auto_generate": false
}
Response
{
"success": true,
"calendar": {
"2024-03-01": {
"content_pieces": [
{
"type": "social_media",
"theme": "Thought Leadership",
"priority": 1
}
]
},
"2024-03-04": {
"content_pieces": [
{
"type": "blog_post",
"theme": "Product Education",
"priority": 2
}
]
}
}
}
Knowledge Base (RAG)
GET /api/brands/{brandId}/knowledge
Query the brand knowledge base using semantic search.
Parameters
| Parameter | Type | Description |
|---|---|---|
| q required | string | Search query |
| limit optional | integer | Number of results (default: 5) |
Response
{
"success": true,
"results": [
{
"document_id": "doc_123",
"content": "Relevant content from knowledge base...",
"metadata": {
"source": "Product documentation",
"tags": ["features", "pricing"]
},
"relevance_score": 0.92
}
]
}
POST /api/brands/{brandId}/knowledge
Add document to knowledge base with automatic embedding generation.
Request Body
{
"content": "Your document content to add to the knowledge base...",
"metadata": {
"source": "Company blog",
"tags": ["marketing", "best-practices"],
"author": "Marketing Team"
}
}
Response
{
"success": true,
"document_id": "doc_456"
}
Admin Dashboard
GET /admin/dashboard
Get dashboard overview statistics.
Response
{
"active_keys": 45,
"total_requests": 125000,
"total_tokens": 5800000,
"unique_users": 32,
"top_content_types": [
{"type": "social_media", "count": 45000},
{"type": "blog_post", "count": 12000}
],
"top_providers": [
{"provider": "anthropic", "count": 80000},
{"provider": "openai", "count": 45000}
],
"alerts": 2,
"system_health": "healthy"
}
API Key Management
GET /admin/keys
List all API keys.
Parameters
| Parameter | Type | Description |
|---|---|---|
| status | string | active, revoked, expired |
| limit | integer | Results per page (default: 50) |
Response
{
"keys": [
{
"key_id": "key_abc123",
"name": "Production Key",
"key": "oui_live_xxxx",
"status": "active",
"tier": "professional",
"permissions": ["generate", "brands", "strategy"],
"created_at": "2024-01-01T00:00:00Z",
"last_used_at": "2024-01-22T14:00:00Z",
"expires_at": null
}
],
"total": 45
}
POST /admin/keys
Create new API key. Note: The full key is only shown once upon creation.
Request Body
{
"name": "New Production Key",
"tier": "professional",
"permissions": ["generate", "strategy", "brands", "rag"],
"brand_ids": ["brand_123"],
"expires_at": "2025-01-01T00:00:00Z"
}
Response
{
"success": true,
"key_id": "key_def456",
"key": "oui_live_abc123def456...",
"message": "API key created successfully"
}
POST /admin/keys/{keyId}/rotate
Rotate (regenerate) an API key. Old key is immediately invalidated.
Response
{
"success": true,
"new_key": "oui_live_newkey789...",
"message": "Key rotated successfully"
}
Analytics
GET /admin/analytics
Get analytics data by type.
Parameters
| Parameter | Type | Description |
|---|---|---|
| type | string | usage, content_types, providers, brands, errors, performance |
| period | string | 7d, 30d, 90d, 1y (default: 30d) |
Monitoring
GET /admin/monitoring
Get system monitoring status.
Response
{
"status": "healthy",
"database": "connected",
"uptime": 864000,
"active_workers": 4,
"memory_usage": 256,
"cpu_usage": 15.5,
"last_check": "2024-01-22T14:00:00Z"
}
GET /admin/monitoring/health
Detailed health check of all services.
Response
{
"status": "healthy",
"checks": {
"database": "ok",
"cache": "ok",
"providers": {
"anthropic": "ok",
"openai": "ok",
"openrouter": "ok"
}
},
"last_check": "2024-01-22T14:00:00Z"
}
Webhooks
GET /admin/webhooks/events
List available webhook events.
Response
{
"events": {
"content.generated": "When content is successfully generated",
"content.failed": "When content generation fails",
"batch.completed": "When a batch generation completes",
"api_key.created": "When a new API key is created",
"api_key.revoked": "When an API key is revoked",
"rate_limit.exceeded": "When rate limit is exceeded",
"brand.updated": "When brand context is updated",
"schedule.generated": "When a content schedule is generated",
"document.added": "When a document is added to knowledge base",
"test": "Test webhook event"
}
}
POST /admin/webhooks
Create a new webhook subscription.
Request Body
{
"name": "Content Notifications",
"url": "https://your-app.com/webhooks/compose",
"events": ["content.generated", "content.failed"],
"is_active": true,
"retry_count": 3,
"timeout_seconds": 30
}
Response
{
"success": true,
"id": 1,
"secret": "whsec_abc123...",
"message": "Webhook created successfully. Save the secret - it will only be shown once."
}
Provider Credentials
GET /admin/credentials
List all AI provider credentials (API keys not exposed).
Response
{
"credentials": [
{
"id": 1,
"provider": "anthropic",
"name": "Claude Production",
"organization_id": null,
"base_url": null,
"model_override": null,
"is_active": true,
"is_default": true,
"settings": {},
"created_at": "2024-01-01T00:00:00Z"
}
]
}
POST /admin/credentials
Add new provider credential.
Request Body
{
"provider": "anthropic",
"name": "Claude Backup",
"api_key": "sk-ant-api03-...",
"is_active": true,
"is_default": false
}
POST /admin/credentials/{credId}/test
Test provider credential connection.
Response
{
"success": true,
"message": "Connection successful",
"details": {
"status": "connected",
"http_code": 200
}
}
Jobs & Cron Tasks
GET /admin/jobs
List all jobs with filtering.
Parameters
| Parameter | Type | Description |
|---|---|---|
| status | string | pending, processing, completed, failed |
| type | string | Job type filter |
Response
{
"jobs": [
{
"id": "job_abc123",
"type": "batch_generation",
"queue": "default",
"status": "completed",
"data": {},
"result": {},
"attempts": 1,
"max_attempts": 3,
"created_at": "2024-01-22T13:00:00Z",
"completed_at": "2024-01-22T13:05:00Z"
}
],
"total": 150
}
GET /admin/cron
List cron tasks.
Response
{
"tasks": [
{
"id": "cron_123",
"name": "Daily Analytics Report",
"handler": "AnalyticsHandler::dailyReport",
"expression": "0 6 * * *",
"description": "Generate daily analytics report",
"is_active": true,
"last_run_at": "2024-01-22T06:00:00Z",
"next_run_at": "2024-01-23T06:00:00Z",
"last_result": "success"
}
]
}
POST /admin/cron/{taskId}/run
Run cron task immediately.
Response
{
"success": true,
"job_id": "job_xyz789"
}
Error Codes
| Code | Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Invalid or missing authentication |
FORBIDDEN | 403 | Insufficient permissions |
NOT_FOUND | 404 | Resource not found |
VALIDATION_ERROR | 400 | Request validation failed |
RATE_LIMIT_EXCEEDED | 429 | Rate limit exceeded |
PROVIDER_ERROR | 502 | AI provider returned an error |
INTERNAL_ERROR | 500 | Internal server error |