> ## 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.

# Add a session

> Create a new chat session from the parameter appId



## OpenAPI

````yaml post /{resourceSlug}/forms/session/add
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}/forms/session/add:
    post:
      tags:
        - Sessions
      summary: Add a session
      description: Create a new chat session from the parameter appId
      operationId: addSessionApi
      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.
      requestBody:
        required: true
        content:
          req.json:
            schema:
              $ref: '#/components/schemas/ObjectId'
        description: JSON body containing appId of the app to use for this session.
      responses:
        '302':
          description: >-
            Successful operation, redirect to
            '/{resourceSlug}/session/{sessionId}'. Redirect field contains path
            to the newly created session to initialise app.
          content:
            dynamicResponse:
              schema:
                $ref: '#/components/schemas/tempRedirectResponse'
        '400':
          description: Validation error or missing required fields.
          content:
            dynamicResponse:
              schema:
                $ref: '#/components/schemas/dynamicResponse'
        '403':
          description: >-
            Invalid permissions on the resourceSlug, attempting to add a model
            outside the permissions of the team.
          content:
            dynamicResponse:
              schema:
                $ref: '#/components/schemas/dynamicResponse'
        '500':
          description: Internal server 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
    tempRedirectResponse:
      description: Server response after successsfully adding a new object
      properties:
        _id:
          type: string
          description: The unique Mongo id of the newly inserted object.
        redirect:
          type: string
          description: >-
            a string containing the redirect link to get all objects after a
            successful insertion.
    dynamicResponse:
      description: Server response
      properties:
        message:
          type: string
          description: Error message to provide more detail
        code:
          type: integer
          description: the error code

````