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:
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 coordinatepositionY(optional): Canvas Y coordinate
201 Created
400 Bad Request: Invalid bucket name or missing required fields401 Unauthorized: Missing or invalid authentication token403 Forbidden: Access denied404 Not Found: Project or environment not found409 Conflict: Bucket name already exists in database500 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
200 OK
400 Bad Request: Invalid website ID401 Unauthorized: Missing or invalid authentication token403 Forbidden: Access denied404 Not Found: Static website not found
Delete Static Website
Path:DELETE /api/:projectSlug/:environmentSlug/resources/:resourceIdUse 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.
Static Website Configuration
When a static website is created, the following AWS S3 configurations are automatically applied:- Static Website Hosting: Enabled with
index.htmlas the index document anderror.htmlas the error document - Public Access Block: Disabled (all public access settings set to
false) - Bucket Policy: Allows public read access to all objects:
- 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