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

# Create a session

> Creates a new session with the specified configuration. This feature is enabled for selected organizations only.



## OpenAPI

````yaml https://api.factory.ai/api/v0/openapi.json post /api/v0/sessions
openapi: 3.0.1
info:
  title: Factory Public API
  description: >-
    Public API for Factory platform. Requires authentication via the
    `Authorization: Bearer` header.
  version: 0.1.0
servers:
  - url: https://api.factory.ai/
    description: Production
security:
  - BearerAuth: []
paths:
  /api/v0/sessions:
    post:
      tags:
        - Sessions
      summary: Create a session
      description: >-
        Creates a new session with the specified configuration. This feature is
        enabled for selected organizations only.
      operationId: createSession
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSessionRequestBody'
      responses:
        '201':
          description: Response for status 201
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSession201ResponseBody'
        '400':
          description: Response for status 400
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSession400ResponseBody'
        '401':
          description: Response for status 401
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSession401ResponseBody'
        '403':
          description: Response for status 403
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSession403ResponseBody'
        '429':
          description: Response for status 429
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSession429ResponseBody'
        '500':
          description: Response for status 500
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSession500ResponseBody'
components:
  schemas:
    CreateSessionRequestBody:
      type: object
      properties:
        computerId:
          type: string
          description: Computer ID to connect
        cwd:
          type: string
          minLength: 1
          maxLength: 4096
          description: Working directory for the session on the computer.
        sessionSettings:
          type: object
          properties:
            model:
              type: string
            reasoningEffort:
              type: string
              enum:
                - none
                - dynamic
                - 'off'
                - minimal
                - low
                - medium
                - high
                - xhigh
                - max
            interactionMode:
              type: string
              enum:
                - auto
                - spec
                - agi
            autonomyLevel:
              type: string
              enum:
                - 'off'
                - low
                - medium
                - high
            autonomyMode:
              type: string
              enum:
                - normal
                - spec
                - auto-low
                - auto-medium
                - auto-high
              description: 'Deprecated: use interactionMode + autonomyLevel instead.'
            specModeModel:
              type: string
            specModeReasoningEffort:
              type: string
              enum:
                - none
                - dynamic
                - 'off'
                - minimal
                - low
                - medium
                - high
                - xhigh
                - max
            providerLock:
              type: string
              enum:
                - anthropic
                - openai
                - generic-chat-completion-api
                - factory
                - google
                - xai
                - voyage
            providerLockTimestamp:
              type: string
            apiProviderLock:
              type: string
              enum:
                - bedrock
                - anthropic
                - vertex_anthropic
                - bedrock_anthropic
                - openai
                - azure_openai
                - google
                - xai
                - fireworks
                - baseten
                - snowflake
            assistantActiveTimeMs:
              type: number
            tokenUsage:
              type: object
              properties:
                inputTokens:
                  type: number
                outputTokens:
                  type: number
                cacheCreationTokens:
                  type: number
                cacheReadTokens:
                  type: number
                thinkingTokens:
                  type: number
                factoryCredits:
                  type: number
              required:
                - inputTokens
                - outputTokens
                - cacheCreationTokens
                - cacheReadTokens
                - thinkingTokens
              additionalProperties: false
            inclusiveTokenUsage:
              type: object
              properties:
                inputTokens:
                  type: number
                outputTokens:
                  type: number
                cacheCreationTokens:
                  type: number
                cacheReadTokens:
                  type: number
                thinkingTokens:
                  type: number
                factoryCredits:
                  type: number
              required:
                - inputTokens
                - outputTokens
                - cacheCreationTokens
                - cacheReadTokens
                - thinkingTokens
              additionalProperties: false
            childInclusiveTokenUsageBySessionId:
              type: object
              additionalProperties:
                type: object
                properties:
                  inputTokens:
                    type: number
                  outputTokens:
                    type: number
                  cacheCreationTokens:
                    type: number
                  cacheReadTokens:
                    type: number
                  thinkingTokens:
                    type: number
                  factoryCredits:
                    type: number
                required:
                  - inputTokens
                  - outputTokens
                  - cacheCreationTokens
                  - cacheReadTokens
                  - thinkingTokens
                additionalProperties: false
            archivedAt:
              type: string
            tags:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                    minLength: 1
                  metadata:
                    type: object
                    additionalProperties:
                      type: string
                required:
                  - name
                additionalProperties: false
            enabledToolIds:
              type: array
              items:
                type: string
            disabledToolIds:
              type: array
              items:
                type: string
          additionalProperties: false
      required:
        - computerId
      additionalProperties: false
    CreateSession201ResponseBody:
      type: object
      properties:
        sessionId:
          type: string
          description: Session ID
        title:
          type: string
          description: Session title
        status:
          type: string
          enum:
            - idle
            - pending
            - running
          description: Current session execution status
        messageCount:
          type: integer
          description: Number of messages in session
        createdAt:
          type: integer
          description: Creation timestamp (Unix ms)
        updatedAt:
          type: integer
          description: Last update timestamp (Unix ms)
        completedAt:
          type: integer
          description: Completion timestamp (Unix ms)
        computerId:
          type: string
          description: Connected computer ID
        sessionSettings:
          type: object
          properties:
            model:
              type: string
            reasoningEffort:
              type: string
              enum:
                - none
                - dynamic
                - 'off'
                - minimal
                - low
                - medium
                - high
                - xhigh
                - max
            interactionMode:
              type: string
              enum:
                - auto
                - spec
                - agi
            autonomyLevel:
              type: string
              enum:
                - 'off'
                - low
                - medium
                - high
            autonomyMode:
              type: string
              enum:
                - normal
                - spec
                - auto-low
                - auto-medium
                - auto-high
              description: 'Deprecated: use interactionMode + autonomyLevel instead.'
            specModeModel:
              type: string
            specModeReasoningEffort:
              type: string
              enum:
                - none
                - dynamic
                - 'off'
                - minimal
                - low
                - medium
                - high
                - xhigh
                - max
            providerLock:
              type: string
              enum:
                - anthropic
                - openai
                - generic-chat-completion-api
                - factory
                - google
                - xai
                - voyage
            providerLockTimestamp:
              type: string
            apiProviderLock:
              type: string
              enum:
                - bedrock
                - anthropic
                - vertex_anthropic
                - bedrock_anthropic
                - openai
                - azure_openai
                - google
                - xai
                - fireworks
                - baseten
                - snowflake
            assistantActiveTimeMs:
              type: number
            tokenUsage:
              type: object
              properties:
                inputTokens:
                  type: number
                outputTokens:
                  type: number
                cacheCreationTokens:
                  type: number
                cacheReadTokens:
                  type: number
                thinkingTokens:
                  type: number
                factoryCredits:
                  type: number
              required:
                - inputTokens
                - outputTokens
                - cacheCreationTokens
                - cacheReadTokens
                - thinkingTokens
              additionalProperties: false
            inclusiveTokenUsage:
              type: object
              properties:
                inputTokens:
                  type: number
                outputTokens:
                  type: number
                cacheCreationTokens:
                  type: number
                cacheReadTokens:
                  type: number
                thinkingTokens:
                  type: number
                factoryCredits:
                  type: number
              required:
                - inputTokens
                - outputTokens
                - cacheCreationTokens
                - cacheReadTokens
                - thinkingTokens
              additionalProperties: false
            childInclusiveTokenUsageBySessionId:
              type: object
              additionalProperties:
                type: object
                properties:
                  inputTokens:
                    type: number
                  outputTokens:
                    type: number
                  cacheCreationTokens:
                    type: number
                  cacheReadTokens:
                    type: number
                  thinkingTokens:
                    type: number
                  factoryCredits:
                    type: number
                required:
                  - inputTokens
                  - outputTokens
                  - cacheCreationTokens
                  - cacheReadTokens
                  - thinkingTokens
                additionalProperties: false
            archivedAt:
              type: string
            tags:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                    minLength: 1
                  metadata:
                    type: object
                    additionalProperties:
                      type: string
                required:
                  - name
                additionalProperties: false
            enabledToolIds:
              type: array
              items:
                type: string
            disabledToolIds:
              type: array
              items:
                type: string
          additionalProperties: false
      required:
        - sessionId
        - status
        - messageCount
        - createdAt
        - updatedAt
      additionalProperties: false
    CreateSession400ResponseBody:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message
        status:
          type: number
          description: HTTP status code
        title:
          type: string
          description: HTTP status title
        metadata:
          type: object
          additionalProperties: {}
          description: Additional error metadata
      required:
        - detail
        - status
        - title
      additionalProperties: false
    CreateSession401ResponseBody:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message
        status:
          type: number
          description: HTTP status code
        title:
          type: string
          description: HTTP status title
        metadata:
          type: object
          additionalProperties: {}
          description: Additional error metadata
      required:
        - detail
        - status
        - title
      additionalProperties: false
    CreateSession403ResponseBody:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message
        status:
          type: number
          description: HTTP status code
        title:
          type: string
          description: HTTP status title
        metadata:
          type: object
          additionalProperties: {}
          description: Additional error metadata
      required:
        - detail
        - status
        - title
      additionalProperties: false
    CreateSession429ResponseBody:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message
        status:
          type: number
          description: HTTP status code
        title:
          type: string
          description: HTTP status title
        metadata:
          type: object
          additionalProperties: {}
          description: Additional error metadata
      required:
        - detail
        - status
        - title
      additionalProperties: false
    CreateSession500ResponseBody:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message
        status:
          type: number
          description: HTTP status code
        title:
          type: string
          description: HTTP status title
        metadata:
          type: object
          additionalProperties: {}
          description: Additional error metadata
      required:
        - detail
        - status
        - title
      additionalProperties: false
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Factory API key or JWT token for authentication

````