# IRPCScheduledJobsAdmin.CancelScheduledJob

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Administration API](https://developer.m-files.com/APIs/gRPC-API/admin/index.md) > [Scheduled jobs](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScheduledJobsAdmin/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScheduledJobsAdmin/CancelScheduledJob/

Badges: `Administration API / specialized` `admin` `session` `idempotent`

Asks a running scheduled job to stop.

- **Service:** [Scheduled jobs](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScheduledJobsAdmin/index.md) `MFiles.IRPCScheduledJobsAdmin`
- **gRPC method:** `/MFiles.IRPCScheduledJobsAdmin/CancelScheduledJob`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/cancel-scheduled-job`
- **Request:** [`CancelScheduledJobRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScheduledJobsAdmin/CancelScheduledJob/index.md#request)
- **Response:** [`CancelScheduledJobResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScheduledJobsAdmin/CancelScheduledJob/index.md#response)
- **Book and level:** Administration API, specialized
- **Kind:** admin
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** yes
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- Sets the job's cancel flag and returns; the job stops asynchronously. Check
  `last_run_cancelled` with
  [GetScheduledJobRunInfo](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScheduledJobsAdmin/GetScheduledJobRunInfo/index.md).
- Allowed also when the vault is offline, so that a vault's optimize job can be stopped.
- Requires `manage_jobs`, or the rights for the job's type (see the service overview). An
  unknown ID fails with "Not found.".

<a id="request"></a>

## Request: CancelScheduledJobRequest

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `scheduled_job` | `int32` | The ID of the job to cancel. |

<a id="response"></a>

## Response: CancelScheduledJobResponse

No fields.

<a id="related"></a>

## Related methods

- [GetScheduledJobRunInfo](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScheduledJobsAdmin/GetScheduledJobRunInfo/index.md): Gets the run state of a scheduled job: running or not, last and next run, errors and progress.
