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you upload, index, search, and extract structured knowledge from video libraries at scale. It is built for teams that deal with large volumes of footage β security operators, media houses, sports analysts, content moderators, researchers, and enterprise data teams β who need to query video content the way a search engine queries text.
|
| 13 |
+
|
| 14 |
+
**What CreativAI enables:**
|
| 15 |
+
- **Semantic search across video** β "Find every moment a forklift enters the loading bay" across 10,000 hours of CCTV footage
|
| 16 |
+
- **Structured data extraction** β turn raw video segments into a spreadsheet: "Is PPE worn?", "How many people are visible?", "What emotion is the speaker expressing?"
|
| 17 |
+
- **AI-powered chat on your video data** β ask natural-language questions and get synthesised, cited answers from your indexed footage
|
| 18 |
+
- **Live stream analysis** β connect an IP camera or OBS stream and run real-time extraction while recording
|
| 19 |
+
- **Team annotation workflows** β divide footage into sub-plates, assign segments to annotators, track verification progress
|
| 20 |
+
|
| 21 |
+
**Base URL:** `https://creativai-apis.com`
|
| 22 |
+
**Current API version:** `v2` (current and recommended for all features).
|
| 23 |
+
**Interactive docs:** Available in-app via **API Documentation** in the left sidebar.
|
| 24 |
+
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
## What Can You Build?
|
| 28 |
+
|
| 29 |
+
| Use Case | Industry | Key APIs Used |
|
| 30 |
+
|----------|----------|---------------|
|
| 31 |
+
| Build searchable visual memory for autonomous systems | Robotics & Embodied AI | Collections β Indexing β Search β Data Plates |
|
| 32 |
+
| Find rare visual events and generate structured labels at scale | Research & Visual Data | Collections β Indexing β Data Plates β Knowledge Extraction |
|
| 33 |
+
| Detect suspicious activity and generate incident timelines | Public Safety & Security | Live Stream β Data Plates β Knowledge Extraction |
|
| 34 |
+
| Auto-tag scenes, people, objects, and brand moments in archives | Media & Entertainment | Collections β Indexing β Search β Knowledge Extraction |
|
| 35 |
+
| Analyze game footage for highlights and tactical patterns | Sports | Collections β Indexing β Search β Data Plates |
|
| 36 |
+
| Query multi-modal datasets (videos and images) in one workflow | Cross-Industry Operations | Collections β Indexing β Search β Agentic Chat |
|
| 37 |
+
| Enrich collection insights with visual charts and summaries | Analytics & BI | Knowledge Extraction β Charts |
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
## Step 0 β Get Your API Key
|
| 42 |
+
|
| 43 |
+
Before making any API call you need an API key. Keys are created from the CreativAI app.
|
| 44 |
+
|
| 45 |
+
### Sign Up / Log In
|
| 46 |
+
|
| 47 |
+
1. Go to **[creativ-ai.com](https://creativ-ai.com)** and create an account (or log in).
|
| 48 |
+
2. Verify your email address.
|
| 49 |
+
3. You will land on the **collections page (`/`)** with a free-tier plan active and welcome credits applied.
|
| 50 |
+
|
| 51 |
+
### Find Your API Key
|
| 52 |
+
|
| 53 |
+
Your API key is **automatically provisioned** when you sign up β there is nothing to create.
|
| 54 |
+
|
| 55 |
+
1. Click your **profile avatar** in the top-right corner to open the profile dropdown.
|
| 56 |
+
2. Click **API Key** to expand the section.
|
| 57 |
+
3. Click the **copy icon** to copy the key to your clipboard.
|
| 58 |
+
|
| 59 |
+
> **Key format:** Keys begin with `sk_live_`. Never commit them to source control.
|
| 60 |
+
|
| 61 |
+
---
|
| 62 |
+
|
| 63 |
+
## Quick Start
|
| 64 |
+
|
| 65 |
+
```bash
|
| 66 |
+
export CREATIVAI_BASE_URL="https://creativai-apis.com"
|
| 67 |
+
export CREATIVAI_API_KEY="<YOUR_API_KEY>"
|
| 68 |
+
|
| 69 |
+
# Health check (no auth required)
|
| 70 |
+
curl "$CREATIVAI_BASE_URL/health"
|
| 71 |
+
|
| 72 |
+
# Verify your key is active and check your account info
|
| 73 |
+
curl "$CREATIVAI_BASE_URL/api/v2/users/get_users_info" \
|
| 74 |
+
-H "X-API-Key: $CREATIVAI_API_KEY"
|
| 75 |
+
# β {"data": {"credits_remaining": 5000, "uploaded_hours": 0, ...}}
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
### First Workflow in 5 Commands
|
| 79 |
+
|
| 80 |
+
> **Scenario:** Import a dashcam recording from Google Drive, index it, and search for moments where a pedestrian is visible.
|
| 81 |
+
>
|
| 82 |
+
> **No local upload required** β the backend fetches the file directly from Google Drive into your collection.
|
| 83 |
+
|
| 84 |
+
```bash
|
| 85 |
+
# 1. Create a collection (video-only model is fine for dashcam footage)
|
| 86 |
+
COLLECTION_ID=$(curl -s -X POST "$CREATIVAI_BASE_URL/api/v2/collections" \
|
| 87 |
+
-H "X-API-Key: $CREATIVAI_API_KEY" \
|
| 88 |
+
-H "Content-Type: application/json" \
|
| 89 |
+
-d '{"collection_name": "dashcam-trip-2026-05", "model": "video_only"}' \
|
| 90 |
+
| python3 -c "import sys,json; print(json.load(sys.stdin)['data']['collection_id'])")
|
| 91 |
+
|
| 92 |
+
# 2. Transfer file from Google Drive (replace GOOGLE_ACCESS_TOKEN and FILE_ID with real values)
|
| 93 |
+
curl -X POST "$CREATIVAI_BASE_URL/api/v2/upload/google-drive/transfer" \
|
| 94 |
+
-H "X-API-Key: $CREATIVAI_API_KEY" \
|
| 95 |
+
-H "Content-Type: application/json" \
|
| 96 |
+
-d "{
|
| 97 |
+
\"collection_id\": \"$COLLECTION_ID\",
|
| 98 |
+
\"access_token\": \"$GOOGLE_ACCESS_TOKEN\",
|
| 99 |
+
\"file_ids\": [\"$DRIVE_FILE_ID\"],
|
| 100 |
+
\"file_names\": [\"trip.mp4\"]
|
| 101 |
+
}"
|
| 102 |
+
|
| 103 |
+
# 3. Start indexing (async β returns a job ID immediately)
|
| 104 |
+
INDEXING_ID=$(curl -s -X POST "$CREATIVAI_BASE_URL/api/v2/indexing/chunk-based" \
|
| 105 |
+
-H "X-API-Key: $CREATIVAI_API_KEY" \
|
| 106 |
+
-H "Content-Type: application/json" \
|
| 107 |
+
-d "{\"collection_id\": \"$COLLECTION_ID\"}" \
|
| 108 |
+
| python3 -c "import sys,json; print(json.load(sys.stdin)['data']['indexing_id'])")
|
| 109 |
+
|
| 110 |
+
# 4. Poll until indexing is complete (takes ~1β3 min per hour of video)
|
| 111 |
+
while true; do
|
| 112 |
+
STATUS=$(curl -s "$CREATIVAI_BASE_URL/api/v2/indexing/chunk-based/$INDEXING_ID/status" \
|
| 113 |
+
-H "X-API-Key: $CREATIVAI_API_KEY" \
|
| 114 |
+
| python3 -c "import sys,json; print(json.load(sys.stdin)['data']['status'])")
|
| 115 |
+
echo "Indexing: $STATUS"
|
| 116 |
+
[ "$STATUS" = "completed" ] && break
|
| 117 |
+
sleep 15
|
| 118 |
+
done
|
| 119 |
+
|
| 120 |
+
# 5. Search β find every moment a pedestrian is visible
|
| 121 |
+
curl -X POST "$CREATIVAI_BASE_URL/api/v2/search" \
|
| 122 |
+
-H "X-API-Key: $CREATIVAI_API_KEY" \
|
| 123 |
+
-H "Content-Type: application/json" \
|
| 124 |
+
-d "{\"collection_id\": \"$COLLECTION_ID\", \"text_query\": \"pedestrian crossing road\", \"search_type\": \"hybrid\"}"
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
> Also works with Dropbox (`POST /api/v2/upload/dropbox/transfer`) and Hugging Face (`POST /api/v2/upload/huggingface/transfer`). See [upload-integrations.md](guides/upload-integrations.md) for the full OAuth setup for each provider.
|
| 128 |
+
|
| 129 |
+
---
|
| 130 |
+
|
| 131 |
+
## API Conventions
|
| 132 |
+
|
| 133 |
+
### Authentication
|
| 134 |
+
|
| 135 |
+
Every authenticated request requires one of these headers (both are equivalent):
|
| 136 |
+
|
| 137 |
+
```
|
| 138 |
+
X-API-Key: <YOUR_API_KEY>
|
| 139 |
+
Authorization: Bearer <YOUR_API_KEY>
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
`X-API-Key` is preferred for server-to-server calls. `Authorization: Bearer` is useful when integrating with tools that follow the OAuth2 convention.
|
| 143 |
+
|
| 144 |
+
> **Exception:** WebRTC signaling endpoints use `?token=<YOUR_API_KEY>` as a query parameter because browsers cannot set custom headers in WebRTC negotiation requests.
|
| 145 |
+
|
| 146 |
+
### Embedding Models
|
| 147 |
+
|
| 148 |
+
CreativAI supports two embedding models. Choose when creating a collection β you cannot change the model afterwards.
|
| 149 |
+
|
| 150 |
+
| `model` | Supports | Best for |
|
| 151 |
+
|---------|----------|----------|
|
| 152 |
+
| `"video_only"` (default) | Video frames, audio/subtitles | CCTV, dashcam, general video search |
|
| 153 |
+
| `"multimodal"` | Video + images | Multi-modal analysis, YouTube content, mixed media workflows |
|
| 154 |
+
|
| 155 |
+
### Response Envelope
|
| 156 |
+
|
| 157 |
+
Every response (success or error) uses the same JSON envelope:
|
| 158 |
+
|
| 159 |
+
```json
|
| 160 |
+
{
|
| 161 |
+
"success": true,
|
| 162 |
+
"data": { "..." },
|
| 163 |
+
"error": null
|
| 164 |
+
}
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
On error:
|
| 168 |
+
|
| 169 |
+
```json
|
| 170 |
+
{
|
| 171 |
+
"success": false,
|
| 172 |
+
"data": null,
|
| 173 |
+
"error": {
|
| 174 |
+
"code": "INSUFFICIENT_CREDITS",
|
| 175 |
+
"message": "Not enough credits to complete this indexing job",
|
| 176 |
+
"details": { "required": 120, "available": 45 },
|
| 177 |
+
"timestamp": "2026-05-26T10:00:00Z"
|
| 178 |
+
}
|
| 179 |
+
}
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
Always check `success` first. If `false`, inspect `error.code` β see [errors.md](guides/errors.md) for the full code list and retry guidance.
|
| 183 |
+
|
| 184 |
+
### API Versioning
|
| 185 |
+
|
| 186 |
+
| Version | Status | Use when |
|
| 187 |
+
|---------|--------|----------|
|
| 188 |
+
| `/api/v2/` | Current stable | All features |
|
| 189 |
+
|
| 190 |
+
If legacy `/api/v3/` aliases exist in older clients, migrate to `/api/v2/`.
|
| 191 |
+
|
| 192 |
+
### Async Operations
|
| 193 |
+
|
| 194 |
+
Long-running jobs (indexing, knowledge extraction, plate creation, S3 transfers) return `202 Accepted` immediately with a `job_id`. Poll the status endpoint until you see a terminal state.
|
| 195 |
+
|
| 196 |
+
| State | Meaning |
|
| 197 |
+
|-------|---------|
|
| 198 |
+
| `initiated` | Job queued, not yet started |
|
| 199 |
+
| `processing` | Actively running |
|
| 200 |
+
| `completed` | Success β results available |
|
| 201 |
+
| `failed` | Permanent failure β check `error` field |
|
| 202 |
+
| `partial` | Some items succeeded, some failed |
|
| 203 |
+
|
| 204 |
+
```
|
| 205 |
+
POST /api/v2/indexing/chunk-based β 202 { "indexing_id": "idx_xxx" }
|
| 206 |
+
GET /api/v2/indexing/chunk-based/{id}/status β { "status": "processing" | "completed" | "failed" }
|
| 207 |
+
```
|
| 208 |
+
|
| 209 |
+
**Recommended polling interval:** 5 s initially, back off to 30 s for long jobs. See [async-jobs.md](guides/async-jobs.md) for a full polling helper.
|
| 210 |
+
|
| 211 |
+
---
|
| 212 |
+
|
| 213 |
+
## Repository Structure
|
| 214 |
+
|
| 215 |
+
```
|
| 216 |
+
creativai-api-reference/
|
| 217 |
+
βββ README.md β you are here
|
| 218 |
+
βββ guides/ β one guide per feature area
|
| 219 |
+
βββ reference/endpoint-registry.md β full endpoint catalog
|
| 220 |
+
βββ examples/
|
| 221 |
+
βββ curl/ β runnable shell scripts
|
| 222 |
+
βββ python/ β Python client + workflows
|
| 223 |
+
```
|
| 224 |
+
|
| 225 |
+
---
|
| 226 |
+
|
| 227 |
+
## Guides
|
| 228 |
+
|
| 229 |
+
Each guide covers one feature area in depth with request/response examples, field tables, and real-world context.
|
| 230 |
+
|
| 231 |
+
### Core Workflow
|
| 232 |
+
|
| 233 |
+
| Guide | What it covers | Real-world example |
|
| 234 |
+
|-------|----------------|--------------------|
|
| 235 |
+
| [getting-started.md](guides/getting-started.md) | End-to-end first integration: upload β index β search β extract | Upload 10 dashcam videos, index them, find every moment a pedestrian is visible |
|
| 236 |
+
| [authentication.md](guides/authentication.md) | API key location, auth headers, key rotation, roles (admin / read_write / read_only), security best practices | Separate keys for dev, CI, and prod; revoke a compromised key immediately |
|
| 237 |
+
| [async-jobs.md](guides/async-jobs.md) | Polling pattern for 202 jobs, status lifecycle, exponential backoff | Wait for an indexing job to complete before triggering a search |
|
| 238 |
+
| [errors.md](guides/errors.md) | Error codes, HTTP status meanings, retryable vs non-retryable, backoff formula | Handle `INSUFFICIENT_CREDITS` gracefully; retry `503` with jitter |
|
| 239 |
+
| [integration-guidelines.md](guides/integration-guidelines.md) | Production best practices: versioning, idempotency, rate limits, logging, data governance | Build a robust CI pipeline that indexes nightly footage uploads reliably |
|
| 240 |
+
|
| 241 |
+
### Collections & Media
|
| 242 |
+
|
| 243 |
+
| Guide | What it covers | Real-world example |
|
| 244 |
+
|-------|----------------|--------------------|
|
| 245 |
+
| [upload-integrations.md](guides/upload-integrations.md) | Import media from Google Drive, Dropbox, and Hugging Face without local download; OAuth setup, list endpoints, transfer endpoints, per-file results | User selects 20 videos from their Google Drive; backend transfers them directly into the collection without the browser ever touching the file bytes |
|
| 246 |
+
| [collections.md](guides/collections.md) | Create collections (video-only or multi-modal models), presigned S3 upload URL for direct upload, multipart upload for large files, transfer from existing S3 buckets | Ingest 500 GB of archival broadcast footage from an S3 bucket in a single transfer job |
|
| 247 |
+
| [indexing-and-search.md](guides/indexing-and-search.md) | Start indexing jobs, poll status, estimate credit cost, semantic/visual/audio search, pagination, image-query search | "Find all moments a red Ferrari is visible" β visual search using an uploaded reference image |
|
| 248 |
+
|
| 249 |
+
### Analysis & Extraction
|
| 250 |
+
|
| 251 |
+
| Guide | What it covers | Real-world example |
|
| 252 |
+
|-------|----------------|--------------------|
|
| 253 |
+
| [data-plates.md](guides/data-plates.md) | Create plates from search results or full collections, manage segments, filter by extracted column values, split work across annotators with sub-plates (`segment_wise` / `filter` / `column_wise`), export to CSV | Create a plate of all "near-miss" incidents from warehouse footage; apply filter `"Is PPE worn?": "No"` to isolate violations; auto-distribute the 800 matches across 4 annotators |
|
| 254 |
+
| [knowledge-extraction.md](guides/knowledge-extraction.md) | Add AI extraction columns (questions answered per-segment), multi-question batch jobs, reference images, chat with plate data, auto-generated charts | Ask "Is the worker wearing a hard hat?" across 2,000 segments; export a compliance report; chat: "Which camera angle has the highest violation rate?" |
|
| 255 |
+
| [agentic-chat.md](guides/agentic-chat.md) | SSE streaming AI agent, multi-step search planning, execution plan events, interrupts (search feedback, YouTube candidates), stop/resume, reconnect after disconnect | "Summarise all camera angles that show a vehicle entering between 2 AM and 4 AM and compare to last week" β agent searches, synthesises, and cites clips |
|
| 256 |
+
|
| 257 |
+
### Live & Online Video
|
| 258 |
+
|
| 259 |
+
| Guide | What it covers | Real-world example |
|
| 260 |
+
|-------|----------------|--------------------|
|
| 261 |
+
| [live-stream-guide.md](guides/live-stream-guide.md) | Connect RTSP/RTMP/SRT/HLS/WebRTC/YouTube streams, start analysis sessions, add questions, poll segment results, manage MediaMTX | Point an IP camera at a factory conveyor belt; extract "defect visible?" every 30 seconds in real time |
|
| 262 |
+
| [online-and-youtube-search.md](guides/online-and-youtube-search.md) | Server-side online search (no extension), browser-extension YouTube Search v2 (refine β submit β curate β index) | Find the 20 most relevant YouTube tutorials on "robotic arm calibration" and index them into a training knowledge base |
|
| 263 |
+
|
| 264 |
+
### Teams & Access
|
| 265 |
+
|
| 266 |
+
| Guide | What it covers | Real-world example |
|
| 267 |
+
|-------|----------------|--------------------|
|
| 268 |
+
| [organizations-and-projects.md](guides/organizations-and-projects.md) | Create orgs and projects to organise collections, multi-tenant isolation | Agency with multiple clients: each client is a project; each campaign is a collection |
|
| 269 |
+
| [sharing-and-rbac.md](guides/sharing-and-rbac.md) | Invite team members, assign roles (admin / read_write / read_only), restrict per-plate access, manage groups, FCM push notifications | Invite 5 annotators with `read_write` access restricted to their assigned sub-plate; invite a client with `read_only` access to the final plate |
|
| 270 |
+
| [tasks.md](guides/tasks.md) | Create and assign annotation/verification tasks, track progress, activity log, auto-distribute a plate across a team | Admin creates a verification task for 2,000 near-miss segments; `auto-distribute` splits the work equally across 4 annotators who update progress daily |
|
| 271 |
+
|
| 272 |
+
### Billing & Account
|
| 273 |
+
|
| 274 |
+
| Guide | What it covers | Real-world example |
|
| 275 |
+
|-------|----------------|--------------------|
|
| 276 |
+
| [users-billing-subscriptions.md](guides/users-billing-subscriptions.md) | Check credit balance, view transactions, upgrade/cancel subscriptions, download invoices, manage API keys programmatically | Check remaining credits before triggering a large indexing batch; export a monthly invoice PDF for finance |
|
| 277 |
+
|
| 278 |
+
---
|
| 279 |
+
|
| 280 |
+
## Running the Examples
|
| 281 |
+
|
| 282 |
+
```bash
|
| 283 |
+
# Set environment variables once
|
| 284 |
+
export CREATIVAI_BASE_URL="https://creativai-apis.com"
|
| 285 |
+
export CREATIVAI_API_KEY="<YOUR_API_KEY>"
|
| 286 |
+
export COLLECTION_ID="your-collection-id"
|
| 287 |
+
|
| 288 |
+
# Run any cURL script
|
| 289 |
+
bash examples/curl/01_collections.sh
|
| 290 |
+
bash examples/curl/02_indexing_and_search.sh
|
| 291 |
+
bash examples/curl/04_agentic_chat_sse.sh
|
| 292 |
+
```
|
| 293 |
+
|
| 294 |
+
```bash
|
| 295 |
+
# Python end-to-end workflows
|
| 296 |
+
pip install -r examples/python/requirements.txt
|
| 297 |
+
python examples/python/workflows.py
|
| 298 |
+
```
|
| 299 |
+
|
| 300 |
+
---
|
| 301 |
+
|
| 302 |
+
## Security Notes
|
| 303 |
+
|
| 304 |
+
- **Never embed API keys** in frontend JavaScript, mobile app bundles, or public repositories β they would be visible to anyone who inspects the source
|
| 305 |
+
- **Use environment variables** for local development (`.env` files that are `.gitignore`d)
|
| 306 |
+
- **Use a secrets manager** in production: AWS Secrets Manager, GCP Secret Manager, HashiCorp Vault, or equivalent
|
| 307 |
+
- **One key per environment** β separate keys for dev, staging, and production so a leaked dev key cannot affect production data
|
| 308 |
+
- **Rotate regularly** β revoke and reissue keys on a schedule (e.g. every 90 days) and immediately upon any suspected compromise
|
| 309 |
+
- **All traffic over HTTPS** β the API does not accept plain HTTP; always use `https://creativai-apis.com`
|
| 310 |
+
|
| 311 |
+
---
|
| 312 |
+
|
| 313 |
+
## Notes
|
| 314 |
+
|
| 315 |
+
- This is reference documentation only β no backend implementation code is included.
|
| 316 |
+
- Internal webhook endpoints (`/internal/...`) are listed for architecture context; they are called by infrastructure, not external clients.
|
| 317 |
+
- Endpoint behaviour and credit pricing can evolve β keep this folder in sync with backend releases.
|
| 318 |
+
- The [endpoint-registry.md](reference/endpoint-registry.md) lists the current v2 endpoints for integration.
|