Update a task from a hook callback
curl --request PATCH \
--url https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/{agentId}/tasks/{taskId} \
--header 'Content-Type: application/json' \
--header 'X-Hook-Token: <api-key>' \
--data '
{
"status": {
"state": "completed"
}
}
'const options = {
method: 'PATCH',
headers: {'X-Hook-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: {state: 'completed'}})
};
fetch('https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/{agentId}/tasks/{taskId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/{agentId}/tasks/{taskId}"
payload = { "status": { "state": "completed" } }
headers = {
"X-Hook-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"ok": true,
"taskId": "<string>",
"status": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Tasks
Update a task from a hook callback
Callback used by async and stream hook targets (the
callback.patch_url they receive) to update the task they were
invoked for. Authenticated with the callback token from
callback.token, sent in X-Hook-Token (or
Authorization: Bearer cbt_...). User credentials are not used on
this method. When status is set, a task.status event is emitted to
the task’s subscribers.
PATCH
/
v1
/
agents
/
{agentId}
/
tasks
/
{taskId}
Update a task from a hook callback
curl --request PATCH \
--url https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/{agentId}/tasks/{taskId} \
--header 'Content-Type: application/json' \
--header 'X-Hook-Token: <api-key>' \
--data '
{
"status": {
"state": "completed"
}
}
'const options = {
method: 'PATCH',
headers: {'X-Hook-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: {state: 'completed'}})
};
fetch('https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/{agentId}/tasks/{taskId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/{agentId}/tasks/{taskId}"
payload = { "status": { "state": "completed" } }
headers = {
"X-Hook-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"ok": true,
"taskId": "<string>",
"status": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Authorizations
Short-lived callback token (cbt_...) minted for one hook
invocation and delivered to the hook target in callback.token.
Authorization: Bearer cbt_... is also accepted.
Path Parameters
Maximum string length:
64Maximum string length:
128Body
application/json
Was this page helpful?