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

# Delete a run

> Deletes a specific run and all its associated data, including files and storage.
This is primarily used for PII compliance when an agent extracts personally identifiable
information. The run can be in either the active Runs table or the RunHistory table —
both are checked automatically.

The `removeMethod` parameter controls what is deleted:

- **`RemoveEntireRun`** (default) — completely removes the run record and all associated files.
- **`RemoveAllFiles`** — removes files but keeps the run record.
- **`RemoveAllFilesAndAgentInput`** — removes files and clears agent input parameters.



## OpenAPI

````yaml DELETE /api/v1/agent/{agentId}/run/{runId}
openapi: 3.0.1
info:
  title: Sequentum Cloud API
  description: API endpoints for Sequentum Cloud
  version: v1
servers: []
security:
  - ApiKey: []
    Bearer: []
paths:
  /api/v1/agent/{agentId}/run/{runId}:
    delete:
      tags:
        - ApiAgent
      summary: Delete a run and all its associated data
      description: >-
        Deletes a specific run and all its associated data, including files and
        storage.

        This is primarily used for PII compliance when an agent extracts
        personally identifiable

        information. The run can be in either the active Runs table or the
        RunHistory table —

        both are checked automatically.


        The `removeMethod` parameter controls what is deleted:


        - **`RemoveEntireRun`** (default) — completely removes the run record
        and all associated files.

        - **`RemoveAllFiles`** — removes files but keeps the run record.

        - **`RemoveAllFilesAndAgentInput`** — removes files and clears agent
        input parameters.
      parameters:
        - name: agentId
          in: path
          description: The ID of the agent that contains the run
          required: true
          schema:
            type: integer
            format: int32
        - name: runId
          in: path
          description: The ID of the run to delete
          required: true
          schema:
            type: integer
            format: int64
        - name: removeMethod
          in: query
          description: The deletion method to use. Defaults to RemoveEntireRun.
          schema:
            $ref: '#/components/schemas/RemoveRunMethod'
      responses:
        '204':
          description: The run was successfully deleted
        '400':
          description: If the request is invalid
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/BadRequestError'
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
            text/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          description: If the API key is missing or invalid
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: If the agent or run is not found, or user doesn't have access
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '429':
          description: Too Many Requests
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: If an unexpected server error occurs or the run could not be deleted
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/InternalServerError'
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
            text/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
components:
  schemas:
    RemoveRunMethod:
      enum:
        - RemoveAllFiles
        - RemoveAllFilesAndAgentInput
        - RemoveEntireRun
      type: string
      description: >-
        `0` = `RemoveAllFiles`; `1` = `RemoveAllFilesAndAgentInput`; `2` =
        `RemoveEntireRun`
    BadRequestError:
      type: object
      properties:
        statusCode:
          type: integer
          format: int32
        statusDescription:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
          readOnly: true
        severity:
          $ref: '#/components/schemas/ErrorSeverity'
        errorCode:
          type: string
          description: "Optional machine-readable error code. When present, clients should switch on this\r\nvalue rather than parsing Sequentum.Enterprise.Core.ControllerError.Message. Omitted from the response when null."
          nullable: true
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: {}
    InternalServerError:
      type: object
      properties:
        statusCode:
          type: integer
          format: int32
        statusDescription:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
          readOnly: true
        severity:
          $ref: '#/components/schemas/ErrorSeverity'
        errorCode:
          type: string
          description: "Optional machine-readable error code. When present, clients should switch on this\r\nvalue rather than parsing Sequentum.Enterprise.Core.ControllerError.Message. Omitted from the response when null."
          nullable: true
      additionalProperties: false
    ErrorSeverity:
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
      type: integer
      description: >-
        `0` = `Error`; `1` = `Unexpected`; `2` = `Fatal`; `3` = `Warning`; `4` =
        `Info`
      format: int32
  securitySchemes:
    ApiKey:
      type: apiKey
      description: >-
        API Key authorization header. Example: "Authorization: ApiKey
        {your-api-key}"
      name: Authorization
      in: header
    Bearer:
      type: http
      description: 'OAuth 2.0 Bearer token. Example: "Authorization: Bearer {access-token}"'
      scheme: bearer
      bearerFormat: JWT

````