# WaveGen — Full Developer & AI Agent Reference > Base URL: https://wavegen.ai > Remote MCP Endpoint: https://wavegen.ai/mcp (Stateless Streamable HTTP, MCP-Protocol-Version: 2025-03-26) > OpenAPI 3.1.0 Spec (Public): https://wavegen.ai/api/v1/openapi.json > Docs: https://wavegen.ai/docs | https://wavegen.ai/docs/mcp | https://wavegen.ai/docs/api | https://wavegen.ai/integrations/mcp ## 1. Authentication, Scopes, Limits & Plan Gate - **OAuth 2.1 + PKCE (`S256`) + Dynamic Client Registration:** - Protected Resource Metadata (RFC 9728): `GET https://wavegen.ai/.well-known/oauth-protected-resource` - Authorization Server Metadata (RFC 8414): `GET https://wavegen.ai/.well-known/oauth-authorization-server` - Dynamic Client Registration: `POST https://wavegen.ai/oauth/register` (`token_endpoint_auth_method: "none"`) - Authorize: `GET https://wavegen.ai/oauth/authorize` (redirects to `https://app.wavegen.ai/oauth/authorize`) - Token: `POST https://wavegen.ai/oauth/token` (`grant_type`: `authorization_code` or `refresh_token`) - Token prefixes & TTLs: access tokens `wgoa_...` (1 hour), refresh tokens `wgor_...` (30 days) - **Workspace API Keys:** - Created at `https://app.wavegen.ai/workspace` with prefix `wg_live_...` - Pass as `Authorization: Bearer wg_live_...` - Keys created in workspace settings currently include all 6 default scopes. - **Scopes (`DEFAULT_API_SCOPES`):** - `brand_kits:read`, `brand_kits:write`, `connections:read`, `generations:write`, `posts:read`, `posts:write` - **Rate Limits & Body Size:** - Authenticated: 300 requests / 15 min per workspace (`RateLimit-*` headers; plain-text HTTP 429 when exceeded). - Pre-auth IP limits: 10,000 requests / 15 min on `/mcp`, 1,500 requests / 15 min on `/api/v1/*`. - Max JSON request body: 10 MB (supports up to 5 MB decoded base64 images). - **Plan Gate:** - Creating API keys, approving OAuth consent, calling `/api/v1/*`, and invoking MCP `tools/call` require a paid WaveGen plan. - Public discovery (`GET /api/v1/openapi.json` and `/.well-known/oauth-*`) is unauthenticated. - On `paid_plan_required`: REST returns HTTP 403 with `upgradeUrl: "https://app.wavegen.ai/upgrade"`; MCP `tools/call` returns `isError: true` with `code: "paid_plan_required"` and `pricingUrl: "https://wavegen.ai/pricing"`. --- ## 2. Remote MCP Server (`POST https://wavegen.ai/mcp`) ### JSON-RPC 2.0 Envelope ```json // Request { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "list_brand_kits", "arguments": {} } } ``` Supported methods: `initialize`, `ping`, `notifications/*` (HTTP 202), `tools/list`, `tools/call`. ### Required Agent Workflow Rules 1. Always call `list_brand_kits` before `generate_posts`. If 0 Brand Kits exist, ask the user whether to create one from their website URL via `create_brand_kit` before generating. 2. `generate_posts` returns `status: "processing"` and a `generationId`. Poll `get_generation` every ~10 seconds until `status` is `"ready"` (terminal states: `"ready" | "partial" | "failed" | "empty"`). 3. `get_generation` (when ready) and `get_post` return visual carousel strip preview images plus clickable `editorUrl` links (`https://app.wavegen.ai/created?viewPost=`). Always share the `editorUrl` with the user. 4. Always confirm target social account name(s) (`profileName`) and publish time with the user before calling `schedule_post`. ### All 13 MCP Tools 1. **`list_brand_kits`** (`brand_kits:read`, `readOnlyHint: true`, `idempotentHint: true`) - Args: `{}` - Returns: `{ brandKits: [{ id, name, brandName?, website?, tagline?, hasLogo, colors: { primaryColor?, secondaryColor?, tertiaryColor? }, fonts: { primaryFont?, secondaryFont?, bodyFont? }, brandVoiceTone?, brandAssets: [{ id, type, description?, tags? }] }] }` 2. **`create_brand_kit`** (`brand_kits:write`, `openWorldHint: true`) - Args: `{ url?: string (http/https), name?: string (1-100), brandName?, tagline?, website?, primaryColor?, secondaryColor?, tertiaryColor?, primaryFont?, secondaryFont?, bodyFont?, brandVoiceTone?: "formal"|"casual"|"friendly"|"professional", brandVoiceInstructions?, styleInstructions?, primarySocial?: { platform: "linkedin"|"instagram"|"twitter"|"youtube"|"tiktok", handle } }` (requires `url` or `name`). - Returns: `{ brandKit }` 3. **`list_connections`** (`connections:read`, `readOnlyHint: true`, `idempotentHint: true`) - Args: `{}` - Returns: `{ connections: [{ id, platform, profileName?, entityType?, status, postingSchedule?: { timezone, slotsCount } }] }` 4. **`generate_posts`** (`generations:write`, `openWorldHint: true`) - Args: `{ sources?: [{ type: "url"|"text", value, label? }] (1-10), url?: string, text?: string (min 100 chars), mode?: "batch"|"synthesis", synthesisPrompt?, brandKitId?, outputOptions?: ("carousel"|"video")[] (default ["carousel"]), maxPostsPerSource?: 1-10, preserveInputTextAsCaption?: boolean, targetLanguage?, contentIntent? }` (requires `sources`, `url`, or `text`). - Returns: `{ generationId, status: "processing", message, posts: [], warnings: [] }` 5. **`get_generation`** (`posts:read`, `readOnlyHint: true`, `idempotentHint: true`) - Args: `{ generationId: string }` (required) - Returns: `{ generationId, status: "processing"|"ready"|"partial"|"failed"|"empty", message?, error?, warnings: string[], posts: [{ id, status, editorUrl, caption, hashtags?, slideCount, brandKitId?, videoEnabled, createdAt, updatedAt }], previewCount }` + rendered preview images in MCP `content[]`. 6. **`list_posts`** (`posts:read`, `readOnlyHint: true`, `idempotentHint: true`) - Args: `{ limit?: 1-50 (default 20), status?: "generating"|"draft"|"scheduled"|"pre-processing"|"publishing"|"published"|"failed"|"mixed" }` - Returns: `{ posts: PublicPostSummaryDto[] }` 7. **`create_post`** (`posts:write`, `openWorldHint: true`, `_meta: { "openai/fileParams": ["files"] }`) - Args (`.strict()`): `{ caption?: string (max 5000), hashtags?: string[] (max 30), firstComment?: string (max 2200), files?: ChatGptFileParam[] (1-10), media?: (ManualImageMedia | ManualVideoMedia)[] (1-10) }` (1-10 items total across `media`/`files`; does not consume a generation credit). - Returns: `{ post }` 8. **`get_post`** (`posts:read`, `readOnlyHint: true`, `idempotentHint: true`) - Args: `{ postId: string (required), includePreviews?: boolean (default true), previewSlides?: integer[] (max 5, 0-based) }` - Returns: `{ post: { ...summary, slides: [{ index, type, dimensions, backgroundColor?, overlays: [{ id, type, text?, position: { x, y }, width?, height?, rotation?, zIndex?, opacity?, style? }] }] }, previewCount }` + preview images. 9. **`update_post`** (`posts:write`, `destructiveHint: true`) - Args (`.strict()`): `{ postId: string (required), caption?, hashtags?, firstComment?, slideEdits?: [{ slideIndex: int, backgroundColor?: hex, backgroundImage?: ImageSource, overlays?: [{ id, text?, image?: ImageSource, position?: { x, y }, width?, height?, rotation?, zIndex?, opacity?, borderRadius?, objectFit?: "fill"|"contain"|"cover", objectPosition?: { x, y }, style?: OverlayStylePatch, delete?: boolean }] }], replaceColors?: [{ from: hex, to: hex }], slideOrder?: int[], includePreviews?: boolean (default true) }` - `ImageSource` discriminated union (`source`): - `{ source: "generate", prompt: string (3-1000), editCurrent?: boolean }` - `{ source: "stock", query: string (1-200) }` - `{ source: "brand_asset", assetId: string }` - `{ source: "url", url: httpsUrl }` - `{ source: "base64", data: string (max 5MB decoded), mimeType?: "image/png"|"image/jpeg"|"image/webp" }` - Returns: `{ post, previewCount }` + preview images. 10. **`animate_post`** (`posts:write`) - Args: `{ postId: string (required), renderVideo?: boolean (default false), forceRegenerate?: boolean (default false), useDefault?: boolean (default false) }` - Returns: animation choreography details and optional `videoUrl` (MP4). 11. **`schedule_post`** (`posts:write`, `openWorldHint: true`) - Args: `{ postId: string (required), connectionIds: string[] (1-20, required), scheduledFor?: ISO-8601 string | Unix epoch ms (omit for next recommended slot), timezone?: IANA string }` - Returns: `{ postId, status: "scheduled", scheduledFor: number (epoch ms), scheduledForIso: string, isReschedule: boolean, accounts: [{ connectionId, platform, profileName? }], editorUrl }` 12. **`cancel_schedule`** (`posts:write`) - Args: `{ postId: string (required), connectionId?: string (omit to unschedule all accounts) }` - Returns: `{ postId, status: "canceled", connectionId: string | "all", editorUrl }` 13. **`get_analytics`** (`posts:read`, `readOnlyHint: true`, `idempotentHint: true`) - Args: `{ days?: 1-90 (default 30), from?: ISO-8601 | epoch ms, to?: ISO-8601 | epoch ms, connectionIds?: string[], sort?: "engagements"|"visibility"|"engagementRate" (default "engagements"), postOffset?: int >= 0 (default 0) }` - Returns: `{ analytics }` --- ## 3. Public REST API v1 (`https://wavegen.ai/api/v1/*`) - `GET /api/v1/openapi.json` — Public OpenAPI 3.1.0 specification (unauthenticated). - `GET /api/v1/brand-kits` (`brand_kits:read`) — List workspace Brand Kits (`{ brandKits }`). - `POST /api/v1/brand-kits` (`brand_kits:write`) — Create Brand Kit (`201 { brandKit }`). - `GET /api/v1/connections` (`connections:read`) — List connected social accounts (`{ connections }`). - `GET /api/v1/analytics` (`posts:read`) — Query params: `days`, `from`, `to`, `connectionIds` (comma-separated), `sort`, `postOffset` (`{ analytics }`). - `POST /api/v1/generations` (`generations:write`) — Start generation (`201 { generationId, status: "processing", message, posts: [], warnings: [] }`). - `GET /api/v1/generations/{generationId}` (`posts:read`) — Poll generation (`{ generationId, status, warnings, posts }`). - `GET /api/v1/posts` (`posts:read`) — Query params: `limit` (1-50), `status` (`{ posts }`). - `POST /api/v1/posts` (`posts:write`) — Manually create draft post (`201 { post }`). - `GET /api/v1/posts/{postId}` (`posts:read`) — Query params: `includePreviews`, `previewSlides` (comma-separated 0-based indices) (`{ post }`). - `PATCH /api/v1/posts/{postId}` (`posts:write`) — Atomically patch post (`{ post }`). - `POST /api/v1/posts/{postId}/animate` (`posts:write`) — Animate carousel / render MP4. - `POST /api/v1/posts/{postId}/schedule` (`posts:write`) — Schedule post (`{ postId, status: "scheduled", scheduledFor, scheduledForIso, isReschedule, accounts, editorUrl }`). - `POST /api/v1/posts/{postId}/cancel-schedule` (`posts:write`) — Cancel schedule (`{ postId, status: "canceled", connectionId, editorUrl }`).