> ## Documentation Index
> Fetch the complete documentation index at: https://docs.60db.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Ingest Memory

> Store a memory (user, knowledge, or hive) in a collection

Store a new memory in your workspace. Memories are processed asynchronously — the response returns immediately with a pending memory ID that you can poll for status.

## Request

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token with your API key
</ParamField>

<ParamField header="Content-Type" type="string" required>
  application/json
</ParamField>

### Body

<ParamField body="text" type="string" required>
  The memory content to store. Max 100,000 characters.
</ParamField>

<ParamField body="title" type="string">
  Optional display title for the memory.
</ParamField>

<ParamField body="type" type="string" default="user">
  Memory type. One of: `user`, `knowledge`, `hive`.

  * `user`: Personal memory for the calling user
  * `knowledge`: Shared knowledge base entry (admin/owner only)
  * `hive`: Workspace-wide shared memory (admin/owner only)
</ParamField>

<ParamField body="collection" type="string">
  Collection ID to store the memory in. Defaults to the caller's personal collection.
  For team collections, pass the collection\_id returned from `POST /memory/collections`.
</ParamField>

<ParamField body="infer" type="boolean" default="true">
  If true, the memory service extracts structured facts and preferences via LLM inference.
</ParamField>

<ParamField body="metadata" type="object">
  Optional metadata to attach to the memory. Filterable at search time.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  True on success
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="collection_id" type="string">
      The collection the memory was stored in
    </ResponseField>

    <ResponseField name="memory_type" type="string">
      Type: user, knowledge, or hive
    </ResponseField>

    <ResponseField name="total_queued" type="integer">
      Number of memories queued for processing
    </ResponseField>

    <ResponseField name="results" type="array">
      List of `{id, status, message}` — one per memory ingested
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.60db.ai/memory/ingest \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "text": "User prefers vegetarian food, lactose intolerant",
      "title": "Dietary preferences",
      "type": "user",
      "infer": true
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.60db.ai/memory/ingest', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer your-api-key',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      text: "User prefers vegetarian food, lactose intolerant",
      title: "Dietary preferences",
      type: "user",
      infer: true,
    }),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.60db.ai/memory/ingest",
      headers={
          "Authorization": "Bearer your-api-key",
          "Content-Type": "application/json",
      },
      json={
          "text": "User prefers vegetarian food, lactose intolerant",
          "title": "Dietary preferences",
          "type": "user",
          "infer": True,
      },
  )
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "collection_id": "user_abc123",
      "collection_label": "Personal Memories",
      "memory_type": "user",
      "total_queued": 1,
      "results": [
        {
          "id": "mem_01HV8K2X3N4P5Q6R7S8T9U",
          "status": "pending",
          "message": "Memory queued for processing"
        }
      ]
    }
  }
  ```
</ResponseExample>

## Billing

This endpoint is billed at \*\*$0.0001 per 1,000 characters** of `text`. A 500-char memory costs $0.00005; a 5,000-char memory costs \$0.0005. The charge is deducted upfront from the workspace owner's wallet, and automatically refunded if the request fails.

**Response headers** — every successful request returns:

| Header             | Meaning                                     |
| ------------------ | ------------------------------------------- |
| `x-credit-balance` | Your wallet balance **after** this charge   |
| `x-credit-charged` | Amount charged for this specific request    |
| `x-billing-tx`     | UUID of the audit row (for refunds/support) |

See [Pricing & Billing](/api-reference/memory/pricing) for the full rate card and refund policy.

## Error responses

| Status | Code                     | Meaning                                                                                                                                  |
| ------ | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| 400    | —                        | Missing or invalid `text` field                                                                                                          |
| 402    | `INSUFFICIENT_CREDITS`   | Wallet balance is lower than the ingest charge. Response body includes `details.required`, `details.available`, and `details.shortfall`. |
| 403    | `POLICY_DENY`            | Role is not allowed to create memories (viewer)                                                                                          |
| 503    | `MEMORY_INFRA_NOT_READY` | The memory layer is still being provisioned for this workspace (usually only on first use). Retry in \~10s.                              |
| 503    | `MEMORY_UNREACHABLE`     | The memory service is temporarily unavailable. Request is queued for retry and the charge is automatically refunded.                     |

## Checking status

Poll `GET /memory/:id/status` to check if a memory has been fully processed. Statuses: `pending`, `processing`, `ready`, `failed`.
