# PutObject

Loads an object and its metadata to ColdStack.

**Note**

ColdStack does not block an object for writing and can accept several requests for writing one object at the same time, however, by default, the user will be able to get only the last written object from ColdStack. To preserve history when overwriting or deleting objects, turn on versioning .

Use a header to ensure that the object is transmitted over the network without damage `Content-MD5`. ColdStack will calculate `MD5`for the stored object and if the calculated `MD5`does not match the one passed in the header, it will return an error. This validation can also be performed on the client side by comparing the `ETag` ColdStack response with the precomputed one `MD5`.

### Request <a href="#request" id="request"></a>

```http
PUT /{bucket}/{key} HTTP/1.1
Content-Type: ContentType
Content-Length: ContentLength
Content-Disposition: ContentDisposition
```

#### Path parameters <a href="#path-parameters" id="path-parameters"></a>

| Parameter | Description                                                                    |
| --------- | ------------------------------------------------------------------------------ |
| `bucket`  | Bucket name.                                                                   |
| `key`     | Object key. The identifier under which the object will be stored in ColdStack. |

#### Headings <a href="#request-headers" id="request-headers"></a>

Use the required [common headers](/http-api-compatible-with-amazon-s3/api-reference/common-request-headers.md) in the request .

Additionally, you can use the headings listed in the table below.

| Heading                                       | Description                                                                                                                                                                                                                                                                                                                                                                                                                             |
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `x-amz-meta-*`                                | <p>Custom object metadata.<br><br>All headers starting with <code>x-amz-meta-</code>ColdStack are treated as custom headers, they are not processed and stored in the form in which they are transmitted.<br><br>The total size of custom headers must not exceed 2KB. The size of the user data is defined as the length of the UTF-8 encoded string. The size takes into account both the names of the headings and their values.</p> |
| `x-amz-storage-class`                         | <p>Object storage class.<br><br>Can have any of the following values:<br>- <code>STANDARD</code>to load an object into the standard storage.<br>- <code>COLD</code>, <code>STANDARD\_IA</code>and <code>NEARLINE</code>to load the object into cold storage.<br><br>If the header is not specified, then the object is saved in the storage set in the bucket settings.</p>                                                             |
| `x-amz-server-side-encryption`                | The default encryption algorithm for encrypting new objects.                                                                                                                                                                                                                                                                                                                                                                            |
| `x-amz-server-side-encryption-aws-kms-key-id` | The default KMS key identifier used to encrypt new objects.                                                                                                                                                                                                                                                                                                                                                                             |

Using the headers listed below, you can set the ACL for the loaded object.

| Heading                    | Description                                                                           |
| -------------------------- | ------------------------------------------------------------------------------------- |
| `x-amz-acl`                | Sets a predefined ACL for an object.                                                  |
| `x-amz-grant-read`         | Sets the recipient to read permission on the object.                                  |
| `x-amz-grant-read-acp`     | Sets the recipient to read the object's ACL.                                          |
| `x-amz-grant-write-acp`    | Sets the recipient to write access to the object's ACL.                               |
| `x-amz-grant-full-control` | Sets the access permission recipient: `READ`, `WRITE`, `READ_ACP`, `WRITE_ACP`object. |

The value for headers `x-amz-grant-*`is a comma-separated list of recipients. Each accessor is identified by a view structure `<тип получателя доступа>:<идентификатор получателя доступа>`. ColdStack supports the following recipient types:

* `id` - access recipient is a cloud user.
* `uri` - access recipient - system group.

Example:

```
x-amz-grant-read: uri="http://acs.amazonaws.com/groups/s3/AuthenticatedUsers"
```

### Answer <a href="#response" id="response"></a>

#### Headings <a href="#response-headers" id="response-headers"></a>

The response can only contain [general headers](/http-api-compatible-with-amazon-s3/api-reference/common-response-headers.md) .

#### Answer codes <a href="#response-codes" id="response-codes"></a>

For a list of possible answers, see the [Answers](/http-api-compatible-with-amazon-s3/api-reference/answers.md) section .


---

# Agent Instructions: 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:

```
GET https://docs.coldstack.io/http-api-compatible-with-amazon-s3/api-reference/object/upload.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
