How to Generate Sites with AI

Create an AI Generated site with Duda's Async APIs

Duda's AI Site Generation API allows you to create a complete website automatically using our AI capabilities. This feature allows Duda partners to create websites programmatically, without needing to use the AI builder interface. The API creates sites based on the business information, theme details, and content requirements you provide.

The AI site generation process uses an asynchronous workflow. This means you submit an initial request and receive a response with a task ID. Then, you periodically check the status until the site generation is complete.

1. Submit a Generation Request

Send business data and design preferences to the Generate Site via AI endpoint

curl --request POST \
     --url https://api.duda.co/api/async-tasks/generate-site-with-ai \
     --header 'Authorization: Basic abcd1234' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
    "additional_ai_context": {
        "max_pages": 10
    },
    "business_data": {
        "category": "string",
        "data_controller": "string",
        "description": "string",
        "logo_url": "string",
        "name": "string",
        "service_area": "string",
        "tone_of_voice": "CONVERSATIONAL"
    },
    "default_domain_prefix": "string",
    "do_not_gen_ssl": true,
    "labels": [
        {
            "name": "string"
        }
    ],
    "lang": "string",
    "migration_params": {
        "addWidgetIdentifier": true,
        "disable_image_compress": true,
        "disable_multisize_images": true,
        "headers": {
            "additionalProp1": "string",
            "additionalProp2": "string",
            "additionalProp3": "string"
        },
        "migrateHomePageOnly": true,
        "skip_image_upload": true,
        "source_platform": "string",
        "useMocks": true
    },
    "site_data": {
        "account_name": "string",
        "editor": "SIMPLE",
        "external_uid": "string",
        "google_tracking_id": "string",
        "googletagmanager_container_id": [
            "string"
        ],
        "piwik_id": "string",
        "removeBizInfos": true,
        "schemas": {
            "local_business": {
                "enabled": true,
                "missing_recommended_fields": [
                    "string"
                ],
                "missing_required_fields": [
                    "string"
                ],
                "status": "string"
            }
        },
        "site_alternate_domains": {
            "domains": [
                "string"
            ],
            "is_redirect": true
        },
        "site_business_info": {
            "address": {
                "city": "string",
                "country": "string",
                "state": "string",
                "street": "string",
                "zip_code": "string"
            },
            "agendize_info": {
                "account_id": "string",
                "company_id": "string"
            },
            "business_name": "string",
            "email": "string",
            "opentable_info": [
                {
                    "country": "string",
                    "location": "string",
                    "restaurant_id": "string"
                }
            ],
            "phone_number": "string"
        },
        "site_domain": "string",
        "site_seo": {
            "description": "string",
            "no_index": true,
            "og_image": "string",
            "title": "string"
        }
    },
    "template_id": 0,
    "theme": {
        "colors": [
            {
                "id": "string",
                "label": "string",
                "value": "string"
            }
        ],
        "text": {
            "default": {
                "breakpoints": {
                    "mobile": {
                        "font_size": "string"
                    },
                    "tablet": {
                        "font_size": "string"
                    }
                },
                "color": "string",
                "font_family": "string",
                "font_size": "string",
                "font_style": "string",
                "font_weight": "string",
                "letter_spacing": "string",
                "line_height": "string",
                "text_decoration": "string",
                "text_direction": "string",
                "text_transform": "string"
            },
            "h1": {
                "breakpoints": {
                    "mobile": {
                        "font_size": "string"
                    },
                    "tablet": {
                        "font_size": "string"
                    }
                },
                "color": "string",
                "font_family": "string",
                "font_size": "string",
                "font_style": "string",
                "font_weight": "string",
                "letter_spacing": "string",
                "line_height": "string",
                "text_decoration": "string",
                "text_direction": "string",
                "text_transform": "string"
            },
            "h2": {
                "breakpoints": {
                    "mobile": {
                        "font_size": "string"
                    },
                    "tablet": {
                        "font_size": "string"
                    }
                },
                "color": "string",
                "font_family": "string",
                "font_size": "string",
                "font_style": "string",
                "font_weight": "string",
                "letter_spacing": "string",
                "line_height": "string",
                "text_decoration": "string",
                "text_direction": "string",
                "text_transform": "string"
            },
            "h3": {
                "breakpoints": {
                    "mobile": {
                        "font_size": "string"
                    },
                    "tablet": {
                        "font_size": "string"
                    }
                },
                "color": "string",
                "font_family": "string",
                "font_size": "string",
                "font_style": "string",
                "font_weight": "string",
                "letter_spacing": "string",
                "line_height": "string",
                "text_decoration": "string",
                "text_direction": "string",
                "text_transform": "string"
            },
            "h4": {
                "breakpoints": {
                    "mobile": {
                        "font_size": "string"
                    },
                    "tablet": {
                        "font_size": "string"
                    }
                },
                "color": "string",
                "font_family": "string",
                "font_size": "string",
                "font_style": "string",
                "font_weight": "string",
                "letter_spacing": "string",
                "line_height": "string",
                "text_decoration": "string",
                "text_direction": "string",
                "text_transform": "string"
            },
            "h5": {
                "breakpoints": {
                    "mobile": {
                        "font_size": "string"
                    },
                    "tablet": {
                        "font_size": "string"
                    }
                },
                "color": "string",
                "font_family": "string",
                "font_size": "string",
                "font_style": "string",
                "font_weight": "string",
                "letter_spacing": "string",
                "line_height": "string",
                "text_decoration": "string",
                "text_direction": "string",
                "text_transform": "string"
            },
            "h6": {
                "breakpoints": {
                    "mobile": {
                        "font_size": "string"
                    },
                    "tablet": {
                        "font_size": "string"
                    }
                },
                "color": "string",
                "font_family": "string",
                "font_size": "string",
                "font_style": "string",
                "font_weight": "string",
                "letter_spacing": "string",
                "line_height": "string",
                "text_decoration": "string",
                "text_direction": "string",
                "text_transform": "string"
            },
            "paragraph": {
                "breakpoints": {
                    "mobile": {
                        "font_size": "string"
                    },
                    "tablet": {
                        "font_size": "string"
                    }
                },
                "color": "string",
                "font_family": "string",
                "font_size": "string",
                "font_style": "string",
                "font_weight": "string",
                "letter_spacing": "string",
                "line_height": "string",
                "text_decoration": "string",
                "text_direction": "string",
                "text_transform": "string"
            }
        }
    },
    "url": "string"
}
'

2. Receive a Task ID

Receive a response with a unique task ID.

{
    "id": "5019ca5cf37140f5b4cebd95c8abc5da",
    "type": "GENERATE_SITE_WITH_AI",
    "status": "IN_PROGRESS"
}

Data

Description

id string

Unique identifier of the async task.

type enum

Type of task: GENERATE_SITE_WITH_AI

status enum

Status of task: CREATED, IN_PROGRESS, COMPLETED or FAILED

3. Monitor Task Progress

Use the task ID returned from the response in Step 2 to check the current status of the task.

curl --request GET \
     --url https://api.duda.co/api/async-tasks/5019ca5cf37140f5b4cebd95c8abc5da \
     --header 'Authorization: Basic 1234abcd' \
     --header 'accept: application/json'

The API returns a task object for tracking the generation progress:

In Progress Result

{
    "id": "5019ca5cf37140f5b4cebd95c8abc5da",
    "type": "GENERATE_SITE_WITH_AI",
    "status": "IN_PROGRESS",
    "created_at": "2025-08-15T20:10:45"
}

Data

Description

id string

Unique identifier of the async task.

type enum

Type of task: GENERATE_SITE_WITH_AI

status enum

Status of task: CREATED, IN_PROGRESS, COMPLETED or FAILED

result object

If status is COMPLETED, contains site_name with unique identifier of site created.

error object

If status is FAILED, contains message regarding failed site creation.

created_at date

Date and timestamp of when the task was created.

finished_at date

Date and timestamp of when task was marked COMPLETED or FAILED

4. Repeat the Process Until the Task is Finished

Check the task status endpoint every few seconds, keeping in mind Duda's rate limits. The task is complete once status is marked as COMPLETED or FAILED and a finished_at date is returned.

Complete Result

Once status is marked as COMPLETED, the result object will contain a site_name for the newly generated website.

{
    "id": "5019ca5cf37140f5b4cebd95c8abc5da",
    "type": "GENERATE_SITE_WITH_AI",
    "status": "COMPLETED",
    "created_at": "2025-08-15T20:21:35",
    "finished_at": "2025-08-15T20:22:10",
    "result": {
        "site_name": "806ed191"
    }
}

Failed Result

If a status is marked as FAILED, the error object will contain a message within the response.

{
    "id": "44ecc2af351d45efb42cf9538aa173da",
    "type": "GENERATE_SITE_WITH_AI",
    "status": "FAILED",
    "created_at": "2025-08-15T20:07:33",
    "finished_at": "2025-08-15T20:07:34",
    "error": {
        "message": "Failed to generate site"
    }
}