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

# Upsert session

> Create or update a session



## OpenAPI

````yaml https://api.getcargo.io/openapi.json post /workspaceManagement/sessions
openapi: 3.1.0
info:
  title: Cargo API
  version: 1.0.0
  description: Cargo Platform API v1
servers:
  - url: https://api.getcargo.io/v1
    description: Cargo API
security:
  - bearerAuth: []
paths:
  /workspaceManagement/sessions:
    post:
      tags:
        - Workspace Management - Sessions
      summary: Upsert session
      description: Create or update a session
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                sessionId:
                  type: string
                  minLength: 1
                title:
                  type: string
                  minLength: 1
                summary:
                  type: string
                  minLength: 1
                finishedAt:
                  anyOf:
                    - type: string
                      format: date-time
                      pattern: >-
                        ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                    - type: 'null'
              required:
                - sessionId
                - title
                - summary
              additionalProperties: false
              title: Request body
              description: Request body schema.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  session:
                    type: object
                    properties:
                      uuid:
                        type: string
                      sessionId:
                        type: string
                      userUuid:
                        type: string
                      workspaceUuid:
                        type: string
                      title:
                        type: string
                      summary:
                        type: string
                      createdAt:
                        type: string
                      finishedAt:
                        anyOf:
                          - type: string
                          - type: 'null'
                    required:
                      - uuid
                      - sessionId
                      - userUuid
                      - workspaceUuid
                      - title
                      - summary
                      - createdAt
                      - finishedAt
                    additionalProperties: false
                required:
                  - session
                additionalProperties: false
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '500':
          description: Internal server error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````