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

# Apify: Stop Actor Run

> Stopping or canceling a running or scheduled Apify Actor run by run ID while preserving completed output. Includes SDK V2 examples, schemas, and cost.

Stopping or canceling a running or scheduled Apify Actor run by run ID while preserving completed output.

<Info>
  Tool ID: `apify_stop_actor_run`
</Info>

## Run this action

Use the TypeScript SDK for a single call. Put `ctx.tools.execute(...)` inside a Play when the call should be durable, scheduled, or run across a CSV.

```ts theme={null}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'apify_stop_actor_run',
  {
    "runId": "run_123"
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={null}
deepline tools execute apify_stop_actor_run --input '{
  "runId": "run_123"
}' --json
```

## Example response

The SDK exposes this shape at `result.toolResponse.raw`. Values below are representative.

```json theme={null}
{
  "data": {
    "id": "id_123",
    "status": "example"
  }
}
```

Use `deepline tools get apify_stop_actor_run --json` for the latest machine-readable contract.

## Input reference

Apify stop actor run input.

| Name                 | Type      | Required | Default | Details                                                                  |
| -------------------- | --------- | -------- | ------- | ------------------------------------------------------------------------ |
| `payload.runId`      | `string`  | Yes      | —       | —                                                                        |
| `payload.gracefully` | `boolean` | No       | `false` | Give the Actor time to persist state before stopping. Defaults to false. |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Apify stop actor run input.",
    "properties": {
      "runId": {
        "type": "string"
      },
      "gracefully": {
        "type": "boolean",
        "description": "Give the Actor time to persist state before stopping. Defaults to false.",
        "default": false
      }
    },
    "required": [
      "runId"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

Apify stop actor run result envelope.

| Name                                         | Type                    | Required | Default | Details                                        |
| -------------------------------------------- | ----------------------- | -------- | ------- | ---------------------------------------------- |
| `result.data`                                | `object`                | Yes      | —       | Current Apify Actor run state after stopping.  |
| `result.data.id`                             | `string`                | Yes      | —       | —                                              |
| `result.data.status`                         | `string`                | Yes      | —       | —                                              |
| `result.data.actId`                          | `string`                | No       | —       | —                                              |
| `result.data.defaultDatasetId`               | `string`                | No       | —       | —                                              |
| `result.data.startedAt`                      | `string`                | No       | —       | —                                              |
| `result.data.finishedAt`                     | `string \| null`        | No       | —       | —                                              |
| `result.data.next`                           | `object`                | No       | —       | —                                              |
| `result.data.next.getActorRun`               | `object`                | Yes      | —       | —                                              |
| `result.data.next.getActorRun.tool`          | `"apify_get_actor_run"` | Yes      | —       | —                                              |
| `result.data.next.getActorRun.payload`       | `object`                | Yes      | —       | —                                              |
| `result.data.next.getActorRun.payload.runId` | `string`                | Yes      | —       | —                                              |
| `result.meta`                                | `record`                | No       | —       | Additional response metadata (status, paging). |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Apify stop actor run result envelope.",
    "properties": {
      "data": {
        "type": "object",
        "description": "Current Apify Actor run state after stopping.",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "actId": {
            "type": "string"
          },
          "defaultDatasetId": {
            "type": "string"
          },
          "startedAt": {
            "type": "string"
          },
          "finishedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "next": {
            "type": "object",
            "properties": {
              "getActorRun": {
                "type": "object",
                "properties": {
                  "tool": {
                    "type": "string",
                    "const": "apify_get_actor_run"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "runId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "runId"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "tool",
                  "payload"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "getActorRun"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "status"
        ],
        "additionalProperties": true
      },
      "meta": {
        "type": "object",
        "description": "Additional response metadata (status, paging).",
        "additionalProperties": {}
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.

## Related documentation

* [Apify provider guide](/docs/providers/apify/guide)
* [SDK V2 quickstart](/docs/sdk-v2/quickstart)
* [SDK reference](/docs/sdk-v2/sdk-reference)
* [Run tools across a CSV](/docs/sdk-v2/batch-csv)
