Initiate OAuth connection
curl --request POST \
--url https://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/connect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/connect"
payload = {}
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({})
};
fetch('https://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/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://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/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([
]),
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://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/connect"
payload := strings.NewReader("{}")
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://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/connect")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/connect")
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 = "{}"
response = http.request(request)
puts response.read_body{
"auth_url": "https://login.salesforce.com/services/oauth2/authorize?..."
}{
"error": "ServerNotFound",
"message": "Server with ID '123' not found",
"details": {}
}{
"error": "ServerNotFound",
"message": "Server with ID '123' not found",
"details": {}
}{
"error": "OAuthConfigurationError",
"message": "Server is missing OAuth configuration. Ask an admin to configure credentials before initiating a connection."
}Connections
Initiate OAuth connection
Initiate OAuth connection flow for a server. Returns an authorization URL that the user should visit to complete the OAuth flow.
The server must have OAuth configuration set up by an admin.
POST
/
api
/
servers
/
{server_id}
/
connect
Initiate OAuth connection
curl --request POST \
--url https://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/connect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/connect"
payload = {}
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({})
};
fetch('https://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/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://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/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([
]),
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://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/connect"
payload := strings.NewReader("{}")
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://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/connect")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{organization_id}.platform.barndoor.ai/api/servers/{server_id}/connect")
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 = "{}"
response = http.request(request)
puts response.read_body{
"auth_url": "https://login.salesforce.com/services/oauth2/authorize?..."
}{
"error": "ServerNotFound",
"message": "Server with ID '123' not found",
"details": {}
}{
"error": "ServerNotFound",
"message": "Server with ID '123' not found",
"details": {}
}{
"error": "OAuthConfigurationError",
"message": "Server is missing OAuth configuration. Ask an admin to configure credentials before initiating a connection."
}Authorizations
JWT token obtained through Barndoor's OAuth 2.0 authorization-code flow with PKCE.
The token should be included in the Authorization header:
Authorization: Bearer <your-jwt-token>
Use the Barndoor SDK's loginInteractive() function to obtain tokens automatically.
Path Parameters
Server UUID
Query Parameters
Optional return URL after OAuth completion
Body
application/json
The body is of type object.
Response
Connection initiation successful
OAuth authorization URL to redirect user to
Example:
"https://login.salesforce.com/services/oauth2/authorize?..."
⌘I