# Get a session

Get an active session for a project

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Context Store",
    "version": "4.0.10"
  },
  "servers": [
    {
      "url": "https://{environment}.digitalcx.com",
      "variables": {
        "environment": {
          "default": "contextstore",
          "enum": [
            "contextstore",
            "contextstore-cms",
            "contextstore-staging"
          ]
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Context Store",
      "description": "Conversational AI Cloud's Context Store API provides the ability to read and update sessions."
    }
  ],
  "paths": {
    "/sessions/{sessionId}": {
      "get": {
        "tags": [
          "Context Store"
        ],
        "summary": "Get a session",
        "description": "Get an active session for a project",
        "security": [
          {
            "accessToken": [],
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/customerKeyParam"
          },
          {
            "$ref": "#/components/parameters/projectKeyParam"
          },
          {
            "name": "sessionId",
            "in": "path",
            "description": "The session identifier name.",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContextStoreSession"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "customerKeyParam": {
        "name": "customerKey",
        "in": "query",
        "description": "Customer identifier used for authenticating the request.",
        "schema": {
          "type": "string"
        },
        "required": true
      },
      "projectKeyParam": {
        "name": "projectKey",
        "in": "query",
        "description": "Project identifier used for authenticating the request, and to determine what project environment the interaction will take place in.",
        "schema": {
          "type": "string"
        },
        "required": true
      }
    },
    "securitySchemes": {
      "accessToken": {
        "description": "JWT used to access the Context Store API",
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "apiKey": {
        "description": "Conversational AI Cloud API key",
        "type": "apiKey",
        "in": "query",
        "name": "apikey"
      }
    },
    "schemas": {
      "SessionHistorySchema": {
        "description": "Contains information of the items that were sent to the user",
        "type": "object",
        "properties": {
          "kba": {
            "type": "string",
            "description": "Knowledge Base Article (Q&A or event) that triggered the answer",
            "example": "1"
          },
          "interactionValue": {
            "type": "string",
            "description": "The input provided to the Gateway API",
            "example": "Hi there!"
          },
          "outputText": {
            "type": "string",
            "description": "The response returned by the Gateway API",
            "example": "Hello, this is an example answer!"
          },
          "date": {
            "type": "string",
            "description": "Timestamp",
            "example": "2022-01-01T00:00:00.000Z"
          }
        }
      },
      "ContextStoreSession": {
        "type": "object",
        "description": "Object representing a standard session model for Gateway API interactions.",
        "properties": {
          "id": {
            "type": "string",
            "example": "00000000-0000-0000-0000-000000000000",
            "description": "Session identifier UUID"
          },
          "UserId": {
            "type": "string",
            "example": "00000000-0000-0000-0000-000000000000",
            "description": "User identifier UUID linked to this session"
          },
          "InDialog": {
            "type": "boolean",
            "example": false,
            "description": "Boolean indicating whether or not this session is in a dialog."
          },
          "DialogPath": {
            "type": "string",
            "example": "",
            "description": "The current path within the dialog. Set if InDialog is True. Null when InDialog is false."
          },
          "History": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionHistorySchema"
            }
          },
          "Mode": {
            "type": "integer",
            "format": "int64",
            "example": 2,
            "description": "Contains information on the mode for the session."
          },
          "DeviceType": {
            "type": "integer",
            "format": "int64",
            "example": 1,
            "description": "Information around the device type used to interact with this session."
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 102,
      "1": 38,
      "2": 26,
      "3": 84,
      "4": 5,
      "5": 242,
      "6": 44,
      "7": 0,
      "8": 17,
      "9": 188,
      "10": 64,
      "11": 72
    }
  }
}
```