# Write a stored document

Source: https://docs.vlayers.ai/reference/hosting/put-store-document

`PUT /v1/agents/{id}/store/{collection}/docs/{docId}` · scope `workspace:write`

Creates or replaces one document. Each field the manifest declares must have its type. A document over the plan's size limit, a collection over its document limit or a workspace over its store limit is refused with 413 and the limit named. Fields the manifest marks indexed are also kept so you can query on them; one marked personal is indexed only as a keyed hash.

Requires an API key with the `workspace:write` scope.

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The agent id. Example: `"0192f5c2-6f7a-7b9c-8d1e-2f3a4b5c6d78"` |
| `collection` | path | string | yes | The collection id. Example: `"orders"` |
| `docId` | path | string | yes | The document id. Example: `"order-1001"` |
| `value` | body | object | yes | The document: a JSON object. It may not hold a key named `$spans`. |

## Request

cURL:

```bash
curl -X PUT "https://api.vlayers.ai/v1/agents/$AGENT_ID/store/$COLLECTION/docs/$DOC_ID" \
  -H "Authorization: Bearer $VOICELAYER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "value": {
      "status": "open",
      "total": 42
    }
  }'
```

TypeScript:

```ts
import { VoiceLayer } from '@voicelayer/api';

const voicelayer = new VoiceLayer();

const { created } = await voicelayer.hosting.putStoreDocument('<agent-id>', '<collection>', '<doc-id>', {
  value: { status: 'open', total: 42 }
});
console.log(created);
```

Python:

```python
from voicelayer import VoiceLayer

vl = VoiceLayer()

result = vl.hosting.put_store_document(
    "<agent-id>",
    "<collection>",
    "<doc-id>",
    value={
        "status": "open",
        "total": 42,
    },
)
print(result.created)
```

## Response `200`

```json
{
  "document": {
    "collection": "orders",
    "id": "order-1001",
    "value": {
      "status": "open",
      "total": 42
    },
    "updatedAt": "2026-10-20T15:04:05.000Z"
  },
  "created": true
}
```
