Skip to main content
POST
/
api
/
v1
/
worker-queues
/
{queue_id}
/
workers
/
{worker_id}
/
update-lock
Acquire Update Lock
curl --request POST \
  --url https://control-plane.kubiya.ai/api/v1/worker-queues/{queue_id}/workers/{worker_id}/update-lock \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "worker_id": "<string>",
  "lock_duration_seconds": 300
}
'
import requests

url = "https://control-plane.kubiya.ai/api/v1/worker-queues/{queue_id}/workers/{worker_id}/update-lock"

payload = {
"worker_id": "<string>",
"lock_duration_seconds": 300
}
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({worker_id: '<string>', lock_duration_seconds: 300})
};

fetch('https://control-plane.kubiya.ai/api/v1/worker-queues/{queue_id}/workers/{worker_id}/update-lock', 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://control-plane.kubiya.ai/api/v1/worker-queues/{queue_id}/workers/{worker_id}/update-lock",
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([
'worker_id' => '<string>',
'lock_duration_seconds' => 300
]),
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://control-plane.kubiya.ai/api/v1/worker-queues/{queue_id}/workers/{worker_id}/update-lock"

payload := strings.NewReader("{\n \"worker_id\": \"<string>\",\n \"lock_duration_seconds\": 300\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://control-plane.kubiya.ai/api/v1/worker-queues/{queue_id}/workers/{worker_id}/update-lock")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"worker_id\": \"<string>\",\n \"lock_duration_seconds\": 300\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://control-plane.kubiya.ai/api/v1/worker-queues/{queue_id}/workers/{worker_id}/update-lock")

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 \"worker_id\": \"<string>\",\n \"lock_duration_seconds\": 300\n}"

response = http.request(request)
puts response.read_body
{
  "lock_id": "<string>",
  "worker_id": "<string>",
  "queue_id": "<string>",
  "acquired_at": "<string>",
  "expires_at": "<string>",
  "locked": true
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Enter your Kubiya API token (format: Bearer )

Path Parameters

queue_id
string
required
worker_id
string
required

Body

application/json

Request to acquire an update lock for coordinated rolling updates

worker_id
string
required
lock_duration_seconds
integer
default:300

Lock TTL (60-600 seconds)

Required range: 60 <= x <= 600

Response

Successful Response

Response with update lock information

lock_id
string
required
worker_id
string
required
queue_id
string
required
acquired_at
string
required
expires_at
string
required
locked
boolean
required