LogoFreestyle
API Reference/Deprecated

Deploy a Website (v1)

Deploy a website. Files is a map of file paths to file contents. Configuration is optional and contains additional information about the deployment.

POST/web/v1/deploy

Request Body

application/jsonRequired
filesRequiredobject

The files to deploy, a map of file paths to file contents, e.g. { "index.js": {"content": "your main", "encoding": "utf-8"}, "file2.js": {"content": "your helper" } }

Do not include node modules in this bundle, they will not work. Instead, includes a package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock, the node modules for the project will be installed from that lock file, or use the node_modules field in the configuration to specify the node modules to install.

configobject
curl -X POST "https://api.freestyle.sh/web/v1/deploy" \
  -H "Content-Type: application/json" \
  -d '{
    "files": {
      "index.js": {
        "content": "import http from \'node:http\';\\n// import { resolver } from \'./file2.js\';\\n\\nconsole.log(\'starting server\');\\n\\nconst server = http.createServer(async(req, res) => {\\n  // wait 5 seconds before responding\\n  // await new Promise((resolve) => setTimeout(resolve, 5000));\\n  res.writeHead(200, { \'Content-Type\': \'text/plain\' });\\n  res.end(\'Welcome to New York its been waiting for you\');\\n});\\n\\nserver.listen(3000, () => {\\n  console.log(\'Server is running at http://localhost:3000\');\\n});"
      }
    },
    "config": {
      "entrypoint": "index.js",
      "domains": [
        "subdomain.yourdomain.com"
      ],
      "projectId": null,
      "nodeModules": {
        "resend": "4.0.1"
      },
      "envVars": {
        "RESEND_API_KEY": "re_123456789"
      },
      "serverStartCheck": false,
      "networkPermissions": null,
      "build": null,
      "timeout": "15"
    }
  }'

successfully deployed

{
  "deploymentId": "string",
  "projectId": "string",
  "domains": [
    "string"
  ],
  "entrypoint": "string"
}