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

# How to cancel or delete a job

> Cancel a running Serverless AI job or delete its record.

If you don't need a job to continue running, you can cancel it. The jobs that finish with `COMPLETED` status are canceled automatically.

If you need to remove any record about the job from the job list, delete the job instead of canceling it.

## Prerequisites

> [tab] Web console
>
> Make sure that you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the
> role within your
> .
> You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

> [tab] CLI
>
> * [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI.
>
>   Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration:
>
>   ```bash theme={null}
>   cat ~/.nebius/config.yaml
>   ```
>
> * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the
>   role within your
>   .
>   You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

> [tab] Go SDK
>
> * [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md).
> * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the
>   role within your
>   .
>   You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

> [tab] Python SDK
>
> * [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md).
> * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the
>   role within your
>   .
>   You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

> [tab] JavaScript SDK
>
> * [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md).
> * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the
>   role within your
>   .
>   You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

> [tab] REST API
>
> * Get an access token to [authenticate to the REST API](https://docs.nebius.com/rest-api/authentication.md).
> * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the
>   role within your
>   .
>   You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

## How to cancel a job

> [tab] Web console
>
> 1. In the sidebar, go to  **Serverless AI** → **Jobs**.
> 2. Find the job and then click  → **Cancel**.
> 3. In the window that opens, confirm canceling the job.

> [tab] CLI
>
> 1. List jobs:
>
>    ```bash theme={null}
>    nebius ai job list
>    ```
>
>    In the output, copy the ID of the required job.
>
> 2. To cancel a job, run:
>
>    ```bash theme={null}
>    nebius ai job cancel <job_ID>
>    ```

> [tab] Go SDK
>
> 1. List jobs:
>
>    ```go theme={null}
>    listJobService := sdk.Services().Ai().V1().Job()
>    jobs, err := listJobService.List(
>        ctx,
>        &ai.ListJobsRequest{ParentId: "<project_ID>"},
>    )
>    if err != nil {
>        return fmt.Errorf("list jobs: %w", err)
>    }
>    fmt.Println(jobs)
>    ```
>
>    In `ai.ListJobsRequest`, set `ParentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk). In the response, copy the `Metadata.Id` of the required job.
>
> 2. To cancel a job, run:
>
>    ```go theme={null}
>    cancelJobService := sdk.Services().Ai().V1().Job()
>    cancelJobOperation, err := cancelJobService.Cancel(
>        ctx,
>        &ai.CancelJobRequest{Id: "<job_ID>"},
>    )
>    if err != nil {
>        return fmt.Errorf("cancel job: %w", err)
>    }
>    if _, err = cancelJobOperation.Wait(ctx); err != nil {
>        return fmt.Errorf("wait for job cancellation: %w", err)
>    }
>    ```
>
>    In `ai.CancelJobRequest`, set `Id` to the job ID that you copied.

> [tab] Python SDK
>
> 1. List jobs:
>
>    ```python theme={null}
>    list_job_service = JobServiceClient(sdk)
>    jobs = await list_job_service.list(
>        ListJobsRequest(parent_id="<project_ID>"),
>    )
>    print(jobs)
>    ```
>
>    In `ListJobsRequest`, set `parent_id` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk). In the response, copy the `metadata.id` of the required job.
>
> 2. To cancel a job, run:
>
>    ```python theme={null}
>    cancel_job_service = JobServiceClient(sdk)
>    cancel_job_operation = await cancel_job_service.cancel(
>        CancelJobRequest(id="<job_ID>"),
>    )
>    await cancel_job_operation.wait()
>    ```
>
>    In `CancelJobRequest`, set `id` to the job ID that you copied.

> [tab] JavaScript SDK
>
> 1. List jobs:
>
>    ```ts theme={null}
>    const listJobService = new JobService(sdk);
>    const jobs = await listJobService.list(
>      ListJobsRequest.create({
>        parentId: "<project_ID>",
>      }),
>    );
>    console.log(jobs);
>    ```
>
>    In `ListJobsRequest`, set `parentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk). In the response, copy the `metadata.id` of the required job.
>
> 2. To cancel a job, run:
>
>    ```ts theme={null}
>    const cancelJobService = new JobService(sdk);
>    const cancelJobOperation = await cancelJobService.cancel(
>      CancelJobRequest.create({ id: "<job_ID>" }),
>    ).result;
>    await cancelJobOperation.wait();
>    ```
>
>    In `CancelJobRequest`, set `id` to the job ID that you copied.

> [tab] REST API
>
> 1. List jobs:
>
>    ```bash theme={null}
>    curl --request GET \
>      --url "https://api.nebius.cloud/ai/v1/jobs?parentId=<project_ID>" \
>      --header "Authorization: Bearer <access_token>"
>    ```
>
>    In the request, specify:
>
>    * Your access token in the `Authorization` header.
>    * The [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id) in the `parentId` query parameter.
>
>    In the response, copy the `metadata.id` of the required job.
>
> 2. Cancel the job:
>
>    ```bash theme={null}
>    curl --request POST \
>      --url 'https://api.nebius.cloud/ai/v1/jobs/cancel' \
>      --header "Authorization: Bearer <access_token>" \
>      --header 'Content-Type: application/json' \
>      --data '{
>        "id": "<job_ID>"
>      }'
>    ```
>
>    In the request, specify:
>
>    * Your access token in the `Authorization` header.
>    * `<job_ID>`: Job ID that you copied.

Canceling a job immediately stops the underlying VM and deletes the container disk. The job remains in the list of jobs. Mounted volumes are retained. You can remove the mounted volumes manually. See the guides on [deleting a filesystem](https://docs.nebius.com/kubernetes/storage/filesystem-over-csi.md#how-to-delete-the-created-resources) and [deleting a bucket](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-delete-buckets).

## How to delete a job

> [tab] Web console
>
> 1. In the sidebar, go to  **Serverless AI** → **Jobs**.
> 2. Find the job and then click  → **Delete**.
> 3. In the window that opens, confirm deleting the job.

> [tab] CLI
>
> 1. List jobs:
>
>    ```bash theme={null}
>    nebius ai job list
>    ```
>
>    In the output, copy the ID of the required job.
>
> 2. Delete the job:
>
>    ```bash theme={null}
>    nebius ai job delete <job_ID>
>    ```

> [tab] Go SDK
>
> 1. List jobs:
>
>    ```go theme={null}
>    listJobService := sdk.Services().Ai().V1().Job()
>    jobs, err := listJobService.List(
>        ctx,
>        &ai.ListJobsRequest{ParentId: "<project_ID>"},
>    )
>    if err != nil {
>        return fmt.Errorf("list jobs: %w", err)
>    }
>    fmt.Println(jobs)
>    ```
>
>    In `ai.ListJobsRequest`, set `ParentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk). In the response, copy the `Metadata.Id` of the required job.
>
> 2. Delete the job:
>
>    ```go theme={null}
>    deleteJobService := sdk.Services().Ai().V1().Job()
>    deleteJobOperation, err := deleteJobService.Delete(
>        ctx,
>        &ai.DeleteJobRequest{Id: "<job_ID>"},
>    )
>    if err != nil {
>        return fmt.Errorf("delete job: %w", err)
>    }
>    if _, err = deleteJobOperation.Wait(ctx); err != nil {
>        return fmt.Errorf("wait for job deletion: %w", err)
>    }
>    ```
>
>    In `ai.DeleteJobRequest`, set `Id` to the job ID that you copied.

> [tab] Python SDK
>
> 1. List jobs:
>
>    ```python theme={null}
>    list_job_service = JobServiceClient(sdk)
>    jobs = await list_job_service.list(
>        ListJobsRequest(parent_id="<project_ID>"),
>    )
>    print(jobs)
>    ```
>
>    In `ListJobsRequest`, set `parent_id` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk). In the response, copy the `metadata.id` of the required job.
>
> 2. Delete the job:
>
>    ```python theme={null}
>    delete_job_service = JobServiceClient(sdk)
>    delete_job_operation = await delete_job_service.delete(
>        DeleteJobRequest(id="<job_ID>"),
>    )
>    await delete_job_operation.wait()
>    ```
>
>    In `DeleteJobRequest`, set `id` to the job ID that you copied.

> [tab] JavaScript SDK
>
> 1. List jobs:
>
>    ```ts theme={null}
>    const listJobService = new JobService(sdk);
>    const jobs = await listJobService.list(
>      ListJobsRequest.create({
>        parentId: "<project_ID>",
>      }),
>    );
>    console.log(jobs);
>    ```
>
>    In `ListJobsRequest`, set `parentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk). In the response, copy the `metadata.id` of the required job.
>
> 2. Delete the job:
>
>    ```ts theme={null}
>    const deleteJobService = new JobService(sdk);
>    const deleteJobOperation = await deleteJobService.delete(
>      DeleteJobRequest.create({ id: "<job_ID>" }),
>    ).result;
>    await deleteJobOperation.wait();
>    ```
>
>    In `DeleteJobRequest`, set `id` to the job ID that you copied.

> [tab] REST API
>
> 1. List jobs:
>
>    ```bash theme={null}
>    curl --request GET \
>      --url "https://api.nebius.cloud/ai/v1/jobs?parentId=<project_ID>" \
>      --header "Authorization: Bearer <access_token>"
>    ```
>
>    In the request, specify:
>
>    * Your access token in the `Authorization` header.
>    * The [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id) in the `parentId` query parameter.
>
>    In the response, copy the `metadata.id` of the required job.
>
> 2. Delete the job:
>
>    ```bash theme={null}
>    curl --request DELETE \
>      --url "https://api.nebius.cloud/ai/v1/jobs/<job_ID>" \
>      --header "Authorization: Bearer <access_token>"
>    ```
>
>    In the request, specify:
>
>    * Your access token in the `Authorization` header.
>    * The job ID that you copied in the request path.

When the job is deleted, it disappears from the list of jobs. If a job is running, deleting cancels the job first.

If the job uses additional volumes, they are not deleted with it. You can remove the mounted volumes manually. See the guides on [deleting a filesystem](https://docs.nebius.com/kubernetes/storage/filesystem-over-csi.md#how-to-delete-the-created-resources) and [deleting a bucket](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-delete-buckets).
