Skip to content

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:

ParameterTypeRequiredDescription
prefixstringNoFolder 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/upload

Request Body:

json
{
  "fileName": "index.html",
  "content": "<html><body><h1>Hello!</h1></body></html>",
  "contentType": "text/html",
  "folder": "",
  "encoding": "text"
}
FieldTypeRequiredDescription
fileNamestringYesFile name
contentstringYesFile content (text or base64)
contentTypestringNoMIME type (default: text/html)
folderstringNoTarget folder path
encodingstringNotext (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-url

Request 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.png

Get Download URL

Get a presigned GET URL for downloading a file.

POST /website/download-url

Request Body:

json
{
  "key": "images/logo.png"
}

Delete File

POST /website/delete

Request Body:

json
{
  "key": "old-page.html"
}

Delete Folder

Delete a folder and all its contents.

POST /website/delete-folder

Request Body:

json
{
  "folder": "old-section"
}

Create Folder

POST /website/create-folder

Request Body:

json
{
  "folder": "blog",
  "parent": ""
}

Get Usage

Get storage usage statistics.

GET /website/usage

Response:

json
{
  "data": {
    "storageUsedMb": 12.5,
    "storageQuotaMb": 1024,
    "percentUsed": 1.2,
    "tier": "starter"
  }
}

Get Site Info

Get your site URL, status, and summary.

GET /website/info

Response:

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 and index.html is present
  • not_published — Missing alias or no index.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/invalidate

Request Body:

json
{
  "paths": ["/*"]
}
FieldTypeRequiredDescription
pathsstring[]NoArray 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)"
}
StatusDescription
400Bad request (missing required fields)
401Authentication required
403Storage quota exceeded
404File or route not found
500Internal server error

Universal API - The agentic entry point to the universe of APIs