Skip to main content
PATCH
/
invocations
/
{id}
JavaScript
import Kernel from '@onkernel/sdk';

const client = new Kernel({
  apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted
});

const invocation = await client.invocations.update('id', { status: 'succeeded' });

console.log(invocation.id);
import os
from kernel import Kernel

client = Kernel(
    api_key=os.environ.get("KERNEL_API_KEY"),  # This is the default and can be omitted
)
invocation = client.invocations.update(
    id="id",
    status="succeeded",
)
print(invocation.id)
package main

import (
	"context"
	"fmt"

	"github.com/kernel/kernel-go-sdk"
	"github.com/kernel/kernel-go-sdk/option"
)

func main() {
	client := kernel.NewClient(
		option.WithAPIKey("My API Key"),
	)
	invocation, err := client.Invocations.Update(
		context.TODO(),
		"id",
		kernel.InvocationUpdateParams{
			Status: kernel.InvocationUpdateParamsStatusSucceeded,
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", invocation.ID)
}
curl --request PATCH \
  --url https://api.onkernel.com/invocations/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "output": "<string>"
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.onkernel.com/invocations/{id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_POSTFIELDS => json_encode([
    'output' => '<string>'
  ]),
  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;
}
HttpResponse<String> response = Unirest.patch("https://api.onkernel.com/invocations/{id}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"output\": \"<string>\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.onkernel.com/invocations/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"output\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "rr33xuugxj9h0bkf1rdt2bet",
  "app_name": "my-app",
  "version": "1.0.0",
  "action_name": "analyze",
  "started_at": "2024-05-19T15:30:00.000000000Z07:00",
  "status": "succeeded",
  "payload": "{\"data\":\"example input\"}",
  "output": "{\"result\":\"success\",\"data\":\"processed input\"}",
  "finished_at": "2024-05-19T15:30:05.000000000Z07:00",
  "status_reason": "Invocation completed successfully"
}
{
  "code": "bad_request",
  "message": "Missing required field: app_name",
  "details": [
    {
      "code": "invalid_input",
      "message": "Provided version string is not semver compliant"
    }
  ],
  "inner_error": {
    "code": "invalid_input",
    "message": "Provided version string is not semver compliant"
  }
}
{
  "code": "bad_request",
  "message": "Missing required field: app_name",
  "details": [
    {
      "code": "invalid_input",
      "message": "Provided version string is not semver compliant"
    }
  ],
  "inner_error": {
    "code": "invalid_input",
    "message": "Provided version string is not semver compliant"
  }
}
{
  "code": "bad_request",
  "message": "Missing required field: app_name",
  "details": [
    {
      "code": "invalid_input",
      "message": "Provided version string is not semver compliant"
    }
  ],
  "inner_error": {
    "code": "invalid_input",
    "message": "Provided version string is not semver compliant"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Invocation ID

Body

application/json

Request body for updating an invocation.

status
enum<string>
required

New status for the invocation.

Available options:
succeeded,
failed
output
string

Updated output of the invocation rendered as JSON string.

Response

Invocation updated successfully

id
string
required

ID of the invocation

Example:

"rr33xuugxj9h0bkf1rdt2bet"

app_name
string
required

Name of the application

Example:

"my-app"

version
string
required

Version label for the application

Example:

"1.0.0"

action_name
string
required

Name of the action invoked

Example:

"analyze"

started_at
string<date-time>
required

RFC 3339 Nanoseconds timestamp when the invocation started

Example:

"2024-05-19T15:30:00.000000000Z07:00"

status
enum<string>
required

Status of the invocation

Available options:
queued,
running,
succeeded,
failed
Example:

"succeeded"

payload
string

Payload provided to the invocation. This is a string that can be parsed as JSON.

Example:

"{\"data\":\"example input\"}"

output
string

Output produced by the action, rendered as a JSON string. This could be: string, number, boolean, array, object, or null.

Example:

"{\"result\":\"success\",\"data\":\"processed input\"}"

finished_at
string<date-time> | null

RFC 3339 Nanoseconds timestamp when the invocation finished (null if still running)

Example:

"2024-05-19T15:30:05.000000000Z07:00"

status_reason
string

Status reason

Example:

"Invocation completed successfully"