Skip to main content
POST
/
private-api
/
v1
/
{workspace_id}
/
farms
/
{farm_id}
/
tasks
/
batches
Create Task Batch
curl --request POST \
  --url https://api.nonce.app/private-api/v1/{workspace_id}/farms/{farm_id}/tasks/batches \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "task_name": "miner.system.reboot",
  "miner_ids": [
    "<string>"
  ],
  "params": {
    "force": false
  }
}
'
import requests

url = "https://api.nonce.app/private-api/v1/{workspace_id}/farms/{farm_id}/tasks/batches"

payload = {
"task_name": "miner.system.reboot",
"miner_ids": ["<string>"],
"params": { "force": False }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
task_name: 'miner.system.reboot',
miner_ids: ['<string>'],
params: {force: false}
})
};

fetch('https://api.nonce.app/private-api/v1/{workspace_id}/farms/{farm_id}/tasks/batches', 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.nonce.app/private-api/v1/{workspace_id}/farms/{farm_id}/tasks/batches",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'task_name' => 'miner.system.reboot',
'miner_ids' => [
'<string>'
],
'params' => [
'force' => false
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.nonce.app/private-api/v1/{workspace_id}/farms/{farm_id}/tasks/batches"

payload := strings.NewReader("{\n \"task_name\": \"miner.system.reboot\",\n \"miner_ids\": [\n \"<string>\"\n ],\n \"params\": {\n \"force\": false\n }\n}")

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

req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.nonce.app/private-api/v1/{workspace_id}/farms/{farm_id}/tasks/batches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"task_name\": \"miner.system.reboot\",\n \"miner_ids\": [\n \"<string>\"\n ],\n \"params\": {\n \"force\": false\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.nonce.app/private-api/v1/{workspace_id}/farms/{farm_id}/tasks/batches")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"task_name\": \"miner.system.reboot\",\n \"miner_ids\": [\n \"<string>\"\n ],\n \"params\": {\n \"force\": false\n }\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "data": [
    {
      "batch_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "task_name": "miner.log.get",
      "task_count": 10,
      "task_params": {},
      "created_by": {
        "type": "user",
        "id": "user_2xGz1234567890",
        "name": "John Doe",
        "avatar": "https://example.com/avatar.png",
        "metadata": {}
      },
      "created_at": "YYYY-MM-DDTHH:MM:SSZ"
    }
  ],
  "error": null,
  "meta": {
    "summary": {
      "created_count": 123,
      "skipped_count": 123
    },
    "skipped": [
      {
        "reason": "no_change",
        "message": "<string>",
        "miner_ids": [
          "<string>"
        ]
      }
    ]
  }
}
{
"statusCode": 400,
"message": "Invalid request parameters",
"error": "Bad Request"
}
{
"statusCode": 401,
"message": "Invalid or missing API key",
"error": "Unauthorized"
}
{
"statusCode": 403,
"message": "Access denied to workspace",
"error": "Forbidden"
}
{
"statusCode": 404,
"message": "Resource not found",
"error": "Not Found"
}

Authorizations

Authorization
string
header
required

Clerk Machine API Key for authentication

Path Parameters

workspace_id
string
required
farm_id
string
required

Body

application/json
task_name
enum<string>
required

Reboot miner ASIC. Brief downtime. Use after firmware update or when miner is unresponsive.

Available options:
miner.system.reboot
miner_ids
string[]
required

Array of miner IDs to execute task on

Required array length: 1 - 1000 elements
params
object

Reboot parameters (optional).

Response

Successfully created task batches

success
boolean
required

Indicates if the request was successful

Example:

true

data
Miner Task Batch · object[]
required

Array of items

error
null
required

Error object (null on success)

Example:

null

meta
Create Task Batch Meta · object
required