# Capture knowledge (/docs/knowledge/capture-knowledge)
Some knowledge doesn't live in a file or an app you can connect, such as records your service generates or content you assemble at runtime. `dock.capture` with a `container` sends that knowledge to Docklee from your code.

<Callout type="info" title="Capture knowledge from code when...">
- The content is generated by your own service.
- You'd rather push updates than have Docklee read a source.
</Callout>

## Capture into a container [#capture-into-a-container]

Declare the container on `Dock`. A vector container also takes a dimension:

<CodeTabs>
  <Tab value="Python">
    ```python
    from docklee import Dock

    dock = Dock(container="vector", dimension=1024)
    dock.capture(
        "Orders over $50 ship free within the continental US.",
        type="knowledge",
        metadata={"policy": "shipping", "version": "2026-10"},
    )
    result = dock.flush_sync()
    print(result.accepted, result.rejected)
    ```
  </Tab>
  <Tab value="TypeScript">
    ```ts
    import { Dock } from 'docklee';

    const dock = new Dock({ container: 'vector', dimension: 1024 });
    dock.capture('Orders over $50 ship free within the continental US.', {
      type: 'knowledge',
      metadata: { policy: 'shipping', version: '2026-10' },
    });
    const result = await dock.flush();
    console.log(result?.accepted, result?.rejected);
    await dock.close();
    ```
  </Tab>
  <Tab value="cURL">
    ```bash
    curl https://api.docklee.com/v1/dock/ingest \
      -H "Authorization: Bearer $DOCKLEE_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "container": "vector",
        "dimension": 1024,
        "events": [
          {
            "content": "Orders over $50 ship free within the continental US.",
            "type": "knowledge",
            "metadata": {"policy": "shipping", "version": "2026-10"}
          }
        ]
      }'
    ```
  </Tab>
</CodeTabs>

The response counts knowledge events under `ke_events`:

```json
{
  "batch_id": "5a9c1e7f-3d24-4b8a-9e60-c1f7a2d48b3e",
  "accepted": 1,
  "rejected": 0,
  "errors": [],
  "usage": {
    "events_accepted": 1,
    "ke_events": 1,
    "dum_events": 0,
    "processing_time_ms": 521
  }
}
```

## Make it answerable [#make-it-answerable]

1. **Find the feed.** The first write to a container creates an **API/SDK Feed** source for it in **Sources**.
2. **Link it.** Open the engine in **Knowledge Engines**, go to its **Sources** tab, and add the feed.
3. **Query.** The engine now answers from everything written to that feed.

<Callout type="warn">
An engine never reads a feed until you link it. Data you write before linking isn't lost. It becomes answerable as soon as the feed is linked.
</Callout>

## Types for knowledge [#types-for-knowledge]

| Type | Use it for |
| --- | --- |
| `knowledge` | Facts and reference content for an engine to answer from. |
| `document` | Longer written content, such as an article or a page of a manual. |

When a `Dock` declares only a container, every event goes to the container, whatever its type. When it declares a container and a memory space, only `knowledge` and `document` events go to the container. See [How Docklee works](/docs/docklee/how-docklee-works#where-a-write-goes).

## Limits [#limits]

| Limit | Value |
| --- | --- |
| Content per event | 50,000 characters |
| Metadata per event | 10 KB |
| Events per batch | 100 |

## Errors [#errors]

| Error | Meaning |
| --- | --- |
| `403` with `ke_runtime_denied` | The key doesn't include the Knowledge Engines runtime. |
| `422` | The container isn't `vector` or `okf`, or every event was rejected. |
| `ke_ingestion_failed` in `errors` | The event couldn't be stored. The `message` says why, such as a dimension that isn't enabled. |

## Next steps [#next-steps]

Your knowledge is in a container. Ask an engine about it next.

<Cards>
  <Card title="Query an engine" href="/docs/knowledge/query-an-engine" description="Get a cited answer in one call." />
  <Card title="Containers" href="/docs/docklee/containers" description="Vector or OKF, and which dimension to pick." />
  <Card title="Batching and flush" href="/docs/memory/essentials/batching-and-flush" description="When Dock sends what you capture." />
</Cards>
