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

# POST /content-studio/create-blog — Generate Blog Content

> Generate an AI-optimized blog post with CogNerd's Content Studio. Pass a topic and brand name, choose short or long format, and receive a publish-ready article.

The Content Studio blog endpoint generates SEO- and AEO-optimized articles for your brand. You provide a topic and your brand name, choose a length, and CogNerd's multi-stage pipeline — covering SEO analysis, competitor research, intent classification, content generation, and RAGAS quality evaluation — produces a publish-ready markdown article.

<Note>
  **Credit cost:** Short blog = **10 credits**, Long blog = **30 credits**. Credits are deducted when generation starts. Make sure your balance is sufficient before calling this endpoint.
</Note>

## Generate a blog post

<CodeGroup>
  ```bash cURL — short blog theme={null}
  curl -X POST https://api.cognerd.in/content-studio/create-blog \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "topic": "How AI search is changing B2B buying",
      "brandName": "Acme Corp",
      "length": "short"
    }'
  ```

  ```bash cURL — long blog theme={null}
  curl -X POST https://api.cognerd.in/content-studio/create-blog \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "topic": "The complete guide to AI visibility for SaaS brands",
      "brandName": "Acme Corp",
      "length": "long"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.cognerd.in/content-studio/create-blog', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      topic: 'How AI search is changing B2B buying',
      brandName: 'Acme Corp',
      length: 'short'
    })
  });
  const blog = await response.json();
  console.log(blog.content); // Markdown content
  ```
</CodeGroup>

### Request body

<ParamField body="topic" type="string" required>
  The blog post topic or working title. Be specific — a focused topic produces better results than a broad one.
</ParamField>

<ParamField body="brandName" type="string" required>
  Your brand name. Used to align tone, include brand-relevant references, and ensure the content supports your visibility goals.
</ParamField>

<ParamField body="length" type="string" required>
  Blog length. One of `"short"` (800–1,200 words, 10 credits) or `"long"` (2,500–4,000 words, 30 credits).
</ParamField>

### Response

```json theme={null}
{
  "id": "blog_7f3a21",
  "status": "completed",
  "topic": "How AI search is changing B2B buying",
  "brandName": "Acme Corp",
  "length": "short",
  "content": "# How AI Search Is Changing B2B Buying\n\nArtificial intelligence has reshaped...",
  "createdAt": "2024-01-15T11:00:00Z"
}
```

<ResponseField name="id" type="string">
  Unique identifier for this blog document.
</ResponseField>

<ResponseField name="status" type="string">
  Generation status: `"completed"`, `"pending"`, or `"failed"`.
</ResponseField>

<ResponseField name="content" type="string">
  The full blog post in markdown format, ready to paste into your CMS or publish directly.
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp.
</ResponseField>

## Retrieve the latest blog

Use this endpoint to fetch the most recently generated blog for your account without needing the `id`.

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.cognerd.in/content-studio/latest \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.cognerd.in/content-studio/latest', {
    headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
  });
  const latest = await response.json();
  ```
</CodeGroup>

## Error responses

| Status | Code                   | Meaning                                                  |
| ------ | ---------------------- | -------------------------------------------------------- |
| 401    | `UNAUTHORIZED`         | Missing or invalid Bearer token                          |
| 402    | `INSUFFICIENT_CREDITS` | Not enough credits for the chosen length                 |
| 400    | `VALIDATION_ERROR`     | Missing required fields (`topic`, `brandName`, `length`) |
| 500    | `GENERATION_FAILED`    | Content generation failed; retry the request             |

<Tip>
  For best results, use specific topics tied to questions your target audience is asking AI platforms. Check your **Brand Monitor** to see what queries are driving competitor citations, then create content that answers those same questions.
</Tip>
