---
title: "Generate AI post variants"
method: POST
path: "/generate"
tags: ["Generate"]
---

# Generate AI post variants

`POST /generate`

## Request

- Base URL: `https://api.misar.io/post`
- URL: `https://api.misar.io/post/generate`
- Auth: API key in header `Authorization`

Generates up to `count` post-copy variants per requested platform via the assisters.dev AI gateway, and persists them as `draft` post variants (so they also count toward the monthly generation quota and are listable via `GET /drafts`). Rate limit: 20 requests/minute. Requires an active or trialing plan: without one the call returns `402` with `code: "plan_limit_exceeded"`, `reason: "no_active_plan"` and the plan offer (MisarPost has no Free plan). A plan's monthly generation cap, where it has one, also returns `402` with `code: "plan_limit_exceeded"` and an upgrade offer.

## Request body

- GenerateRequest
  - `topic` string, required
  - `platforms` string[], required
  - `tone` 'professional' | 'casual' | 'technical' | 'inspirational'
  - `count` integer

## Response `200`

Generated variants, grouped by platform.

- GenerateResponse
  - `variants` object[], required
    - `platform` string
    - `variants` object[]
      - `caption` string
      - `hashtags` string[]

## Other responses

- `400`: Request body failed schema validation. `error` is a Zod `flatten()`-shaped object (`fieldErrors` / `formErrors`), not a plain string.
- `401`: Missing, malformed, revoked, or invalid API key/session.
- `402`: Plan limit: no active plan (any write; `reason: "no_active_plan"`), a monthly allowance is spent, or the feature is not on the caller's plan. Detect by `code: "plan_limit_exceeded"`.
- `403`: The API key lacks the scope this operation requires (`code: "insufficient_scope"`, `required_scope`).
- `429`: Per-user, per-route rate limit exceeded for this endpoint.

---

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