---
title: "Generate platform-specific post copy"
method: POST
path: "/api/v1/generation/text"
tags: ["generation"]
---

# Generate platform-specific post copy

`POST /api/v1/generation/text`

## Request

- Base URL: `https://api.cadencz.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.cadencz.com/api/v1/generation/text`
- Auth: HTTP bearer

Runs the Cadencz agent graph (per platform) to turn one idea into publish-ready copy — in the workspace's learned voice, shaped to each platform's rules, and checked by the critic. Uses the tiered model router (no direct provider key needed).

## Request body

- TextGenerationRequest
  - `input` string, required: Source material or instructions the model should turn into social copy.
  - `platforms` string[]: One or more platform prompt templates to apply.
  - `provider` string, nullable: Text model provider. Defaults to TEXT_MODEL_PROVIDER.
  - `model` string, nullable: Provider model id. Defaults to OPENAI_MODEL for the OpenAI provider.
  - `brain_id` string, nullable: Optional Brain id/slug used to ground the generation in saved product knowledge.
  - `conversation_id` string, nullable: Optional durable Brain conversation to continue. Requires brain_id; when omitted, a new conversation is created for Brain-backed generation.
  - `conversation_message` string, nullable: User-visible conversation turn to persist. Defaults to input when omitted, allowing clients to keep generation-only prompt instructions out of conversation history.
  - `brain_context` string, nullable: Optional client-provided Brain context fallback when the Brain is not yet saved server-side.
  - `temperature` number
  - `max_tokens` integer, nullable
  - `count` integer, nullable: How many distinct post concepts to create. When omitted, Compose infers an explicit count from requests such as 'write two posts'.
  - `content_guidance` string, nullable: Selected content mode, kept separate from the user's requested subject.

## Response `200`

Successful Response

- TextGenerationResponse
  - `outputs` GeneratedPlatformText[], required
    - `platform` string, required
    - `text` string, required
    - `provider` string, required
    - `model` string, required
    - `agent_run_id` string, required
    - `draft_index` integer
  - `conversation_id` string, nullable

## Other responses

- `400`: The request payload is invalid.
- `401`: Missing or invalid Supabase bearer token.
- `404`: The requested resource was not found.
- `422`: Validation Error
- `502`: The upstream provider rejected the request.
- `503`: Required infrastructure or provider config is unavailable.

---

[API](https://skmtc.dev/cadencz/apis/cadencz-api.md) · [All operations](https://skmtc.dev/cadencz/apis/cadencz-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cadencz/apis/cadencz-api/revisions/3392fe5e93db?raw)
