Start OAuth Sign-in
curl --request POST \
--url https://api.60db.ai/agents/integrations/oauth/start \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "<string>",
"name": "<string>",
"connection_id": "<string>",
"fields": {}
}
'import requests
url = "https://api.60db.ai/agents/integrations/oauth/start"
payload = {
"provider": "<string>",
"name": "<string>",
"connection_id": "<string>",
"fields": {}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({provider: '<string>', name: '<string>', connection_id: '<string>', fields: {}})
};
fetch('https://api.60db.ai/agents/integrations/oauth/start', 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.60db.ai/agents/integrations/oauth/start",
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' => '<string>',
'name' => '<string>',
'connection_id' => '<string>',
'fields' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.60db.ai/agents/integrations/oauth/start"
payload := strings.NewReader("{\n \"provider\": \"<string>\",\n \"name\": \"<string>\",\n \"connection_id\": \"<string>\",\n \"fields\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.60db.ai/agents/integrations/oauth/start")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"<string>\",\n \"name\": \"<string>\",\n \"connection_id\": \"<string>\",\n \"fields\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.60db.ai/agents/integrations/oauth/start")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"<string>\",\n \"name\": \"<string>\",\n \"connection_id\": \"<string>\",\n \"fields\": {}\n}"
response = http.request(request)
puts response.read_bodyAgent Integrations
Start OAuth Sign-in
Start Connect with Zendesk, Google Calendar, Google Drive, Google Sheets or Salesforce, and get the provider’s sign-in URL
POST
/
agents
/
integrations
/
oauth
/
start
Start OAuth Sign-in
curl --request POST \
--url https://api.60db.ai/agents/integrations/oauth/start \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "<string>",
"name": "<string>",
"connection_id": "<string>",
"fields": {}
}
'import requests
url = "https://api.60db.ai/agents/integrations/oauth/start"
payload = {
"provider": "<string>",
"name": "<string>",
"connection_id": "<string>",
"fields": {}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({provider: '<string>', name: '<string>', connection_id: '<string>', fields: {}})
};
fetch('https://api.60db.ai/agents/integrations/oauth/start', 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.60db.ai/agents/integrations/oauth/start",
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' => '<string>',
'name' => '<string>',
'connection_id' => '<string>',
'fields' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.60db.ai/agents/integrations/oauth/start"
payload := strings.NewReader("{\n \"provider\": \"<string>\",\n \"name\": \"<string>\",\n \"connection_id\": \"<string>\",\n \"fields\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.60db.ai/agents/integrations/oauth/start")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"<string>\",\n \"name\": \"<string>\",\n \"connection_id\": \"<string>\",\n \"fields\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.60db.ai/agents/integrations/oauth/start")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"<string>\",\n \"name\": \"<string>\",\n \"connection_id\": \"<string>\",\n \"fields\": {}\n}"
response = http.request(request)
puts response.read_bodyStart a Connect with … sign-in for a provider whose catalog entry has
oauth: true. The response is the provider’s sign-in URL. Send the user’s browser there. After the user approves, the provider returns to your integrations page, and 60db stores the connection.
This endpoint is for the 60db app and other browser sign-ins. The sign-in is tied to the browser that started it by a short-lived cookie, so the same browser must open the URL. You need the integration:write permission (owner, admin or developer).
How the sign-in completes
- Open the
urlfrom the response in the same browser. - The user approves on the provider’s page.
- The provider redirects to the Redirect URL (your integrations page, see
oauth_redirect_uriin the catalog) withcodeandstate. - That page passes them to
GET /agents/integrations/oauth/callback. 60db checks the state against the cookie (single use, 15 minutes), exchanges the code, stores the tokens encrypted, and runs the live test. - The browser lands back on the integrations page with
?integration_oauth=connected&integration=<id>, or?integration_oauth=error&reason=<reason>, optionally with&detail=<provider OAuth error code>.
Request
Headers
Body
An existing connection to reconnect (UUID). Its stored OAuth client is used unless
fields gives a new one.Field values from the catalog. Use
oauth_client_id and oauth_client_secret for your own OAuth client (required unless the catalog says oauth_default_client: true), subdomain for Zendesk, and optionally spreadsheet_id and sheet (default spreadsheet and tab) for Google Sheets.curl -X POST https://api.60db.ai/agents/integrations/oauth/start \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"provider": "google_calendar",
"fields": { "oauth_client_id": "1234-abc.apps.googleusercontent.com", "oauth_client_secret": "GOCSPX-..." }
}'
Response
200 OK{ "success": true, "data": { "url": "https://accounts.google.com/o/oauth2/v2/auth?response_type=code&client_id=...&state=...&code_challenge=..." } }
Callback outcomes
reason | Meaning |
|---|---|
denied | The user cancelled on the provider’s page |
expired | The sign-in took longer than 15 minutes, or was already used |
state_mismatch | The sign-in was finished in another browser than the one that started it |
exchange_failed | The provider did not issue a token. Check the OAuth client ID, secret and Redirect URL. detail names the provider’s error code, such as invalid_client |
test_failed | Signed in, but the live test failed |
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_ERROR | A field is missing or wrong, for example the Zendesk sub-domain, or a secret pasted into the client ID field |
| 403 | No integration:write permission | |
| 404 | INTEGRATION_NOT_FOUND | connection_id is not a connection of this workspace |
| 422 | INTEGRATION_OAUTH_NOT_CONFIGURED | The provider has no OAuth, or no OAuth client was given and the server has no default |
| 429 | RATE_LIMITED | Too many changes in the last minute |