{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-s3/json-schema/amazon-s3-put-bucket-website-request-schema.json",
  "title": "PutBucketWebsiteRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-s3-website-api-openapi.yml#/components/schemas/PutBucketWebsiteRequest",
  "type": "object",
  "properties": {
    "Bucket": {
      "type": "string",
      "description": "The bucket name."
    },
    "ContentMD5": {
      "type": "string",
      "description": "The Base64 encoded 128-bit MD5 digest of the data. You must use this header as a message integrity check to verify that the request body was not corrupted in transit. For more information, see RFC 1864. For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically."
    },
    "ChecksumAlgorithm": {
      "type": "string",
      "enum": [
        "CRC32",
        "CRC32C",
        "SHA1",
        "SHA256",
        "CRC64NVME",
        "SHA512",
        "MD5",
        "XXHASH64",
        "XXHASH3",
        "XXHASH128"
      ],
      "description": "Indicates the algorithm used to create the checksum for the request when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding x-amz-checksum or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad Request. For more information, see Checking object integrity in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 ignores any provided ChecksumAlgorithm parameter."
    },
    "WebsiteConfiguration": {
      "$ref": "#/$defs/WebsiteConfiguration"
    },
    "ExpectedBucketOwner": {
      "type": "string",
      "description": "The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied)."
    }
  },
  "required": [
    "Bucket",
    "WebsiteConfiguration"
  ],
  "$defs": {
    "Condition": {
      "type": "object",
      "properties": {
        "HttpErrorCodeReturnedEquals": {
          "type": "string",
          "description": "The HTTP error code when the redirect is applied. In the event of an error, if the error code equals this value, then the specified redirect is applied. Required when parent element Condition is specified and sibling KeyPrefixEquals is not specified. If both are specified, then both must be true for the redirect to be applied."
        },
        "KeyPrefixEquals": {
          "type": "string",
          "description": "The object key name prefix when the redirect is applied. For example, to redirect requests for ExamplePage.html, the key prefix will be ExamplePage.html. To redirect request for all pages with the prefix docs/, the key prefix will be /docs, which identifies all objects in the docs/ folder. Required when the parent element Condition is specified and sibling HttpErrorCodeReturnedEquals is not specified. If both conditions are specified, both must be true for the redirect to be applied. Replacement must be made for object keys containing special characters (such as carriage returns) when using XM"
        }
      }
    },
    "ErrorDocument": {
      "type": "object",
      "properties": {
        "Key": {
          "type": "string",
          "description": "The object key name to use when a 4XX class error occurs. Replacement must be made for object keys containing special characters (such as carriage returns) when using XML requests. For more information, see XML related object key constraints."
        }
      },
      "required": [
        "Key"
      ]
    },
    "IndexDocument": {
      "type": "object",
      "properties": {
        "Suffix": {
          "type": "string",
          "description": "A suffix that is appended to a request that is for a directory on the website endpoint. (For example, if the suffix is index.html and you make a request to samplebucket/images/, the data that is returned will be for the object with the key name images/index.html.) The suffix must not be empty and must not include a slash character. Replacement must be made for object keys containing special characters (such as carriage returns) when using XML requests. For more information, see XML related object key constraints."
        }
      },
      "required": [
        "Suffix"
      ]
    },
    "Redirect": {
      "type": "object",
      "properties": {
        "HostName": {
          "type": "string",
          "description": "The host name to use in the redirect request."
        },
        "HttpRedirectCode": {
          "type": "string",
          "description": "The HTTP redirect code to use on the response. Not required if one of the siblings is present."
        },
        "Protocol": {
          "type": "string",
          "enum": [
            "http",
            "https"
          ],
          "description": "Protocol to use when redirecting requests. The default is the protocol that is used in the original request."
        },
        "ReplaceKeyPrefixWith": {
          "type": "string",
          "description": "The object key prefix to use in the redirect request. For example, to redirect requests for all pages with prefix docs/ (objects in the docs/ folder) to documents/, you can set a condition block with KeyPrefixEquals set to docs/ and in the Redirect set ReplaceKeyPrefixWith to /documents. Not required if one of the siblings is present. Can be present only if ReplaceKeyWith is not provided. Replacement must be made for object keys containing special characters (such as carriage returns) when using XML requests. For more information, see XML related object key constraints."
        },
        "ReplaceKeyWith": {
          "type": "string",
          "description": "The specific object key to use in the redirect request. For example, redirect request to error.html. Not required if one of the siblings is present. Can be present only if ReplaceKeyPrefixWith is not provided. Replacement must be made for object keys containing special characters (such as carriage returns) when using XML requests. For more information, see XML related object key constraints."
        }
      }
    },
    "RedirectAllRequestsTo": {
      "type": "object",
      "properties": {
        "HostName": {
          "type": "string",
          "description": "Name of the host where requests are redirected."
        },
        "Protocol": {
          "type": "string",
          "enum": [
            "http",
            "https"
          ],
          "description": "Protocol to use when redirecting requests. The default is the protocol that is used in the original request."
        }
      },
      "required": [
        "HostName"
      ]
    },
    "RoutingRule": {
      "type": "object",
      "properties": {
        "Condition": {
          "$ref": "#/$defs/Condition"
        },
        "Redirect": {
          "$ref": "#/$defs/Redirect"
        }
      },
      "required": [
        "Redirect"
      ]
    },
    "WebsiteConfiguration": {
      "type": "object",
      "properties": {
        "ErrorDocument": {
          "$ref": "#/$defs/ErrorDocument"
        },
        "IndexDocument": {
          "$ref": "#/$defs/IndexDocument"
        },
        "RedirectAllRequestsTo": {
          "$ref": "#/$defs/RedirectAllRequestsTo"
        },
        "RoutingRules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RoutingRule"
          },
          "description": "Rules that define when a redirect is applied and the redirect behavior."
        }
      }
    }
  }
}