{"openapi":"3.1.0","info":{"title":"NextBlog API","version":"0.1.0","summary":"Full REST API for projects, posts, generation, integrations, billing and analytics.","license":{"name":"Proprietary","url":"https://nextblog.ai/terms"},"description":"Every dashboard action is available here and through the MCP server at `/api/mcp`; both call the same services.\n\n**Authentication.** `Authorization: Bearer <account API key, project API key or OAuth access token>`.\nAn account API key (`nb_u_…`) acts on every project the user owns and may be read-only. A legacy project API key (`nb_…`) can read and write only its own project and cannot create/delete projects or rotate keys (`ACCOUNT_SCOPE_REQUIRED`). OAuth has full account scope and is the only way to manage keys.\n\n**Errors.** Every failure is `{ error: { code, message, details? } }`.\n\n**Rate limits.** 120 requests/minute and 1000/hour per token. Generation is 10/hour and Stripe-session creation 20/hour per token; a 429 carries `Retry-After` and `X-RateLimit-*`.\n\n**Retries.** Mutations accept `Idempotency-Key`; repeating it within 24 hours replays the first response (`X-Idempotent-Replay: true`).\n\n**Pagination.** `limit` (default 50, max 100) and `offset`; list responses include `total`."},"servers":[{"url":"https://nextblog.ai/api/v1","description":"Production"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Account","description":"Who the caller is, their plan, credits and projects."},{"name":"Analytics","description":"Dashboard analytics for 7/30/90 days."},{"name":"Billing","description":"Plan and credit status; Stripe Checkout/Customer Portal session links (never charges)."},{"name":"Projects","description":"Project settings, API keys, descriptions and backlinks."},{"name":"Posts","description":"Posts, approval and CMS fan-out."},{"name":"Generation","description":"Queued AI post and YouTube video generation."},{"name":"Integrations","description":"CMS credentials and connection tests; secrets are write-only."},{"name":"Connections","description":"YouTube and Shopify OAuth connections."},{"name":"Search Console","description":"Google Search Console status, properties and tests."},{"name":"Voices","description":"ElevenLabs and xAI voice catalogs."},{"name":"Discovery","description":"Machine-readable API description."}],"paths":{"/me":{"get":{"operationId":"getMe","summary":"Account, plan, credits and accessible projects","tags":["Account"],"responses":{"200":{"description":"Account snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountSnapshot","description":"Account snapshot"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Same snapshot as the MCP `whoami` tool. An account API key sees every project; a legacy project API key sees only its own."}},"/keys":{"get":{"operationId":"listApiKeys","summary":"List account API keys","tags":["Account"],"responses":{"200":{"description":"Live account API keys, newest first","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}},"required":["keys"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Metadata only; the secret is shown once at creation and can never be read again.\n\nRequires a credential that is not bound to a single project: an account API key or OAuth. A legacy project API key gets 403 ACCOUNT_SCOPE_REQUIRED."},"post":{"operationId":"createApiKey","summary":"Create an account API key","tags":["Account"],"responses":{"201":{"description":"Created key plus its one-time secret","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"$ref":"#/components/schemas/ApiKey"},"secret":{"type":"string","description":"The `nb_u_…` secret. Shown once and never again."}},"required":["key","secret"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Returns the secret exactly once, in this response. OAuth or a dashboard session only: an API key gets 403 OAUTH_REQUIRED. Max 10 active keys (403 KEY_LIMIT_REACHED); a duplicate live name is 409 CONFLICT.\n\nRequires a credential that is not bound to a single project: an account API key or OAuth. A legacy project API key gets 403 ACCOUNT_SCOPE_REQUIRED.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60,"description":"Display name for the key (1–60 characters)"},"readOnly":{"description":"When true the key may read but never mutate anything","type":"boolean"}},"required":["name"],"additionalProperties":false}}}}}},"/keys/{keyId}":{"delete":{"operationId":"revokeApiKey","summary":"Revoke an account API key","tags":["Account"],"responses":{"204":{"description":"Key revoked"},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Revocation is immediate: the key's next request fails 401 INVALID_API_KEY. Unknown, already-revoked and other users' ids all answer 404 NOT_FOUND. OAuth or a dashboard session only.\n\nRequires a credential that is not bound to a single project: an account API key or OAuth. A legacy project API key gets 403 ACCOUNT_SCOPE_REQUIRED.","parameters":[{"name":"keyId","in":"path","required":true,"description":"Account API key id (uuid)","schema":{"type":"string","format":"uuid"}}]}},"/analytics":{"get":{"operationId":"getAnalytics","summary":"Dashboard analytics for 7, 30 or 90 days","tags":["Analytics"],"responses":{"200":{"description":"Analytics report","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Analytics"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Totals, zero-filled daily timeline, per-project stats and top/recent posts. An API key only sees its own project.","parameters":[{"name":"days","in":"query","required":false,"description":"Reporting window in days: 7, 30, 90 (default 30)","schema":{"default":30,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}}]}},"/billing/status":{"get":{"operationId":"getBillingStatus","summary":"Plan, credits, limits and renewal state","tags":["Billing"],"responses":{"200":{"description":"Billing status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingStatus"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}}}},"/billing/checkout":{"post":{"operationId":"createCheckoutLink","summary":"Create a Stripe Checkout URL (never charges)","tags":["Billing"],"responses":{"200":{"description":"Stripe Checkout URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingLink","description":"`{ url }`"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Returns `{ url }`; open it in a browser to upgrade. Rate limited to 20/hour per token.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"planId":{"description":"Plan to buy: starter, growth or pro","default":"","type":"string"},"billedYearly":{"description":"true bills yearly (annual price), false/omitted bills monthly","type":"boolean"},"referralCode":{"description":"Referral code to attach to the subscription metadata","anyOf":[{"type":"string","maxLength":256},{"type":"null"}]},"isSignUpOffer":{"description":"Apply the legacy sign-up coupon","type":"boolean"},"offer":{"description":"Offer code, e.g. winback30 with its token","anyOf":[{"type":"string","maxLength":64},{"type":"null"}]},"token":{"description":"Offer token that must match the one stored for the account","anyOf":[{"type":"string","maxLength":512},{"type":"null"}]}}}}}}}},"/billing/portal":{"post":{"operationId":"createBillingPortalLink","summary":"Create a Stripe Customer Portal URL (never charges)","tags":["Billing"],"responses":{"200":{"description":"Stripe Customer Portal URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingLink","description":"`{ url }`"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}}}},"/voices":{"get":{"operationId":"listVoices","summary":"List ElevenLabs and xAI voices","tags":["Voices"],"responses":{"200":{"description":"Voice catalog","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceCatalog"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"provider","in":"query","required":false,"description":"Voice provider: all, elevenlabs or xai","schema":{"default":"all","type":"string","enum":["all","elevenlabs","xai"]}}]}},"/projects":{"get":{"operationId":"listProjects","summary":"List accessible projects","tags":["Projects"],"responses":{"200":{"description":"Projects with post counts","content":{"application/json":{"schema":{"type":"object","properties":{"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project"}}},"required":["projects"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"limit","in":"query","description":"Page size (1–100, default 50)","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","description":"Rows to skip","schema":{"type":"integer","minimum":0,"default":0}}]},"post":{"operationId":"createProject","summary":"Create a project","tags":["Projects"],"responses":{"201":{"description":"Created project","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}},"required":["project"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Account scope only: an account API key or OAuth. Plan limits apply (`UPGRADE_REQUIRED`). `extract: true` prefills name/description from `url` using the shared 5/day quota.\n\nRequires a credential that is not bound to a single project: an account API key or OAuth. A legacy project API key gets 403 ACCOUNT_SCOPE_REQUIRED.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"url":{"type":"string","maxLength":2048},"description":{"type":"string","maxLength":50000},"extract":{"type":"boolean"}}}}}}}},"/projects/{projectId}":{"get":{"operationId":"getProject","summary":"Get one project","tags":["Projects"],"responses":{"200":{"description":"Project settings (secrets redacted)","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}},"required":["project"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}}]},"patch":{"operationId":"updateProject","summary":"Update project settings","tags":["Projects"],"responses":{"200":{"description":"Updated project","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}},"required":["project"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Every editable field is optional; unknown keys are ignored. Credentials are write-only.","parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"url":{"type":"string","maxLength":2048},"description":{"type":"string","maxLength":50000},"auto_generate":{"type":"boolean"},"auto_publish":{"type":"boolean"},"wordpress_enabled":{"type":"boolean"},"wordpress_url":{"type":"string","maxLength":2048},"wordpress_username":{"type":"string","maxLength":512},"wordpress_password":{"type":"string","maxLength":2048},"notion_enabled":{"type":"boolean"},"notion_token":{"type":"string","maxLength":2048},"notion_database_id":{"type":"string","maxLength":512},"ghost_enabled":{"type":"boolean"},"ghost_url":{"type":"string","maxLength":2048},"ghost_admin_api_key":{"type":"string","maxLength":2048},"shopify_enabled":{"type":"boolean"},"shopify_shop":{"type":"string","maxLength":512},"shopify_shop_url":{"type":"string","maxLength":2048},"shopify_client_id":{"type":"string","maxLength":512},"shopify_client_secret":{"type":"string","maxLength":2048},"shopify_blog_id":{"type":"string","maxLength":512},"shopify_legacy_enabled":{"type":"boolean"},"shopify_legacy_shop_url":{"type":"string","maxLength":2048},"shopify_legacy_client_id":{"type":"string","maxLength":512},"shopify_legacy_client_secret":{"type":"string","maxLength":2048},"shopify_legacy_blog_id":{"type":"string","maxLength":512},"webflow_enabled":{"type":"boolean"},"webflow_api_token":{"type":"string","maxLength":2048},"webflow_collection_id":{"type":"string","maxLength":512},"wix_enabled":{"type":"boolean"},"wix_api_key":{"type":"string","maxLength":2048},"wix_site_id":{"type":"string","maxLength":512},"wix_member_id":{"type":"string","maxLength":512},"framer_enabled":{"type":"boolean"},"framer_api_token":{"type":"string","maxLength":2048},"framer_collection_id":{"type":"string","maxLength":512},"devto_enabled":{"type":"boolean"},"devto_api_key":{"type":"string","maxLength":2048},"hashnode_enabled":{"type":"boolean"},"hashnode_api_key":{"type":"string","maxLength":2048},"hashnode_publication_id":{"type":"string","maxLength":512},"blogger_enabled":{"type":"boolean"},"blogger_blog_id":{"type":"string","maxLength":512},"webhook_url":{"type":"string","maxLength":2048},"generation_schedule":{"anyOf":[{"type":"null"},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":0,"maximum":9007199254740991}}]},"blog_base_url":{"type":"string","maxLength":2048},"target_language":{"type":"string","maxLength":128},"article_length":{"type":"string"},"subdomain_enabled":{"type":"boolean"},"subdomain":{"type":"string","maxLength":63},"internal_linking":{"type":"boolean"},"backlink_network_enabled":{"type":"boolean"},"gsc_enabled":{"type":"boolean"},"gsc_site_url":{"type":"string","maxLength":2048},"video_generation_enabled":{"type":"boolean"},"video_auto_every_n":{"anyOf":[{"type":"null"},{"type":"string","const":""},{"type":"integer","minimum":1,"maximum":4}]},"youtube_connection_id":{"type":"string","maxLength":128},"youtube_privacy_status":{"type":"string"},"elevenlabs_voice_id":{"type":"string","maxLength":128},"xai_voice_id":{"type":"string","maxLength":128}}}}}}},"delete":{"operationId":"deleteProject","summary":"Delete a project and all of its posts","tags":["Projects"],"responses":{"200":{"description":"Deletion result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteResult"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}}],"description":"Requires a credential that is not bound to a single project: an account API key or OAuth. A legacy project API key gets 403 ACCOUNT_SCOPE_REQUIRED."}},"/projects/{projectId}/api-key":{"post":{"operationId":"rotateApiKey","summary":"Rotate the project API key","tags":["Projects"],"responses":{"200":{"description":"New key (shown once)","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"},"apiKey":{"type":"string","description":"New key (shown once)"}},"required":["project","apiKey"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Returns the new key exactly once; the old key stops working immediately. Account scope only.\n\nRequires a credential that is not bound to a single project: an account API key or OAuth. A legacy project API key gets 403 ACCOUNT_SCOPE_REQUIRED.","parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}}]}},"/projects/{projectId}/generate-description":{"post":{"operationId":"generateProjectDescription","summary":"Generate a project description from its website","tags":["Projects"],"responses":{"200":{"description":"Generated description","content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":"string"}},"required":["description"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Shared 5-per-UTC-day extraction quota; 429 RATE_LIMITED when exhausted. Does not save the result.","parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}}]}},"/projects/{projectId}/backlinks":{"get":{"operationId":"getProjectBacklinks","summary":"Backlink Network stats","tags":["Projects"],"responses":{"200":{"description":"Given/received counts","content":{"application/json":{"schema":{"type":"object","properties":{"given":{"type":"integer"},"received":{"type":"integer"}},"required":["given","received"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}}]}},"/projects/{projectId}/generation-runs":{"get":{"operationId":"listGenerationRuns","summary":"Recent generation runs","tags":["Generation"],"responses":{"200":{"description":"Generation runs","content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"$ref":"#/components/schemas/GenerationRun"}}},"required":["runs"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}},{"name":"instanceId","in":"query","description":"Only the run with this workflow instance id","schema":{"type":"string","maxLength":128}}]}},"/projects/{projectId}/generate":{"post":{"operationId":"generatePost","summary":"Queue one AI post generation","tags":["Generation"],"responses":{"200":{"description":"Generation queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationResult"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Spends credits. Returns `{ instanceId, status }`; poll `/generation-runs`. Rate limited to 10/hour per token.","parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}}]}},"/projects/{projectId}/posts":{"get":{"operationId":"listPosts","summary":"List posts (no markdown)","tags":["Posts"],"responses":{"200":{"description":"Post page","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostList"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}},{"name":"status","in":"query","description":"draft | approved | declined","schema":{"type":"string","enum":["draft","approved","declined"]}},{"name":"published","in":"query","description":"Filter by published state","schema":{"type":"boolean"}},{"name":"limit","in":"query","description":"Page size (1–100, default 50)","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","description":"Rows to skip","schema":{"type":"integer","minimum":0,"default":0}}]},"post":{"operationId":"createPost","summary":"Create a post","tags":["Posts"],"responses":{"201":{"description":"Created post","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostResponse"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"0 credits. A duplicate slug returns 409 CONFLICT. Honour `Idempotency-Key`.","parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200,"description":"Post title (max 200 characters)"},"markdown":{"type":"string","maxLength":204800,"description":"Post body as markdown (max 200 KB)"},"slug":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"description":{"anyOf":[{"type":"string","maxLength":500,"description":"Description (max 500 characters)"},{"type":"null"}]},"cover_image_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}]},"cover_image_alt":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"status":{"type":"string","enum":["draft","approved","declined"]},"published":{"type":"boolean"}},"required":["title","markdown"]}}}}}},"/projects/{projectId}/posts/{postId}":{"get":{"operationId":"getPost","summary":"Get one post with markdown and integration URLs","tags":["Posts"],"responses":{"200":{"description":"Post detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostResponse"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}},{"name":"postId","in":"path","required":true,"description":"Post id (bigint)","schema":{"type":"integer","minimum":1}}]},"patch":{"operationId":"updatePost","summary":"Update a post","tags":["Posts"],"responses":{"200":{"description":"Updated post","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostResponse"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}},{"name":"postId","in":"path","required":true,"description":"Post id (bigint)","schema":{"type":"integer","minimum":1}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200,"description":"Post title (max 200 characters)"},"markdown":{"type":"string","maxLength":204800,"description":"Post body as markdown (max 200 KB)"},"slug":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"description":{"anyOf":[{"type":"string","maxLength":500,"description":"Description (max 500 characters)"},{"type":"null"}]},"cover_image_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}]},"cover_image_alt":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"status":{"type":"string","enum":["draft","approved","declined"]},"published":{"type":"boolean"}}}}}}},"delete":{"operationId":"deletePost","summary":"Delete a post","tags":["Posts"],"responses":{"200":{"description":"Deletion result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteResult"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}},{"name":"postId","in":"path","required":true,"description":"Post id (bigint)","schema":{"type":"integer","minimum":1}}]}},"/projects/{projectId}/posts/{postId}/approve":{"post":{"operationId":"approvePost","summary":"Approve and publish a post","tags":["Posts"],"responses":{"200":{"description":"Post plus per-provider results","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishResult"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Publishes to every enabled CMS integration and the webhook. Requires a paid plan (403 UPGRADE_REQUIRED). One failing provider never fails the approval.","parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}},{"name":"postId","in":"path","required":true,"description":"Post id (bigint)","schema":{"type":"integer","minimum":1}}]}},"/projects/{projectId}/posts/{postId}/decline":{"post":{"operationId":"declinePost","summary":"Decline a post","tags":["Posts"],"responses":{"200":{"description":"Updated post","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostResponse"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}},{"name":"postId","in":"path","required":true,"description":"Post id (bigint)","schema":{"type":"integer","minimum":1}}]}},"/projects/{projectId}/posts/{postId}/unpublish":{"post":{"operationId":"unpublishPost","summary":"Revert a post to draft and unpublish it from every CMS","tags":["Posts"],"responses":{"200":{"description":"Post plus per-provider results","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishResult"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}},{"name":"postId","in":"path","required":true,"description":"Post id (bigint)","schema":{"type":"integer","minimum":1}}]}},"/projects/{projectId}/posts/{postId}/generate-video":{"post":{"operationId":"generateVideo","summary":"Queue a YouTube video for a post","tags":["Generation"],"responses":{"200":{"description":"Post plus the queued video job","content":{"application/json":{"schema":{"type":"object","properties":{"post":{"$ref":"#/components/schemas/Post"},"videoJob":{"$ref":"#/components/schemas/VideoJob"}},"required":["post","videoJob"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Spends credits; requires an active plan, a YouTube connection and an xAI voice. Rate limited to 10/hour per token.","parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}},{"name":"postId","in":"path","required":true,"description":"Post id (bigint)","schema":{"type":"integer","minimum":1}}]}},"/projects/{projectId}/posts/{postId}/video":{"get":{"operationId":"getVideoStatus","summary":"Latest video job for a post","tags":["Generation"],"responses":{"200":{"description":"Video job or null","content":{"application/json":{"schema":{"type":"object","properties":{"video":{"oneOf":[{"$ref":"#/components/schemas/VideoJob"},{"type":"null"}]}},"required":["video"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}},{"name":"postId","in":"path","required":true,"description":"Post id (bigint)","schema":{"type":"integer","minimum":1}}]}},"/projects/{projectId}/integrations":{"get":{"operationId":"getIntegrations","summary":"Integration settings with secrets redacted","tags":["Integrations"],"responses":{"200":{"description":"Provider map plus publish targets","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationsView"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}}]},"patch":{"operationId":"updateIntegrations","summary":"Update integration settings","tags":["Integrations"],"responses":{"200":{"description":"Updated provider map","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationsView"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Accepts provider-grouped bodies (`{ wordpress: { url, … } }`), flat project columns, or `{ integrations: … }`. Credentials are write-only.","parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Provider-grouped integration settings"}}}}}},"/projects/{projectId}/integrations/{provider}/test":{"post":{"operationId":"testIntegration","summary":"Test a CMS connection","tags":["Integrations"],"responses":{"200":{"description":"Test result","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string"},"success":{"type":"boolean"},"message":{"type":"string"}},"required":["provider","success","message"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}},{"name":"provider","in":"path","required":true,"description":"Integration provider: wordpress, notion, ghost, shopify, shopify_legacy, webflow, wix, framer, devto, hashnode, blogger","schema":{"type":"string","enum":["wordpress","notion","ghost","shopify","shopify_legacy","webflow","wix","framer","devto","hashnode","blogger"]}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Optional credential overrides (never echoed back)"}}}}}},"/projects/{projectId}/integrations/{provider}/connect-url":{"get":{"operationId":"getConnectUrl","summary":"Browser URL that starts an OAuth connection flow","tags":["Integrations"],"responses":{"200":{"description":"Connection URL","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string"},"url":{"type":"string","format":"uri"},"requiresBrowser":{"type":"boolean"},"next":{"type":"string"}},"required":["provider","url","requiresBrowser","next"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}},{"name":"provider","in":"path","required":true,"description":"OAuth provider: shopify, youtube, google, blogger, gsc","schema":{"type":"string","enum":["shopify","youtube","google","blogger","gsc"]}},{"name":"returnTo","in":"query","description":"In-app path to open after the flow (must start with /)","schema":{"type":"string","maxLength":512}}]}},"/projects/{projectId}/gsc/test":{"post":{"operationId":"testGsc","summary":"Verify a Search Console property","tags":["Integrations"],"responses":{"200":{"description":"Search Console test result","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"projectId","in":"path","required":true,"description":"Project id (bigint)","schema":{"type":"integer","minimum":1}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"siteUrl":{"type":"string","minLength":1,"maxLength":2048,"description":"Search Console property, e.g. https://example.com or sc-domain:example.com"}},"required":["siteUrl"]}}}}}},"/connections/youtube":{"get":{"operationId":"listYoutubeConnections","summary":"List YouTube connections","tags":["Connections"],"responses":{"200":{"description":"YouTube connections","content":{"application/json":{"schema":{"$ref":"#/components/schemas/YoutubeConnections"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}}}},"/connections/shopify":{"get":{"operationId":"listShopifyConnections","summary":"List Shopify connections","tags":["Connections"],"responses":{"200":{"description":"Shopify connections","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShopifyConnections"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}}}},"/connections/youtube/{connectionId}":{"delete":{"operationId":"disconnectYoutube","summary":"Remove a YouTube connection","tags":["Connections"],"responses":{"200":{"description":"Disconnect result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisconnectResult"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"connectionId","in":"path","required":true,"description":"Connection id (uuid)","schema":{"type":"string","format":"uuid"}}]}},"/connections/shopify/{connectionId}":{"delete":{"operationId":"disconnectShopify","summary":"Remove a Shopify connection","tags":["Connections"],"responses":{"200":{"description":"Disconnect result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisconnectResult"}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"connectionId","in":"path","required":true,"description":"Connection id (uuid)","schema":{"type":"string","format":"uuid"}}]}},"/gsc/status":{"get":{"operationId":"getGscStatus","summary":"Search Console connection status","tags":["Search Console"],"responses":{"200":{"description":"Connection status","content":{"application/json":{"schema":{"type":"object","properties":{"connected":{"type":"boolean"},"tokenExpiry":{"type":["string","null"]}},"required":["connected","tokenExpiry"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}}}},"/gsc/sites":{"get":{"operationId":"listGscSites","summary":"Search Console properties","tags":["Search Console"],"responses":{"200":{"description":"Available properties","content":{"application/json":{"schema":{"type":"object","properties":{"sites":{"type":"array","items":{"type":"object","additionalProperties":true}}},"required":["sites"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}}}},"/gsc/disconnect":{"post":{"operationId":"disconnectGsc","summary":"Disconnect Search Console for the account","tags":["Search Console"],"responses":{"200":{"description":"Disconnect result","content":{"application/json":{"schema":{"type":"object","properties":{"disconnected":{"type":"boolean"}},"required":["disconnected"]}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Account scope only: clears Search Console on every project. Auth files are untouched.\n\nRequires a credential that is not bound to a single project: an account API key or OAuth. A legacy project API key gets 403 ACCOUNT_SCOPE_REQUIRED."}},"/openapi.json":{"get":{"operationId":"getOpenApiDocument","summary":"This OpenAPI 3.1 document","tags":["Discovery"],"responses":{"200":{"description":"OpenAPI 3.1 document","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"4XX":{"$ref":"#/components/responses/Error"},"5XX":{"$ref":"#/components/responses/Error"}},"description":"Public, no authentication, CORS `*`, cached for 5 minutes.","security":[]}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"Account key (nb_u_…), project key (nb_) or OAuth access token","description":"Three credentials share this header. An account key (`nb_u_…`) acts on every project the user owns and may be read-only; a project key (`nb_…`, legacy) is scoped to exactly one project; an OAuth access token has full account scope. Key management (`/keys`) needs an OAuth connection or the dashboard session — an API key gets 403 OAUTH_REQUIRED."}},"schemas":{"Project":{"type":"object","description":"Project row with every secret replaced by a `configured` boolean","properties":{"id":{"oneOf":[{"type":"integer"},{"type":"string"}]},"name":{"type":["string","null"]},"url":{"type":["string","null"]},"description":{"type":["string","null"]},"post_count":{"type":"integer"},"subdomain":{"type":["string","null"]},"subdomain_enabled":{"type":"boolean"},"auto_generate":{"type":"boolean"},"auto_publish":{"type":"boolean"},"article_length":{"type":["string","null"]},"target_language":{"type":["string","null"]},"api_key_created_at":{"type":["string","null"]},"api_key_last_used_at":{"type":["string","null"]},"configured":{"type":"object","additionalProperties":{"type":"boolean"}}},"additionalProperties":true,"required":["id"]},"Integration":{"type":"object","description":"One provider's redacted integration state","properties":{"provider":{"type":"string"},"enabled":{"type":"boolean"},"configured":{"type":"boolean"}},"additionalProperties":true,"required":["provider","enabled","configured"]},"IntegrationsView":{"type":"object","properties":{"projectId":{"oneOf":[{"type":"integer"},{"type":"string"}]},"integrations":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Integration"}},"publishTargets":{"type":"array","items":{"type":"string"}}},"required":["projectId","integrations","publishTargets"]},"PostSummary":{"type":"object","description":"Post list row (never includes markdown)","properties":{"id":{"oneOf":[{"type":"integer"},{"type":"string"}]},"title":{"type":["string","null"]},"slug":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"type":["string","null"]},"published":{"type":"boolean"},"cover_image_url":{"type":["string","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]},"video_jobs":{"type":["object","null"],"additionalProperties":true}},"additionalProperties":true,"required":["id"]},"Post":{"type":"object","description":"Full post row plus the URL of every integration it reached","properties":{"id":{"oneOf":[{"type":"integer"},{"type":"string"}]},"project_id":{"oneOf":[{"type":"integer"},{"type":"string"}]},"title":{"type":["string","null"]},"slug":{"type":["string","null"]},"markdown":{"type":"string"},"status":{"type":["string","null"]},"published":{"type":"boolean"},"integrations":{"type":"object","additionalProperties":{"type":"object","properties":{"id":{"oneOf":[{"type":"integer"},{"type":"string"},{"type":"null"}]},"url":{"type":["string","null"]}},"required":["id","url"]}}},"additionalProperties":true,"required":["id"]},"PostList":{"type":"object","properties":{"posts":{"type":"array","items":{"$ref":"#/components/schemas/PostSummary"}},"total":{"type":"integer"}},"required":["posts","total"]},"PostResponse":{"type":"object","properties":{"post":{"$ref":"#/components/schemas/Post"}},"required":["post"]},"PublishResult":{"type":"object","properties":{"post":{"$ref":"#/components/schemas/Post"},"integrationUpdates":{"type":"object","properties":{"success":{"type":"array","items":{"type":"string"}},"failed":{"type":"array","items":{"type":"object","properties":{"platform":{"type":"string"},"error":{"type":"string"}},"required":["platform","error"]}}},"required":["success","failed"]}},"required":["post","integrationUpdates"]},"DeleteResult":{"type":"object","properties":{"deleted":{"type":"boolean"},"id":{"oneOf":[{"type":"integer"},{"type":"string"}]}},"required":["deleted","id"]},"GenerationResult":{"type":"object","properties":{"instanceId":{"type":"string"},"status":{"type":"string","enum":["queued","running","completed","failed"]},"blogId":{"oneOf":[{"type":"integer"},{"type":"string"},{"type":"null"}]}},"required":["instanceId","status"],"additionalProperties":true},"GenerationRun":{"type":"object","properties":{"id":{"oneOf":[{"type":"integer"},{"type":"string"}]},"workflow_instance_id":{"type":"string"},"status":{"type":"string","enum":["queued","running","completed","failed"]},"error":{"type":["string","null"]},"blog_id":{"oneOf":[{"type":"integer"},{"type":"string"},{"type":"null"}]}},"additionalProperties":true,"required":["id"]},"VideoJob":{"type":"object","properties":{"id":{"oneOf":[{"type":"integer"},{"type":"string"}]},"status":{"type":"string","enum":["pending","processing","rendering","uploading","completed","failed"]},"error":{"type":["string","null"]},"youtube_video_id":{"type":["string","null"]},"youtube_video_url":{"type":["string","null"]}},"additionalProperties":true,"required":["id","status"]},"BillingStatus":{"type":"object","properties":{"plan":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":["string","null"]},"status":{"type":"string"},"price":{"type":"string"},"isOnTrial":{"type":"boolean"},"isCancelled":{"type":"boolean"},"expiration":{"type":["string","null"]}},"required":["id","name","status","price"]},"credits":{"type":"object","properties":{"allowed":{"type":"integer"},"used":{"type":"integer"},"available":{"type":"integer"}},"required":["allowed","used","available"]},"limits":{"type":"object","properties":{"maxProjects":{"type":"integer"}},"required":["maxProjects"]},"hasExistingPayment":{"type":"boolean"},"isPreview":{"type":"boolean"}},"required":["plan","credits","limits"]},"BillingLink":{"type":"object","properties":{"url":{"type":"string","format":"uri"}},"required":["url"]},"Analytics":{"type":"object","properties":{"rangeDays":{"type":"integer","enum":[7,30,90]},"totals":{"type":"object","additionalProperties":true},"timeline":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"views":{"type":"integer"},"articles":{"type":"integer"}},"required":["date","views","articles"]}},"projectStats":{"type":"array","items":{"type":"object","additionalProperties":true}},"topArticles":{"type":"array","items":{"type":"object","additionalProperties":true}},"recentArticles":{"type":"array","items":{"type":"object","additionalProperties":true}},"generatedAt":{"type":"string","format":"date-time"}},"required":["rangeDays","totals","timeline","generatedAt"]},"VoiceCatalog":{"type":"object","properties":{"voices":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string"},"voice_id":{"type":"string"},"name":{"type":["string","null"]}},"additionalProperties":true,"required":["provider","voice_id"]}},"providers":{"type":"object","additionalProperties":{"type":"object","properties":{"configured":{"type":"boolean"}},"required":["configured"]}}},"required":["voices","providers"]},"YoutubeConnections":{"type":"object","properties":{"youtube":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channelId":{"type":["string","null"]},"channelTitle":{"type":["string","null"]},"email":{"type":["string","null"]},"createdAt":{"type":["string","null"]},"updatedAt":{"type":["string","null"]}},"required":["id"]}}},"required":["youtube"]},"ShopifyConnections":{"type":"object","properties":{"shopify":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"projectId":{"oneOf":[{"type":"integer"},{"type":"string"}]},"shop":{"type":["string","null"]},"createdAt":{"type":["string","null"]},"tokenExpiry":{"type":["string","null"]}},"required":["id","projectId"]}}},"required":["shopify"]},"DisconnectResult":{"type":"object","properties":{"provider":{"type":"string"},"deleted":{"type":"boolean"},"id":{"type":"string"}},"required":["provider","deleted","id"]},"ApiKey":{"type":"object","description":"Account API key metadata. The secret and its hash are never included.","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"prefix":{"type":"string","description":"First 12 characters, for display (e.g. nb_u_9f1c2ab)"},"readOnly":{"type":"boolean"},"createdAt":{"type":["string","null"]},"lastUsedAt":{"type":["string","null"]}},"required":["id","name","prefix","readOnly","createdAt","lastUsedAt"]},"AccountSnapshot":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":["string","null"]}},"required":["id","email"]},"auth":{"type":"object","properties":{"type":{"type":"string","enum":["oauth","api_key"]},"scopedProjectId":{"oneOf":[{"type":"integer"},{"type":"string"},{"type":"null"}]},"keyId":{"type":"string","description":"Account key id. Present only for an account API key."},"keyName":{"type":["string","null"],"description":"Account key name. Present only for an account API key."},"readOnly":{"type":"boolean","description":"True when the account key may only read. Present only for an account API key."}},"required":["type","scopedProjectId"]},"scopedProject":{"type":["object","null"],"additionalProperties":true},"plan":{"type":"object","additionalProperties":true},"credits":{"type":"object","additionalProperties":true},"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project"}}},"required":["user","auth","plan","credits","projects"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["AUTH_REQUIRED","INVALID_API_KEY","FORBIDDEN","NOT_FOUND","VALIDATION_ERROR","UPGRADE_REQUIRED","INSUFFICIENT_CREDITS","CONFIRMATION_REQUIRED","RATE_LIMITED","PROJECT_SCOPE_VIOLATION","CONFLICT","ACCOUNT_SCOPE_REQUIRED","READ_ONLY_KEY","KEY_LIMIT_REACHED","OAUTH_REQUIRED","INTERNAL_ERROR","PROVIDER_NOT_CONFIGURED","UPSTREAM_ERROR","METHOD_NOT_ALLOWED"],"description":"Stable machine-readable code. Branch on this, not on the message."},"message":{"type":"string"},"details":{"description":"Optional structured context (validation issues, limits)"}},"required":["code","message"]}},"required":["error"]}},"responses":{"Error":{"description":"Standard error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}