---
title: "Generate content plan"
method: POST
path: "/api/apps/{app_id}/virality/generate"
---

# Generate content plan

`POST /api/apps/{app_id}/virality/generate`

<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Generates the full content plan: a set of posts for each platform you approve, written from the app's accepted strategy.

Submit answers and accept a strategy first. This endpoint fails with a 409 unless the app has a strategy, and while another generation is already running for the app.

This request costs 10 credits and fails with a 402 when the workspace is out of quota. It runs the whole generation inline, one language model call per platform plus the first platform's images, so it can take **several minutes** with 3 platforms. Use a long client timeout. The remaining images generate in the background, so poll [Get social content state](/api-reference/get-social-content-state) to pick up the `image_url` values that land after the response.

Generating a plan replaces any plan the app already has, including its generated images.

This endpoint shares a limit of 15 requests per minute with the other social content endpoints.

<Note>This endpoint accepts a personal API key. Workspace API keys are not authorized for it and are rejected with a 403.</Note>

<Warning>The response may include fields beyond the ones documented here. Don't use any undocumented fields, as they can change at any time.</Warning>

## Path parameters

- `app_id` string, required — ID of the app.

## Request body

- GeneratePlanPayload
  - `platforms` string[], required — Platforms to generate content for, 1 to 3 of `x`, `instagram`, `tiktok`, `linkedin`, `reddit`, `facebook`. The order is preserved in the response. Unsupported values are ignored, and a request where none are supported fails with a 400.
  - `social_url` string, nullable — HTTPS URL of your social profile, used to match the writing voice of the generated content. Omit it to reuse the voice resolved when you submitted answers.

## Response `200`

The generated content plan.

- ContentPlanResponse
  - `plan` ContentPlan
    - `id` string, nullable — ID of the content plan.
    - `app_id` string, nullable — ID of the app the plan belongs to.
    - `strategy` ContentStrategy
      - `app_summary` string, nullable — Short summary of what the app does.
      - `marketing_approach` string, nullable — The approach the content takes, extracted from the accepted strategy. Empty if the strategy text was empty when the plan was generated.
      - `platforms` PlatformContentPlan[] — One entry per platform you approved, in the order you sent them.
        - `platform` 'x' | 'instagram' | 'tiktok' | 'linkedin' | 'reddit' | 'facebook'
        - `mode` 'series' | 'selection'
        - `reasoning` string, nullable — Why the content for this platform takes the shape it does.
        - `posts` SocialPost[] — The generated posts for this platform.
          - `id` string, nullable — ID of the post. Pass it as `post_id` to [Refine a post](/api-reference/refine-a-post), [Update post content](/api-reference/update-post-content), and [Generate a post image](/api-reference/generate-a-post-image).
          - `platform` 'x' | 'instagram' | 'tiktok' | 'linkedin' | 'reddit' | 'facebook'
          - `angle` 'pain_point' | 'feature_demo' | 'social_proof' | 'trending_hook' | 'user_story' | 'before_after'
          - `angle_label` string, nullable — Human-readable label for the angle.
          - `post_number` integer, nullable — Position of this post within its platform's set, starting at 1.
          - `total_posts` integer, nullable — Number of posts generated for this platform.
          - `suggested_day` integer, nullable — Suggested day to publish on, counted from the start of the campaign.
          - `rationale` string, nullable — Why this post works for this platform and angle.
          - `content` string, nullable — The post text, ready to publish. Change it with [Update post content](/api-reference/update-post-content).
          - `image_url` string, nullable — URL of the post image, or `null` if no image was generated yet. Create one with [Generate a post image](/api-reference/generate-a-post-image).
          - `image_prompt` string, nullable — Prompt used to generate the post image, or `null` if the post has none.
          - `hashtags` string[], nullable — Suggested hashtags, without the leading `#`.
          - `post_title` string, nullable — Title for platforms that use one, such as Reddit and LinkedIn. `null` elsewhere.
          - `suggested_subreddits` string[], nullable — Subreddits to consider for a Reddit post. Empty for other platforms.
          - `launch_comment` string, nullable — First comment to post under the main post, or `null` if none was generated.
          - `option_label` string, nullable — Label for this post when the platform's `mode` is `selection`, so you can tell the alternatives apart. `null` in `series` mode.
          - `best_for_context` string, nullable — When to prefer this option over the others, or `null` if not applicable.
    - `created_at` string, nullable — Time the plan was created, as an ISO 8601 timestamp.
    - `updated_at` string, nullable — Time the plan last changed, as an ISO 8601 timestamp.

## Other responses

- `400` — None of the requested platforms are supported.
- `401` — Missing or invalid credentials.
- `402` — The workspace is out of credits.
- `403` — You don't have editor access to this app, or you used a workspace API key.
- `404` — App not found, the app has no social content state yet, or the social content feature is not enabled for your account.
- `409` — The app has no accepted strategy yet, or a content plan is already generating.
- `422` — Validation Error
- `429` — Rate limit exceeded (15 requests per minute).
- `500` — Generating the content plan failed. Retry the request.

## Changes

- **2026-08-25** `8dfd9c46c0b9` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/idealspot/apis/base44-app-management-api/changes/api/apps/:app_id/virality/generate/post.md)

---

[API](https://skmtc.dev/idealspot/apis/base44-app-management-api.md) · [All operations](https://skmtc.dev/idealspot/apis/base44-app-management-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/idealspot/base44-app-management-api/revisions/31ef75eb64ab/schema)
