Appearance
Website Hosting API Reference
All endpoints require authentication via Bearer token or Cognito JWT.
Base URL: https://api.universalapi.co
List Files
List files and folders in your site storage.
GET /website/list?prefix={prefix}Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
prefix | string | No | Folder path to list (e.g., css/ or images/) |
Response:
json
{
"data": {
"files": [
{
"key": "index.html",
"fileName": "index.html",
"size": 1234,
"lastModified": "2026-01-15T10:30:00Z",
"type": "file"
}
],
"folders": [
{
"key": "css/",
"fileName": "css",
"type": "folder"
}
],
"prefix": "",
"storageUsedMb": 0.5,
"storageQuotaMb": 50,
"tier": "free"
}
}Upload File (Direct)
Upload a file directly in the request body. Max 5 MB.
POST /website/uploadRequest Body:
json
{
"fileName": "index.html",
"content": "<html><body><h1>Hello!</h1></body></html>",
"contentType": "text/html",
"folder": "",
"encoding": "text"
}| Field | Type | Required | Description |
|---|---|---|---|
fileName | string | Yes | File name |
content | string | Yes | File content (text or base64) |
contentType | string | No | MIME type (default: text/html) |
folder | string | No | Target folder path |
encoding | string | No | text (default) or base64 |
Response:
json
{
"data": {
"message": "File uploaded successfully",
"key": "index.html",
"size": 42,
"contentType": "text/html",
"url": "https://site.universalapi.co/your-alias/index.html"
}
}Get Upload URL (Presigned)
Get a presigned PUT URL for uploading larger files. Max 25 MB.
POST /website/upload-urlRequest Body:
json
{
"fileName": "logo.png",
"contentType": "image/png",
"folder": "images"
}Response:
json
{
"data": {
"uploadUrl": "https://site.universalapi.co.s3.amazonaws.com/...",
"key": "images/logo.png",
"contentType": "image/png",
"expiresIn": 3600,
"maxSize": 26214400,
"siteUrl": "https://site.universalapi.co/your-alias/images/logo.png"
}
}Then upload using the presigned URL:
bash
curl -X PUT "PRESIGNED_URL" \
-H "Content-Type: image/png" \
--data-binary @logo.pngGet Download URL
Get a presigned GET URL for downloading a file.
POST /website/download-urlRequest Body:
json
{
"key": "images/logo.png"
}Delete File
POST /website/deleteRequest Body:
json
{
"key": "old-page.html"
}Delete Folder
Delete a folder and all its contents.
POST /website/delete-folderRequest Body:
json
{
"folder": "old-section"
}Create Folder
POST /website/create-folderRequest Body:
json
{
"folder": "blog",
"parent": ""
}Get Usage
Get storage usage statistics.
GET /website/usageResponse:
json
{
"data": {
"storageUsedMb": 12.5,
"storageQuotaMb": 1024,
"percentUsed": 1.2,
"tier": "starter"
}
}Get Site Info
Get your site URL, status, and summary.
GET /website/infoResponse:
json
{
"data": {
"siteUrl": "https://site.universalapi.co/your-alias/",
"alias": "your-alias",
"hasIndexHtml": true,
"fileCount": 15,
"storageUsedMb": 2.3,
"status": "published"
}
}Status values:
published— Alias exists andindex.htmlis presentnot_published— Missing alias or noindex.html
Invalidate Cache
Invalidate the CloudFront CDN cache so updated files are served immediately. By default invalidates all paths (/*). You can optionally specify specific paths.
CloudFront invalidations typically take 1-2 minutes to complete. The first 1,000 invalidation paths per month are free; additional paths cost $0.005 each.
POST /website/invalidateRequest Body:
json
{
"paths": ["/*"]
}| Field | Type | Required | Description |
|---|---|---|---|
paths | string[] | No | Array of paths to invalidate. Defaults to ["/*"] (all files). Examples: ["/index.html"], ["/css/*", "/js/*"] |
Response:
json
{
"data": {
"invalidationId": "I3EXAMPLE",
"status": "InProgress",
"paths": ["/*"]
}
}Error Responses
json
{
"error": "Storage quota exceeded. Used: 49.5 MB, Quota: 50 MB (free tier)"
}| Status | Description |
|---|---|
| 400 | Bad request (missing required fields) |
| 401 | Authentication required |
| 403 | Storage quota exceeded |
| 404 | File or route not found |
| 500 | Internal server error |