Functions
List function invocations
Retrieve recent invocation history for a function, including console logs captured during execution.
Returns the most recent invocations (up to 20 by default) with:
- Request/response payloads
- Status codes and execution duration
- Console logs (info, warn, error messages)
- Error details for failed invocations
Use the status parameter to filter by success or failure.
GET
/
functions
/
{function_id}
/
invocations
List function invocations
curl --request GET \
--url https://api.kapso.ai/platform/v1/functions/{function_id}/invocations \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.kapso.ai/platform/v1/functions/{function_id}/invocations"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.kapso.ai/platform/v1/functions/{function_id}/invocations', 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.kapso.ai/platform/v1/functions/{function_id}/invocations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.kapso.ai/platform/v1/functions/{function_id}/invocations"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.kapso.ai/platform/v1/functions/{function_id}/invocations")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kapso.ai/platform/v1/functions/{function_id}/invocations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"function_id": "550e8400-e29b-41d4-a716-446655440000",
"function_name": "calculate-shipping",
"invocations": [
{
"id": "660e8400-e29b-41d4-a716-446655440001",
"status_code": 200,
"duration_ms": 45,
"request_body": {
"weight": 5.5,
"distance": 120
},
"response_body": {
"cost": 24.75,
"currency": "USD"
},
"error_message": null,
"created_at": "2025-01-15T10:30:00.000Z",
"console_logs": [
{
"level": "info",
"message": "Calculating shipping for weight 5.5",
"logged_at": "2025-01-15T10:30:00.000Z"
}
]
},
{
"id": "660e8400-e29b-41d4-a716-446655440002",
"status_code": 500,
"duration_ms": 12,
"request_body": {
"weight": -1
},
"response_body": null,
"error_message": "Invalid weight value",
"created_at": "2025-01-15T10:25:00.000Z",
"console_logs": [
{
"level": "error",
"message": "Invalid weight: -1",
"logged_at": "2025-01-15T10:25:00.000Z",
"stack": "Error: Invalid weight value\n at validateWeight..."
}
]
}
],
"total": 2
}
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Path Parameters
Function identifier
Query Parameters
Filter by invocation status:
success: Status codes 200-299failed: Status codes outside 200-299
Available options:
success, failed Maximum number of invocations to return (max 20)
Required range:
1 <= x <= 20Response
Invocations retrieved successfully
Function invocations with console logs
Show child attributes
Show child attributes
Was this page helpful?
⌘I
List function invocations
curl --request GET \
--url https://api.kapso.ai/platform/v1/functions/{function_id}/invocations \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.kapso.ai/platform/v1/functions/{function_id}/invocations"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.kapso.ai/platform/v1/functions/{function_id}/invocations', 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.kapso.ai/platform/v1/functions/{function_id}/invocations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.kapso.ai/platform/v1/functions/{function_id}/invocations"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.kapso.ai/platform/v1/functions/{function_id}/invocations")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kapso.ai/platform/v1/functions/{function_id}/invocations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"function_id": "550e8400-e29b-41d4-a716-446655440000",
"function_name": "calculate-shipping",
"invocations": [
{
"id": "660e8400-e29b-41d4-a716-446655440001",
"status_code": 200,
"duration_ms": 45,
"request_body": {
"weight": 5.5,
"distance": 120
},
"response_body": {
"cost": 24.75,
"currency": "USD"
},
"error_message": null,
"created_at": "2025-01-15T10:30:00.000Z",
"console_logs": [
{
"level": "info",
"message": "Calculating shipping for weight 5.5",
"logged_at": "2025-01-15T10:30:00.000Z"
}
]
},
{
"id": "660e8400-e29b-41d4-a716-446655440002",
"status_code": 500,
"duration_ms": 12,
"request_body": {
"weight": -1
},
"response_body": null,
"error_message": "Invalid weight value",
"created_at": "2025-01-15T10:25:00.000Z",
"console_logs": [
{
"level": "error",
"message": "Invalid weight: -1",
"logged_at": "2025-01-15T10:25:00.000Z",
"stack": "Error: Invalid weight value\n at validateWeight..."
}
]
}
],
"total": 2
}
}{
"error": "<string>"
}{
"error": "<string>"
}
