> ## Documentation Index
> Fetch the complete documentation index at: https://docs.writerzroom.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Content

> Submit a generation request through the API and receive a request identifier for tracking.

`POST /generate` starts a new content generation job.

It accepts the selected template, selected style profile, generation mode, optional vertical, and structured user input required for that request. The response returns a `request_id` rather than a completed draft because generation runs asynchronously.

## Generation Overview

<div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: '12px', margin: '1.5rem 0' }}>
  <div style={{ border: '1px solid rgba(128,128,128,0.20)', borderRadius: '14px', padding: '16px', background: 'rgba(255,255,255,0.04)' }}>
    <div style={{ fontWeight: 800 }}>Template</div>
    <div style={{ fontSize: '13px', color: 'var(--colors-content-secondary)' }}>Defines the content structure.</div>
  </div>

  <div style={{ border: '1px solid rgba(128,128,128,0.20)', borderRadius: '14px', padding: '16px', background: 'rgba(255,255,255,0.04)' }}>
    <div style={{ fontWeight: 800 }}>Style</div>
    <div style={{ fontSize: '13px', color: 'var(--colors-content-secondary)' }}>Controls tone, voice, and audience fit.</div>
  </div>

  <div style={{ border: '1px solid rgba(128,128,128,0.20)', borderRadius: '14px', padding: '16px', background: 'rgba(255,255,255,0.04)' }}>
    <div style={{ fontWeight: 800 }}>Input</div>
    <div style={{ fontSize: '13px', color: 'var(--colors-content-secondary)' }}>Supplies topic, audience, and requirements.</div>
  </div>

  <div style={{ border: '1px solid rgba(128,128,128,0.20)', borderRadius: '14px', padding: '16px', background: 'rgba(255,255,255,0.04)' }}>
    <div style={{ fontWeight: 800 }}>Request ID</div>
    <div style={{ fontSize: '13px', color: 'var(--colors-content-secondary)' }}>Tracks the job until completion.</div>
  </div>
</div>

## Request

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
POST https://writerzroom.com/api/generate
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "template_id": "blog_article_generator",
  "style_profile_id": "general_blog",
  "generation_mode": "standard",
  "user_input": {
    "topic": "The future of AI in content marketing",
    "target_audience": "Marketing directors at B2B SaaS companies",
    "objective": "Educate on practical AI adoption strategies",
    "key_points": ["ROI measurement", "Team workflows", "Tool selection"]
  },
  "vertical_id": "saas_tech"
}
```

## Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "request_id": "req_xyz789",
  "status": "pending",
  "created_at": "2026-03-10T20:00:00Z"
}
```

## Core Request Fields

| Field              |    Required | Description                                                             |
| ------------------ | ----------: | ----------------------------------------------------------------------- |
| `template_id`      |         Yes | Template identifier, such as `blog_article_generator`                   |
| `style_profile_id` |         Yes | Style profile identifier, such as `general_blog`                        |
| `generation_mode`  | Recommended | Generation tier, such as `quick`, `standard`, or `premium`              |
| `user_input`       |         Yes | Structured inputs required by the selected template                     |
| `vertical_id`      |    Optional | Domain configuration, such as `saas_tech`, `medical_ai`, or `political` |

## Core Request Pattern

<Steps>
  <Step title="Choose a template identifier">
    Select the content structure that matches the output you want to create.
  </Step>

  <Step title="Choose a style profile identifier">
    Select the writing behavior that controls tone, voice, depth, and audience fit.
  </Step>

  <Step title="Provide required input fields">
    Add the required fields inside the `user_input` object.
  </Step>

  <Step title="Submit the request">
    Call `POST /generate` and store the returned `request_id`.
  </Step>

  <Step title="Poll until complete">
    Poll `/generate/status/{request_id}` until the request returns `completed` or `failed`.
  </Step>
</Steps>

## Best Practice

Validate template and style identifiers before submitting large batches of requests. That reduces avoidable failures and makes automation more reliable.

<Tip>
  Use `/templates` and `/style-profiles` to fetch valid identifiers programmatically rather than hardcoding them.
</Tip>

<CardGroup cols={2}>
  <Card title="Check Generation Status" icon="activity" href="/api/check-generation-status">
    Poll the request until content completes or fails.
  </Card>

  <Card title="Endpoints Reference" icon="route" href="/api/endpoints">
    Review available API endpoints.
  </Card>
</CardGroup>
