> ## 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 AI Editing

> This endpoint generates a preiview of AI Editing video before redering the final video. Generating a video preview through this endpoint costs 1 credit for every 30 seconds.

### Queue a preview generation task

Generate a preview of AI Editing video.

```python theme={null}
import requests

url = "https://api.creatify.ai/api/ai_editing/preview/"

payload = {
    "video_url": "https://d35ghwdno3nak3.cloudfront.net/media_file/2/20240805/038a9606-7b03-4fdd-a44d-122195a97afb_jun-16x9.mp4",
    "editing_style": "film"
}
headers = {
    "X-API-ID": "<your-x-api-id>",
    "X-API-KEY": "<your-x-api-key>",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
```

### Check preview status

Now our AI model is generating preview of AI Editing video. It will return a `id` of the AI Editing video. Then you can check the preview status of your video by sending a GET request to [Get AI Editing video by id endpoint](/api-reference/ai-editing/get-ai-editing-/).

```python theme={null}
import requests

url = "https://api.creatify.ai/api/ai_editing/{id}/"

headers = {
    "X-API-ID": "<your-x-api-id>",
    "X-API-KEY": "<your-x-api-key>"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
```

Once the preview of AI Editing video is generated, there will be data in `preview` field. Then you can render the video by sending a POST request to [Render a AI Editing video endpoint](/api-reference/ai-editing/post-ai-editing-render).

### Render the video

```python theme={null}
import requests

url = "https://api.creatify.ai/api/ai_editing/{id}/render/"

payload = {}

headers = {
    "X-API-ID": "<your-x-api-id>",
    "X-API-KEY": "<your-x-api-key>",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
```

### Check render status

```python theme={null}
import requests

url = "https://api.creatify.ai/api/ai_editing/{id}/"

headers = {
    "X-API-ID": "<your-x-api-id>",
    "X-API-KEY": "<your-x-api-key>"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
```

You will find the `status` to be `done` when finished. Meanwhile you can find the video output in `video_output` field.


## OpenAPI

````yaml post /api/ai_editing/preview/
openapi: 3.0.3
info:
  title: creatify.ai API
  version: 1.0.0
  description: API for creatify.ai
servers: []
security: []
paths:
  /api/ai_editing/preview/:
    post:
      tags:
        - ai_editing
      operationId: ai_editing_preview_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ViralCutFlowCreateByVideoURL'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/ViralCutFlowCreateByVideoURL'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ViralCutFlowCreateByVideoURL'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ViralCutFlow'
          description: ''
      security:
        - X-API-ID: []
          X-API-KEY: []
components:
  schemas:
    ViralCutFlowCreateByVideoURL:
      type: object
      properties:
        editing_style:
          $ref: '#/components/schemas/EditingStyleEnum'
        video_url:
          type: string
          format: uri
        caption_setting:
          allOf:
            - $ref: '#/components/schemas/Caption'
          nullable: true
          description: >-
            Caption setting, default null and default caption setting will be
            used
        background_music_url:
          type: string
          format: uri
          nullable: true
          description: >-
            Background music URL for the video. Default is null, video will use
            random music.
          maxLength: 255
        background_music_volume:
          type: number
          format: double
          maximum: 1
          minimum: 0
          nullable: true
          description: >-
            Volume of the background music, ranging from 0.0 to 1.0. Default is
            null, video will use default music volume of visual_style.
        voiceover_volume:
          type: number
          format: double
          maximum: 1
          minimum: 0
          nullable: true
          description: >-
            Volume of the voiceover, ranging from 0.0 to 1.0. Default is null,
            video will use default voiceover volume of visual_style.
        webhook_url:
          type: string
          format: uri
          nullable: true
          description: Webhook URL for status updates. Default is null.
          maxLength: 200
      required:
        - editing_style
        - video_url
    ViralCutFlow:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        status:
          allOf:
            - $ref: '#/components/schemas/StatusD69Enum'
          readOnly: true
        failed_reason:
          type: string
          readOnly: true
          description: Failed reason
        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.
        is_hidden:
          type: boolean
          readOnly: true
          description: Is the video hidden in the website projects page
        progress:
          type: number
          format: double
          readOnly: true
          description: Progress of the job
        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
        media_job:
          type: string
          readOnly: true
          nullable: true
        permission_type:
          allOf:
            - $ref: '#/components/schemas/PermissionTypeEnum'
          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
          maxLength: 255
        script:
          type: string
          nullable: true
          description: Text to be converted to video
        aspect_ratio:
          nullable: true
          description: |-
            Aspect ratio of the video

            * `9x16` -  9X16
            * `16x9` -  16X9
            * `1x1` -  1X1
          oneOf:
            - $ref: '#/components/schemas/AspectRatio338Enum'
            - $ref: '#/components/schemas/NullEnum'
        is_talking_video:
          type: boolean
          description: Whether the video is talking video or not
        is_one_person_in_video:
          type: boolean
          description: Whether the video is one person video or not
        editing_style:
          nullable: true
          description: |-
            Style to be used for the video

            * `film` - Film
            * `geometric_gradient` - Geometric Gradient
            * `glitch` - Glitch
            * `glitter_gradient` - Glitter Gradient
            * `paper` - Paper
          oneOf:
            - $ref: '#/components/schemas/EditingStyleEnum'
            - $ref: '#/components/schemas/NullEnum'
        audio_url:
          type: string
          nullable: true
          description: Audio to be used for the video
          maxLength: 255
        video_url:
          type: string
          nullable: true
          description: Video to be used for the video
          maxLength: 255
        size:
          type: number
          format: double
          description: Size of the video
        created_from_api:
          type: boolean
          description: Flow is created from api or not
        caption_setting:
          nullable: true
          description: >-
            Caption setting, default null and default caption setting will be
            used
        background_music_url:
          type: string
          format: uri
          nullable: true
          description: >-
            Background music URL for the video. Default is null, video will use
            random music.
          maxLength: 255
        background_music_volume:
          type: number
          format: double
          maximum: 1
          minimum: 0
          nullable: true
          description: >-
            Volume of the background music, ranging from 0.0 to 1.0. Default is
            null, video will use default music volume of visual_style.
        voiceover_volume:
          type: number
          format: double
          maximum: 1
          minimum: 0
          nullable: true
          description: >-
            Volume of the voiceover, ranging from 0.0 to 1.0. Default is null,
            video will use default voiceover volume of visual_style.
        webhook_url:
          type: string
          format: uri
          nullable: true
          description: Webhook URL for status updates. Default is null.
          maxLength: 200
        user:
          type: integer
          readOnly: true
          nullable: true
        workspace:
          type: string
          format: uuid
          readOnly: true
          nullable: true
        brand:
          type: string
          format: uuid
          nullable: true
      required:
        - created_at
        - credits_used
        - duration
        - editor_url
        - failed_reason
        - id
        - is_hidden
        - media_job
        - permission_type
        - preview
        - progress
        - status
        - updated_at
        - user
        - video_output
        - workspace
    EditingStyleEnum:
      enum:
        - film
        - geometric_gradient
        - glitch
        - glitter_gradient
        - paper
      type: string
      description: |-
        * `film` - Film
        * `geometric_gradient` - Geometric Gradient
        * `glitch` - Glitch
        * `glitter_gradient` - Glitter Gradient
        * `paper` - Paper
    Caption:
      type: object
      properties:
        style:
          allOf:
            - $ref: '#/components/schemas/Style0e1Enum'
          default: normal-black
          description: |-
            Caption style

            * `normal-black` - NORMAL_BLACK
            * `normal-white` - NORMAL_WHITE
            * `normal-red` - NORMAL_RED
            * `normal-blue` - NORMAL_BLUE
            * `neo` - NEO
            * `brick` - BRICK
            * `frenzy` - FRENZY
            * `verana` - VERANA
            * `mustard` - MUSTARD
            * `glow` - GLOW
            * `mint` - MINT
            * `coolers` - COOLERS
            * `bilo` - BILO
            * `toons` - TOONS
            * `deep-blue` - DEEP_BLUE
            * `mystique` - MYSTIQUE
            * `caution` - CAUTION
            * `duality` - DUALITY
            * `comic-shadow` - COMIC_SHADOW
            * `clean-bold` - CLEAN_BOLD
            * `soft-pill` - SOFT_PILL
            * `underline-bold` - UNDERLINE_BOLD
            * `classic-duo` - CLASSIC_DUO
            * `hand-script` - HAND_SCRIPT
            * `button-glow` - BUTTON_GLOW
            * `emboss-outline` - EMBOSS_OUTLINE
            * `standard-bold` - STANDARD_BOLD
            * `outlined-text` - OUTLINED_TEXT
            * `quiet-serif` - QUIET_SERIF
            * `editorial-clean` - EDITORIAL_CLEAN
            * `shout-block` - SHOUT_BLOCK
            * `word-flash` - WORD_FLASH
            * `promo-punch` - PROMO_PUNCH
            * `light-word` - LIGHT_WORD
            * `tagline-bold` - TAGLINE_BOLD
            * `glow-speak` - GLOW_SPEAK
            * `black-block` - BLACK_BLOCK
            * `zoom-punch` - ZOOM_PUNCH
        offset:
          allOf:
            - $ref: '#/components/schemas/CaptionOffset'
          default:
            x: 0
            'y': 0.4
          description: Caption offset
        font_family:
          allOf:
            - $ref: '#/components/schemas/FontFamilyEnum'
          default: Montserrat
          description: |-
            Font family

            * `Montserrat` - Montserrat
            * `Jockey One` - JockeyOne
            * `Lilita One` - LilitaOne
            * `Mclaren` - Mclaren
            * `Corben` - Corben
            * `Dela Gothic One` - DelaGothicOne
            * `Comfortaa` - Comfortaa
            * `Luckiest Guy` - LuckiestGuy
            * `Quantico` - Quantico
            * `Poppins` - Poppins
        font_size:
          type: integer
          default: 70
          description: Font size
        font_style:
          nullable: true
          description: |-
            Font style

            * `font-bold` - BOLD
            * `italic` - ITALIC
            * `underline` - UNDERLINE
          oneOf:
            - $ref: '#/components/schemas/FontStyleEnum'
            - $ref: '#/components/schemas/NullEnum'
        background_color:
          type: string
          nullable: true
          description: >-
            Caption background color, hex color with an alpha channel:
            #RRGGBBAA.
        text_color:
          type: string
          nullable: true
          description: 'Caption text color, hex color with an alpha channel: #RRGGBBAA.'
        highlight_text_color:
          type: string
          nullable: true
          description: >-
            Caption highlight color for the word currently being spoken, hex
            color with an alpha channel: #RRGGBBAA.
        max_width:
          type: integer
          nullable: true
          description: Caption max width in px
        line_height:
          type: number
          format: double
          nullable: true
          description: Caption line height
        text_shadow:
          type: string
          nullable: true
          description: Caption text shadow
        hidden:
          type: boolean
          default: false
          description: Hide caption
        override_visual_style:
          type: boolean
          default: false
          description: >-
            If true, these caption settings will override the visual style's
            default caption settings. Only effective when visual_style is set.
    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
    PermissionTypeEnum:
      enum:
        - private
        - workspace
        - public
      type: string
      description: |-
        * `private` - Private
        * `workspace` - Workspace
        * `public` - Public
    AspectRatio338Enum:
      enum:
        - 9x16
        - 16x9
        - 1x1
      type: string
      description: |-
        * `9x16` -  9X16
        * `16x9` -  16X9
        * `1x1` -  1X1
    NullEnum:
      enum:
        - null
    Style0e1Enum:
      enum:
        - normal-black
        - normal-white
        - normal-red
        - normal-blue
        - neo
        - brick
        - frenzy
        - verana
        - mustard
        - glow
        - mint
        - coolers
        - bilo
        - toons
        - deep-blue
        - mystique
        - caution
        - duality
        - comic-shadow
        - clean-bold
        - soft-pill
        - underline-bold
        - classic-duo
        - hand-script
        - button-glow
        - emboss-outline
        - standard-bold
        - outlined-text
        - quiet-serif
        - editorial-clean
        - shout-block
        - word-flash
        - promo-punch
        - light-word
        - tagline-bold
        - glow-speak
        - black-block
        - zoom-punch
      type: string
      description: |-
        * `normal-black` - NORMAL_BLACK
        * `normal-white` - NORMAL_WHITE
        * `normal-red` - NORMAL_RED
        * `normal-blue` - NORMAL_BLUE
        * `neo` - NEO
        * `brick` - BRICK
        * `frenzy` - FRENZY
        * `verana` - VERANA
        * `mustard` - MUSTARD
        * `glow` - GLOW
        * `mint` - MINT
        * `coolers` - COOLERS
        * `bilo` - BILO
        * `toons` - TOONS
        * `deep-blue` - DEEP_BLUE
        * `mystique` - MYSTIQUE
        * `caution` - CAUTION
        * `duality` - DUALITY
        * `comic-shadow` - COMIC_SHADOW
        * `clean-bold` - CLEAN_BOLD
        * `soft-pill` - SOFT_PILL
        * `underline-bold` - UNDERLINE_BOLD
        * `classic-duo` - CLASSIC_DUO
        * `hand-script` - HAND_SCRIPT
        * `button-glow` - BUTTON_GLOW
        * `emboss-outline` - EMBOSS_OUTLINE
        * `standard-bold` - STANDARD_BOLD
        * `outlined-text` - OUTLINED_TEXT
        * `quiet-serif` - QUIET_SERIF
        * `editorial-clean` - EDITORIAL_CLEAN
        * `shout-block` - SHOUT_BLOCK
        * `word-flash` - WORD_FLASH
        * `promo-punch` - PROMO_PUNCH
        * `light-word` - LIGHT_WORD
        * `tagline-bold` - TAGLINE_BOLD
        * `glow-speak` - GLOW_SPEAK
        * `black-block` - BLACK_BLOCK
        * `zoom-punch` - ZOOM_PUNCH
    CaptionOffset:
      type: object
      properties:
        x:
          type: number
          format: double
          default: 0
          description: X offset for the caption.
        'y':
          type: number
          format: double
          default: 0.4
          description: Y offset for the caption.
    FontFamilyEnum:
      enum:
        - Montserrat
        - Jockey One
        - Lilita One
        - Mclaren
        - Corben
        - Dela Gothic One
        - Comfortaa
        - Luckiest Guy
        - Quantico
        - Poppins
      type: string
      description: |-
        * `Montserrat` - Montserrat
        * `Jockey One` - JockeyOne
        * `Lilita One` - LilitaOne
        * `Mclaren` - Mclaren
        * `Corben` - Corben
        * `Dela Gothic One` - DelaGothicOne
        * `Comfortaa` - Comfortaa
        * `Luckiest Guy` - LuckiestGuy
        * `Quantico` - Quantico
        * `Poppins` - Poppins
    FontStyleEnum:
      enum:
        - font-bold
        - italic
        - underline
      type: string
      description: |-
        * `font-bold` - BOLD
        * `italic` - ITALIC
        * `underline` - UNDERLINE
  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.

````