curl --request GET \
--url https://api.spreadjam.com/v1/agent-connect/{pollToken}import requests
url = "https://api.spreadjam.com/v1/agent-connect/{pollToken}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.spreadjam.com/v1/agent-connect/{pollToken}', 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/agent-connect/{pollToken}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.spreadjam.com/v1/agent-connect/{pollToken}"
req, _ := http.NewRequest("GET", url, nil)
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.spreadjam.com/v1/agent-connect/{pollToken}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spreadjam.com/v1/agent-connect/{pollToken}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "pending",
"message": "<string>",
"apiKey": "<string>",
"replaced": true,
"workspaceId": "<string>",
"expiresAt": "<string>",
"stage": "awaiting_signin",
"reason": "checkout_not_started",
"checkoutStartedAt": "<string>",
"checkoutExpiresAt": "<string>",
"resumeUrl": "https://www.spreadjam.com/connect/ABCD234567",
"humanMessage": "<string>"
}Poll an agent connect session
No API key needed. pending (with stage: what is left) until the human approves and, for a session started with onboarding, until the trial has started and the project exists; then approved with the API key; then consumed. The raw key is never stored, so it is not shown twice: a poll within 10 minutes of the first approved whose key was never used gets a replacement key (the first is revoked, replaced: true), so a poller that died before storing it can recover. denied and expired are final.
curl --request GET \
--url https://api.spreadjam.com/v1/agent-connect/{pollToken}import requests
url = "https://api.spreadjam.com/v1/agent-connect/{pollToken}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.spreadjam.com/v1/agent-connect/{pollToken}', 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/agent-connect/{pollToken}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.spreadjam.com/v1/agent-connect/{pollToken}"
req, _ := http.NewRequest("GET", url, nil)
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.spreadjam.com/v1/agent-connect/{pollToken}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spreadjam.com/v1/agent-connect/{pollToken}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "pending",
"message": "<string>",
"apiKey": "<string>",
"replaced": true,
"workspaceId": "<string>",
"expiresAt": "<string>",
"stage": "awaiting_signin",
"reason": "checkout_not_started",
"checkoutStartedAt": "<string>",
"checkoutExpiresAt": "<string>",
"resumeUrl": "https://www.spreadjam.com/connect/ABCD234567",
"humanMessage": "<string>"
}Path Parameters
^jcp_[0-9a-f]{64}$"jcp_0000000000000000000000000000000000000000000000000000000000000000"
Response
Where the session stands.
pending, approved, consumed, denied, expired Only on approved. Store it now. If it is lost before it is used (the poller died), poll again with the same token within 10 minutes: Jam revokes that key and answers a new one (replaced: true). Once the key has been used, or after 10 minutes, the poll answers consumed.
On approved: true when this key replaces an earlier, never used key from this session, which is now revoked.
Only on pending: what is left. awaiting_signin (the link is not opened by a signed-in person yet), awaiting_review (they have not approved), awaiting_payment (approved, the trial has not started), setting_up (paid, the project is being created).
awaiting_signin, awaiting_review, awaiting_payment, setting_up Only on awaiting_payment: why the trial has not started. checkout_not_started (approved, checkout not opened yet), checkout_open (the checkout the human opened is still payable, for up to 31 minutes after it opened; they may still be paying), checkout_abandoned (checkout was opened, then closed or expired unpaid), payment_failed (the card payment did not go through).
checkout_not_started, checkout_open, checkout_abandoned, payment_failed Only on awaiting_payment: when the human last opened checkout, or null.
Only on awaiting_payment: when the checkout the human last opened stops being payable (31 minutes after it opened), or null. After it, reason is checkout_abandoned and "Finish checkout" opens a fresh one.
Only on awaiting_payment: send the human this link (the same as connectUrl). Signed in as the person who approved, it shows "Finish checkout", which opens a fresh checkout with the plan they chose. It is never a raw checkout link.
"https://www.spreadjam.com/connect/ABCD234567"
Only on awaiting_payment: a sentence you can pass to the human as is, with the link and what to do.