For AI agents: markdown of this page — /docs-content-en/entities/tasks/results-last.md documentation index — /llms.txt
Get the ID of the last task result
GET /v1/tasks/:taskId/results/last
Returns the ID of the task's last result — the largest ID among its results, without the text or author.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ParametertaskId (path) |
Typenumber | Requiredyes | DescriptionTask ID, a positive integer. List: GET /v1/tasks |
Examples
curl — personal key
curl -X GET "https://vibecode.bitrix24.com/v1/tasks/4207/results/last" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X GET "https://vibecode.bitrix24.com/v1/tasks/4207/results/last" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/4207/results/last', {
headers: {
'X-Api-Key': 'YOUR_API_KEY',
},
})
const { success, data } = await res.json()
console.log('Last result ID:', data.result)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/4207/results/last', {
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue if the request succeeded |
Fielddata |
Typeobject | DescriptionWrapper with the result ID |
Fielddata.result |
Typenumber | DescriptionID of the task's last result, or 0 for a task without results. The result itself is in the list returned by GET /v1/tasks/:taskId/results |
Response example
The task has results:
{
"success": true,
"data": {
"result": 29
}
}
The task has no results:
{
"success": true,
"data": {
"result": 0
}
}
Error response example
400 — taskId is not a positive integer:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "taskId must be a positive integer"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptiontaskId is not a positive integer. Message: taskId must be a positive integer |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionThe X-Api-Key header is missing |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe key has no Bitrix24 tokens |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key has no task scope |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionThe employee on whose behalf the call is made cannot read the task. Message: Access denied. |
| HTTP429 | CodeRATE_LIMITED |
DescriptionRequest rate exceeded. The effective cap is in the x-ratelimit-limit header |
The full list of common API errors — Errors.
Known specifics
The response does not distinguish a task without results from a task that does not exist. For a request with a nonexistent taskId, a Bitrix24 account administrator's key gets 200 with "result": 0. To check that the task exists, use GET /v1/tasks/:id.