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

# Generate Preview of Custom Template Video (Async)

> This endpoint generates a preview asynchronously before rendering the final video. Unlike the synchronous preview endpoint, this returns immediately with a 201 status and the job details. You can poll the job status using the GET endpoint. Generating a preview through this endpoint costs 1 credit for every 30 seconds.

### Difference from Synchronous Preview

The synchronous `POST /api/custom_template_jobs/preview/` endpoint blocks until the preview is ready and returns the completed result directly.

This async endpoint returns immediately with the job in a `pending` state. You should poll the job status using `GET /api/custom_template_jobs/{id}/` until the status becomes `done`, then read the `preview` field from the response.

### About preview Field in the Response

The preview field provides a link to preview the video. This link allows you to preview the video before rendering it, you can put it in an iframe to show the video in your application.
Example: The preview field in the response will look like this:

```arduino theme={null}
"https://app.creatify.ai/preview?layout=videos/20241024/f0c1e1f1-be05-48e0-91d8-3d26ed633d5b.json"
```

### Recommended Usage

This async endpoint is recommended over the synchronous preview endpoint, especially for templates with complex assets or heavy processing. It avoids HTTP timeout issues that can occur with the synchronous endpoint when the server is under high load.


## OpenAPI

````yaml post /api/custom_template_jobs/preview_async/
openapi: 3.0.3
info:
  title: creatify.ai API
  version: 1.0.0
  description: API for creatify.ai
servers: []
security: []
paths:
  /api/custom_template_jobs/preview_async/:
    post:
      tags:
        - custom_template_jobs
      operationId: custom_template_jobs_preview_async_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomTemplateJob'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CustomTemplateJob'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CustomTemplateJob'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomTemplateJob'
          description: ''
      security:
        - X-API-ID: []
          X-API-KEY: []
components:
  schemas:
    CustomTemplateJob:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        created_at:
          type: string
          format: date-time
          readOnly: true
          title: Created date
        updated_at:
          type: string
          format: date-time
          readOnly: true
          title: Updated date
        name:
          type: string
          nullable: true
          description: Name of the video. Default is null.
          maxLength: 255
        template_id:
          type: string
          format: uuid
          writeOnly: true
          description: Template ID associated with the job.
        variables:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Variable'
          description: JSON data for the custom template.
        media_job:
          type: string
          readOnly: true
          nullable: true
        video_output:
          type: string
          nullable: true
          readOnly: true
          description: Video output URL
        preview:
          type: string
          nullable: true
          readOnly: true
          description: Preview URL
        editor_url:
          type: string
          nullable: true
          readOnly: true
          description: >-
            Editor URL for the video. Expires in 24 hours. Available only if
            your API account has API editor access enabled. , expires in 24
            hours.
        failed_reason:
          type: string
          readOnly: true
          description: Failed reason
        credits_used:
          type: number
          description: Credits used in this API call
          readOnly: true
        duration:
          type: integer
          readOnly: true
          description: Duration of the video in seconds
        status:
          allOf:
            - $ref: '#/components/schemas/StatusD69Enum'
          readOnly: true
        progress:
          type: number
          format: double
          readOnly: true
          description: Progress of the job
        webhook_url:
          type: string
          format: uri
          nullable: true
          description: Webhook URL for status updates. Default is null.
          maxLength: 200
        model_version:
          allOf:
            - $ref: '#/components/schemas/ModelVersion699Enum'
          description: >-
            Model version for the avatar, 'standard', 'aurora_v1' or
            'aurora_v1_fast'. Default is 'standard'. Standard model costs 5
            credits per 30 seconds video, Aurora_v1 model costs 1 credit per
            second, and Aurora_v1_fast renders faster with lower quality for 0.5
            credits per second.


            * `standard` - Standard

            * `aurora_v1` - Aurora v1

            * `aurora_v1_fast` - Aurora v1 Fast
        is_hidden:
          type: boolean
          default: false
          description: Whether the job should be hidden.
      required:
        - created_at
        - credits_used
        - duration
        - editor_url
        - failed_reason
        - id
        - media_job
        - preview
        - progress
        - status
        - template_id
        - updated_at
        - variables
        - video_output
    Variable:
      type: object
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/VariableTypeEnum'
          description: >-
            Type of the variable with example properties.


            * `image` - Image file with a URL. Example: properties = {'url':
            'https://example.com/image.jpg'}

            * `video` - Video file with a URL. Example: properties = {'url':
            'https://example.com/video.mp4'}

            * `audio` - Audio file with a URL. Example: properties = {'url':
            'https://example.com/audio.mp3'}

            * `text` - Scene text or overlay text with content. Example:
            properties = {'content': 'Sample text content'}

            * `avatar` - Avatar with a unique ID. Example: properties =
            {'avatar_id': '123e4567-e89b-12d3-a456-426614174000'}

            * `voiceover` - Voiceover with an associated voice ID. Example:
            properties = {'voice_id': '123e4567-e89b-12d3-a456-426614174001'}
        properties:
          type: object
          additionalProperties: {}
          description: Properties based on the selected type.
      required:
        - properties
        - type
    StatusD69Enum:
      enum:
        - pending
        - in_queue
        - running
        - failed
        - done
        - rejected
      type: string
      description: |-
        * `pending` - Pending
        * `in_queue` - In Queue
        * `running` - Running
        * `failed` - Failed
        * `done` - Done
        * `rejected` - Rejected
    ModelVersion699Enum:
      enum:
        - standard
        - aurora_v1
        - aurora_v1_fast
      type: string
      description: |-
        * `standard` - Standard
        * `aurora_v1` - Aurora v1
        * `aurora_v1_fast` - Aurora v1 Fast
    VariableTypeEnum:
      enum:
        - image
        - video
        - audio
        - text
        - avatar
        - voiceover
      type: string
      description: >-
        * `image` - Image file with a URL. Example: properties = {'url':
        'https://example.com/image.jpg'}

        * `video` - Video file with a URL. Example: properties = {'url':
        'https://example.com/video.mp4'}

        * `audio` - Audio file with a URL. Example: properties = {'url':
        'https://example.com/audio.mp3'}

        * `text` - Scene text or overlay text with content. Example: properties
        = {'content': 'Sample text content'}

        * `avatar` - Avatar with a unique ID. Example: properties =
        {'avatar_id': '123e4567-e89b-12d3-a456-426614174000'}

        * `voiceover` - Voiceover with an associated voice ID. Example:
        properties = {'voice_id': '123e4567-e89b-12d3-a456-426614174001'}
  securitySchemes:
    X-API-ID:
      type: apiKey
      in: header
      name: X-API-ID
      description: API ID, from your settings page.
    X-API-KEY:
      type: apiKey
      in: header
      name: X-API-KEY
      description: API Key, from your settings page.

````