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

# Retrieve Session

> Retrieve a JSON object of the session from path sessionId. Will also return a list of all tasks, tools, agents, models and datasources as a front end helper



## OpenAPI

````yaml get /{resourceSlug}/session/{sessionId}.json
openapi: 3.0.0
info:
  title: Agentcloud Webapp API Docs
  description: The API docs for Agentcloud's webapp.
  version: 0.2.1
servers:
  - url: https://app.agentcloud.dev
    description: Use our public api endpoints!
  - url: '{custom_url}'
    description: Test the endpoints on your own instance of Agent Cloud!
    variables:
      custom_url:
        default: https://app.agentcloud.dev
security: []
tags: []
paths:
  /{resourceSlug}/session/{sessionId}.json:
    get:
      tags:
        - Sessions
      summary: Retrieve Session
      description: >-
        Retrieve a JSON object of the session from path sessionId. Will also
        return a list of all tasks, tools, agents, models and datasources as a
        front end helper
      operationId: sessionJson
      parameters:
        - name: resourceSlug
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ObjectId'
          description: >-
            The resourceSlug is a url parameter of the teamId associated with
            the user. Anywhere the resourceSlug is used can be interpreted as a
            teamId
        - name: sessionId
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ObjectId'
          description: The sessionId of the session to retrieve
      responses:
        '200':
          description: >-
            JSON object the session associated with the given sessionId, will
            return an empty array if the request is successful but there are no
            associated agents.
          content:
            session.json:
              schema:
                properties:
                  csrf:
                    type: string
                    description: cross site token
                  session:
                    $ref: '#/components/schemas/Session'
                    description: Session Object returned for the given sessionId
        '400':
          description: Error in validation, check error message for more information
          content:
            dynamicResponse:
              schema:
                $ref: '#/components/schemas/dynamicResponse'
        '403':
          description: >-
            Invalid permissions on the resourceSlug, attempting to access an
            agent outside the permissions of the team
          content:
            dynamicResponse:
              schema:
                $ref: '#/components/schemas/dynamicResponse'
        '500':
          description: Internal error
          content:
            dynamicResponse:
              schema:
                $ref: '#/components/schemas/dynamicResponse'
components:
  schemas:
    ObjectId:
      description: >-
        Mongodb Object id, unique identifier, length of 24 characters fitting
        the following regex; [a-f0-9]{24}
      type: string
    Session:
      description: Session object used when a chat app is running
      required:
        - orgId
        - teamId
        - name
        - startDate
        - lastUpdatedDate
        - tokensUsed
        - status
        - sharingConfig
      properties:
        _id:
          $ref: '#/components/schemas/ObjectId'
        orgId:
          $ref: '#/components/schemas/ObjectId'
          description: >-
            The id of the organisation that the session belongs to (usually the
            teamId of the corresponding app object).
        teamId:
          $ref: '#/components/schemas/ObjectId'
          description: >-
            The id object of the team the session belongs to (usually the teamId
            of the corresponding app object the session stems from).
        name:
          type: string
          description: The name of the session
        startDate:
          type: object
          description: Date object of when the session was started.
        lastUpdatedDate:
          type: object
          description: Date object of when the session was last updated.
        tokensUsed:
          type: integer
          description: The number of AI tokens used in this session.
        status:
          type: string
          enum:
            - started
            - running
            - waiting
            - warning
            - error
            - terminated
          description: The cuurent state of the session
        appId:
          $ref: '#/components/schemas/ObjectId'
          description: The appId of the app that the session is running
        previewLabel:
          type: string
          description: Label to show when previewing the session
        sharingConfig:
          $ref: '#/components/schemas/SharingConfig'
    dynamicResponse:
      description: Server response
      properties:
        message:
          type: string
          description: Error message to provide more detail
        code:
          type: integer
          description: the error code
    SharingConfig:
      type: object
      description: >-
        While the permissions object is intended to hold permissions presence in
        the permissions object as a key implies view/read access for now until
        we implement checks and update middleware chains for more complex
        permissions. Keys are intended to be user, team, or org IDs with a
        mapping to permissions.
      required:
        - permissions
        - mode
      properties:
        permissions:
          description: >-
            Permissions mapping where keys are user, team, or org IDs and values
            are permissions. Presence implies view/read access.
          type: object
          additionalProperties:
            type: string
        mode:
          $ref: '#/components/schemas/SharingMode'
          description: The mode of sharing.
    SharingMode:
      type: string
      description: Enum representing the different sharing modes.
      enum:
        - restricted
        - team
        - public

````