Create a Credential for a Connector
curl --request POST \
--url https://production.runalloy.com/connectors/{connectorId}/credentials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--data '
{
"userId": "{{userId}}",
"authenticationType": "oauth2",
"redirectUri": "http://localhost:3000"
}
'import requests
url = "https://production.runalloy.com/connectors/{connectorId}/credentials"
payload = {
"userId": "{{userId}}",
"authenticationType": "oauth2",
"redirectUri": "http://localhost:3000"
}
headers = {
"x-api-version": "<x-api-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-version': '<x-api-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
userId: '{{userId}}',
authenticationType: 'oauth2',
redirectUri: 'http://localhost:3000'
})
};
fetch('https://production.runalloy.com/connectors/{connectorId}/credentials', 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://production.runalloy.com/connectors/{connectorId}/credentials",
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([
'userId' => '{{userId}}',
'authenticationType' => 'oauth2',
'redirectUri' => 'http://localhost:3000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-api-version: <x-api-version>"
],
]);
$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://production.runalloy.com/connectors/{connectorId}/credentials"
payload := strings.NewReader("{\n \"userId\": \"{{userId}}\",\n \"authenticationType\": \"oauth2\",\n \"redirectUri\": \"http://localhost:3000\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-version", "<x-api-version>")
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://production.runalloy.com/connectors/{connectorId}/credentials")
.header("x-api-version", "<x-api-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"userId\": \"{{userId}}\",\n \"authenticationType\": \"oauth2\",\n \"redirectUri\": \"http://localhost:3000\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://production.runalloy.com/connectors/{connectorId}/credentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-version"] = '<x-api-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userId\": \"{{userId}}\",\n \"authenticationType\": \"oauth2\",\n \"redirectUri\": \"http://localhost:3000\"\n}"
response = http.request(request)
puts response.read_body{
"oauthUrl": "http://localhost:4040/api/strategy/connector/slack/authorize?userId=5eba51a03fe9631316668514&redirectUri=http%3A%2F%2Flocalhost%3A3000&token=abcdefghijklmnopqrstvwxyz123456790"
}Credentials
Create a Credential for a Connector
Create a credential for a specified
POST
/
connectors
/
{connectorId}
/
credentials
Create a Credential for a Connector
curl --request POST \
--url https://production.runalloy.com/connectors/{connectorId}/credentials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--data '
{
"userId": "{{userId}}",
"authenticationType": "oauth2",
"redirectUri": "http://localhost:3000"
}
'import requests
url = "https://production.runalloy.com/connectors/{connectorId}/credentials"
payload = {
"userId": "{{userId}}",
"authenticationType": "oauth2",
"redirectUri": "http://localhost:3000"
}
headers = {
"x-api-version": "<x-api-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-version': '<x-api-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
userId: '{{userId}}',
authenticationType: 'oauth2',
redirectUri: 'http://localhost:3000'
})
};
fetch('https://production.runalloy.com/connectors/{connectorId}/credentials', 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://production.runalloy.com/connectors/{connectorId}/credentials",
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([
'userId' => '{{userId}}',
'authenticationType' => 'oauth2',
'redirectUri' => 'http://localhost:3000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-api-version: <x-api-version>"
],
]);
$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://production.runalloy.com/connectors/{connectorId}/credentials"
payload := strings.NewReader("{\n \"userId\": \"{{userId}}\",\n \"authenticationType\": \"oauth2\",\n \"redirectUri\": \"http://localhost:3000\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-version", "<x-api-version>")
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://production.runalloy.com/connectors/{connectorId}/credentials")
.header("x-api-version", "<x-api-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"userId\": \"{{userId}}\",\n \"authenticationType\": \"oauth2\",\n \"redirectUri\": \"http://localhost:3000\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://production.runalloy.com/connectors/{connectorId}/credentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-version"] = '<x-api-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userId\": \"{{userId}}\",\n \"authenticationType\": \"oauth2\",\n \"redirectUri\": \"http://localhost:3000\"\n}"
response = http.request(request)
puts response.read_body{
"oauthUrl": "http://localhost:4040/api/strategy/connector/slack/authorize?userId=5eba51a03fe9631316668514&redirectUri=http%3A%2F%2Flocalhost%3A3000&token=abcdefghijklmnopqrstvwxyz123456790"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
API version
Path Parameters
Connector ID
Body
application/json
User identifier for the credential
Example:
"{{userId}}"
Type of authentication method
Example:
"oauth2"
ID of the auth config you want to create the credential with
Example:
"67a37f29e0aa276e50d7253a"
The URI to which we'll redirect the user after authenticating
Example:
"https://myapp.com"
Response
200 - application/json
Credential created successfully
- Option 1
- Option 2
OAuth authorization URL to redirect the user and complete credential linking
⌘I

