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

# Cleanup Inactive Sessions

> 清理不活跃的会话



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/agentlin/openapi.documented.yml post /env/sessions/cleanup
openapi: 3.1.0
info:
  title: Agentlin API
  description: >-
    The Agentlin REST API. Please see https://linxueyuan.online/agentlin/ for
    more details.
  version: 2.3.0
  termsOfService: https://linxueyuan.online/policies/terms-of-use
  contact:
    name: Agentlin Support
    url: https://help.linxueyuan.online/
  license:
    name: MIT
    url: https://github.com/LinXueyuanStdio/agentlin/blob/master/LICENSE
servers:
  - url: https://api.linxueyuan.online/v1
security:
  - ApiKeyAuth: []
tags:
  - name: Tasks
    description: Create, retrieve, and cancel agent tasks.
  - name: Environment
    description: Interact with remote environments.
paths:
  /env/sessions/cleanup:
    post:
      tags:
        - Environment
      summary: Cleanup Inactive Sessions
      description: 清理不活跃的会话
      operationId: cleanup_inactive_sessions_v1_env_sessions_cleanup_post
      parameters:
        - name: inactive_seconds
          in: query
          required: false
          schema:
            type: integer
            description: Inactive threshold in seconds
            default: 3600
            title: Inactive Seconds
          description: Inactive threshold in seconds
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Client from 'agentlin_client';

            const client = new Client({
              apiKey: process.env['AGENTLIN_API_KEY'], // This is the default and can be omitted
            });

            const response = await client.env.cleanSession();

            console.log(response);
        - lang: Python
          source: |-
            import os
            from agentlin_client import Client

            client = Client(
                api_key=os.environ.get("AGENTLIN_API_KEY"),  # This is the default and can be omitted
            )
            response = client.env.clean_session()
            print(response)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/LinXueyuanStdio/agentlin-client-go\"\n\t\"github.com/LinXueyuanStdio/agentlin-client-go/option\"\n)\n\nfunc main() {\n\tclient := agentlin.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Env.CleanSession(context.TODO(), agentlin.EnvCleanSessionParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}\n"
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer

````