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

# Generate Content

> Create a content generation job from text input

## Endpoint

```
POST /api/v1/process-text-async
```

## Authentication

Requires API key in `x-api-key` header.

## Request Body

<ParamField body="text" type="string" required>
  The text content to transform into social media content
</ParamField>

<ParamField body="format" type="string" required>
  Content format. Options: `image`, `carousel`, `reel`
</ParamField>

<ParamField body="visualTemplate" type="string">
  Visual style template. Options: `infographic`, `screenshot`, `meme`, `minimal`, `magazine`, `neon`, `news`, `auto`
</ParamField>

<ParamField body="platform" type="string">
  Target platform. Options: `instagram`, `tiktok`, `youtube_shorts`
</ParamField>

<ParamField body="slideCount" type="number">
  Number of slides for carousel format. Range: 1-5. Only applicable when `format` is `carousel`
</ParamField>

<ParamField body="maxDuration" type="number">
  Maximum video duration in seconds. Range: 15-180. Only applicable when `format` is `reel`
</ParamField>

<ParamField body="customPrompt" type="string">
  Custom instructions for content generation
</ParamField>

<ParamField body="captionsEnabled" type="boolean">
  Enable captions for video reels. Only applicable when `format` is `reel`
</ParamField>

<ParamField body="captionsStyle" type="string">
  Caption style. Options: `modern`, `minimal`. Requires `captionsEnabled: true`
</ParamField>

<ParamField body="captionsPosition" type="string">
  Caption position. Options: `bottom`, `center`. Requires `captionsEnabled: true`
</ParamField>

<ParamField body="captionsFontSize" type="string">
  Caption font size. Options: `small`, `medium`, `large`. Requires `captionsEnabled: true`
</ParamField>

<ParamField body="visualStyleVariant" type="string">
  Additional style variant for customization
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the request was successful
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable status message
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="jobId" type="string">
      Unique identifier for the content generation job
    </ResponseField>

    <ResponseField name="status" type="string">
      Initial job status (always "pending")
    </ResponseField>
  </Expandable>
</ResponseField>

## Example Request

```bash theme={null}
curl -X POST https://api.distylia.com/api/v1/process-text-async \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "5 essential tips for remote work success",
    "format": "carousel",
    "slideCount": 5,
    "visualTemplate": "minimal",
    "platform": "instagram"
  }'
```

## Example Response

```json theme={null}
{
  "success": true,
  "message": "Text processing job created successfully",
  "data": {
    "jobId": "550e8400-e29b-41d4-a716-446655440000",
    "status": "pending"
  }
}
```

## Error Responses

<ResponseExample>
  ```json 400 - Invalid Format theme={null}
  {
    "error": "Invalid format. Must be: image, carousel, or reel"
  }
  ```

  ```json 400 - No Text Provided theme={null}
  {
    "error": "No text provided"
  }
  ```

  ```json 401 - Invalid API Key theme={null}
  {
    "error": "Invalid API key"
  }
  ```
</ResponseExample>

## Notes

* Jobs are processed asynchronously. Use the returned `jobId` to check status and retrieve results
* Processing time varies by format: images (\~30s), carousels (\~1-2min), reels (\~2-5min)
* The `visualTemplate` parameter is optional. If set to `auto` or omitted, the system will choose the best template
