Mint an OAuth authorization URL for git-provider connect
curl --request POST \
--url https://api.agentmark.co/v1/apps/{appId}/git/connect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Agentmark-App-Id: <api-key>' \
--data '
{
"provider": "github"
}
'import requests
url = "https://api.agentmark.co/v1/apps/{appId}/git/connect"
payload = { "provider": "github" }
headers = {
"X-Agentmark-App-Id": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Agentmark-App-Id': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({provider: 'github'})
};
fetch('https://api.agentmark.co/v1/apps/{appId}/git/connect', 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.agentmark.co/v1/apps/{appId}/git/connect",
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([
'provider' => 'github'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Agentmark-App-Id: <api-key>"
],
]);
$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.agentmark.co/v1/apps/{appId}/git/connect"
payload := strings.NewReader("{\n \"provider\": \"github\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Agentmark-App-Id", "<api-key>")
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.agentmark.co/v1/apps/{appId}/git/connect")
.header("X-Agentmark-App-Id", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"github\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agentmark.co/v1/apps/{appId}/git/connect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Agentmark-App-Id"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"github\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"authorization_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"state": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Apps
Mint an OAuth authorization URL for git-provider connect
Returns a GitHub App install authorization URL plus a signed state token. Headless flow:
- Headless agent POSTs
{ provider }. - Gateway returns
{ authorization_url, state, expires_at }. - Agent surfaces the URL to a human (Slack DM, console output, etc.).
- Human clicks; GitHub redirects to the dashboard OAuth callback.
- Callback validates the state token and writes the
git_connectionrow. - Agent polls
GET /v1/apps/:appId/gituntil{ connected: true }.
The state token is HMAC-signed (10-minute TTL) and binds the OAuth callback to the originating app + tenant + provider. Each call mints a fresh nonce — no replay across attempts.
Returns 503 git_connect_not_configured when the GitHub App slug cannot be resolved from GET /app.
POST
/
v1
/
apps
/
{appId}
/
git
/
connect
Mint an OAuth authorization URL for git-provider connect
curl --request POST \
--url https://api.agentmark.co/v1/apps/{appId}/git/connect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Agentmark-App-Id: <api-key>' \
--data '
{
"provider": "github"
}
'import requests
url = "https://api.agentmark.co/v1/apps/{appId}/git/connect"
payload = { "provider": "github" }
headers = {
"X-Agentmark-App-Id": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Agentmark-App-Id': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({provider: 'github'})
};
fetch('https://api.agentmark.co/v1/apps/{appId}/git/connect', 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.agentmark.co/v1/apps/{appId}/git/connect",
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([
'provider' => 'github'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Agentmark-App-Id: <api-key>"
],
]);
$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.agentmark.co/v1/apps/{appId}/git/connect"
payload := strings.NewReader("{\n \"provider\": \"github\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Agentmark-App-Id", "<api-key>")
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.agentmark.co/v1/apps/{appId}/git/connect")
.header("X-Agentmark-App-Id", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"github\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agentmark.co/v1/apps/{appId}/git/connect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Agentmark-App-Id"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"github\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"authorization_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"state": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
Application ID for tenant scoping. X-Outerlayer-App-Id is accepted as an equivalent header.
API key (sk_agentmark_*)
Path Parameters
Body
application/json
Available options:
github Response
Authorization URL minted.
Show child attributes
Show child attributes
Was this page helpful?
⌘I