curl --request POST \
--url https://api.spreadjam.com/v1/actions/{actionId}/executions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mode": "agent"
}
'import requests
url = "https://api.spreadjam.com/v1/actions/{actionId}/executions"
payload = { "mode": "agent" }
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({mode: 'agent'})
};
fetch('https://api.spreadjam.com/v1/actions/{actionId}/executions', 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.spreadjam.com/v1/actions/{actionId}/executions",
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([
'mode' => 'agent'
]),
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.spreadjam.com/v1/actions/{actionId}/executions"
payload := strings.NewReader("{\n \"mode\": \"agent\"\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.spreadjam.com/v1/actions/{actionId}/executions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"agent\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spreadjam.com/v1/actions/{actionId}/executions")
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 \"mode\": \"agent\"\n}"
response = http.request(request)
puts response.read_body{
"status": "accepted",
"work": "draft",
"opportunityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"changeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"runId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"chatUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}Have Jam do an action
Ask Jam to do the work. By default (no body, or {"mode": "one_shot"}) nothing changed: a new_page action (or any action linked to an article) is drafted, metered against credits; a page_edit or technical action gets a prepared code change to preview (opening its pull request is a separate request that holds the Make PR price); outreach and community work is yours (422, use agentPrompt from GET /v1/actions/{actionId}). 409 when the action is finished or dismissed, or a change is already in flight. With {"mode": "agent"}, as the dashboard’s “Send to Jam”: Jam starts a background agent run on the action in its own chat (runId, chatUrl), which also drafts outreach and community work; a content-only change may get its pull request opened by the run, anything touching code stops at the change for you to open. A repeat while the run is going returns the same runId; 409 when its article is already drafted, in review or live (edit it there); 422 when Jam cannot do it (an action done or dismissed, or agent runs are not available to the workspace yet). 402 when credits cannot cover it. Requires a paid plan.
curl --request POST \
--url https://api.spreadjam.com/v1/actions/{actionId}/executions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mode": "agent"
}
'import requests
url = "https://api.spreadjam.com/v1/actions/{actionId}/executions"
payload = { "mode": "agent" }
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({mode: 'agent'})
};
fetch('https://api.spreadjam.com/v1/actions/{actionId}/executions', 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.spreadjam.com/v1/actions/{actionId}/executions",
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([
'mode' => 'agent'
]),
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.spreadjam.com/v1/actions/{actionId}/executions"
payload := strings.NewReader("{\n \"mode\": \"agent\"\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.spreadjam.com/v1/actions/{actionId}/executions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"agent\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spreadjam.com/v1/actions/{actionId}/executions")
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 \"mode\": \"agent\"\n}"
response = http.request(request)
puts response.read_body{
"status": "accepted",
"work": "draft",
"opportunityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"changeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"runId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"chatUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}Authorizations
Body
one_shot (the default, unchanged): Jam drafts the article, or prepares a code change for you to preview (no pull request until you ask). agent: Jam starts a background agent run in its own chat (runId, chatUrl); it can also do outreach and community work, and it may open the pull request for a content-only change itself.
one_shot, agent "agent"
Response
The work is accepted.
draft: Jam is writing the article (follow opportunityId in /v1/opportunities and /v1/content). site_change: Jam is preparing a code change (follow changeId in /v1/site-changes/{changeId}; in the default mode no pull request is opened until you ask). agent_task (agent mode only): outreach or community drafts. In agent mode the ids may be null at first: GET /v1/actions/{actionId} carries opportunityId and change once the run creates them.
draft, site_change, agent_task