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

# Create AI Script

> Generate AI-powered video script based on product information and requirements.
The script generation is asynchronous - use the returned task_id to check status.


Generate AI-powered video scripts based on product information. The AI will create multiple script variations optimized for your video duration.

## Example Usage

### Using Product ID

```bash theme={null}
curl --request POST \
  --url 'https://api.jogg.ai/v2/ai_scripts' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "language": "english",
    "video_length_seconds": "30",
    "script_style": "Storytime",
    "product_info": {
      "source_type": "id",
      "data": {
        "id": "NTQ0MTkzNjg"
      }
    }
  }'
```

### Using Product Details

```bash theme={null}
curl --request POST \
  --url 'https://api.jogg.ai/v2/ai_scripts' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "language": "english",
    "video_length_seconds": "30",
    "script_style": "Discovery",
    "product_info": {
      "source_type": "details",
      "data": {
    "name": "Amazing Smart Watch",
        "description": "A smartwatch with health tracking, fitness monitoring, and smart notifications"
      }
    },
    "target_audience": "Fitness enthusiasts and tech-savvy consumers"
  }'
```

## Related Guides

<CardGroup cols={2}>
  <Card title="AI Scripts Guide" href="/api-reference/v2/API Documentation/AIScripts">
    Learn the complete AI scripts workflow
  </Card>

  <Card title="Get Script Results" href="/api-reference/v2/Asset/GetAIScriptResult">
    Retrieve generated scripts
  </Card>
</CardGroup>


## OpenAPI

````yaml POST /v2/ai_scripts
openapi: 3.0.1
info:
  title: JoggAI OpenAPI v2
  description: >
    JoggAI OpenAPI v2 provides a comprehensive suite of endpoints for creating
    and managing AI-powered video content.


    ## Authentication

    All API requests require authentication using an API key provided in the
    `x-api-key` header.


    ## Base URL

    Production: https://api.jogg.ai/v2


    ## Rate Limiting

    API calls are subject to rate limiting based on your subscription plan.


    ## Error Handling

    All endpoints return standard HTTP status codes along with detailed error
    messages in the response body.
  version: 2.0.0
  license:
    name: MIT
servers:
  - url: https://api.jogg.ai
    description: Production server
security:
  - apiKeyAuth: []
tags:
  - name: Video
    description: Video creation and management operations
  - name: Avatar
    description: Avatar management and creation operations
  - name: Voice
    description: Voice and timbre management operations
  - name: Asset
    description: Asset management including music, scripts, and uploads
  - name: Template
    description: Template management operations
  - name: Product
    description: Product management operations
  - name: User
    description: User account operations
  - name: Webhook
    description: Webhook endpoint management for event notifications
paths:
  /v2/ai_scripts:
    post:
      tags:
        - Asset
      summary: Submit AI script generation request
      description: >
        Generate AI-powered video script based on product information and
        requirements.

        The script generation is asynchronous - use the returned task_id to
        check status.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - language
                - video_length_seconds
                - script_style
                - product_info
              properties:
                language:
                  type: string
                  description: Script generation language
                  enum:
                    - english
                    - filipino
                    - french
                    - german
                    - hindi
                    - indonesian
                    - italian
                    - japanese
                    - korean
                    - malay
                    - portuguese
                    - russian
                    - spanish
                    - thai
                    - vietnamese
                    - arabic
                    - greek
                    - turkish
                    - slovenian
                    - croatian
                    - romanian
                    - chinese
                    - bengali
                    - urdu
                    - hungarian
                    - traditional-chinese
                    - polish
                    - cantonese
                    - danish
                    - malayalam
                    - tamil
                    - telugu
                    - czech
                    - hebrew
                    - zulu
                    - swedish
                    - lithuanian
                    - dutch
                    - flemish
                    - norwegian
                    - finnish
                    - bulgarian
                    - latvian
                    - ukrainian
                    - mongolian
                    - persian
                    - odia
                    - assamese
                    - kannada
                    - tagalog
                    - amharic
                    - serbian
                    - slovak
                    - swahili
                  example: english
                video_length_seconds:
                  type: string
                  description: Desired video length in seconds
                  enum:
                    - '15'
                    - '30'
                    - '60'
                  example: '30'
                script_style:
                  type: string
                  description: |
                    Script writing style for video content:
                    * Don't Worry - Casual and reassuring tone
                    * Storytime - Narrative and engaging storytelling approach
                    * Discovery - Exploratory and revealing style
                    * Data - Fact-based and analytical presentation
                    * Top 3 reasons - List-based persuasive format
                    * Light marketing - Soft-sell marketing approach
                  enum:
                    - Don't Worry
                    - Storytime
                    - Discovery
                    - Data
                    - Top 3 reasons
                    - Light marketing
                  example: Storytime
                product_info:
                  type: object
                  description: Product information for script generation
                  required:
                    - source_type
                    - data
                  properties:
                    source_type:
                      type: string
                      description: |
                        Source type of product information:
                        * id - Use product ID from product creation endpoint
                        * details - Provide product details directly
                      enum:
                        - id
                        - details
                      example: id
                    data:
                      type: object
                      description: Product data based on source_type
                      properties:
                        id:
                          type: string
                          description: Product ID (required when source_type is 'id')
                          example: NTQ0MTkzNjg
                        name:
                          type: string
                          description: >-
                            Product name (required when source_type is
                            'details')
                          example: Owala FreeSip Insulated Stainless Steel Water Bottle
                        description:
                          type: string
                          description: >-
                            Product description and selling points (required
                            when source_type is 'details')
                          example: >-
                            The Owala FreeSip bottle is perfect for active
                            lifestyles...
                target_audience:
                  type: string
                  description: Target audience for the product (optional)
                  example: Fitness enthusiasts and outdoor adventurers
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/BaseResponse'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          task_id:
                            type: string
                            description: Task ID to check script generation status
                            example: task_123456789
components:
  schemas:
    BaseResponse:
      type: object
      required:
        - code
        - msg
      properties:
        code:
          type: integer
          description: |
            Business status code:
            * 0 - Success
            * 10104 - Record not found
            * 10105 - Invalid API key
            * 18020 - Insufficient credit
            * 18025 - No permission to call APIs
            * 40000 - Parameter error
            * 50000 - System error
          example: 0
        msg:
          type: string
          description: Response message
          example: Success
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication. Obtain your key from the JoggAI dashboard.

````