> ## 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 from PDF

> Create a content generation job from a PDF file

## Endpoint

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

## Authentication

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

## Request

This endpoint accepts `multipart/form-data` for file upload.

<ParamField body="pdf" type="file" required>
  PDF file to process (max 10MB, must be application/pdf)
</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`
</ParamField>

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

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

<ParamField body="maxDuration" type="string">
  Maximum video duration in seconds (as string). 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="string">
  Enable captions for video reels. Use `"true"` or `"false"`. 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-pdf-async \
  -H "x-api-key: YOUR_API_KEY" \
  -F "pdf=@document.pdf" \
  -F "format=carousel" \
  -F "slideCount=5" \
  -F "visualTemplate=minimal" \
  -F "platform=instagram"
```

## Example Response

```json theme={null}
{
  "success": true,
  "message": "PDF 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 PDF Provided theme={null}
  {
    "error": "No PDF file provided"
  }
  ```

  ```json 400 - Invalid File Type theme={null}
  {
    "error": "Only PDF files are allowed"
  }
  ```

  ```json 400 - File Too Large theme={null}
  {
    "error": "File size exceeds 10MB limit"
  }
  ```

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

## Notes

* Maximum file size is 10MB
* Only PDF files are accepted (validated by MIME type)
* All form fields except `pdf` and `format` are optional
* Number fields (`slideCount`, `maxDuration`) must be sent as strings in form data
* Boolean fields (`captionsEnabled`) must be sent as `"true"` or `"false"` strings
* Jobs are processed asynchronously. Use the returned `jobId` to check status and retrieve results
* PDF content is extracted and transformed into social media content using AI
