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>"
}
]
}API Reference
Acquire Update Lock
Acquire an update lock for coordinated rolling updates.
This ensures only one worker in a queue updates at a time. Uses Redis for distributed locking with automatic TTL expiration.
Args: queue_id: Worker queue ID worker_id: Worker ID requesting the lock lock_request: Lock configuration (duration)
Returns: Lock information if acquired, or error if another worker holds the lock
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
Enter your Kubiya API token (format: Bearer )
Body
application/json
Was this page helpful?
⌘I