curl --request POST \
--url https://partner.peaka.studio/api/v1/connections/{projectId}/oauth2 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"queryParameters": "code=1234&state=xyz¶m1=value1¶m2=value2"
}
'import requests
url = "https://partner.peaka.studio/api/v1/connections/{projectId}/oauth2"
payload = { "queryParameters": "code=1234&state=xyz¶m1=value1¶m2=value2" }
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({queryParameters: 'code=1234&state=xyz¶m1=value1¶m2=value2'})
};
fetch('https://partner.peaka.studio/api/v1/connections/{projectId}/oauth2', 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://partner.peaka.studio/api/v1/connections/{projectId}/oauth2",
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([
'queryParameters' => 'code=1234&state=xyz¶m1=value1¶m2=value2'
]),
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://partner.peaka.studio/api/v1/connections/{projectId}/oauth2"
payload := strings.NewReader("{\n \"queryParameters\": \"code=1234&state=xyz¶m1=value1¶m2=value2\"\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://partner.peaka.studio/api/v1/connections/{projectId}/oauth2")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"queryParameters\": \"code=1234&state=xyz¶m1=value1¶m2=value2\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://partner.peaka.studio/api/v1/connections/{projectId}/oauth2")
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 \"queryParameters\": \"code=1234&state=xyz¶m1=value1¶m2=value2\"\n}"
response = http.request(request)
puts response.read_body{
"id": "6243f42a-42d0-4821-a90f-763cda6cda50",
"name": "exampleOauth2Connection",
"type": "google_analytics"
}Oauth2 Callback
This callback/webhook is used while creating a new connection with Oauth2. See https://docs.peaka.com/how-to-guides/how-to-create-oauth2-based-connections-via-peaka for more information.
curl --request POST \
--url https://partner.peaka.studio/api/v1/connections/{projectId}/oauth2 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"queryParameters": "code=1234&state=xyz¶m1=value1¶m2=value2"
}
'import requests
url = "https://partner.peaka.studio/api/v1/connections/{projectId}/oauth2"
payload = { "queryParameters": "code=1234&state=xyz¶m1=value1¶m2=value2" }
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({queryParameters: 'code=1234&state=xyz¶m1=value1¶m2=value2'})
};
fetch('https://partner.peaka.studio/api/v1/connections/{projectId}/oauth2', 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://partner.peaka.studio/api/v1/connections/{projectId}/oauth2",
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([
'queryParameters' => 'code=1234&state=xyz¶m1=value1¶m2=value2'
]),
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://partner.peaka.studio/api/v1/connections/{projectId}/oauth2"
payload := strings.NewReader("{\n \"queryParameters\": \"code=1234&state=xyz¶m1=value1¶m2=value2\"\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://partner.peaka.studio/api/v1/connections/{projectId}/oauth2")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"queryParameters\": \"code=1234&state=xyz¶m1=value1¶m2=value2\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://partner.peaka.studio/api/v1/connections/{projectId}/oauth2")
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 \"queryParameters\": \"code=1234&state=xyz¶m1=value1¶m2=value2\"\n}"
response = http.request(request)
puts response.read_body{
"id": "6243f42a-42d0-4821-a90f-763cda6cda50",
"name": "exampleOauth2Connection",
"type": "google_analytics"
}Authorizations
Use the Authorization header with the value 'Bearer ' to authenticate. Partner API Keys have full access; Project API Keys are limited to their project scope. Learn more: https://docs.peaka.com/api-reference/authentication
Path Parameters
ID of the project
Body
Oauth2 Callback Body
Query parameters received from the Oauth2 redirection. Pass all query parameters as a single string.
Example: "https://yourdomain.com/oauth2/mycallback?code=1234&state=xyz¶m1=value1¶m2=value2"
"queryParameters": "code=1234&state=xyz¶m1=value1¶m2=value2"
Response
Connection created successfully
Connection ID
Name of the connection
Type of connection.
Example: airtable for AirTable, stripe for Stripe, hubspot_access_token for HubSpot (with Access Token), etc.
Exact list can be fetched by following url: /connections/config
Oauth callback url if the connection is Oauth based.