Claim GitHub source work
curl --request POST \
--url https://galinum.com/api/v1/github/refs/{refId}/claim \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"leaseSeconds": 600
}
'import requests
url = "https://galinum.com/api/v1/github/refs/{refId}/claim"
payload = { "leaseSeconds": 600 }
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({leaseSeconds: 600})
};
fetch('https://galinum.com/api/v1/github/refs/{refId}/claim', 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://galinum.com/api/v1/github/refs/{refId}/claim",
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([
'leaseSeconds' => 600
]),
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://galinum.com/api/v1/github/refs/{refId}/claim"
payload := strings.NewReader("{\n \"leaseSeconds\": 600\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://galinum.com/api/v1/github/refs/{refId}/claim")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"leaseSeconds\": 600\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://galinum.com/api/v1/github/refs/{refId}/claim")
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 \"leaseSeconds\": 600\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"state": "claimed",
"claim": {
"refId": "<string>",
"sourceId": "<string>",
"sourceGeneration": 1,
"instructions": "<string>",
"leaseToken": "<string>",
"expiresAt": 1,
"fromSha": "<string>",
"toSha": "<string>",
"complete": true,
"comparison": {
"beforeSha": "<string>",
"afterSha": "<string>"
},
"repositoryContext": {
"description": "<string>",
"readme": "<string>",
"commitSha": "<string>"
},
"files": [
{
"path": "<string>",
"patch": "<string>"
}
],
"changes": [
{
"sha": "<string>",
"message": "<string>",
"pullRequests": [
{
"number": 1,
"mergedHeadSha": "<string>"
}
],
"sourceCampaignIds": [
"<string>"
]
}
],
"withdrawals": [
{
"campaignId": "<string>",
"contributions": [
{
"id": "<string>",
"ordinal": 1,
"withdrawn": true,
"edits": [
{
"variantId": "<string>",
"field": "title",
"before": "<string>",
"after": "<string>"
}
]
}
],
"patch": {
"name": {
"before": "<string>",
"after": "<string>"
},
"variants": [
{
"id": "<string>",
"edits": [
{
"field": "title",
"before": "<string>",
"after": "<string>"
}
]
}
]
}
}
],
"drafts": [
{
"campaignId": "<string>",
"origin": "source",
"contentHash": "<string>",
"customerEditedFields": [
"<string>"
],
"review": "pending",
"campaign": {
"id": "cmp_3ce6dba5-7f36-41f5-9327-d5cc3099ab77",
"name": "Launch: CSV export",
"status": "draft",
"effectiveStatus": "draft",
"channel": "web_inapp",
"goalId": "<string>",
"createdBy": "api",
"createdAt": 1784067764978,
"startedAt": 123,
"endedAt": 123,
"deliverFrom": 123,
"deliverUntil": 123,
"audience": {
"kind": "all"
},
"targeting": {
"traits": {
"plan": "free"
},
"events": {
"seen": [
"activated_workspace"
],
"not_seen": [
"used_csv_export"
]
}
},
"pages": [
"/dashboard",
"/settings/*"
],
"stats": {
"sent": 123,
"frequencyCapped": 123,
"delivered": 123,
"shown": 123,
"opened": 123,
"clicked": 123,
"dismissed": 123,
"bounced": 123,
"complained": 123,
"unsubscribed": 123,
"converted": 123
},
"variants": [
{
"id": "var_37705a49-52c6-4577-aeed-665099a1e13d",
"name": "A",
"weight": 1,
"isControl": true,
"content": {
"presentation": "toast",
"title": "CSV export is here 📊",
"body": "Export any table to CSV from the toolbar.",
"cta": {
"label": "Try it",
"destination": {
"kind": "website",
"url": "https://app.example.com/exports"
}
},
"media": {
"url": "https://galinum.example/media/projects/prj_123/media/9c2f0b7e-4d11-4c2a-a3d1-1c9a1a2b3c4d.png",
"alt": "Screenshot of the new analytics dashboard",
"decorative": false
}
},
"stats": {
"sent": 123,
"frequencyCapped": 123,
"delivered": 123,
"shown": 123,
"opened": 123,
"clicked": 123,
"dismissed": 123,
"bounced": 123,
"complained": 123,
"unsubscribed": 123,
"converted": 123
}
}
],
"sourceChanges": {
"revision": "<string>",
"changes": [
{
"sourceId": "<string>",
"kind": "commit",
"sha": "<string>"
}
]
},
"push": {
"appId": "<string>",
"selection": {
"kind": "last_active"
},
"ttlSeconds": 1209600,
"replacementKey": "<string>"
}
}
}
]
}
}{
"ok": false,
"status": 400,
"error": "<string>",
"retryAfterMs": 1
}{
"error": "Unauthorized"
}{
"ok": false,
"status": 400,
"error": "<string>",
"retryAfterMs": 1
}{
"ok": false,
"status": 400,
"error": "<string>",
"retryAfterMs": 1
}{
"ok": false,
"status": 400,
"error": "<string>",
"retryAfterMs": 1
}{
"error": "Invalid request"
}{
"error": "Too many requests"
}{
"ok": false,
"status": 400,
"error": "<string>",
"retryAfterMs": 1
}GitHub sources
Claim GitHub source work
Refreshes source evidence and grants a bounded lease, or settles lifecycle work without model execution. Read the returned state before acting. Available in Galinum Cloud.
POST
/
api
/
v1
/
github
/
refs
/
{refId}
/
claim
Claim GitHub source work
curl --request POST \
--url https://galinum.com/api/v1/github/refs/{refId}/claim \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"leaseSeconds": 600
}
'import requests
url = "https://galinum.com/api/v1/github/refs/{refId}/claim"
payload = { "leaseSeconds": 600 }
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({leaseSeconds: 600})
};
fetch('https://galinum.com/api/v1/github/refs/{refId}/claim', 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://galinum.com/api/v1/github/refs/{refId}/claim",
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([
'leaseSeconds' => 600
]),
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://galinum.com/api/v1/github/refs/{refId}/claim"
payload := strings.NewReader("{\n \"leaseSeconds\": 600\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://galinum.com/api/v1/github/refs/{refId}/claim")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"leaseSeconds\": 600\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://galinum.com/api/v1/github/refs/{refId}/claim")
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 \"leaseSeconds\": 600\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"state": "claimed",
"claim": {
"refId": "<string>",
"sourceId": "<string>",
"sourceGeneration": 1,
"instructions": "<string>",
"leaseToken": "<string>",
"expiresAt": 1,
"fromSha": "<string>",
"toSha": "<string>",
"complete": true,
"comparison": {
"beforeSha": "<string>",
"afterSha": "<string>"
},
"repositoryContext": {
"description": "<string>",
"readme": "<string>",
"commitSha": "<string>"
},
"files": [
{
"path": "<string>",
"patch": "<string>"
}
],
"changes": [
{
"sha": "<string>",
"message": "<string>",
"pullRequests": [
{
"number": 1,
"mergedHeadSha": "<string>"
}
],
"sourceCampaignIds": [
"<string>"
]
}
],
"withdrawals": [
{
"campaignId": "<string>",
"contributions": [
{
"id": "<string>",
"ordinal": 1,
"withdrawn": true,
"edits": [
{
"variantId": "<string>",
"field": "title",
"before": "<string>",
"after": "<string>"
}
]
}
],
"patch": {
"name": {
"before": "<string>",
"after": "<string>"
},
"variants": [
{
"id": "<string>",
"edits": [
{
"field": "title",
"before": "<string>",
"after": "<string>"
}
]
}
]
}
}
],
"drafts": [
{
"campaignId": "<string>",
"origin": "source",
"contentHash": "<string>",
"customerEditedFields": [
"<string>"
],
"review": "pending",
"campaign": {
"id": "cmp_3ce6dba5-7f36-41f5-9327-d5cc3099ab77",
"name": "Launch: CSV export",
"status": "draft",
"effectiveStatus": "draft",
"channel": "web_inapp",
"goalId": "<string>",
"createdBy": "api",
"createdAt": 1784067764978,
"startedAt": 123,
"endedAt": 123,
"deliverFrom": 123,
"deliverUntil": 123,
"audience": {
"kind": "all"
},
"targeting": {
"traits": {
"plan": "free"
},
"events": {
"seen": [
"activated_workspace"
],
"not_seen": [
"used_csv_export"
]
}
},
"pages": [
"/dashboard",
"/settings/*"
],
"stats": {
"sent": 123,
"frequencyCapped": 123,
"delivered": 123,
"shown": 123,
"opened": 123,
"clicked": 123,
"dismissed": 123,
"bounced": 123,
"complained": 123,
"unsubscribed": 123,
"converted": 123
},
"variants": [
{
"id": "var_37705a49-52c6-4577-aeed-665099a1e13d",
"name": "A",
"weight": 1,
"isControl": true,
"content": {
"presentation": "toast",
"title": "CSV export is here 📊",
"body": "Export any table to CSV from the toolbar.",
"cta": {
"label": "Try it",
"destination": {
"kind": "website",
"url": "https://app.example.com/exports"
}
},
"media": {
"url": "https://galinum.example/media/projects/prj_123/media/9c2f0b7e-4d11-4c2a-a3d1-1c9a1a2b3c4d.png",
"alt": "Screenshot of the new analytics dashboard",
"decorative": false
}
},
"stats": {
"sent": 123,
"frequencyCapped": 123,
"delivered": 123,
"shown": 123,
"opened": 123,
"clicked": 123,
"dismissed": 123,
"bounced": 123,
"complained": 123,
"unsubscribed": 123,
"converted": 123
}
}
],
"sourceChanges": {
"revision": "<string>",
"changes": [
{
"sourceId": "<string>",
"kind": "commit",
"sha": "<string>"
}
]
},
"push": {
"appId": "<string>",
"selection": {
"kind": "last_active"
},
"ttlSeconds": 1209600,
"replacementKey": "<string>"
}
}
}
]
}
}{
"ok": false,
"status": 400,
"error": "<string>",
"retryAfterMs": 1
}{
"error": "Unauthorized"
}{
"ok": false,
"status": 400,
"error": "<string>",
"retryAfterMs": 1
}{
"ok": false,
"status": 400,
"error": "<string>",
"retryAfterMs": 1
}{
"ok": false,
"status": 400,
"error": "<string>",
"retryAfterMs": 1
}{
"error": "Invalid request"
}{
"error": "Too many requests"
}{
"ok": false,
"status": 400,
"error": "<string>",
"retryAfterMs": 1
}Authorizations
secretKeyhostedAgentKey
Your project's secret key (pk_…, without the pub segment). Server-side only — never ship it to a browser. Get it from Settings → Projects in the dashboard.
Path Parameters
Required string length:
1 - 128Body
application/json
Required range:
30 <= x <= 900