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

# List Executions

> List a sandbox's recorded executions (Python, bash, SQL, TQL) with cursor-based pagination

<Note>
  Every execution run in a sandbox is recorded and listed here newest-first — including after the sandbox is stopped, so this doubles as a post-mortem audit trail. Records are retained for **30 days**, then purged. `input` is stored in full; `output_preview` is truncated (large output ends with a `…[truncated]` marker) and never includes generated files or dataframes.
</Note>


## OpenAPI

````yaml GET /v2/sandcastles/{id}/executions
openapi: 3.1.0
info:
  title: TextQL v2 API
  version: '2.0'
  description: >
    REST API for TextQL platform operations. All endpoints require Bearer token
    authentication.
servers:
  - url: https://app.textql.com
security:
  - bearerAuth: []
tags:
  - name: Chat
    description: Create and manage AI chat sessions
  - name: Connectors
    description: List available data connectors
  - name: Playbooks
    description: Create, configure, and run automated playbooks
  - name: Sandcastles
    description: Manage Python sandbox environments for code execution
  - name: Changes
    description: Review, approve, and deny Ontology changes
  - name: API Keys
    description: Mint and revoke scoped platform API keys
paths:
  /v2/sandcastles/{id}/executions:
    get:
      tags:
        - Sandcastles
      summary: List Executions
      description: |
        List a sandbox's recorded executions (Python, bash, SQL, TQL),
        newest first, with cursor-based pagination.

        Every execution run in a sandbox — via Execute Code, Load Connector
        Data, or chat — is recorded here. Readable even after the sandbox is
        stopped, so it doubles as a post-mortem audit trail.

        Retention: records are kept for **30 days**, then purged. `input` is
        stored in full; `output_preview` is truncated (large output ends with
        a `…[truncated]` marker) and never includes generated files or
        dataframes.
      operationId: v2.listSandboxExecutions
      parameters:
        - $ref: '#/components/parameters/SandboxId'
        - name: limit
          in: query
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 200
            default: 50
          description: Maximum number of executions to return (default 50, max 200)
        - name: cursor
          in: query
          schema:
            type: string
          description: |
            Opaque pagination cursor from a previous response's `next_cursor`.
            Omit to start from the first (newest) page.
      responses:
        '200':
          description: Paginated list of executions, newest first
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListSandboxExecutionsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    SandboxId:
      name: id
      in: path
      required: true
      schema:
        type: string
      description: Sandbox ID
  schemas:
    ListSandboxExecutionsResponse:
      type: object
      required:
        - executions
      properties:
        executions:
          type: array
          items:
            $ref: '#/components/schemas/SandboxExecution'
        next_cursor:
          type: string
          description: |
            Opaque cursor to pass as `cursor` on the next request. Omitted when
            there are no more results.
    SandboxExecution:
      type: object
      properties:
        id:
          type: string
          description: Unique execution identifier
        kind:
          type: string
          enum:
            - python
            - bash
            - sql
            - tql
          description: Execution type
        source:
          type: string
          enum:
            - platform_api
            - chat
            - dashboard
            - playbook
            - internal
          description: Product surface that triggered the execution
        input:
          type: string
          description: |
            The executed input — code (python/bash), SQL text (sql), or the
            library path (tql).
        output_preview:
          type: string
          description: |
            Truncated output preview (up to 16 KB; longer output ends with a
            `…[truncated]` marker). Does not include generated files or
            dataframes.
        error:
          type: string
          description: Error message when the execution failed; empty otherwise.
        duration_ms:
          type: integer
          format: int64
          description: Execution duration in milliseconds
        created_at:
          type: string
          format: date-time
          description: When the execution ran
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code
              enum:
                - invalid_request
                - unauthenticated
                - permission_denied
                - not_found
                - conflict
                - rate_limit_exceeded
                - internal
                - timeout
                - cancelled
                - execution_failed
                - no_report
            message:
              type: string
              description: Human-readable error message
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: invalid_request
              message: Invalid request body
    Unauthorized:
      description: Missing or invalid authentication
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: unauthenticated
              message: Authentication required
    Forbidden:
      description: Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: permission_denied
              message: Insufficient permissions
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: not_found
              message: Resource not found
    RateLimited:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: rate_limit_exceeded
              message: Rate limit exceeded
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: internal
              message: Internal server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key or JWT token

````