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

# Create Session

> Create a session for tembo to start working on in the background



## OpenAPI

````yaml /openapi.documented.yml post /session/create
openapi: 3.1.0
info:
  title: Developer API
  description: Tembo Developer API
  version: 1.0.0
servers:
  - url: https://api.tembo.io/
    description: Tembo API
security: []
paths:
  /session/create:
    post:
      summary: Create Session
      description: Create a session for tembo to start working on in the background
      operationId: postPublic-apiSessionCreate
      parameters: []
      requestBody:
        description: Session creation payload
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  minLength: 1
                  description: >-
                    Description of the session to be performed. Supports tagging
                    files.
                  example: Fix the authentication bug in the login component
                description:
                  type: string
                  minLength: 1
                  description: Detailed description of the session (alternative to prompt)
                  example: >-
                    Users are reporting they cannot log in. JWT token validation
                    appears to be failing.
                agent:
                  type: string
                  description: The agent to use for this session
                  example: claudeCode:claude-opus-4-5
                repositories:
                  type: array
                  items:
                    type: string
                  description: Array of code repository urls that this session relates to
                  example:
                    - https://github.com/org/repo
                    - https://gitlab.com/org/repo-2
                codeRepoIds:
                  type: array
                  items:
                    type: string
                  description: Array of Tembo code repository IDs to target directly
                  example:
                    - cbad4334-c844-4fef-a8da-d08f209f267e
                    - 6307d53a-b99d-4e90-ab89-f29114f33d53
                targetBranch:
                  type: string
                  nullable: true
                  description: >-
                    The branch to open the pull request against (e.g. main,
                    develop)
                  example: main
                branchName:
                  type: string
                  nullable: true
                  description: The branch name to use for the work
                  example: feature/auth-fix
                queueRightAway:
                  type: boolean
                  nullable: true
                  default: true
                  description: >-
                    Whether to immediately queue the session for processing
                    (optional, defaults to true)
                  example: false
              anyOf:
                - required:
                    - prompt
                - required:
                    - description
        required: true
      responses:
        '200':
          description: Session created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  title:
                    type: string
                  description:
                    type: string
                  status:
                    type: string
                  createdAt:
                    type: string
                    format: date-time
                  updatedAt:
                    type: string
                    format: date-time
                  organizationId:
                    type: string
                    format: uuid
                  htmlUrl:
                    type: string
                    format: uri
                    description: URL to view this session in the Tembo web application
                    example: >-
                      https://app.tembo.io/sessions/123e4567-e89b-12d3-a456-426614174000
                required:
                  - id
                  - title
                  - description
                  - status
                  - createdAt
                  - updatedAt
                  - organizationId
                  - htmlUrl
        '400':
          description: Bad request - invalid input or missing organization ID
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Tembo from '@tembo-io/sdk';

            const client = new Tembo({
              apiKey: 'My API Key',
            });

            const session = await client.session.create({
              prompt: 'Fix the authentication bug in the login component',
              agent: 'claudeCode:claude-opus-4-5',
              repositories: [
                'https://github.com/org/repo',
                'https://gitlab.com/org/repo-2',
              ],
              targetBranch: 'dev',
              branchName: "cooper-is-awesome",
            });

            console.log(session.id);

````