curl --request POST \
--url https://api.onkernel.com/invocations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"action_name": "analyze",
"app_name": "my-app",
"version": "1.0.0",
"async": true,
"async_timeout_seconds": 600,
"payload": "{\"data\":\"example input\"}"
}
'import requests
url = "https://api.onkernel.com/invocations"
payload = {
"action_name": "analyze",
"app_name": "my-app",
"version": "1.0.0",
"async": True,
"async_timeout_seconds": 600,
"payload": "{\"data\":\"example input\"}"
}
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({
action_name: 'analyze',
app_name: 'my-app',
version: '1.0.0',
async: true,
async_timeout_seconds: 600,
payload: '{"data":"example input"}'
})
};
fetch('https://api.onkernel.com/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.onkernel.com/invocations",
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([
'action_name' => 'analyze',
'app_name' => 'my-app',
'version' => '1.0.0',
'async' => true,
'async_timeout_seconds' => 600,
'payload' => '{"data":"example input"}'
]),
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://api.onkernel.com/invocations"
payload := strings.NewReader("{\n \"action_name\": \"analyze\",\n \"app_name\": \"my-app\",\n \"version\": \"1.0.0\",\n \"async\": true,\n \"async_timeout_seconds\": 600,\n \"payload\": \"{\\\"data\\\":\\\"example input\\\"}\"\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://api.onkernel.com/invocations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action_name\": \"analyze\",\n \"app_name\": \"my-app\",\n \"version\": \"1.0.0\",\n \"async\": true,\n \"async_timeout_seconds\": 600,\n \"payload\": \"{\\\"data\\\":\\\"example input\\\"}\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onkernel.com/invocations")
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 \"action_name\": \"analyze\",\n \"app_name\": \"my-app\",\n \"version\": \"1.0.0\",\n \"async\": true,\n \"async_timeout_seconds\": 600,\n \"payload\": \"{\\\"data\\\":\\\"example input\\\"}\"\n}"
response = http.request(request)
puts response.read_body{
"action_name": "analyze",
"id": "rr33xuugxj9h0bkf1rdt2bet",
"status": "queued",
"output": "{\"result\":\"success\",\"data\":\"processed input\"}",
"status_reason": "Invocation queued for execution"
}{
"action_name": "analyze",
"id": "rr33xuugxj9h0bkf1rdt2bet",
"status": "queued",
"output": "{\"result\":\"success\",\"data\":\"processed input\"}",
"status_reason": "Invocation queued for execution"
}{
"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"
}
}{
"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"
}
}Invoke an action
Invoke an action.
curl --request POST \
--url https://api.onkernel.com/invocations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"action_name": "analyze",
"app_name": "my-app",
"version": "1.0.0",
"async": true,
"async_timeout_seconds": 600,
"payload": "{\"data\":\"example input\"}"
}
'import requests
url = "https://api.onkernel.com/invocations"
payload = {
"action_name": "analyze",
"app_name": "my-app",
"version": "1.0.0",
"async": True,
"async_timeout_seconds": 600,
"payload": "{\"data\":\"example input\"}"
}
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({
action_name: 'analyze',
app_name: 'my-app',
version: '1.0.0',
async: true,
async_timeout_seconds: 600,
payload: '{"data":"example input"}'
})
};
fetch('https://api.onkernel.com/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.onkernel.com/invocations",
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([
'action_name' => 'analyze',
'app_name' => 'my-app',
'version' => '1.0.0',
'async' => true,
'async_timeout_seconds' => 600,
'payload' => '{"data":"example input"}'
]),
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://api.onkernel.com/invocations"
payload := strings.NewReader("{\n \"action_name\": \"analyze\",\n \"app_name\": \"my-app\",\n \"version\": \"1.0.0\",\n \"async\": true,\n \"async_timeout_seconds\": 600,\n \"payload\": \"{\\\"data\\\":\\\"example input\\\"}\"\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://api.onkernel.com/invocations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action_name\": \"analyze\",\n \"app_name\": \"my-app\",\n \"version\": \"1.0.0\",\n \"async\": true,\n \"async_timeout_seconds\": 600,\n \"payload\": \"{\\\"data\\\":\\\"example input\\\"}\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onkernel.com/invocations")
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 \"action_name\": \"analyze\",\n \"app_name\": \"my-app\",\n \"version\": \"1.0.0\",\n \"async\": true,\n \"async_timeout_seconds\": 600,\n \"payload\": \"{\\\"data\\\":\\\"example input\\\"}\"\n}"
response = http.request(request)
puts response.read_body{
"action_name": "analyze",
"id": "rr33xuugxj9h0bkf1rdt2bet",
"status": "queued",
"output": "{\"result\":\"success\",\"data\":\"processed input\"}",
"status_reason": "Invocation queued for execution"
}{
"action_name": "analyze",
"id": "rr33xuugxj9h0bkf1rdt2bet",
"status": "queued",
"output": "{\"result\":\"success\",\"data\":\"processed input\"}",
"status_reason": "Invocation queued for execution"
}{
"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"
}
}{
"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
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Invocation parameters
Name of the action to invoke
"analyze"
Name of the application
"my-app"
Version of the application
"1.0.0"
If true, invoke asynchronously. When set, the API responds 202 Accepted with status "queued".
true
Timeout in seconds for async invocations (min 10, max 3600). Only applies when async is true.
10 <= x <= 3600600
Input data for the action, sent as a JSON string.
"{\"data\":\"example input\"}"
Response
Invocation created successfully
Name of the action invoked
"analyze"
ID of the invocation
"rr33xuugxj9h0bkf1rdt2bet"
Status of the invocation
queued, running, succeeded, failed "queued"
The return value of the action that was invoked, rendered as a JSON string. This could be: string, number, boolean, array, object, or null.
"{\"result\":\"success\",\"data\":\"processed input\"}"
Status reason
"Invocation queued for execution"