> ## 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.

# Open a session

> Open a working session in the given project and return its session id.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/sessions
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/sessions:
    post:
      tags:
        - Sessions
      summary: Open a session
      description: Open a working session in the given project and return its session id.
      operationId: startSession
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StartSessionBody'
      responses:
        '200':
          description: The opened session's id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '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:
    StartSessionBody:
      type: object
      description: The body for `POST /v1/sessions`.
      required:
        - project_id
      properties:
        project_id:
          type: string
          description: The project to open the session in.
    SessionResponse:
      type: object
      required:
        - session_id
      properties:
        session_id:
          type: string
          format: uuid
          description: The opened session's id.
    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'
    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`.

````