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

# Extend Session

> Extend a session.

This endpoint allows you to extend an existing session (`session_id`) for another **30 minutes** while a user has the SDK open, when you receive the `refresh session request` event in the `onEvent` callback.

If the SDK is closed, it is best practice to create a new session before re-initializing the SDK using [Create Session](https://docs.knotapi.com/api-reference/sessions/create-session).


## OpenAPI

````yaml POST /session/extend
openapi: 3.1.0
info:
  title: Knot API
  description: An API to interact with the Knot merchant connectivity platform.
  version: 1.0.0
servers:
  - url: https://development.knotapi.com
    description: Development server
security:
  - basicAuth: []
paths:
  /session/extend:
    post:
      description: Extend a session.
      operationId: session_extend
      requestBody:
        description: The input parameters required for extending a session.
        content:
          application/json:
            schema:
              type: object
              properties:
                session_id:
                  type: string
                  description: Specific session.
                  example: 915efe72-5136-4652-z91q-d9d48003c102
              required:
                - session_id
      responses:
        '200':
          description: Successful request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  session:
                    type: string
                    description: The extended session.
                    example: 915efe72-5136-4652-z91q-d9d48003c102
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                SessionNotFound:
                  summary: Session was not found
                  value:
                    error_type: SESSION_ERROR
                    error_code: SESSION_NOT_FOUND
                    error_message: The session was not found. Please check the ID provided.
                SessionIdRequired:
                  summary: session_id must be provided
                  value:
                    error_type: INVALID_REQUEST
                    error_code: INVALID_FIELD
                    error_message: The session id field is required.
                InvalidSession:
                  summary: Session must be a string
                  value:
                    error_type: INVALID_REQUEST
                    error_code: INVALID_FIELD
                    error_message: The session id field must be a string.
                ExtensionNotSupported:
                  summary: Session does not support extending
                  value:
                    error_type: SESSION_ERROR
                    error_code: EXTEND_NOT_SUPPORTED
                    error_message: This session does not support extending its expiration.
        '401':
          description: Unauthorized request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                AuthFailed:
                  summary: Auth failed
                  value:
                    error_type: INVALID_INPUT
                    error_code: INVALID_API_KEYS
                    error_message: Invalid client_id or secret provided.
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                InternalServerError:
                  summary: Unexpected server error
                  value:
                    message: Server Error
components:
  schemas:
    Error:
      type: object
      properties:
        error_type:
          type: string
          description: Type of error.
          enum:
            - INVALID_INPUT
            - INVALID_REQUEST
            - USER_ERROR
            - SESSION_ERROR
            - MERCHANT_ACCOUNT_ERROR
            - MERCHANT_ERROR
            - SUBSCRIPTION_ERROR
            - TRANSACTION_ERROR
            - CART_ERROR
          example: INVALID_REQUEST
        error_code:
          type: string
          description: Error code.
          enum:
            - INVALID_API_KEYS
            - INVALID_FIELD
            - INVALID_JWE
            - INVALID_CURSOR_FORMAT
            - USER_NOT_FOUND
            - MERCHANT_ACCOUNT_NOT_FOUND
            - MERCHANT_ACCOUNT_DISCONNECTED
            - SESSION_NOT_FOUND
            - EXTEND_NOT_SUPPORTED
            - MERCHANT_UNAVAILABLE
            - NO_ACCESS
            - TRANSACTION_NOT_FOUND
            - NO_TRANSACTIONS
            - SUBSCRIPTION_NOT_FOUND
            - ONGOING_OPERATION
            - CART_NOT_FOUND
            - FULFILLMENT_NOT_FOUND
          example: INVALID_FIELD
        error_message:
          type: string
          description: Detailed error message.
          example: The limit may not be greater than 10.
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >-
        Basic authentication header of the form `Basic <encoded-value>`, where
        `<encoded-value>` is the base64-encoded string `username:password`. Use
        your `client_id` as the `username` and your `secret` as the `password`
        value.

````