---
title: AI Generation API - Create Carousels with AI
description: Generate carousel posts using AI with PostNitro's generate API. Create content from topics, articles, or text with customizable presets.
canonical: https://postnitro.ai/docs/embed/api/initiate/generate
---

# Initiate AI Generation

**POST** `https://embed-api.postnitro.ai/post/initiate/generate`

Generates a carousel post using AI with predefined content generation presets.

#### Headers
- `Content-Type: application/json`
- `embed-api-key: your-api-key-here` (required)

#### Request Body

| Field | Type | Required | Description | Allowed Values |
|-------|------|----------|-------------|----------------|
| `postType` | string | Yes | Type of post to generate | `"CAROUSEL"` |
| `requestorId` | string | No | Custom identifier for tracking | Any string |
| `templateId` | string | Yes | ID of the template to use | Valid template ID |
| `brandId` | string | Yes | ID of the brand configuration | Valid brand ID |
| `presetId` | string | Yes | ID of the AI configuration preset | Valid preset ID |
| `responseType` | string | No | Output format (default: "PDF") | `"PDF"`, `"PNG"` |
| `aiGeneration` | object | Yes | AI generation configuration | See below |

#### AI Generation Object

| Field | Type | Required | Description | Allowed Values |
|-------|------|----------|-------------|----------------|
| `type` | string | Yes | Type of AI generation | `"text"`, `"article"`, `"x"` |
| `context` | string | Yes | Context/prompt for AI generation | Any string |
| `instructions` | string | No | Additional instructions for AI | Any string |

**How `type` and `context` work together:**

- `"text"` — `context` is a plain-text topic or prompt describing what to create (e.g. `"Create a carousel about digital marketing tips"`)
- `"article"` — `context` is the URL of an article to turn into a carousel
- `"x"` — `context` is the URL of an X (Twitter) post to turn into a carousel

#### Example Request

```bash
curl --location 'https://embed-api.postnitro.ai/post/initiate/generate' \
--header 'Content-Type: application/json' \
--header 'embed-api-key: pn-plnnepb6v9omx2ik88v793ak' \
--data '{
    "postType": "CAROUSEL",
    "requestorId": "user123",
    "templateId": "xtrnxgfgk9a08tmsz2601k1c",
    "brandId": "cmdhb8oe10006v0pmh6a4no6t",
    "presetId": "preset123",
    "responseType": "PNG",
    "aiGeneration": {
        "type": "text",
        "context": "Create a carousel about digital marketing tips",
        "instructions": "Focus on actionable tips for small businesses"
    }
}'
```

#### Response

```json
{
    "success": true,
    "message": "CAROUSEL generation initiated",
    "data": {
        "embedPostId": "post123",
        "status": "PENDING"
    }
}
```

> **Generation is asynchronous.** This endpoint returns immediately with an `embedPostId` while the carousel is generated in the background. Poll [Check Post Status](https://postnitro.ai/docs/embed/api/request-status) with the `embedPostId` until the status is `COMPLETED`, then call [Get Post Output](https://postnitro.ai/docs/embed/api/post-output) to retrieve the final files.
