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

# End socket session

> <Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Ends a session before it expires. Its token stops working, and a connected browser receives `session.ended` with the reason `revoked` and is disconnected. Call it when the page closes, so unused sessions don't count toward the key's or token's 5,000.

Available only to white-label workspaces on the Builder plan or higher, with live AI chat updates turned on. Ask your onboarding contact to turn them on for your workspace.

Session calls are limited to 600 requests a minute per workspace. Some workspaces have a different limit. Every request that counts against the limit gets `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (Unix time in seconds) headers, and a `429` also gets `Retry-After` in seconds.



## OpenAPI

````yaml /developers/references/app-management/app-management-openapi.json delete /api/v1/socket-sessions/{session_id}
openapi: 3.1.0
info:
  title: Base44 App Management API
  version: 1.0.0
servers:
  - url: https://app.base44.com
security:
  - PersonalAccessTokenAuth: []
paths:
  /api/v1/socket-sessions/{session_id}:
    delete:
      summary: End socket session
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        Ends a session before it expires. Its token stops working, and a
        connected browser receives `session.ended` with the reason `revoked` and
        is disconnected. Call it when the page closes, so unused sessions don't
        count toward the key's or token's 5,000.


        Available only to white-label workspaces on the Builder plan or higher,
        with live AI chat updates turned on. Ask your onboarding contact to turn
        them on for your workspace.


        Session calls are limited to 600 requests a minute per workspace. Some
        workspaces have a different limit. Every request that counts against the
        limit gets `X-RateLimit-Limit`, `X-RateLimit-Remaining` and
        `X-RateLimit-Reset` (Unix time in seconds) headers, and a `429` also
        gets `Retry-After` in seconds.
      operationId: end_socket_session_api_v1_socket_sessions__session_id__delete
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[0-9a-f]{32}$
            description: >-
              ID of the session, from `session_id` in [Create socket
              session](/api-reference/create-socket-session).
            title: Session Id
          description: >-
            ID of the session, from `session_id` in [Create socket
            session](/api-reference/create-socket-session).
          example: 3f9a1c0e7b2d4e8f9a6b5c4d3e2f1a0b
      responses:
        '200':
          description: Session ended.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SocketSessionEndedResponse'
          headers:
            X-RateLimit-Limit:
              description: Requests allowed in the current minute.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Requests left in the current minute.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: When the limit resets, in Unix time in seconds.
              schema:
                type: integer
        '401':
          description: >-
            The request has no Bearer token, or the key or personal access token
            isn't valid (`unauthenticated`).
          content:
            application/json:
              examples:
                unauthenticated:
                  summary: unauthenticated
                  value:
                    error:
                      code: unauthenticated
                      message: Invalid workspace API key
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '403':
          description: >-
            The key doesn't have the **Watch app builder updates** permission
            (`scope_required`), or the workspace turned personal access tokens
            off (`personal_access_token_policy_violation`).
          content:
            application/json:
              examples:
                scope_required:
                  summary: scope_required
                  value:
                    error:
                      code: scope_required
                      message: The key needs the apps:watch scope
                      details:
                        required_scope: apps:watch
                personal_access_token_policy_violation:
                  summary: personal_access_token_policy_violation
                  value:
                    error:
                      code: personal_access_token_policy_violation
                      message: >-
                        Personal access tokens are turned off for this
                        workspace.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '404':
          description: >-
            The session ended, expired, or was opened by another key or token
            (`session_not_found`).
          content:
            application/json:
              examples:
                session_not_found:
                  summary: session_not_found
                  value:
                    error:
                      code: session_not_found
                      message: Socket session not found
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '422':
          description: '`session_id` isn''t a valid ID (`invalid_request`).'
          content:
            application/json:
              examples:
                invalid_request:
                  summary: invalid_request
                  value:
                    error:
                      code: invalid_request
                      message: Invalid request
                      details:
                        errors:
                          - type: string_pattern_mismatch
                            loc:
                              - path
                              - session_id
                            msg: String should match pattern '^[0-9a-f]{32}$'
                            input: 3f9a1c0e
                            ctx:
                              pattern: ^[0-9a-f]{32}$
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '429':
          description: Rate limit reached (`rate_limited`). Retry later.
          content:
            application/json:
              examples:
                rate_limited:
                  summary: rate_limited
                  value:
                    error:
                      code: rate_limited
                      message: Rate limit exceeded
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
          headers:
            X-RateLimit-Limit:
              description: Requests allowed in the current minute.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Requests left in the current minute.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: When the limit resets, in Unix time in seconds.
              schema:
                type: integer
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
        '503':
          description: >-
            Database temporarily unavailable (`database_unavailable`): the data
            cluster did not answer in time. Retry after the `Retry-After`
            seconds.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
              examples:
                database_unavailable:
                  summary: database_unavailable
                  value:
                    error:
                      code: database_unavailable
                      message: Database temporarily unavailable, please retry
                      details: {}
      security:
        - WorkspaceApiKeyBearerAuth:
            - apps:watch
        - PersonalAccessTokenAuth:
            - read_only
components:
  schemas:
    SocketSessionEndedResponse:
      properties:
        session_id:
          type: string
          title: Session Id
          description: ID of the session that ended.
          examples:
            - 3f9a1c0e7b2d4e8f9a6b5c4d3e2f1a0b
      type: object
      required:
        - session_id
      title: SocketSessionEndedResponse
    StandardErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/StandardError'
          description: What went wrong.
      type: object
      required:
        - error
      title: StandardErrorEnvelope
      description: The error body returned in the standard envelope.
    StandardError:
      properties:
        code:
          type: string
          title: Code
          description: >-
            Stable machine-readable cause of the failure. Match on this, not on
            `message`.
          example: not_found
        message:
          type: string
          title: Message
          description: Human-readable explanation. It isn't a stable contract.
          example: App not found
        details:
          additionalProperties: true
          type: object
          title: Details
          description: >-
            Structured context for the failure, or an empty object when there's
            none.
          example: {}
      type: object
      required:
        - code
        - message
      title: StandardError
  securitySchemes:
    PersonalAccessTokenAuth:
      type: http
      scheme: bearer
      description: >-
        Personal access token, sent as `Authorization: Bearer <token>`. Each
        operation lists the permission it needs: `read_only` or `full_access`. A
        full-access token can call every operation. A read-only token can call
        only the operations that list `read_only`; anything else returns 403
        `read_only_credential_route_not_allowed`.
    WorkspaceApiKeyBearerAuth:
      type: http
      scheme: bearer
      description: >-
        Workspace API key, sent as `Authorization: Bearer <key>`. Accepted
        wherever `api_key` is, with the same permission.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.