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

# Create Session

> Create a new session 



## OpenAPI

````yaml POST /sessions/create
openapi: 3.1.0
info:
  title: duohub Retriever API
  description: >-
    Retrieve assisted or non-assisted memory from a duohub knowledge graph. For
    best performance, use the official `duohub` Python package.
  version: 1.0.0
servers:
  - url: https://api.duohub.ai
security:
  - APIKeyHeader: []
paths:
  /sessions/create:
    post:
      tags:
        - Sessions
      summary: Create Session
      description: 'Create a new session '
      operationId: createSession
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: string
                  description: Unique identifier for the session
                customerUserID:
                  type: string
                  description: Optional ID of the customer user
                metadata:
                  type: array
                  description: Optional metadata for the session
                  items:
                    type: object
                    required:
                      - key
                      - value
                    properties:
                      key:
                        type: string
                        description: Metadata key
                      value:
                        type: string
                        description: Metadata value
              example:
                sessionID: 123e4567-e89b-12d3-a456-426614174000
                customerUserID: cust-123
                metadata:
                  - key: source
                    value: web
      responses:
        '201':
          description: Session created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - success
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        description: Session unique identifier
                      organisationID:
                        type: string
                        description: User ID
                      customerUserID:
                        type: string
                        description: Customer user ID
                        nullable: true
                      metadata:
                        type: array
                        items:
                          type: object
                          properties:
                            key:
                              type: string
                            value:
                              type: string
                      createdAt:
                        type: string
                        format: date-time
                        description: Creation timestamp
                      updatedAt:
                        type: string
                        format: date-time
                        description: Last update timestamp
                required:
                  - status
                  - data
                example:
                  status: success
                  data:
                    id: 123e4567-e89b-12d3-a456-426614174000
                    userID: d99e7428-40e1-7073-aa50-94cee086b518
                    customerUserID: cust-123
                    metadata:
                      - key: source
                        value: web
                    createdAt: '2024-01-01T00:00:00.000Z'
                    updatedAt: '2024-01-01T00:00:00.000Z'
                    deletedAt: null
                    endedAt: null
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                  status:
                    type: string
                    enum:
                      - bad_request
                required:
                  - error
                  - status
                examples:
                  no_headers:
                    value:
                      error: No headers provided
                      status: bad_request
                  invalid_json:
                    value:
                      error: Invalid JSON in request body
                      status: bad_request
                  missing_id:
                    value:
                      error: sessionID is required
                      status: bad_request
                  invalid_metadata:
                    value:
                      error: metadata must be a list of key-value pairs
                      status: bad_request
                  duplicate_id:
                    value:
                      error: Session ID already exists
                      status: bad_request
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                  status:
                    type: string
                    enum:
                      - unauthorized
                required:
                  - error
                  - status
                example:
                  error: API key is required
                  status: unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                  status:
                    type: string
                    enum:
                      - forbidden
                required:
                  - error
                  - status
                example:
                  error: Invalid API key
                  status: forbidden
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                  status:
                    type: string
                    enum:
                      - error
                required:
                  - error
                  - status
                example:
                  error: Internal server error
                  status: error
components:
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: 'Your duohub API key. Type: str'

````