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

# Cancel a session

> Cancel a session by Id, best practice to cancel a session once it has completed. The session and it's associated fields will still exist within the database under the same sessionId. The session can be completley removed from the database using the delete route AFTER this has been executed.



## OpenAPI

````yaml post /{resourceSlug}/forms/session/{sessionId}/cancel
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/{sessionId}/cancel:
    post:
      tags:
        - Sessions
      summary: Cancel a session
      description: >-
        Cancel a session by Id, best practice to cancel a session once it has
        completed. The session and it's associated fields will still exist
        within the database under the same sessionId. The session can be
        completley removed from the database using the delete route AFTER this
        has been executed.
      operationId: cancelSessionApi
      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.
        - name: sessionId
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ObjectId'
          description: The ID of the session to be cancelled.
      responses:
        '302':
          description: >-
            Successful operation, redirect to '/{resourceSlug}/models'. (this
            needs to be modified to correctly display dynamicResponse)
          content:
            dynamicResponse:
              schema:
                $ref: '#/components/schemas/tempRedirectResponse'
        '400':
          description: Invalid modelId provided or model does not exist.
          content:
            dynamicResponse:
              schema:
                $ref: '#/components/schemas/dynamicResponse'
        '403':
          description: >-
            Invalid permissions on the resourceSlug, attempting to delete 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

````