---
# @generated by sylphx-gen 0.1.0 from contracts@e145cc7cf1bc9605f2b27439e5e17ed76a1a2fd7e7021906a013f7565e4a0cd5. Do not edit.
title: "Put in Objects"
description: "`data.objects.put` (PUT /v1/objects/{bucket_id}/{key}): Writes an object's bytes, replacing the current version."
type: reference
product: storage
summary: "Writes an object's bytes, replacing the current version."
updated: 2026-09-28
nav: false
---

Writes an object's bytes, replacing the current version. `body` is the base64 of the bytes.

- **Path** `PUT https://api.data.sylphx.com/v1/objects/bucket-id/key`
- **Scope** `data:write`
- **Effect** `write` — a successful call changes state.
- **Collection** [objects](/docs/api/objects)
- **Host** `https://api.data.sylphx.com`

## Request

| Field | Type | What it is |
| --- | --- | --- |
| `bucket_id` | `string` | The bucket's id. Required. |
| `key` | `string` | The object key. Required. |
| `body` | `bytes` | The bytes, base64. |
| `content_type` | `string` | The media type, for example `application/pdf`. |
| `expected_version` | `uint64` | Write only when the current version equals this one (0: any). |

## Response

| Field | Type | What it is |
| --- | --- | --- |
| `object` | `ObjectRecord` | The stored object. |

### ObjectRecord

| Field | Type | What it is |
| --- | --- | --- |
| `bucket_id` | `string` | The bucket's id in the environment, for example `uploads`. |
| `key` | `string` | The object key; `/` separates path segments. |
| `sha256` | `string` | `sha256:<hex>` of the bytes. |
| `size` | `uint64` | Size in bytes. |
| `content_type` | `string` | The media type given at put. |
| `etag` | `string` | The entity tag of this version. |
| `version` | `uint64` | The version, increasing per key. |
| `updated_at_unix_ms` | `int64` | When this version was written, in Unix milliseconds. |
| `delete_marker` | `bool` | Whether this version is a delete marker (exact-version reads only). |
| `visibility` | `string` | `public` or `private` (the default); current version only. |

## Errors

- [`UNAUTHENTICATED`](/docs/api/errors/UNAUTHENTICATED) — No valid key or token was presented.
- [`PERMISSION_DENIED`](/docs/api/errors/PERMISSION_DENIED) — The key lacks the method's permission.
- [`INVALID_FIELD`](/docs/api/errors/INVALID_FIELD) — A field failed validation.
- [`RESOURCE_NOT_FOUND`](/docs/api/errors/RESOURCE_NOT_FOUND) — The named Resource does not exist or is not visible.
- [`ETAG_MISMATCH`](/docs/api/errors/ETAG_MISMATCH) — The etag sent does not match the Resource's current etag.

Every error arrives in the body [Errors](/docs/platform/errors) describes.

## Examples

**cURL**

```curl
curl -X PUT "https://api.data.sylphx.com/v1/objects/bucket-id/key" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

**TypeScript**

```ts
const response = await sylphx.data.objects.put({ bucketId: 'bucket-id', key: 'key' })
```

**Rust**

```rust
let mut req = sylphx::data::PutObjectRequest::default();
req.bucket_id = "bucket-id".to_string();
req.key = "key".to_string();
let response = sx.data().objects().put(req).await?;
```

**MCP**

```json
{ "method_id": "data.objects.put", "args": {"bucket_id":"bucket-id","key":"key"} }
```
