Create a site from a prompt
create_site
Creates a new site in a workspace and starts building it from your prompt straight away.
This spends AI credits from the workspace. Describe the whole site you want in the prompt, the way you would brief a developer.
It returns the new site as project and a jobId, and you follow the build by polling get_job with that jobId, which needs chat:read. Creating a site provisions real infrastructure, so it can take a while.
A refusal comes back as an error carrying the reason: credits-limit-reached when the workspace has no AI credits left, or site-limit-reached with the current count and limit when the plan has no site slot left. Archived sites count toward that limit too.
To rebuild an existing website instead of starting from nothing, pass importSource with SourceUrl set to the page to work from. The prompt still applies, so say what should change in the rebuild rather than repeating the address. To build from a GitHub repository, set Source to github with Owner and Repo, and optionally Branch, keeping the repository address in SourceUrl. A private repository is read only when its GitHub account is connected and verified in the same workspace, and anything else is refused as unreadable, exactly like a repository that does not exist, as Import from GitHub describes. See Create a project.
To keep the code in your own GitHub from the start, pass repository with the installationId of a verified account from list_github_accounts. It needs a paid plan. Modulify copies the new site's code there before the build starts, and the site exists only once that copy has worked: a refusal or a failed copy comes back as an error and no site is created. Without existing, Modulify creates a new private repository, in an organisation or in a personal account whose list_github_accounts row has Granted_At, named repositoryName or, when that is left out, after the subdomain of the site. When the account already has a repository with that name, Modulify adds a dash and the last 6 characters of the site _id, so my-site becomes something like my-site-3f9a2c. With existing set to true, the code goes into a repository the account already has, in an organisation or a personal account, and every branch and tag already in it is deleted and replaced, which Modulify cannot bring back. That repository has to be one the Modulify app can reach, not archived, without protected branches and not already holding another Modulify site, and replacing it also needs the Transfer projects permission and the code:write scope, the same as move_site_code_to_github. See Keep the code in your GitHub.
Request
Call it with a POST to https://api.modulify.ai/v1/create_site, sending the inputs below as a JSON object. The token needs the sites:create scope.
It makes changes, so send an Idempotency-Key header whenever you might retry it. A retry with the same key gets the first answer back instead of running again.
curl -X POST https://api.modulify.ai/v1/create_site \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"workspaceId":"WORKSPACE_ID","prompt":"PROMPT"}'Over MCP, the same method is the create_site tool.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
workspaceId |
string | Yes | The workspace to create the site in. |
prompt |
string | Yes | What the site should be. Be specific about pages, content and style, in at most 500,000 characters. |
mode |
string | No | build, where the agent builds the site straight away, or plan, where it proposes a plan for you to approve first. Defaults to build, and any other value is refused. |
importSource |
object | No | The existing website to rebuild. SourceUrl is the page to work from, and without it the whole import is ignored and you get a plain prompt build. Source names the platform, one of shopify, webflow, wordpress, github or unknown, Name is the business name, which the new site starts with until the build names it, Origin is the site root when SourceUrl is a deeper page, and Owner, Repo and Branch name a GitHub repository. |
repository |
object | No | Where the code goes when it should live in your GitHub. installationId is the _id of a verified account from list_github_accounts. repositoryName is the name of the new repository, or, with existing set to true, of the repository you already have whose branches and tags the site replaces. |
Response
Every call answers with the JSON envelope of success, message, data, code and version. data holds the result described above, and on a method that returns a total, count carries it. The response headers carry the call's X-Request-Id and what is left of your per-minute budget in X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Errors explains every status code a call can answer with.