JavaScript
import Cerca from '@cerca-dev/sdk';
const client = new Cerca({
apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
});
const oauthConnectResponse = await client.oauth.connect('google', {
owner: { type: 'organization' },
returnOrigin: 'https://app.example.com',
});
console.log(oauthConnectResponse.authorizationUrl);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
oauth_connect_response = client.oauth.connect(
provider="google",
owner={
"type": "organization"
},
return_origin="https://app.example.com",
)
print(oauth_connect_response.authorization_url)package main
import (
"context"
"fmt"
"github.com/matrices/cerca-go"
"github.com/matrices/cerca-go/option"
)
func main() {
client := cercago.NewClient(
option.WithAPIKey("My API Key"),
)
oauthConnectResponse, err := client.OAuth.Connect(
context.TODO(),
"google",
cercago.OAuthConnectParams{
Owner: cercago.F[cercago.ConnectionOwnerUnionParam](cercago.ConnectionOwnerOrganizationConnectionOwnerParam{
Type: cercago.F(cercago.ConnectionOwnerOrganizationConnectionOwnerTypeOrganization),
}),
ReturnOrigin: cercago.F("https://app.example.com"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", oauthConnectResponse.AuthorizationURL)
}require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
oauth_connect_response = cerca.oauth.connect("google", owner: {type: :organization}, return_origin: "https://app.example.com")
puts(oauth_connect_response)cerca oauth connect \
--api-key 'My API Key' \
--provider google \
--owner '{type: organization}' \
--return-origin https://app.example.comcurl --request POST \
--url https://api.cerca.dev/oauth/connect/{provider} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"owner": {
"type": "organization"
},
"returnOrigin": "https://app.example.com",
"scopes": [
"email",
"profile"
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/oauth/connect/{provider}",
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([
'owner' => [
'type' => 'organization'
],
'returnOrigin' => 'https://app.example.com',
'scopes' => [
'email',
'profile'
]
]),
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;
}HttpResponse<String> response = Unirest.post("https://api.cerca.dev/oauth/connect/{provider}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": {\n \"type\": \"organization\"\n },\n \"returnOrigin\": \"https://app.example.com\",\n \"scopes\": [\n \"email\",\n \"profile\"\n ]\n}")
.asString();{
"authorizationUrl": "https://accounts.google.com/o/oauth2/v2/auth?...",
"callbackOrigin": "https://app.cerca.dev",
"expiresAt": "2026-04-15T12:00:00.000Z",
"stateNonce": "nonce_abc123"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}OAuth
Start OAuth authorization
POST
/
oauth
/
connect
/
{provider}
JavaScript
import Cerca from '@cerca-dev/sdk';
const client = new Cerca({
apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
});
const oauthConnectResponse = await client.oauth.connect('google', {
owner: { type: 'organization' },
returnOrigin: 'https://app.example.com',
});
console.log(oauthConnectResponse.authorizationUrl);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
oauth_connect_response = client.oauth.connect(
provider="google",
owner={
"type": "organization"
},
return_origin="https://app.example.com",
)
print(oauth_connect_response.authorization_url)package main
import (
"context"
"fmt"
"github.com/matrices/cerca-go"
"github.com/matrices/cerca-go/option"
)
func main() {
client := cercago.NewClient(
option.WithAPIKey("My API Key"),
)
oauthConnectResponse, err := client.OAuth.Connect(
context.TODO(),
"google",
cercago.OAuthConnectParams{
Owner: cercago.F[cercago.ConnectionOwnerUnionParam](cercago.ConnectionOwnerOrganizationConnectionOwnerParam{
Type: cercago.F(cercago.ConnectionOwnerOrganizationConnectionOwnerTypeOrganization),
}),
ReturnOrigin: cercago.F("https://app.example.com"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", oauthConnectResponse.AuthorizationURL)
}require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
oauth_connect_response = cerca.oauth.connect("google", owner: {type: :organization}, return_origin: "https://app.example.com")
puts(oauth_connect_response)cerca oauth connect \
--api-key 'My API Key' \
--provider google \
--owner '{type: organization}' \
--return-origin https://app.example.comcurl --request POST \
--url https://api.cerca.dev/oauth/connect/{provider} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"owner": {
"type": "organization"
},
"returnOrigin": "https://app.example.com",
"scopes": [
"email",
"profile"
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/oauth/connect/{provider}",
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([
'owner' => [
'type' => 'organization'
],
'returnOrigin' => 'https://app.example.com',
'scopes' => [
'email',
'profile'
]
]),
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;
}HttpResponse<String> response = Unirest.post("https://api.cerca.dev/oauth/connect/{provider}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": {\n \"type\": \"organization\"\n },\n \"returnOrigin\": \"https://app.example.com\",\n \"scopes\": [\n \"email\",\n \"profile\"\n ]\n}")
.asString();{
"authorizationUrl": "https://accounts.google.com/o/oauth2/v2/auth?...",
"callbackOrigin": "https://app.cerca.dev",
"expiresAt": "2026-04-15T12:00:00.000Z",
"stateNonce": "nonce_abc123"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Minimum string length:
1Example:
"google"
Body
application/json
Public owner for a reusable connection. Organization owners use the authenticated organization; fleet owners add a fleetId.
- OrganizationConnectionOwner
- FleetConnectionOwner
Show child attributes
Show child attributes
HTTP(S) origin that receives the OAuth completion message.
Example:
"https://app.example.com"
Provider-specific OAuth scopes. Empty entries are ignored after trimming.
Example:
["email", "profile"]
Response
OAuth authorization start details.
Provider authorization URL that the client should open.
Example:
"https://accounts.google.com/o/oauth2/v2/auth?..."
Origin hosting the OAuth callback endpoint.
Example:
"https://app.cerca.dev"
OAuth state expiration timestamp, when returned.
Example:
"2026-04-15T12:00:00.000Z"
OAuth state nonce, when returned.
Example:
"nonce_abc123"
⌘I