> ## Documentation Index
> Fetch the complete documentation index at: https://cognitio-agent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create session

> Create a new Cognitio session for interacting with AI assistants and managing conversations.



## OpenAPI

````yaml /openapi.json post /session
openapi: 3.1.1
info:
  title: cognitio
  description: cognitio api
  version: 1.0.0
servers: []
security: []
paths:
  /session:
    post:
      summary: Create session
      description: >-
        Create a new Cognitio session for interacting with AI assistants and
        managing conversations.
      operationId: session.create
      parameters:
        - in: query
          name: directory
          schema:
            type: string
        - in: query
          name: workspace
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                parentID:
                  type: string
                  pattern: ^ses.*
                title:
                  type: string
                permission:
                  $ref: '#/components/schemas/PermissionRuleset'
                workspaceID:
                  type: string
                  pattern: ^wrk.*
                runtimeConfig:
                  $ref: '#/components/schemas/RuntimeConfig'
      responses:
        '200':
          description: Successfully created session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
      x-codeSamples:
        - lang: js
          source: |-
            import { createCognitioClient } from "@cognitio/sdk

            const client = createCognitioClient()
            await client.session.create({
              ...
            })
components:
  schemas:
    PermissionRuleset:
      type: array
      items:
        $ref: '#/components/schemas/PermissionRule'
    RuntimeConfig:
      type: object
      properties:
        systemPrompt:
          anyOf:
            - type: string
            - type: object
              properties:
                type:
                  type: string
                  const: preset
                preset:
                  type: string
                  enum:
                    - default
                    - none
                append:
                  type: string
              required:
                - type
                - preset
        appendSystemPrompt:
          type: string
        model:
          type: object
          properties:
            providerID:
              type: string
            modelID:
              type: string
          required:
            - providerID
            - modelID
        effort:
          type: string
          enum:
            - low
            - medium
            - high
            - max
        thinkingConfig:
          anyOf:
            - type: object
              properties:
                type:
                  type: string
                  const: adaptive
              required:
                - type
            - type: object
              properties:
                type:
                  type: string
                  const: disabled
              required:
                - type
            - type: object
              properties:
                type:
                  type: string
                  const: enabled
                budgetTokens:
                  type: integer
                  minimum: 1024
                  maximum: 9007199254740991
              required:
                - type
                - budgetTokens
        compaction:
          type: object
          properties:
            auto:
              type: boolean
            includeFiles:
              type: boolean
        includeEnvironment:
          type: boolean
        maxTurns:
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        maxBudgetUsd:
          type: number
          exclusiveMinimum: 0
        permissionMode:
          $ref: '#/components/schemas/RuntimeConfigPermissionMode'
        canUseTool:
          type: boolean
        autoPermissionClassifierModel:
          type: object
          properties:
            providerID:
              type: string
            modelID:
              type: string
          required:
            - providerID
            - modelID
        allowedTools:
          type: array
          items:
            type: string
        disallowedTools:
          type: array
          items:
            type: string
        settingSources:
          type: array
          items:
            type: string
            enum:
              - user
              - project
              - local
        agents:
          type: object
          propertyNames:
            type: string
          additionalProperties:
            $ref: '#/components/schemas/RuntimeAgentDefinition'
        skills:
          type: array
          items:
            $ref: '#/components/schemas/RuntimeSkillDefinition'
        commands:
          type: array
          items:
            $ref: '#/components/schemas/RuntimeCommandDefinition'
        plugins:
          type: array
          items:
            $ref: '#/components/schemas/RuntimePluginSpec'
        hooks:
          type: object
          propertyNames:
            $ref: '#/components/schemas/RuntimeConfigHookEventName'
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/RuntimeConfigHookDescriptor'
        sdkMcpServers:
          type: array
          items:
            $ref: '#/components/schemas/RuntimeMcpServer'
        enableToolSearch:
          anyOf:
            - type: boolean
            - type: string
              const: auto
            - type: string
              const: always
            - type: string
              const: never
        enableFileCheckpointing:
          type: boolean
        outputFormat:
          $ref: '#/components/schemas/OutputFormatJsonSchema'
        backgroundTaskPolicy:
          type: object
          properties:
            mode:
              type: string
              const: foreground
          required:
            - mode
          additionalProperties: false
        checkpointing:
          type: object
          properties:
            enabled:
              type: boolean
            beforeTools:
              type: boolean
            beforeCompaction:
              type: boolean
          additionalProperties: false
    Session:
      type: object
      properties:
        id:
          type: string
          pattern: ^ses.*
        slug:
          type: string
        projectID:
          type: string
        workspaceID:
          type: string
          pattern: ^wrk.*
        directory:
          type: string
        parentID:
          type: string
          pattern: ^ses.*
        forkedFrom:
          type: string
          pattern: ^ses.*
        summary:
          type: object
          properties:
            additions:
              type: number
            deletions:
              type: number
            files:
              type: number
            diffs:
              type: array
              items:
                $ref: '#/components/schemas/SnapshotFileDiff'
          required:
            - additions
            - deletions
            - files
        share:
          type: object
          properties:
            url:
              type: string
          required:
            - url
        title:
          type: string
        tags:
          default: []
          type: array
          items:
            type: string
        version:
          type: string
        time:
          type: object
          properties:
            created:
              type: number
            updated:
              type: number
            compacting:
              type: number
            archived:
              type: number
          required:
            - created
            - updated
        permission:
          $ref: '#/components/schemas/PermissionRuleset'
        revert:
          type: object
          properties:
            messageID:
              type: string
              pattern: ^msg.*
            partID:
              type: string
              pattern: ^prt.*
            snapshot:
              type: string
            checkpointId:
              type: string
            diff:
              type: string
          required:
            - messageID
      required:
        - id
        - slug
        - projectID
        - directory
        - title
        - version
        - time
    BadRequestError:
      type: object
      properties:
        data: {}
        errors:
          type: array
          items:
            type: object
            propertyNames:
              type: string
            additionalProperties: {}
        success:
          type: boolean
          const: false
      required:
        - data
        - errors
        - success
    PermissionRule:
      type: object
      properties:
        permission:
          type: string
        pattern:
          type: string
        action:
          $ref: '#/components/schemas/PermissionAction'
      required:
        - permission
        - pattern
        - action
    RuntimeConfigPermissionMode:
      type: string
      enum:
        - default
        - acceptEdits
        - dontAsk
        - plan
        - bypassPermissions
        - auto
    RuntimeAgentDefinition:
      type: object
      properties:
        prompt:
          type: string
          minLength: 1
        description:
          type: string
        model:
          type: object
          properties:
            providerID:
              type: string
              minLength: 1
            modelID:
              type: string
              minLength: 1
          required:
            - providerID
            - modelID
        tools:
          type: array
          items:
            type: string
        disallowedTools:
          type: array
          items:
            type: string
        permissionMode:
          $ref: '#/components/schemas/RuntimeConfigPermissionMode'
        mcpServers:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/RuntimeRemoteMcpServer'
              - $ref: '#/components/schemas/RuntimeLocalMcpServer'
        steps:
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        temperature:
          type: number
        spawnMode:
          type: string
          enum:
            - fresh
            - inherit
      required:
        - prompt
    RuntimeSkillDefinition:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        content:
          type: string
        baseDir:
          type: string
        allowedTools:
          type: array
          items:
            type: string
        model:
          anyOf:
            - type: string
            - type: object
              properties:
                providerID:
                  type: string
                modelID:
                  type: string
              required:
                - providerID
                - modelID
        disableModelInvocation:
          type: boolean
      required:
        - name
        - description
        - content
    RuntimeCommandDefinition:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        template:
          type: string
        agent:
          type: string
        model:
          type: string
        subtask:
          type: boolean
        allowedTools:
          type: array
          items:
            type: string
        disallowedTools:
          type: array
          items:
            type: string
      required:
        - name
        - template
    RuntimePluginSpec:
      anyOf:
        - $ref: '#/components/schemas/RuntimeInlinePlugin'
        - $ref: '#/components/schemas/RuntimeClaudePlugin'
    RuntimeConfigHookDescriptor:
      type: object
      properties:
        id:
          type: string
          minLength: 1
        matcher:
          type: string
        matcherFlags:
          type: string
        timeoutMs:
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        async:
          type: boolean
      required:
        - id
    RuntimeMcpServer:
      anyOf:
        - $ref: '#/components/schemas/RuntimeRemoteMcpServer'
        - $ref: '#/components/schemas/RuntimeLocalMcpServer'
        - $ref: '#/components/schemas/RuntimeDirectSdkMcpServer'
    OutputFormatJsonSchema:
      type: object
      properties:
        type:
          type: string
          const: json_schema
        schema:
          $ref: '#/components/schemas/JSONSchema'
        retryCount:
          default: 2
          type: integer
          minimum: 0
          maximum: 9007199254740991
      required:
        - type
        - schema
    SnapshotFileDiff:
      type: object
      properties:
        file:
          type: string
        patch:
          type: string
        additions:
          type: number
        deletions:
          type: number
        status:
          type: string
          enum:
            - added
            - deleted
            - modified
      required:
        - file
        - patch
        - additions
        - deletions
    PermissionAction:
      type: string
      enum:
        - allow
        - deny
        - ask
    RuntimeRemoteMcpServer:
      type: object
      properties:
        name:
          type: string
          minLength: 1
        type:
          type: string
          const: remote
        url:
          type: string
          format: uri
        enabled:
          type: boolean
        headers:
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: string
        oauth:
          type: boolean
          const: false
        timeout:
          type: number
          exclusiveMinimum: 0
        transport:
          type: string
          enum:
            - http
            - sse
        ownership:
          description: SDK-owned HTTP host; reattach when forking a session.
          type: string
          const: sdk
      required:
        - name
        - type
        - url
    RuntimeLocalMcpServer:
      type: object
      properties:
        name:
          type: string
          minLength: 1
        type:
          type: string
          const: local
        command:
          minItems: 1
          type: array
          items:
            type: string
            minLength: 1
        environment:
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: string
        cwd:
          type: string
          minLength: 1
        enabled:
          type: boolean
        timeout:
          type: number
          exclusiveMinimum: 0
      required:
        - name
        - type
        - command
    RuntimeInlinePlugin:
      type: object
      properties:
        type:
          type: string
          const: inline
        name:
          type: string
        description:
          type: string
        version:
          type: string
        skills:
          type: array
          items:
            $ref: '#/components/schemas/RuntimeSkillDefinition'
        commands:
          type: array
          items:
            $ref: '#/components/schemas/RuntimeCommandDefinition'
        agents:
          type: object
          propertyNames:
            type: string
          additionalProperties:
            $ref: '#/components/schemas/RuntimeAgentDefinition'
        hooks:
          type: object
          propertyNames:
            $ref: '#/components/schemas/RuntimeConfigHookEventName'
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/RuntimeConfigHookDescriptor'
        mcpServers:
          type: array
          items:
            $ref: '#/components/schemas/RuntimeMcpServer'
      required:
        - type
        - name
    RuntimeClaudePlugin:
      type: object
      properties:
        type:
          type: string
          const: claude
        path:
          type: string
      required:
        - type
        - path
    RuntimeDirectSdkMcpServer:
      type: object
      properties:
        name:
          type: string
          minLength: 1
        type:
          type: string
          const: sdk
        transport:
          type: string
          const: direct
        enabled:
          type: boolean
        timeout:
          type: number
          exclusiveMinimum: 0
        tools:
          type: array
          items:
            $ref: '#/components/schemas/RuntimeDirectSdkMcpTool'
      required:
        - name
        - type
        - transport
        - tools
    JSONSchema:
      type: object
      propertyNames:
        type: string
      additionalProperties: {}
    RuntimeDirectSdkMcpTool:
      type: object
      properties:
        name:
          type: string
          minLength: 1
        description:
          type: string
        inputSchema:
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
        metadata:
          type: object
          properties:
            searchHint:
              type: string
            alwaysLoad:
              type: boolean
        annotations:
          type: object
          properties:
            readOnly:
              type: boolean
            destructive:
              type: boolean
            idempotent:
              type: boolean
            openWorld:
              type: boolean
      required:
        - name
        - inputSchema

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.