Authentication
All sensitive API endpoints require authentication using the Public ID & Private Key generated in the Fasten Connect dashboard. This is done using Basic Authentication, where the Public ID is the username and the Private Key is the password.Remember, when generating the Basic Auth header manually, the Public Id and Private Key must be concatenated with a colon
: and then base64 encoded.
The resulting string should be prefixed with Basic and included in the Authorization header of the request.For example, if your Public ID is public_test_123456324234234 and your Private Key is private_test_9u2orjsd02lk3)i03423,
then the field’s value is the Base64 encoding of public_test_123456324234234:private_test_9u2orjsd02lk3)i03423.Then the Authorization header field will appear as:Authorization: Basic cHVibGljX3Rlc3RfMTIzNDU2MzI0MjM0MjM0OnByaXZhdGVfdGVzdF85dTJvcmpzZDAybGszKWkwMzQyMwo=
# The following Curl examples are equivalent.
# `-u` is the shorthand for `--user`, and can be used to avoid manually encoding the credentials.
curl -u 'public_test_123456324234234':'private_test_9u2orj....sd02lk3)i03423' \
-X POST \
--data '{"org_connection_id":"ebea708d-c5fa-4294-9051-da48ef08c78a"}' \
https://api.connect.fastenhealth.com/v1/bridge/fhir/ehi-export
curl -H 'Authorization: Basic cHVibGljX3Rlc3RfMTIzNDU2MzI0MjM0MjM0OnByaXZhdGVfdGVzdF85dTJvcmpzZDAybGszKWkwMzQyMwo=' \
-X POST \
--data '{"org_connection_id":"ebea708d-c5fa-4294-9051-da48ef08c78a"}' \
https://api.connect.fastenhealth.com/v1/bridge/fhir/ehi-export
publicID := "public_test_123456324234234"
privateKey := "private_test_9u2orjsd02lk3)i03423"
// Concatenate the Public ID and Private Key with a colon
authString := publicID + ":" + privateKey
// Base64 encode the concatenated string
encodedAuth := base64.StdEncoding.EncodeToString([]byte(authString))
// Create the Authorization header value
authHeader := "Basic " + encodedAuth
// Example HTTP request
req, err := http.NewRequest("POST", "https://api.connect.fastenhealth.com/v1/bridge/....", nil)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
// Add the Authorization header
req.Header.Add("Authorization", authHeader)
client := &http.Client{}
resp, err := client.Do(req)
const https = require('https');
// Public ID and Private Key
const publicID = 'public_test_123456324234234';
const privateKey = 'private_test_9u2orjsd02lk3)i03423';
// Concatenate the Public ID and Private Key with a colon
const authString = `${publicID}:${privateKey}`;
// Base64 encode the concatenated string
const encodedAuth = Buffer.from(authString).toString('base64');
// Create the Authorization header value
const authHeader = `Basic ${encodedAuth}`;
// Example HTTP request options
const options = {
hostname: 'api.connect.fastenhealth.com',
port: 443,
path: '/v1/bridge/....',
method: 'POST',
headers: {
'Authorization': authHeader,
'Content-Type': 'application/json',
},
};
// Send the HTTP request
const req = https.request(options, (res) => {
console.log(`Status Code: ${res.statusCode}`);
});
req.end();
import requests
from requests.auth import HTTPBasicAuth
# Public ID and Private Key
public_id = "public_test_123456324234234"
private_key = "private_test_9u2orjsd02lk3)i03423"
# API endpoint
url = "https://api.connect.fastenhealth.com/v1/bridge/...."
# Make the POST request with Basic Authentication
response = requests.post(url, auth=HTTPBasicAuth(public_id, private_key))
String publicId = "public_test_123456324234234";
String privateKey = "private_test_9u2orjsd02lk3)i03423";
String endpoint = "https://api.connect.fastenhealth.com/v1/bridge/...";
// Concatenate Public ID and Private Key with a colon
String authString = publicId + ":" + privateKey;
// Base64 encode the concatenated string
String encodedAuth = Base64.getEncoder().encodeToString(authString.getBytes());
// Create the Authorization header value
String authHeader = "Basic " + encodedAuth;
// Create the HTTP connection
URL url = new URL(endpoint);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Authorization", authHeader);
connection.setRequestProperty("Content-Type", "application/json");
connection.setDoOutput(true);
os.flush();

