curl --request POST \
--url https://api.example.com/credentials/oauth-provider \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "<string>",
"oauth_authorize_url": "<string>",
"oauth_token_url": "<string>",
"oauth_client_id": "<string>",
"oauth_client_secret": "<string>",
"upstream_base_url": "<string>",
"oauth_default_scope": "<string>"
}
'import requests
url = "https://api.example.com/credentials/oauth-provider"
payload = {
"label": "<string>",
"oauth_authorize_url": "<string>",
"oauth_token_url": "<string>",
"oauth_client_id": "<string>",
"oauth_client_secret": "<string>",
"upstream_base_url": "<string>",
"oauth_default_scope": "<string>"
}
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({
label: '<string>',
oauth_authorize_url: '<string>',
oauth_token_url: '<string>',
oauth_client_id: '<string>',
oauth_client_secret: '<string>',
upstream_base_url: '<string>',
oauth_default_scope: '<string>'
})
};
fetch('https://api.example.com/credentials/oauth-provider', 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.example.com/credentials/oauth-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([
'label' => '<string>',
'oauth_authorize_url' => '<string>',
'oauth_token_url' => '<string>',
'oauth_client_id' => '<string>',
'oauth_client_secret' => '<string>',
'upstream_base_url' => '<string>',
'oauth_default_scope' => '<string>'
]),
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://api.example.com/credentials/oauth-provider"
payload := strings.NewReader("{\n \"label\": \"<string>\",\n \"oauth_authorize_url\": \"<string>\",\n \"oauth_token_url\": \"<string>\",\n \"oauth_client_id\": \"<string>\",\n \"oauth_client_secret\": \"<string>\",\n \"upstream_base_url\": \"<string>\",\n \"oauth_default_scope\": \"<string>\"\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://api.example.com/credentials/oauth-provider")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"<string>\",\n \"oauth_authorize_url\": \"<string>\",\n \"oauth_token_url\": \"<string>\",\n \"oauth_client_id\": \"<string>\",\n \"oauth_client_secret\": \"<string>\",\n \"upstream_base_url\": \"<string>\",\n \"oauth_default_scope\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/credentials/oauth-provider")
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 \"label\": \"<string>\",\n \"oauth_authorize_url\": \"<string>\",\n \"oauth_token_url\": \"<string>\",\n \"oauth_client_id\": \"<string>\",\n \"oauth_client_secret\": \"<string>\",\n \"upstream_base_url\": \"<string>\",\n \"oauth_default_scope\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"credential_id": "<string>"
}{
"error": {
"code": "validation_error",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "unauthorized",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "forbidden",
"message": "<string>",
"details": {}
}
}Create an OAuth provider credential
Creates a system.credential of kind: oauth_token carrying an upstream service’s OAuth client config — authorize URL, token URL, client_id, encrypted client_secret, upstream API base URL, and optional default scope. The resulting credential id is passed as credential_ref on subsequent POST /connections/install calls so multiple integrations of the same upstream (e.g. google.calendar + google.tasks) share one OAuth client and one stored secret instead of duplicating per-integration.
The client_secret is encrypted server-side under the connectionOauthToken HKDF domain (AES-256-GCM). Decryption only happens at the OAuth proxy + callback paths; the plaintext is never returned by any read path.
Tenant-scoped: the credential is created in the calling key’s tenant, and integrations within that tenant can reference it. Cross-tenant reuse is not supported — each tenant brings its own OAuth provider config.
curl --request POST \
--url https://api.example.com/credentials/oauth-provider \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "<string>",
"oauth_authorize_url": "<string>",
"oauth_token_url": "<string>",
"oauth_client_id": "<string>",
"oauth_client_secret": "<string>",
"upstream_base_url": "<string>",
"oauth_default_scope": "<string>"
}
'import requests
url = "https://api.example.com/credentials/oauth-provider"
payload = {
"label": "<string>",
"oauth_authorize_url": "<string>",
"oauth_token_url": "<string>",
"oauth_client_id": "<string>",
"oauth_client_secret": "<string>",
"upstream_base_url": "<string>",
"oauth_default_scope": "<string>"
}
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({
label: '<string>',
oauth_authorize_url: '<string>',
oauth_token_url: '<string>',
oauth_client_id: '<string>',
oauth_client_secret: '<string>',
upstream_base_url: '<string>',
oauth_default_scope: '<string>'
})
};
fetch('https://api.example.com/credentials/oauth-provider', 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.example.com/credentials/oauth-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([
'label' => '<string>',
'oauth_authorize_url' => '<string>',
'oauth_token_url' => '<string>',
'oauth_client_id' => '<string>',
'oauth_client_secret' => '<string>',
'upstream_base_url' => '<string>',
'oauth_default_scope' => '<string>'
]),
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://api.example.com/credentials/oauth-provider"
payload := strings.NewReader("{\n \"label\": \"<string>\",\n \"oauth_authorize_url\": \"<string>\",\n \"oauth_token_url\": \"<string>\",\n \"oauth_client_id\": \"<string>\",\n \"oauth_client_secret\": \"<string>\",\n \"upstream_base_url\": \"<string>\",\n \"oauth_default_scope\": \"<string>\"\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://api.example.com/credentials/oauth-provider")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"<string>\",\n \"oauth_authorize_url\": \"<string>\",\n \"oauth_token_url\": \"<string>\",\n \"oauth_client_id\": \"<string>\",\n \"oauth_client_secret\": \"<string>\",\n \"upstream_base_url\": \"<string>\",\n \"oauth_default_scope\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/credentials/oauth-provider")
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 \"label\": \"<string>\",\n \"oauth_authorize_url\": \"<string>\",\n \"oauth_token_url\": \"<string>\",\n \"oauth_client_id\": \"<string>\",\n \"oauth_client_secret\": \"<string>\",\n \"upstream_base_url\": \"<string>\",\n \"oauth_default_scope\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"credential_id": "<string>"
}{
"error": {
"code": "validation_error",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "unauthorized",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "forbidden",
"message": "<string>",
"details": {}
}
}Authorizations
Pass an API key (marfa_k1_...) or OAuth access token (marfa_at_...)
Body
1 - 200204820481 - 5121 - 204820482048Response
Credential created. Returns the new credential's id for use as credential_ref on install.