Skip to content

Latest commit

 

History

History
532 lines (415 loc) · 7.71 KB

File metadata and controls

532 lines (415 loc) · 7.71 KB

============================================

MYND Platform - API Reference v0.2

============================================

Base URL

http://localhost:8000/api

Authentication

All API endpoints require authentication via JWT token:

Authorization: Bearer <your-jwt-token>

Voice API

Voice Clones

List all voice clones

GET /voice/clones

Create voice clone

POST /voice/clones
Content-Type: multipart/form-data

{
  "name": "My Voice",
  "description": "My custom voice",
  "language": "en",
  "samples": [File]  // 3-10 seconds of audio
}

Get voice clone

GET /voice/clones/:id

Delete voice clone

DELETE /voice/clones/:id

Text-to-Speech (TTS)

Generate speech

POST /voice/generate
Content-Type: application/json

{
  "text": "Hello, world!",
  "cloneId": "cl_abc123",
  "language": "en",
  "effects": {
    "pitch": 1.0,
    "speed": 1.0,
    "emotion": "neutral"
  },
  "format": "mp3",
  "stream": false
}

Stream TTS (Server-Sent Events)

POST /voice/generate/stream
Content-Type: application/json

{
  "text": "Hello, world!",
  "cloneId": "cl_abc123"
}

Speech-to-Text (STT)

Transcribe audio

POST /voice/transcribe
Content-Type: multipart/form-data

{
  "audio": File,
  "language": "en",
  "timestamps": true
}

Real-time dictation (WebSocket)

WS /voice/dictate/ws

Voice Projects

List projects

GET /voice/projects

Create project

POST /voice/projects
Content-Type: application/json

{
  "name": "My Project",
  "cloneId": "cl_abc123"
}

Export project

POST /voice/projects/:id/export
Content-Type: application/json

{
  "format": "wav"
}

Video API

Video Generation

Generate video from text

POST /video/generate
Content-Type: application/json

{
  "prompt": "A beautiful sunset over the ocean",
  "negativePrompt": "blurry, low quality",
  "model": "ltx-2",
  "aspectRatio": "16:9",
  "duration": 5,
  "fps": 24,
  "motionStrength": 0.7
}

Generate video from image

POST /video/generate/image
Content-Type: multipart/form-data

{
  "image": File,
  "motionPrompt": "Camera pans left slowly",
  "duration": 5
}

Get generation status

GET /video/generations/:id

Cancel generation

POST /video/generations/:id/cancel

Social Media Videos

Generate social media video

POST /video/social
Content-Type: application/json

{
  "template": "tiktok",
  "prompt": "Product showcase",
  "music": "upbeat",
  "captions": true
}

Batch Processing

Create batch job

POST /video/batch
Content-Type: application/json

{
  "name": "Marketing Campaign",
  "prompts": [
    "Scene 1: Product intro",
    "Scene 2: Features demo",
    "Scene 3: Call to action"
  ]
}

Get batch status

GET /video/batch/:id

Docs API

Collections

List collections

GET /docs/collections

Create collection

POST /docs/collections
Content-Type: application/json

{
  "name": "My Documentation",
  "slug": "my-docs",
  "theme": "default",
  "gitRepo": "https://github.com/user/repo"
}

Documents

Ingest document (multi-format)

POST /docs/ingest
Content-Type: multipart/form-data

{
  "collectionId": "col_abc123",
  "file": File,  // PDF, DOCX, XLSX, Image
  "type": "auto"
}

Create document (markdown)

POST /docs/documents
Content-Type: application/json

{
  "collectionId": "col_abc123",
  "title": "Getting Started",
  "slug": "getting-started",
  "content": "# Getting Started\n\nWelcome to MYND!"
}

Search

Semantic search

POST /docs/search
Content-Type: application/json

{
  "collectionId": "col_abc123",
  "query": "how to install",
  "limit": 10
}

OpenAPI Generation

Generate from OpenAPI spec

POST /docs/openapi
Content-Type: application/json

{
  "collectionId": "col_abc123",
  "specUrl": "https://api.example.com/openapi.json"
}

Build & Deploy

Build static site

POST /docs/collections/:id/build

Get build status

GET /docs/collections/:id/build/status

Deploy API

Projects

List projects

GET /deploy/projects

Create project

POST /deploy/projects
Content-Type: application/json

{
  "name": "My App",
  "framework": "sveltekit"
}

GitHub Deployment

Connect GitHub repo

POST /deploy/projects/:id/github
Content-Type: application/json

{
  "repo": "user/repo",
  "branch": "main",
  "autoDeploy": true
}

Trigger deployment

POST /deploy/projects/:id/deploy
Content-Type: application/json

{
  "branch": "main"
}

Preview Environments

Create pgrok preview

POST /deploy/preview
Content-Type: application/json

{
  "deploymentId": "dep_abc123",
  "port": 3000
}

Stop preview

POST /deploy/preview/:id/stop

File Upload CDN

Get upload URL

POST /deploy/upload/url
Content-Type: application/json

{
  "fileName": "image.png",
  "fileType": "image/png",
  "fileSize": 1024000
}

Complete upload

POST /deploy/upload/complete/:fileId

Environment Variables

List variables

GET /deploy/projects/:id/env

Set variable

POST /deploy/projects/:id/env
Content-Type: application/json

{
  "key": "DATABASE_URL",
  "value": "postgresql://...",
  "isSecret": true
}

Domains

Add custom domain

POST /deploy/projects/:id/domains
Content-Type: application/json

{
  "domain": "app.example.com"
}

Verify domain

POST /deploy/projects/:id/domains/:domain/verify

Logs & Metrics

Get build logs

GET /deploy/deployments/:id/logs

Get deployment metrics

GET /deploy/deployments/:id/metrics

Real-time build updates (WebSocket)

WS /deploy/ws/:deploymentId

WebSocket Events

All WebSocket endpoints send JSON messages:

Voice Dictation

{
  "type": "transcript",
  "text": "Hello world",
  "isFinal": true,
  "confidence": 0.95
}

Deployment Updates

{
  "deployment": {
    "id": "dep_abc123",
    "status": "building"
  },
  "logs": [
    { "message": "Installing dependencies...", "level": "info" }
  ]
}

Error Responses

All errors follow this format:

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request parameters",
    "details": {
      "field": "prompt",
      "reason": "Required"
    }
  }
}

Common Error Codes

Code Description
VALIDATION_ERROR Request validation failed
UNAUTHORIZED Missing or invalid authentication
FORBIDDEN Insufficient permissions
NOT_FOUND Resource not found
RATE_LIMITED API rate limit exceeded
INTERNAL_ERROR Server error

Rate Limits

Tier Requests/minute
Free 60
Pro 1000
Enterprise Unlimited

SDK Usage

TypeScript SDK

import { VoiceClient, VideoClient, DocsClient, DeployClient } from '@mynd/sdk';

// Voice
const voice = new VoiceClient('http://localhost:8000/api/voice', 'api-key');
const audio = await voice.generateTTS('Hello world', 'clone-id');

// Video
const video = new VideoClient('http://localhost:8000/api/video', 'api-key');
const generation = await video.generateFromText('A beautiful sunset');

// Docs
const docs = new DocsClient('http://localhost:8000/api/docs', 'api-key');
const results = await docs.search('how to install');

// Deploy
const deploy = new DeployClient('http://localhost:8000/api/deploy', 'api-key');
const deployment = await deploy.deployFromGitHub('project-id');