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

# Update Session

> ### Description
Updates a session

### Details
This API can be used to update the session that matches the ID that was passed in as a path parameter. To use this API, pass in the `id` that was returned from your Create Session API call as a path parameter.

Review the request schema to see the fields that can be updated.



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/sgp/openapi.yml patch /v4/sessions/{session_id}
openapi: 3.1.0
info:
  title: EGP API V4
  description: >-
    This is the parent API for all EGP APIs. If you are looking for the EGP API,
    please go to https://api.egp.scale.com/docs.
  contact:
    name: Scale Generative AI Platform
    url: https://scale.com/genai-platform
  version: 0.1.0
servers:
  - url: https://api.egp.scale.com
security: []
tags:
  - name: Models
    description: Model API.
paths:
  /v4/sessions/{session_id}:
    patch:
      tags:
        - Sessions
      summary: Update Session
      description: >-
        ### Description

        Updates a session


        ### Details

        This API can be used to update the session that matches the ID that was
        passed in as a path parameter. To use this API, pass in the `id` that
        was returned from your Create Session API call as a path parameter.


        Review the request schema to see the fields that can be updated.
      operationId: PATCH-V4-/sessions/{session_id}
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            title: Session Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestorablePartialSessionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    RestorablePartialSessionRequest:
      oneOf:
        - $ref: '#/components/schemas/PartialSessionRequest'
        - $ref: '#/components/schemas/RestoreRequest'
      title: RestorablePartialSessionRequest
      discriminator:
        propertyName: restore
        mapping:
          'False':
            $ref: '#/components/schemas/PartialSessionRequest'
          'True':
            $ref: '#/components/schemas/RestoreRequest'
    SessionResponse:
      properties:
        id:
          type: string
          title: Id
        title:
          title: Title
          can_patch: true
          type: string
        start_date:
          title: Start Date
          description: Start of the session window.
          can_patch: true
          type: string
          format: date-time
        end_date:
          title: End Date
          description: End of the session window.
          can_patch: true
          type: string
          format: date-time
        state:
          additionalProperties: true
          type: object
          title: State
          description: Opaque, caller-defined session state.
          can_patch: true
          optional_in_request: true
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The date and time when the entity was created in ISO format.
        archived_at:
          title: Archived At
          description: The date and time when the entity was archived in ISO format.
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: The date and time when the entity was last updated in ISO format.
        created_by_user_id:
          type: string
          title: Created By User Id
          description: The user who originally created the entity.
        created_by_identity_type:
          $ref: '#/components/schemas/IdentifierTypeEnum'
          description: The type of identity that created the entity.
        account_id:
          type: string
          title: Account Id
          description: The ID of the account that owns the given entity.
          can_patch: false
      type: object
      required:
        - id
        - title
        - state
        - created_at
        - updated_at
        - created_by_user_id
        - created_by_identity_type
        - account_id
      title: SessionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PartialSessionRequest:
      properties:
        title:
          title: Title
          can_patch: true
          type: string
        start_date:
          title: Start Date
          description: Start of the session window.
          can_patch: true
          type: string
          format: date-time
        end_date:
          title: End Date
          description: End of the session window.
          can_patch: true
          type: string
          format: date-time
        state:
          title: State
          description: Opaque, caller-defined session state.
          can_patch: true
          additionalProperties: true
          type: object
        restore:
          type: boolean
          const: false
          title: Restore
          description: Set to true to restore the entity from the database.
          default: false
      additionalProperties: false
      type: object
      title: PartialSessionRequest
    RestoreRequest:
      properties:
        restore:
          type: boolean
          const: true
          title: Restore
          description: Set to true to restore the entity from the database.
      additionalProperties: false
      type: object
      required:
        - restore
      title: RestoreRequest
    IdentifierTypeEnum:
      type: string
      enum:
        - user
        - service_account
      title: IdentifierTypeEnum
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
          additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````