2025-07-10 19:09:49 +01:00
|
|
|
# API Documentation
|
|
|
|
|
|
|
|
|
|
## Base URL
|
|
|
|
|
```
|
|
|
|
|
http://localhost:8000
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Endpoints
|
|
|
|
|
|
|
|
|
|
### Generate Marketing Copy
|
|
|
|
|
**POST** `/generate`
|
|
|
|
|
|
|
|
|
|
Generate marketing copy based on prompt and brand guidelines.
|
|
|
|
|
|
|
|
|
|
#### Request Body
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"prompt": "string",
|
|
|
|
|
"content_type": "general",
|
|
|
|
|
"tone": "string"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Response
|
|
|
|
|
```json
|
|
|
|
|
"Generated marketing copy text"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Add Campaign
|
|
|
|
|
**POST** `/add-campaign`
|
|
|
|
|
|
|
|
|
|
Add a marketing campaign to the vector store for future reference.
|
|
|
|
|
|
|
|
|
|
#### Request Body
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"content": "string",
|
|
|
|
|
"content_type": "string",
|
|
|
|
|
"metadata": {}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Search Campaigns
|
|
|
|
|
**GET** `/search`
|
|
|
|
|
|
|
|
|
|
Search for similar campaigns using vector similarity.
|
|
|
|
|
|
|
|
|
|
#### Query Parameters
|
|
|
|
|
- `query` (string): Search query
|
|
|
|
|
- `content_type` (string, optional): Filter by content type
|
|
|
|
|
- `k` (int, optional): Number of results to return (default: 3)
|
|
|
|
|
|
|
|
|
|
#### Response
|
|
|
|
|
```json
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"content": "string",
|
|
|
|
|
"content_type": "string",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"_search_distance": 0.0
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Health Check
|
|
|
|
|
**GET** `/health`
|
|
|
|
|
|
|
|
|
|
Check API health status.
|
|
|
|
|
|
|
|
|
|
#### Response
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"status": "healthy"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Root
|
|
|
|
|
**GET** `/`
|
|
|
|
|
|
|
|
|
|
API root endpoint with basic information.
|
|
|
|
|
|
|
|
|
|
## Content Types
|
|
|
|
|
- `general` - General marketing content
|
|
|
|
|
- `email` - Email campaigns
|
|
|
|
|
- `social` - Social media posts
|
|
|
|
|
- `ad` - Advertisement copy
|
|
|
|
|
- `blog` - Blog content
|
|
|
|
|
|
|
|
|
|
## Error Responses
|
|
|
|
|
All endpoints may return:
|
|
|
|
|
- **422 Validation Error** - Invalid request format
|
|
|
|
|
- **500 Internal Server Error** - Server error
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"detail": [
|
|
|
|
|
{
|
|
|
|
|
"loc": ["field_name"],
|
|
|
|
|
"msg": "Error message",
|
|
|
|
|
"type": "error_type"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Vector Store Features
|
|
|
|
|
- Uses `all-MiniLM-L6-v2` model for embeddings (384 dimensions)
|
|
|
|
|
- FAISS index for fast similarity search
|
|
|
|
|
- Persistent storage of campaigns
|
|
|
|
|
- Automatic index rebuilding on startup
|