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

# Create a session

> Creates a Loops session for the given training project.



## OpenAPI

````yaml post /v1/loops/sessions
openapi: 3.1.0
info:
  description: REST API for management of Baseten resources
  title: Baseten management API
  version: 1.0.0
servers:
  - url: https://api.baseten.co
security:
  - BearerAuth: []
paths:
  /v1/loops/sessions:
    post:
      summary: Create a Loops session.
      description: Creates a Loops session for the given training project.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLoopsSessionRequestV1'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateLoopsSessionResponseV1'
      x-codeSamples:
        - lang: bash
          source: |-
            curl --request POST \
            --url https://api.baseten.co/v1/loops/sessions \
            --header "Authorization: Bearer $BASETEN_API_KEY" \
            --data '{
              "training_project_id": null
            }'
        - lang: python
          source: |-
            import requests
            import os
            API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
            url = "https://api.baseten.co/v1/loops/sessions"

            headers = {"Authorization": f"Bearer {API_KEY}"}

            response = requests.request(
                "POST",
                url,
                headers=headers,
                json={'training_project_id': None}
            )

            print(response.text)
components:
  schemas:
    CreateLoopsSessionRequestV1:
      properties:
        training_project_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            ID of the training project to associate with. If omitted, a default
            project is created for the org.
          title: Training Project Id
      title: CreateLoopsSessionRequestV1
      type: object
    CreateLoopsSessionResponseV1:
      properties:
        session:
          $ref: '#/components/schemas/LoopsSessionV1'
      required:
        - session
      title: CreateLoopsSessionResponseV1
      type: object
    LoopsSessionV1:
      properties:
        id:
          title: Id
          type: string
      required:
        - id
      title: LoopsSessionV1
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Pass your Baseten API key. Clients automatically send `Authorization:
        Bearer <key>`. Direct callers can also use `Authorization: Api-Key
        <key>`; both schemes are accepted.

````