PostHog task-runs API

The task-runs API from PostHog — 17 operation(s) for task-runs.

Operations 19

GET /api/projects/{project_id}/tasks/{task_id}/runs/ List task runs #
POST /api/projects/{project_id}/tasks/{task_id}/runs/ Create task run #
GET /api/projects/{project_id}/tasks/{task_id}/runs/{id}/ #
PATCH /api/projects/{project_id}/tasks/{task_id}/runs/{id}/ Update task run #
POST /api/projects/{project_id}/tasks/{task_id}/runs/{id}/append_log/ Append log entries #
POST /api/projects/{project_id}/tasks/{task_id}/runs/{id}/artifacts/ Upload artifacts for a task run #
POST /api/projects/{project_id}/tasks/{task_id}/runs/{id}/artifacts/download/ Download an artifact through the backend #
POST /api/projects/{project_id}/tasks/{task_id}/runs/{id}/artifacts/finalize_upload/ Finalize direct uploads for task run artifacts #
POST /api/projects/{project_id}/tasks/{task_id}/runs/{id}/artifacts/prepare_upload/ Prepare direct uploads for task run artifacts #
POST /api/projects/{project_id}/tasks/{task_id}/runs/{id}/artifacts/presign/ Generate presigned URL for an artifact #
POST /api/projects/{project_id}/tasks/{task_id}/runs/{id}/command/ Send command to agent server #
GET /api/projects/{project_id}/tasks/{task_id}/runs/{id}/connection_token/ Get sandbox connection token #
GET /api/projects/{project_id}/tasks/{task_id}/runs/{id}/logs/ Get task run logs #
POST /api/projects/{project_id}/tasks/{task_id}/runs/{id}/relay_message/ Relay run message to Slack #
POST /api/projects/{project_id}/tasks/{task_id}/runs/{id}/resume_in_cloud/ Resume task run in cloud #
GET /api/projects/{project_id}/tasks/{task_id}/runs/{id}/session_logs/ Get filtered task run session logs #
PATCH /api/projects/{project_id}/tasks/{task_id}/runs/{id}/set_output/ Set run output #
POST /api/projects/{project_id}/tasks/{task_id}/runs/{id}/start/ Start task run #
GET /api/projects/{project_id}/tasks/{task_id}/runs/{id}/stream/ #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/posthog-task-runs-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

posthog-task-runs-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: PostHog actions Task Runs API
  version: 1.0.0
  description: ''
servers:
- url: https://app.posthog.com/api
  description: Base URL declared by the provider in apis.yml (roadmap#122).
tags:
- name: task-runs
paths:
  /api/projects/{project_id}/tasks/{task_id}/runs/:
    get:
      operationId: tasks_runs_list
      description: Get a list of runs for a specific task.
      summary: List task runs
      parameters:
      - name: limit
        required: false
        in: query
        description: Number of results to return per page.
        schema:
          type: integer
      - name: offset
        required: false
        in: query
        description: The initial index from which to return the results.
        schema:
          type: integer
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      security:
      - PersonalAPIKeyAuth:
        - task:read
      - PersonalAPIKeyAuth:
        - task:read
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedTaskRunDetailList'
          description: List of task runs
      x-explicit-tags:
      - task-runs
      - tasks
    post:
      operationId: tasks_runs_create
      description: Create a new run for a specific task without starting execution.
      summary: Create task run
      parameters:
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRunBootstrapCreateRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TaskRunBootstrapCreateRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TaskRunBootstrapCreateRequest'
      security:
      - PersonalAPIKeyAuth:
        - task:write
      - PersonalAPIKeyAuth:
        - task:write
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunDetail'
          description: Created task run
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunErrorResponse'
          description: Invalid task run payload
      x-explicit-tags:
      - task-runs
      - tasks
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/:
    get:
      operationId: tasks_runs_retrieve
      description: API for managing task runs. Each run represents an execution of a task.
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      security:
      - PersonalAPIKeyAuth:
        - task:read
      - PersonalAPIKeyAuth:
        - task:read
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunDetail'
          description: ''
      x-explicit-tags:
      - task-runs
    patch:
      operationId: tasks_runs_partial_update
      description: API for managing task runs. Each run represents an execution of a task.
      summary: Update task run
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedTaskRunUpdate'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedTaskRunUpdate'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedTaskRunUpdate'
      security:
      - PersonalAPIKeyAuth:
        - task:write
      - PersonalAPIKeyAuth:
        - task:write
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunDetail'
          description: Updated task run
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid update data
        '404':
          description: Task run not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/append_log/:
    post:
      operationId: tasks_runs_append_log_create
      description: Append one or more log entries to the task run log array
      summary: Append log entries
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRunAppendLogRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TaskRunAppendLogRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TaskRunAppendLogRequest'
        required: true
      security:
      - PersonalAPIKeyAuth:
        - task:write
      - PersonalAPIKeyAuth:
        - task:write
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunDetail'
          description: Run with updated log
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid log entries
        '404':
          description: Run not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/artifacts/:
    post:
      operationId: tasks_runs_artifacts_create
      description: Persist task artifacts to S3 and attach them to the run manifest.
      summary: Upload artifacts for a task run
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactsUploadRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactsUploadRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactsUploadRequest'
        required: true
      security:
      - PersonalAPIKeyAuth:
        - task:write
      - PersonalAPIKeyAuth:
        - task:write
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunArtifactsUploadResponse'
          description: Run with updated artifact manifest
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid artifact payload
        '404':
          description: Run not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/artifacts/download/:
    post:
      operationId: tasks_runs_artifacts_download_create
      description: Streams artifact content for a task run artifact after validating that it belongs to the run.
      summary: Download an artifact through the backend
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactPresignRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactPresignRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactPresignRequest'
        required: true
      security:
      - PersonalAPIKeyAuth:
        - task:read
      - PersonalAPIKeyAuth:
        - task:read
      responses:
        '200':
          description: Artifact content
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid request
        '404':
          description: Artifact not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/artifacts/finalize_upload/:
    post:
      operationId: tasks_runs_artifacts_finalize_upload_create
      description: Verify directly uploaded S3 objects and attach them to the run artifact manifest.
      summary: Finalize direct uploads for task run artifacts
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactsFinalizeUploadRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactsFinalizeUploadRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactsFinalizeUploadRequest'
        required: true
      security:
      - PersonalAPIKeyAuth:
        - task:write
      - PersonalAPIKeyAuth:
        - task:write
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunArtifactsFinalizeUploadResponse'
          description: Run with updated artifact manifest
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid artifact payload
        '404':
          description: Run not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/artifacts/prepare_upload/:
    post:
      operationId: tasks_runs_artifacts_prepare_upload_create
      description: Reserve S3 object keys for task artifacts and return presigned POST forms for direct uploads.
      summary: Prepare direct uploads for task run artifacts
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactsPrepareUploadRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactsPrepareUploadRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactsPrepareUploadRequest'
        required: true
      security:
      - PersonalAPIKeyAuth:
        - task:write
      - PersonalAPIKeyAuth:
        - task:write
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunArtifactsPrepareUploadResponse'
          description: Prepared uploads for the requested artifacts
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid artifact payload
        '404':
          description: Run not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/artifacts/presign/:
    post:
      operationId: tasks_runs_artifacts_presign_create
      description: Returns a temporary, signed URL that can be used to download a specific artifact.
      summary: Generate presigned URL for an artifact
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactPresignRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactPresignRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TaskRunArtifactPresignRequest'
        required: true
      security:
      - PersonalAPIKeyAuth:
        - task:read
      - PersonalAPIKeyAuth:
        - task:read
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunArtifactPresignResponse'
          description: Presigned URL for the requested artifact
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid request
        '404':
          description: Artifact not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/command/:
    post:
      operationId: tasks_runs_command_create
      description: Forward a JSON-RPC command to the agent server running in the sandbox. Supports user_message, cancel, close, permission_response, and set_config_option commands.
      summary: Send command to agent server
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRunCommandRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TaskRunCommandRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TaskRunCommandRequest'
        required: true
      security:
      - PersonalAPIKeyAuth:
        - task:write
      - PersonalAPIKeyAuth:
        - task:write
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunCommandResponse'
          description: Agent server response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid command or no active sandbox
        '404':
          description: Task run not found
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Agent server unreachable
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/connection_token/:
    get:
      operationId: tasks_runs_connection_token_retrieve
      description: Generate a JWT token for direct connection to the sandbox. Valid for 24 hours.
      summary: Get sandbox connection token
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      security:
      - PersonalAPIKeyAuth:
        - task:read
      - PersonalAPIKeyAuth:
        - task:read
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionTokenResponse'
          description: Connection token for direct sandbox connection
        '404':
          description: Task run not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/logs/:
    get:
      operationId: tasks_runs_logs_retrieve
      description: Fetch the logs for a task run as JSONL. If the run resumes from another (state.resume_from_run_id), each ancestor's log is concatenated first (oldest ancestor → ... → this run) so resume consumers see a single continuous history and can find the most recent git_checkpoint event regardless of which run emitted it.
      summary: Get task run logs
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      security:
      - PersonalAPIKeyAuth:
        - task:read
      - PersonalAPIKeyAuth:
        - task:read
      responses:
        '200':
          description: Log content in JSONL format
        '404':
          description: Task run not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/relay_message/:
    post:
      operationId: tasks_runs_relay_message_create
      description: Queue a Slack relay workflow to post a run message into the mapped Slack thread.
      summary: Relay run message to Slack
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRunRelayMessageRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TaskRunRelayMessageRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TaskRunRelayMessageRequest'
        required: true
      security:
      - PersonalAPIKeyAuth:
        - task:write
      - PersonalAPIKeyAuth:
        - task:write
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunRelayMessageResponse'
          description: Relay accepted
        '404':
          description: Run not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/resume_in_cloud/:
    post:
      operationId: tasks_runs_resume_in_cloud_create
      description: Resume an existing task run in a cloud sandbox. Terminates any existing workflow and starts a new one.
      summary: Resume task run in cloud
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      security:
      - PersonalAPIKeyAuth:
        - task:write
      - PersonalAPIKeyAuth:
        - task:write
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunDetail'
          description: Run resumed in cloud
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Run already active or workflow failed
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/session_logs/:
    get:
      operationId: tasks_runs_session_logs_retrieve
      description: Fetch session log entries for a task run with optional filtering by timestamp, event type, and limit.
      summary: Get filtered task run session logs
      parameters:
      - in: query
        name: after
        schema:
          type: string
          format: date-time
        description: Only return events after this ISO8601 timestamp
      - in: query
        name: event_types
        schema:
          type: string
          minLength: 1
        description: Comma-separated list of event types to include
      - in: query
        name: exclude_types
        schema:
          type: string
          minLength: 1
        description: Comma-separated list of event types to exclude
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - in: query
        name: limit
        schema:
          type: integer
          maximum: 5000
          minimum: 1
          default: 1000
        description: Maximum number of entries to return (default 1000, max 5000)
      - in: query
        name: offset
        schema:
          type: integer
          minimum: 0
          default: 0
        description: Zero-based offset into the filtered log entries
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      security:
      - PersonalAPIKeyAuth:
        - task:read
      - PersonalAPIKeyAuth:
        - task:read
      responses:
        '200':
          description: Filtered log events as JSON array
        '404':
          description: Task run not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/set_output/:
    patch:
      operationId: tasks_runs_set_output_partial_update
      description: Update the output field for a task run (e.g., PR URL, commit SHA, etc.)
      summary: Set run output
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedTaskRunSetOutputRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedTaskRunSetOutputRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedTaskRunSetOutputRequest'
      security:
      - PersonalAPIKeyAuth:
        - task:write
      - PersonalAPIKeyAuth:
        - task:write
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunDetail'
          description: Run with updated output
        '404':
          description: Run not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/start/:
    post:
      operationId: tasks_runs_start_create
      description: Start an existing cloud run after any initial run-scoped attachments have been uploaded.
      summary: Start task run
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRunStartRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TaskRunStartRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TaskRunStartRequest'
      security:
      - PersonalAPIKeyAuth:
        - task:write
      - PersonalAPIKeyAuth:
        - task:write
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Task'
          description: Task with updated latest run
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid start payload
        '404':
          description: Task run not found
      x-explicit-tags:
      - task-runs
  /api/projects/{project_id}/tasks/{task_id}/runs/{id}/stream/:
    get:
      operationId: tasks_runs_stream_retrieve
      description: API for managing task runs. Each run represents an execution of a task.
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this task run.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: path
        name: task_id
        schema:
          type: string
          format: uuid
        required: true
      tags:
      - task-runs
      security:
      - PersonalAPIKeyAuth:
        - task:read
      - PersonalAPIKeyAuth:
        - task:read
      responses:
        '200':
          content:
            text/event-stream:
              schema:
                $ref: '#/components/schemas/TaskRunDetail'
          description: ''
      x-explicit-tags:
      - task-runs
components:
  schemas:
    S3PresignedPost:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: Presigned S3 POST URL
        fields:
          type: object
          additionalProperties:
            type: string
          description: Form fields that must be submitted verbatim with the file upload
      required:
      - fields
      - url
    PrAuthorshipModeEnum:
      enum:
      - user
      - bot
      type: string
      description: '* `user` - user

        * `bot` - bot'
    TaskRunDetailStatusEnum:
      enum:
      - not_started
      - queued
      - in_progress
      - completed
      - failed
      - cancelled
      type: string
      description: '* `not_started` - Not Started

        * `queued` - Queued

        * `in_progress` - In Progress

        * `completed` - Completed

        * `failed` - Failed

        * `cancelled` - Cancelled'
    NullEnum:
      enum:
      - null
    MethodEnum:
      enum:
      - user_message
      - cancel
      - close
      - permission_response
      - set_config_option
      type: string
      description: '* `user_message` - user_message

        * `cancel` - cancel

        * `close` - close

        * `permission_response` - permission_response

        * `set_config_option` - set_config_option'
    TaskRunArtifactPrepareUpload:
      type: object
      properties:
        name:
          type: string
          description: File name to associate with the artifact
          maxLength: 255
        type:
          allOf:
          - $ref: '#/components/schemas/TaskRunArtifactTypeEnum'
          description: 'Classification for the artifact


            * `plan` - plan

            * `context` - context

            * `reference` - reference

            * `output` - output

            * `artifact` - artifact

            * `tree_snapshot` - tree_snapshot

            * `user_attachment` - user_attachment'
        source:
          type: string
          default: ''
          description: Optional source label for the artifact, such as agent_output or user_attachment
          maxLength: 64
        size:
          type: integer
          maximum: 31457280
          minimum: 1
          description: Expected upload size in bytes (max 31457280 bytes)
        content_type:
          type: string
          description: Optional MIME type for the artifact upload
          maxLength: 255
      required:
      - name
      - size
      - type
    ContentEncodingEnum:
      enum:
      - utf-8
      - base64
      type: string
      description: '* `utf-8` - utf-8

        * `base64` - base64'
    TaskRunStartRequest:
      type: object
      properties:
        pending_user_message:
          type: string
          description: Initial or follow-up user message to include in the run prompt.
        pending_user_artifact_ids:
          type: array
          items:
            type: string
            maxLength: 128
          description: Identifiers for run artifacts that should be attached to the next user message delivered to the sandbox.
    ConnectionTokenResponse:
      type: object
      description: Response containing a JWT token for direct sandbox connection
      properties:
        token:
          type: string
          description: JWT token for authenticating with the sandbox
      required:
      - token
    OriginProductEnum:
      enum:
      - error_tracking
      - eval_clusters
      - user_created
      - automation
      - slack
      - support_queue
      - session_summaries
      - signal_report
      type: string
      description: '* `error_tracking` - Error Tracking

        * `eval_clusters` - Eval Clusters

        * `user_created` - User Created

        * `automation` - A

# --- truncated at 32 KB (60 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/posthog/refs/heads/main/openapi/posthog-task-runs-api-openapi.yml