Skip to main content
PUT
/
v1
/
jobs
/
{uuid}
/
cancel
Stop Job
curl --request PUT \
  --url https://api.dispersed.com/v1/jobs/{uuid}/cancel \
  --header 'Content-Type: application/json' \
  --data '
{
  "reason": "Cancelled by user"
}
'
import requests

url = "https://api.dispersed.com/v1/jobs/{uuid}/cancel"

payload = { "reason": "Cancelled by user" }
headers = {"Content-Type": "application/json"}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({reason: 'Cancelled by user'})
};

fetch('https://api.dispersed.com/v1/jobs/{uuid}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dispersed.com/v1/jobs/{uuid}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'reason' => 'Cancelled by user'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.dispersed.com/v1/jobs/{uuid}/cancel"

payload := strings.NewReader("{\n \"reason\": \"Cancelled by user\"\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://api.dispersed.com/v1/jobs/{uuid}/cancel")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"Cancelled by user\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.dispersed.com/v1/jobs/{uuid}/cancel")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"Cancelled by user\"\n}"

response = http.request(request)
puts response.read_body
{
  "object": "job",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "title": "<string>",
  "cpu_count": 123,
  "gpu_count": 123,
  "min_ram_gb": 123,
  "min_vram_gb": 123,
  "min_storage_gb": 123,
  "parameters": {
    "parameters": {
      "allowed_ips": [
        "<string>"
      ],
      "env": {},
      "host": "<string>",
      "image": "<string>",
      "imagesrc": "<string>",
      "ports": [
        123
      ],
      "secret": "<string>",
      "sshkey": "<string>",
      "tag": "<string>",
      "user": "<string>",
      "volumes": [
        {
          "image": "<string>",
          "mount": "<string>",
          "registry": "<string>",
          "secret": "<string>",
          "tag": "<string>",
          "user": "<string>"
        }
      ]
    },
    "type": "docker"
  },
  "timeout_assign_at_ms": 123,
  "uuid": "<string>",
  "started_at": "2023-11-07T05:31:56Z",
  "completed_at": "2023-11-07T05:31:56Z",
  "description": "<string>",
  "gpu_name": "<string>",
  "gpu_registry_uuid": "<string>",
  "max_timeout_assign_ms": 123,
  "max_timeout_run_ms": 123,
  "max_timeout_start_ms": 123,
  "max_retry_count": 123,
  "max_node_count": 123,
  "image_size_bytes": 123,
  "allowed_region_codes": [],
  "container_access_tokens": [],
  "status_reason": "<string>",
  "source_recipe_uuid": "<string>"
}
{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}
{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}
{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}
{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}

Path Parameters

uuid
string<uuid>
required

Body

application/json
reason
string
Example:

"Cancelled by user"

Response

Job cancelled

object
enum<string>
required
Available options:
job
created_at
string<date-time> | null
required
updated_at
string<date-time> | null
required
status
enum<string>
required
Available options:
PENDING,
ASSIGNED,
RUNNING,
COMPLETED,
CANCELLED,
FAILED
task
enum<string>
required
Available options:
BATCH,
PERSISTENT
title
string
required
cpu_count
number | null
required
gpu_count
number | null
required
min_ram_gb
number
required
min_vram_gb
number
required
min_storage_gb
number
required
parameters
object
required
timeout_assign_at_ms
number | null
required
uuid
string | null
started_at
string<date-time> | null
completed_at
string<date-time> | null
description
string | null
gpu_name
string | null
gpu_registry_uuid
string | null
max_timeout_assign_ms
number | null
max_timeout_run_ms
number | null
max_timeout_start_ms
number | null
max_retry_count
number | null
max_node_count
number | null
image_size_bytes
number | null
allowed_region_codes
(enum<string> | null)[]

Coarse geographic-network region identifier (AWS-style naming).

Available options:
ca-central-1,
ca-west-1,
mx-central-1,
sa-east-1,
us-east-1,
us-east-2,
us-west-1,
us-west-2,
eu-central-1,
eu-central-2,
eu-north-1,
eu-south-1,
eu-south-2,
eu-west-1,
eu-west-2,
eu-west-3,
ap-east-1,
ap-east-2,
ap-northeast-1,
ap-northeast-2,
ap-northeast-3,
ap-south-1,
ap-south-2,
ap-southeast-1,
ap-southeast-2,
ap-southeast-3,
ap-southeast-4,
ap-southeast-5,
ap-southeast-6,
ap-southeast-7,
cn-north-1,
cn-northwest-1,
af-south-1,
il-central-1,
me-central-1,
me-south-1,
null
Example:

"us-west-2"

container_access_tokens
object[]
status_reason
string | null
source_recipe_uuid
string | null