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

> ## Agent Instructions
> Internal links on these pages omit the .md extension. Append .md to a docs page URL, or send an Accept: text/markdown header, to get that page as markdown.

# 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 5,000.

Available to white-label workspaces with live builder updates turned on. Your onboarding contact turns 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/service/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/service/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 5,000.


        Available to white-label workspaces with live builder updates turned on.
        Your onboarding contact turns 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_service_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 isn't valid
            (`unauthenticated`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
              examples:
                unauthenticated:
                  summary: unauthenticated
                  value:
                    error:
                      code: unauthenticated
                      message: Invalid workspace API key
                      details: {}
        '403':
          description: >-
            The key doesn't have the **Watch app builder updates** permission
            (`scope_required`).
          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
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '404':
          description: >-
            The session ended, expired, or was opened by another key
            (`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:
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
              examples:
                rate_limited:
                  summary: rate_limited
                  value:
                    error:
                      code: rate_limited
                      message: Rate limit exceeded
                      details: {}
          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
      security:
        - WorkspaceApiKeyBearerAuth:
            - apps:watch
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>`.'

````

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