object-storage-2

Create static website configuration

Creates a new static website hosting configuration for a domain.

post/1.3/object-storage-2/{service-uuid}/static-websites

Request

  • Base URL: https://api.upcloud.com
  • URL: https://api.upcloud.com/1.3/object-storage-2/{service-uuid}/static-websites
  • Auth: HTTP bearer

Path parameters

service-uuidstring uuid required

The unique identifier for the service.

Example:01234567-89ab-cdef-0123-456789abcdef

Service UUID

Request body

domain_namestring

Custom domain to use for static website hosting. Must be a custom domain attached to the service. If omitted, the primary static website domain is used.

bucket_namestring required

Name of the S3/ECS bucket containing the website content. Only alphanumerics, dots, hyphens, and underscores are allowed.

bucket_prefixstring

Optional prefix/subfolder within the bucket. Only alphanumerics, slashes, dots, hyphens, and underscores are allowed.

index_documentstring

Default document for directories. Only alphanumerics, slashes, dots, hyphens, and underscores are allowed.

spa_modeboolean nullable

Enable Single Page Application (SPA) mode. When enabled, all non-file routes serve the index document, allowing client-side routing to handle the URL. Essential for React, Vue, Next.js, and similar frameworks.

enabledboolean

Whether the static website configuration should be active. Defaults to true if not specified.

Example request

{
  "domain_name": "www.example.com",
  "bucket_name": "my-website",
  "bucket_prefix": "v2/",
  "index_document": "index.html",
  "enabled": true,
  "error_pages": [
    {
      "status_code": 404,
      "error_document": "errors/404.html"
    },
    {
      "status_range": {
        "start": 500,
        "end": 599
      },
      "error_document": "errors/5xx.html"
    }
  ]
}

Response

Created

domain_namestring required

The domain this configuration applies to

bucket_namestring required

Name of the S3/ECS bucket containing the website content. Only alphanumerics, dots, hyphens, and underscores are allowed.

bucket_prefixstring required

Optional prefix/subfolder within the bucket. Only alphanumerics, slashes, dots, hyphens, and underscores are allowed.

index_documentstring required

Default document for directories. Only alphanumerics, slashes, dots, hyphens, and underscores are allowed.

spa_modeboolean

Enable Single Page Application (SPA) mode. When enabled, all non-file routes serve the index document, allowing client-side routing to handle the URL. Essential for React, Vue, Next.js, and similar frameworks.

enabledboolean required

Whether the static website configuration is currently active

created_atstring date-time required

Timestamp when this configuration was created

updated_atstring date-time required

Timestamp when this configuration was last updated

Example response

{
  "domain_name": "abc123-static.upbucket.example.com",
  "bucket_name": "my-website",
  "bucket_prefix": "v2/",
  "index_document": "index.html",
  "spa_mode": true,
  "error_pages": [
    {
      "status_code": 403,
      "error_document": "errors/403.html"
    },
    {
      "status_code": 404,
      "error_document": "errors/404.html"
    },
    {
      "status_range": {
        "start": 400,
        "end": 499
      },
      "error_document": "errors/4xx.html"
    }
  ],
  "enabled": true,
  "created_at": "2025-10-28T10:00:00Z",
  "updated_at": "2025-10-28T12:00:00Z"
}

Changes

No recorded changes to this operation across all 1 revision of this API.