> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/api-reference/storage-and-backup/ionos-object-storage/ionos-object-storage-for-contract-owned-buckets/cors.md).

# CORS

Cross Origin Resource Sharing Configuration

## GetBucketCors

> Returns the cors configuration information set for the bucket.\
> To use this operation, you must have permission to perform the GetBucketCORS operation. By default, the bucket owner has this permission and can grant it to others.\
> \#### S3 API Compatibility - The \`x-amz-expected-bucket-owner\` header isn't supported.

```json
{"openapi":"3.0.3","info":{"title":"IONOS CLOUD Object Storage API for contract-owned buckets","version":"2.0.4"},"tags":[{"name":"CORS","description":"Cross Origin Resource Sharing Configuration"}],"servers":[{"url":"https://s3.eu-central-3.ionoscloud.com","description":"The endpoint for the `eu-central-3` region (Berlin, Germany)"},{"url":"https://s3.eu-central-4.ionoscloud.com","description":"The endpoint for the `eu-central-4` region (Frankfurt, Germany)"},{"url":"https://s3.us-central-1.ionoscloud.com","description":"The endpoint for the `us-central-1` region (Lenexa, USA)"}],"security":[{"hmac":[]}],"components":{"securitySchemes":{"hmac":{"type":"apiKey","name":"Authorization","in":"header","description":"IONOS CLOUD Object Storage API requests are authenticated using the AWS signature. \nThe IONOS CLOUD Object Storage API authenticates users using a customized HTTP scheme based on a [keyed-HMAC](https://en.wikipedia.org/wiki/HMAC) (Hash Message Authentication Code).\nThe process of generating the proper Authorization header is somewhat involved. We recommend that you make use of a tool such as Postman.\n\nIn the **Authorization** tab for a request, select **AWS Signature** from the **Type** dropdown list.\nSpecify where Postman should append your authorization data using the **Add authorization data to** drop-down menu.\n\n* If you select **Request Headers**, Postman populates the **Headers** tab with Authorization and `X-Amz-` prefixed fields.\n\n* If you select **Request URL**, Postman populates the **Params** tab with authentication details prefixed with `X-Amz-`.\n\n\n**Note:** The parameters listed below contain confidential information. We recommend using variables to keep this data secure while working in a collaborative environment.\n\n* For **Access Key**, enter your `access key` directly in the fields or through variables for added security.\n\n* For **Secret Key**, enter your `secret key` directly in the fields or through variables for added security.\n\nAdvanced fields are optional, but Postman will attempt to generate them automatically if necessary.\n* For **AWS Region**, enter one of the [regions](#section/Endpoints) (`eu-central-3`) where your bucket is hosted.\n\n* For **Service Name**, enter `s3`. The name of the service that receives the requests.\n\n* For **Session Token**, **leave the field blank**. This is only required when temporary security credentials are used.\n"}},"schemas":{"GetBucketCorsOutput":{"type":"object","properties":{"CORSRules":{"$ref":"#/components/schemas/CORSRules"}}},"CORSRules":{"type":"array","items":{"$ref":"#/components/schemas/CORSRule"},"xml":{"wrapped":false},"description":"A set of origins and methods (cross-origin access that you want to allow). You can add up to 100 rules to the configuration."},"CORSRule":{"description":"Specifies a cross-origin access rule for an IONOS CLOUD Object Storage bucket.","type":"object","required":["AllowedMethods","AllowedOrigins"],"properties":{"ID":{"$ref":"#/components/schemas/ID"},"AllowedHeaders":{"$ref":"#/components/schemas/AllowedHeaders"},"AllowedMethods":{"$ref":"#/components/schemas/AllowedMethods"},"AllowedOrigins":{"$ref":"#/components/schemas/AllowedOrigins"},"ExposeHeaders":{"$ref":"#/components/schemas/ExposeHeaders"},"MaxAgeSeconds":{"$ref":"#/components/schemas/MaxAgeSeconds"}}},"ID":{"type":"integer","description":"Container for the Contract Number of the owner.","xml":{"name":"ID"}},"AllowedHeaders":{"type":"array","description":"Headers that are specified in the `Access-Control-Request-Headers` header. These headers are allowed in a preflight OPTIONS request. In response to any preflight OPTIONS request, IONOS CLOUD Object Storage returns any requested headers that are allowed.","items":{"$ref":"#/components/schemas/AllowedHeader"},"xml":{"wrapped":false}},"AllowedHeader":{"type":"string"},"AllowedMethods":{"type":"array","description":"An HTTP method that you allow the origin to execute. Valid values are `GET`, `PUT`, `HEAD`, `POST`, and `DELETE`.","items":{"$ref":"#/components/schemas/AllowedMethod"},"xml":{"wrapped":false}},"AllowedMethod":{"type":"string","xml":{"name":"AllowedMethod"}},"AllowedOrigins":{"type":"array","description":"One or more origins you want customers to be able to access the bucket from.","items":{"$ref":"#/components/schemas/AllowedOrigin"},"xml":{"wrapped":false}},"AllowedOrigin":{"type":"string","xml":{"name":"AllowedOrigin"}},"ExposeHeaders":{"type":"array","description":"One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript `XMLHttpRequest` object).","items":{"$ref":"#/components/schemas/ExposeHeader"},"xml":{"wrapped":false}},"ExposeHeader":{"type":"string","xml":{"name":"ExposeHeader"}},"MaxAgeSeconds":{"description":"The time in seconds that your browser is to cache the preflight response for the specified resource.","type":"integer"},"BucketName":{"description":"The bucket name.","type":"string","minLength":3,"maxLength":63,"xml":{"name":"Name"}}}},"paths":{"/{Bucket}?cors":{"get":{"tags":["CORS"],"summary":"GetBucketCors","operationId":"GetBucketCors","description":"Returns the cors configuration information set for the bucket.\nTo use this operation, you must have permission to perform the GetBucketCORS operation. By default, the bucket owner has this permission and can grant it to others.\n#### S3 API Compatibility - The `x-amz-expected-bucket-owner` header isn't supported.","responses":{"200":{"description":"Success","headers":{},"content":{"application/xml":{"schema":{"$ref":"#/components/schemas/GetBucketCorsOutput"}}}}},"parameters":[{"name":"Bucket","in":"path","required":true,"schema":{"$ref":"#/components/schemas/BucketName"}},{"name":"cors","in":"query","required":true,"schema":{"type":"boolean","enum":[true]},"allowEmptyValue":true}]}}}}
```

## PutBucketCors

> \<p>Sets the \`CORS\` configuration for your bucket. If the configuration exists, it will be overwritten and replaced.\</p>          \<p>To use this operation, you must be allowed to perform the \`PutBucketCORS\` operation. By default, the bucket owner has this permission and can grant it to others.\</p> \<p>You set this configuration on a bucket so that the bucket can service cross-origin requests. For example, you might want to enable a request whose origin is \`<http://www.example.com\\`> to access your IONOS CLOUD Object Storage bucket at \`my.example.bucket.com\` by using the browser's \`XMLHttpRequest\` capability.\</p> \<p>To enable cross-origin resource sharing (CORS) on a bucket, you add the \`cors\` subresource to the bucket. The \`cors\` subresource is an XML document in which you configure rules that identify origins and the HTTP methods that can be executed on your bucket. The document is limited to 64 KB in size. \</p> \<p>When IONOS CLOUD Object Storage receives a cross-origin request (or a pre-flight OPTIONS request) against a bucket, it evaluates the \`cors\` configuration on the bucket and uses the first \`CORSRule\` rule that matches the incoming browser request to enable a cross-origin request. For a rule to match, the following conditions must be met:\</p> \<ul> \<li> \<p>The request's \`Origin\` header must match \`AllowedOrigin\` elements.\</p> \</li> \<li> \<p>The request method (for example, GET, PUT, HEAD, and so on) or the \`Access-Control-Request-Method\` header in case of a pre-flight \`OPTIONS\` request must be one of the \`AllowedMethod\` elements. \</p> \</li> \<li> \<p>Every header specified in the \`Access-Control-Request-Headers\` request header of a pre-flight request must match an \`AllowedHeader\` element. \</p> \</li> \</ul>

```json
{"openapi":"3.0.3","info":{"title":"IONOS CLOUD Object Storage API for contract-owned buckets","version":"2.0.4"},"tags":[{"name":"CORS","description":"Cross Origin Resource Sharing Configuration"}],"servers":[{"url":"https://s3.eu-central-3.ionoscloud.com","description":"The endpoint for the `eu-central-3` region (Berlin, Germany)"},{"url":"https://s3.eu-central-4.ionoscloud.com","description":"The endpoint for the `eu-central-4` region (Frankfurt, Germany)"},{"url":"https://s3.us-central-1.ionoscloud.com","description":"The endpoint for the `us-central-1` region (Lenexa, USA)"}],"security":[{"hmac":[]}],"components":{"securitySchemes":{"hmac":{"type":"apiKey","name":"Authorization","in":"header","description":"IONOS CLOUD Object Storage API requests are authenticated using the AWS signature. \nThe IONOS CLOUD Object Storage API authenticates users using a customized HTTP scheme based on a [keyed-HMAC](https://en.wikipedia.org/wiki/HMAC) (Hash Message Authentication Code).\nThe process of generating the proper Authorization header is somewhat involved. We recommend that you make use of a tool such as Postman.\n\nIn the **Authorization** tab for a request, select **AWS Signature** from the **Type** dropdown list.\nSpecify where Postman should append your authorization data using the **Add authorization data to** drop-down menu.\n\n* If you select **Request Headers**, Postman populates the **Headers** tab with Authorization and `X-Amz-` prefixed fields.\n\n* If you select **Request URL**, Postman populates the **Params** tab with authentication details prefixed with `X-Amz-`.\n\n\n**Note:** The parameters listed below contain confidential information. We recommend using variables to keep this data secure while working in a collaborative environment.\n\n* For **Access Key**, enter your `access key` directly in the fields or through variables for added security.\n\n* For **Secret Key**, enter your `secret key` directly in the fields or through variables for added security.\n\nAdvanced fields are optional, but Postman will attempt to generate them automatically if necessary.\n* For **AWS Region**, enter one of the [regions](#section/Endpoints) (`eu-central-3`) where your bucket is hosted.\n\n* For **Service Name**, enter `s3`. The name of the service that receives the requests.\n\n* For **Session Token**, **leave the field blank**. This is only required when temporary security credentials are used.\n"}},"schemas":{"BucketName":{"description":"The bucket name.","type":"string","minLength":3,"maxLength":63,"xml":{"name":"Name"}},"Content-MD5":{"type":"string","description":"The base64 encoded MD5 digest of the message (without the headers) according to\n[RFC 1864](http://www.ietf.org/rfc/rfc1864.txt).\n"},"CORSRules":{"type":"array","items":{"$ref":"#/components/schemas/CORSRule"},"xml":{"wrapped":false},"description":"A set of origins and methods (cross-origin access that you want to allow). You can add up to 100 rules to the configuration."},"CORSRule":{"description":"Specifies a cross-origin access rule for an IONOS CLOUD Object Storage bucket.","type":"object","required":["AllowedMethods","AllowedOrigins"],"properties":{"ID":{"$ref":"#/components/schemas/ID"},"AllowedHeaders":{"$ref":"#/components/schemas/AllowedHeaders"},"AllowedMethods":{"$ref":"#/components/schemas/AllowedMethods"},"AllowedOrigins":{"$ref":"#/components/schemas/AllowedOrigins"},"ExposeHeaders":{"$ref":"#/components/schemas/ExposeHeaders"},"MaxAgeSeconds":{"$ref":"#/components/schemas/MaxAgeSeconds"}}},"ID":{"type":"integer","description":"Container for the Contract Number of the owner.","xml":{"name":"ID"}},"AllowedHeaders":{"type":"array","description":"Headers that are specified in the `Access-Control-Request-Headers` header. These headers are allowed in a preflight OPTIONS request. In response to any preflight OPTIONS request, IONOS CLOUD Object Storage returns any requested headers that are allowed.","items":{"$ref":"#/components/schemas/AllowedHeader"},"xml":{"wrapped":false}},"AllowedHeader":{"type":"string"},"AllowedMethods":{"type":"array","description":"An HTTP method that you allow the origin to execute. Valid values are `GET`, `PUT`, `HEAD`, `POST`, and `DELETE`.","items":{"$ref":"#/components/schemas/AllowedMethod"},"xml":{"wrapped":false}},"AllowedMethod":{"type":"string","xml":{"name":"AllowedMethod"}},"AllowedOrigins":{"type":"array","description":"One or more origins you want customers to be able to access the bucket from.","items":{"$ref":"#/components/schemas/AllowedOrigin"},"xml":{"wrapped":false}},"AllowedOrigin":{"type":"string","xml":{"name":"AllowedOrigin"}},"ExposeHeaders":{"type":"array","description":"One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript `XMLHttpRequest` object).","items":{"$ref":"#/components/schemas/ExposeHeader"},"xml":{"wrapped":false}},"ExposeHeader":{"type":"string","xml":{"name":"ExposeHeader"}},"MaxAgeSeconds":{"description":"The time in seconds that your browser is to cache the preflight response for the specified resource.","type":"integer"}}},"paths":{"/{Bucket}?cors":{"put":{"tags":["CORS"],"summary":"PutBucketCors","operationId":"PutBucketCors","description":"<p>Sets the `CORS` configuration for your bucket. If the configuration exists, it will be overwritten and replaced.</p>          <p>To use this operation, you must be allowed to perform the `PutBucketCORS` operation. By default, the bucket owner has this permission and can grant it to others.</p> <p>You set this configuration on a bucket so that the bucket can service cross-origin requests. For example, you might want to enable a request whose origin is `http://www.example.com` to access your IONOS CLOUD Object Storage bucket at `my.example.bucket.com` by using the browser's `XMLHttpRequest` capability.</p> <p>To enable cross-origin resource sharing (CORS) on a bucket, you add the `cors` subresource to the bucket. The `cors` subresource is an XML document in which you configure rules that identify origins and the HTTP methods that can be executed on your bucket. The document is limited to 64 KB in size. </p> <p>When IONOS CLOUD Object Storage receives a cross-origin request (or a pre-flight OPTIONS request) against a bucket, it evaluates the `cors` configuration on the bucket and uses the first `CORSRule` rule that matches the incoming browser request to enable a cross-origin request. For a rule to match, the following conditions must be met:</p> <ul> <li> <p>The request's `Origin` header must match `AllowedOrigin` elements.</p> </li> <li> <p>The request method (for example, GET, PUT, HEAD, and so on) or the `Access-Control-Request-Method` header in case of a pre-flight `OPTIONS` request must be one of the `AllowedMethod` elements. </p> </li> <li> <p>Every header specified in the `Access-Control-Request-Headers` request header of a pre-flight request must match an `AllowedHeader` element. </p> </li> </ul>","responses":{"200":{"description":"Success","headers":{}}},"parameters":[{"name":"Bucket","in":"path","required":true,"schema":{"$ref":"#/components/schemas/BucketName"}},{"name":"Content-MD5","in":"header","required":false,"schema":{"$ref":"#/components/schemas/Content-MD5"}},{"name":"cors","in":"query","required":true,"schema":{"type":"boolean","enum":[true]},"allowEmptyValue":true}],"requestBody":{"required":true,"content":{"application/xml":{"schema":{"type":"object","required":["CORSConfiguration"],"properties":{"CORSConfiguration":{"description":"Describes the cross-origin access configuration for objects in an IONOS CLOUD Object Storage bucket.","type":"object","properties":{"CORSRules":{"allOf":[{"$ref":"#/components/schemas/CORSRules"},{"xml":{"name":"CORSRule"},"description":"A set of origins and methods (cross-origin access that you want to allow). You can add up to 100 rules to the configuration."}]}}}}}}}}}}}}
```

## DeleteBucketCors

> Deletes the \`CORS\` configuration information set for the bucket.\</p> \<p>To use this operation, you must have permission to perform the \`PutBucketCORS\` operation. The bucket owner has this permission by default and can grant this permission to others.\
> \#### S3 API Compatibility - The \`x-amz-expected-bucket-owner\` header isn't supported.

```json
{"openapi":"3.0.3","info":{"title":"IONOS CLOUD Object Storage API for contract-owned buckets","version":"2.0.4"},"tags":[{"name":"CORS","description":"Cross Origin Resource Sharing Configuration"}],"servers":[{"url":"https://s3.eu-central-3.ionoscloud.com","description":"The endpoint for the `eu-central-3` region (Berlin, Germany)"},{"url":"https://s3.eu-central-4.ionoscloud.com","description":"The endpoint for the `eu-central-4` region (Frankfurt, Germany)"},{"url":"https://s3.us-central-1.ionoscloud.com","description":"The endpoint for the `us-central-1` region (Lenexa, USA)"}],"security":[{"hmac":[]}],"components":{"securitySchemes":{"hmac":{"type":"apiKey","name":"Authorization","in":"header","description":"IONOS CLOUD Object Storage API requests are authenticated using the AWS signature. \nThe IONOS CLOUD Object Storage API authenticates users using a customized HTTP scheme based on a [keyed-HMAC](https://en.wikipedia.org/wiki/HMAC) (Hash Message Authentication Code).\nThe process of generating the proper Authorization header is somewhat involved. We recommend that you make use of a tool such as Postman.\n\nIn the **Authorization** tab for a request, select **AWS Signature** from the **Type** dropdown list.\nSpecify where Postman should append your authorization data using the **Add authorization data to** drop-down menu.\n\n* If you select **Request Headers**, Postman populates the **Headers** tab with Authorization and `X-Amz-` prefixed fields.\n\n* If you select **Request URL**, Postman populates the **Params** tab with authentication details prefixed with `X-Amz-`.\n\n\n**Note:** The parameters listed below contain confidential information. We recommend using variables to keep this data secure while working in a collaborative environment.\n\n* For **Access Key**, enter your `access key` directly in the fields or through variables for added security.\n\n* For **Secret Key**, enter your `secret key` directly in the fields or through variables for added security.\n\nAdvanced fields are optional, but Postman will attempt to generate them automatically if necessary.\n* For **AWS Region**, enter one of the [regions](#section/Endpoints) (`eu-central-3`) where your bucket is hosted.\n\n* For **Service Name**, enter `s3`. The name of the service that receives the requests.\n\n* For **Session Token**, **leave the field blank**. This is only required when temporary security credentials are used.\n"}},"schemas":{"BucketName":{"description":"The bucket name.","type":"string","minLength":3,"maxLength":63,"xml":{"name":"Name"}}}},"paths":{"/{Bucket}?cors":{"delete":{"tags":["CORS"],"summary":"DeleteBucketCors","operationId":"DeleteBucketCors","description":"Deletes the `CORS` configuration information set for the bucket.</p> <p>To use this operation, you must have permission to perform the `PutBucketCORS` operation. The bucket owner has this permission by default and can grant this permission to others.\n#### S3 API Compatibility - The `x-amz-expected-bucket-owner` header isn't supported.","responses":{"204":{"description":"Success","headers":{}}},"parameters":[{"name":"Bucket","in":"path","required":true,"schema":{"$ref":"#/components/schemas/BucketName"}},{"name":"cors","in":"query","required":true,"schema":{"type":"boolean","enum":[true]},"allowEmptyValue":true}]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ionos.com/cloud/api-reference/storage-and-backup/ionos-object-storage/ionos-object-storage-for-contract-owned-buckets/cors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
