Skip to main content

Static Websites API

Static websites are S3 buckets configured for static website hosting with public access enabled. They automatically have:
  • Static website hosting enabled
  • Public access block disabled
  • Bucket policy allowing public read access
  • CORS configuration for cross-origin requests

Base URL

All endpoints are prefixed with /api/:projectSlug/:environmentSlug/static-websites

Endpoints

Create Static Website

Create a new static website (S3 bucket with static website hosting enabled). Endpoint: POST /api/:projectSlug/:environmentSlug/static-websites Authentication: Required Request Body:
Parameters:
  • name (required): Static website name (used as bucket name). Any valid name — no domain format required. Validation depends on provider:
    • AWS: 3–63 characters, lowercase letters, numbers, hyphens, periods. Must begin and end with letter or number.
    • Azure: 3–24 characters. Letters, numbers, hyphens (hyphens are stripped for Storage Account).
    • GCP: 3–63 characters, lowercase letters, numbers, hyphens, underscores, periods. Must meet GCS bucket naming rules.
  • region (optional): Region (defaults to connection region)
  • positionX (optional): Canvas X coordinate
  • positionY (optional): Canvas Y coordinate
Response: 201 Created
Note: If a bucket with the same name already exists in AWS and is owned by you, it will be imported instead of creating a new one. Error Responses:
  • 400 Bad Request: Invalid bucket name or missing required fields
  • 401 Unauthorized: Missing or invalid authentication token
  • 403 Forbidden: Access denied
  • 404 Not Found: Project or environment not found
  • 409 Conflict: Bucket name already exists in database
  • 500 Internal Server Error: Server error

List Static Websites

List all static websites for a project environment. Endpoint: GET /api/:projectSlug/:environmentSlug/static-websites Authentication: Required Response: 200 OK

Get Static Website Details

Get details of a specific static website. Endpoint: GET /api/:projectSlug/:environmentSlug/static-websites/:websiteId Authentication: Required Parameters:
  • websiteId (path parameter): Static website database ID
Response: 200 OK
Error Responses:
  • 400 Bad Request: Invalid website ID
  • 401 Unauthorized: Missing or invalid authentication token
  • 403 Forbidden: Access denied
  • 404 Not Found: Static website not found

Delete Static Website

Path: DELETE /api/:projectSlug/:environmentSlug/resources/:resourceId
Use the static website’s database ID as resourceId. See Resources API — Delete Resource by ID. All resource types (including static websites) are deleted via this unified path.
Query parameter: deleteFromCloud (optional)
  • true (default): Delete the bucket from the cloud (S3/GCS/Azure), remove resource connections, then soft-delete the resource. The bucket must be empty.
  • false: Only remove the resource from the database (and its resource connections). The bucket is not deleted from the cloud.
Example (delete from cloud, default):
Example (remove from database only):

Static Website Configuration

When a static website is created, the following AWS S3 configurations are automatically applied:
  1. Static Website Hosting: Enabled with index.html as the index document and error.html as the error document
  2. Public Access Block: Disabled (all public access settings set to false)
  3. Bucket Policy: Allows public read access to all objects:
  4. CORS Configuration: Allows GET requests from any origin:

Website URL Format

The static website URL follows this format:
  • us-east-1: http://{bucket-name}.s3-website-us-east-1.amazonaws.com
  • Other regions: http://{bucket-name}.s3-website.{region}.amazonaws.com

Integration with Resources API

Static websites are included in the unified resources API:
  • List all resources: GET /api/:projectSlug/:environmentSlug/resources?type=all
  • List static websites only: GET /api/:projectSlug/:environmentSlug/resources?type=static_websites
  • Get static website details: GET /api/:projectSlug/:environmentSlug/resources/static_website/:websiteId

Resource Connections

Static websites can be connected to other resources using the resource connections API:
  • Create connection: POST /api/:projectSlug/:environmentSlug/resource-connections
  • List connections: GET /api/:projectSlug/:environmentSlug/resource-connections
Example: Connect a static website to an application resource.