Create a Connect request
curl --request POST \
--url https://api.swippee.com/v1/connect/request \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scopes": [
"identity",
"income"
],
"redirect_uri": "https://yourapp.com/cb"
}
'import requests
url = "https://api.swippee.com/v1/connect/request"
payload = {
"scopes": ["identity", "income"],
"redirect_uri": "https://yourapp.com/cb"
}
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({scopes: ['identity', 'income'], redirect_uri: 'https://yourapp.com/cb'})
};
fetch('https://api.swippee.com/v1/connect/request', 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.swippee.com/v1/connect/request",
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([
'scopes' => [
'identity',
'income'
],
'redirect_uri' => 'https://yourapp.com/cb'
]),
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.swippee.com/v1/connect/request"
payload := strings.NewReader("{\n \"scopes\": [\n \"identity\",\n \"income\"\n ],\n \"redirect_uri\": \"https://yourapp.com/cb\"\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.swippee.com/v1/connect/request")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scopes\": [\n \"identity\",\n \"income\"\n ],\n \"redirect_uri\": \"https://yourapp.com/cb\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swippee.com/v1/connect/request")
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 \"scopes\": [\n \"identity\",\n \"income\"\n ],\n \"redirect_uri\": \"https://yourapp.com/cb\"\n}"
response = http.request(request)
puts response.read_body{
"request_token": "<string>",
"connect_url": "<string>"
}{
"error_type": "AUTHENTICATION_ERROR",
"error_code": "INVALID_API_KEY",
"error_message": "Unknown API key.",
"display_message": null,
"request_id": "req_8f3c9b2e4a1d4f7c9e0b1a2c3d4e5f60",
"documentation_url": "https://docs.swippee.com/concepts/errors#invalid_api_key",
"suggested_action": "Check your API key in the Authorization header."
}Connect
Create a Connect request
Your backend starts a hosted consent flow. Returns a request_token and connect_url to open in the browser.
POST
/
v1
/
connect
/
request
Create a Connect request
curl --request POST \
--url https://api.swippee.com/v1/connect/request \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scopes": [
"identity",
"income"
],
"redirect_uri": "https://yourapp.com/cb"
}
'import requests
url = "https://api.swippee.com/v1/connect/request"
payload = {
"scopes": ["identity", "income"],
"redirect_uri": "https://yourapp.com/cb"
}
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({scopes: ['identity', 'income'], redirect_uri: 'https://yourapp.com/cb'})
};
fetch('https://api.swippee.com/v1/connect/request', 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.swippee.com/v1/connect/request",
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([
'scopes' => [
'identity',
'income'
],
'redirect_uri' => 'https://yourapp.com/cb'
]),
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.swippee.com/v1/connect/request"
payload := strings.NewReader("{\n \"scopes\": [\n \"identity\",\n \"income\"\n ],\n \"redirect_uri\": \"https://yourapp.com/cb\"\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.swippee.com/v1/connect/request")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scopes\": [\n \"identity\",\n \"income\"\n ],\n \"redirect_uri\": \"https://yourapp.com/cb\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swippee.com/v1/connect/request")
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 \"scopes\": [\n \"identity\",\n \"income\"\n ],\n \"redirect_uri\": \"https://yourapp.com/cb\"\n}"
response = http.request(request)
puts response.read_body{
"request_token": "<string>",
"connect_url": "<string>"
}{
"error_type": "AUTHENTICATION_ERROR",
"error_code": "INVALID_API_KEY",
"error_message": "Unknown API key.",
"display_message": null,
"request_id": "req_8f3c9b2e4a1d4f7c9e0b1a2c3d4e5f60",
"documentation_url": "https://docs.swippee.com/concepts/errors#invalid_api_key",
"suggested_action": "Check your API key in the Authorization header."
}Authorizations
Your API key from the dashboard, sent as Authorization: Bearer swippee_sk_live_....
Body
application/json
⌘I