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

# Store a knowledge cell

> Store a single cell of knowledge and return its node id. Validation, quota, and authorization run inside the facade. `source_agent` and `tenant_id` are stamped from the authenticated principal and cannot be set by the client.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/store
openapi: 3.0.3
info:
  title: HyphaeDB REST API
  version: 1.0.0
  description: >-
    The unary REST surface over the HyphaeDB internal service facade. JSON over
    HTTP/1.1; every endpoint is a thin translator onto the same facade that gRPC
    and MCP speak. `recall` and `query` return fully hydrated nodes in rank
    order (nearest-first); no similarity score rides the wire — the array order
    conveys the rank.


    All endpoints except `GET /healthz` require an API key supplied in the
    `x-hyphae-key` header. Errors use a uniform envelope: `{ "error": { "code":
    string, "message": string } }`.


    This document covers the unary REST endpoints only. The WebSocket gossip
    stream (`GET /v1/inbox`) and the MCP-over-HTTP endpoint (`POST /mcp`) are
    separate surfaces not described here, and `GET /openapi.json` serves this
    document itself.
servers:
  - url: http://localhost:8080
    description: Local HyphaeDB server
security:
  - ApiKeyAuth: []
tags:
  - name: Memory
    description: Store and retrieve knowledge cells.
  - name: Sessions
    description: Open and close working sessions.
  - name: Beacons
    description: Standing interest beacons for gossip routing.
  - name: Inbox
    description: 'The gossip inbox: the unary work-cycle drain for non-resident agents.'
  - name: Scenes
    description: Scene listing, lookup, and consolidation.
  - name: Health
    description: Liveness probe.
paths:
  /v1/store:
    post:
      tags:
        - Memory
      summary: Store a knowledge cell
      description: >-
        Store a single cell of knowledge and return its node id. Validation,
        quota, and authorization run inside the facade. `source_agent` and
        `tenant_id` are stamped from the authenticated principal and cannot be
        set by the client.
      operationId: store
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreBody'
      responses:
        '200':
          description: The stored cell's node id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoreResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ServerError'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  schemas:
    StoreBody:
      type: object
      description: The body for `POST /v1/store`.
      required:
        - content
        - cell_type
      properties:
        content:
          type: string
          description: The cell's text content.
        cell_type:
          $ref: '#/components/schemas/CellType'
        salience:
          type: number
          format: float
          default: 0.5
          minimum: 0
          maximum: 1
          description: >-
            Importance hint in [0.0, 1.0]; the server clamps out-of-range
            values.
        scene_id:
          type: string
          format: uuid
          description: An optional owning scene id.
        source_ref:
          $ref: '#/components/schemas/SourceRef'
        metadata:
          type: object
          additionalProperties: true
          default: {}
          description: Arbitrary JSON metadata; defaults to an empty object.
        idempotency_key:
          type: string
          description: An optional key to deduplicate retried stores.
    StoreResponse:
      type: object
      required:
        - node_id
      properties:
        node_id:
          type: string
          format: uuid
          description: The stored cell's node id.
    CellType:
      type: string
      description: >-
        The nine cell types the energy and promotion models are calibrated
        against.
      enum:
        - Decision
        - Constraint
        - Risk
        - Pattern
        - Lesson
        - Fact
        - Preference
        - Context
        - Task
    SourceRef:
      type: object
      description: >-
        A reference back to the source of a cell's content (e.g. `file:line`,
        `url`).
      required:
        - kind
        - locator
      properties:
        kind:
          type: string
          description: The reference kind, e.g. `file` or `url`.
        locator:
          type: string
          description: The locator within that kind, e.g. a path or URL.
    Error:
      type: object
      description: The uniform error envelope returned for every non-2xx response.
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: A stable, machine-readable error code.
              enum:
                - not_found
                - validation
                - dimension_mismatch
                - unauthorized
                - forbidden
                - conflict
                - transaction
                - quota_exceeded
                - rate_limited
                - timeout
                - unavailable
                - storage
                - embedding
                - config
                - internal
            message:
              type: string
              description: >-
                A redaction-safe, human-readable description (never embeds
                secrets).
  responses:
    BadRequest:
      description: >-
        The request was malformed or failed validation (codes: `validation`,
        `dimension_mismatch`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: 'Missing or invalid `x-hyphae-key` (code: `unauthorized`).'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: 'Authenticated but not permitted (code: `forbidden`).'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: 'A conflicting or aborted operation (codes: `conflict`, `transaction`).'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnsupportedMediaType:
      description: >-
        The request body was sent with a non-JSON `Content-Type` (code:
        `validation`). Send `Content-Type: application/json`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnprocessableContent:
      description: >-
        The JSON body parsed but did not match the expected shape — a missing
        required field or a wrong field type (code: `validation`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: >-
        Quota exhausted or rate limited (codes: `quota_exceeded`,
        `rate_limited`). A `rate_limited` response sets the `Retry-After` header
        (in seconds).
      headers:
        Retry-After:
          description: Seconds to wait before retrying (only on `rate_limited`).
          schema:
            type: integer
            minimum: 1
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: 'An internal error (codes: `embedding`, `config`, `internal`).'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unavailable:
      description: 'A dependency was unavailable (codes: `unavailable`, `storage`).'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-hyphae-key
      description: >-
        The API key issued for the calling agent. Required on every endpoint
        except `GET /healthz`.

````