Authentication
Creating Credentials
You can generate new credentials within our Partner Portal by navigating to API Keys.
Basic Auth
Our API supports authentication with client credentials through the basic
authorization scheme. Basic auth provides a simple way to authenticate machine-to-machine API calls utilizing your client credentials. The client credentials include a client-id and a client-secret which should be treated as a secret key and stored in a secure way. These credentials should not be utilized for frontend-based calls (e.g., via javascript in your customer-facing application).
Examples
- cURL with user flags
- JavaScript
- Java
- PHP
- Python
- Ruby
- C#
curl -X GET -u $CLIENT_ID:$CLIENT_SECRET 'https://api.verticalinsure.com/v1/products'
const request = await fetch('https://api.verticalinsure.com/v1/products', {
headers: {
Authorization: Basic btoa(`${CLIENT_ID}:${CLIENT_SECRET}`)
}
})
final OkHttpClient client = new OkHttpClient.Builder().authenticator((route, response) -> {
String credential = Credentials.basic(clientId, clientSecret);
return response.request().newBuilder().header("Authorization", credential).build();
})
.build();
final Response response = client.newCall(
new Request.Builder()
.url("https://api.verticalinsure.com/v1/products")
.build()).execute();
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.verticalinsure.com/v1/products',
CURLOPT_USERPWD => $VERTICAL_INSURE_CLIENT_ID.":".$VERTICAL_INSURE_CLIENT_SECRET,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Accept: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
response = requests.get(
"https://api.verticalinsure.com/v1/products",
auth=(VERTICAL_INSURE_CLIENT_ID,VERTICAL_INSURE_CLIENT_SECRET)
)
uri = URI('https://api.verticalinsure.com/v1/products')
req = Net::HTTP::Get.new(uri)
req.basic_auth VERTICAL_INSURE_CLIENT_ID, VERTICAL_INSURE_CLIENT_SECRET
res = Net::HTTP.start(uri.hostname, uri.port) {|http|
http.request(req)
}
puts res.body
using System.Net.Http.Headers;
using System.Text;
using HttpClient client = new();
var basicAuthValue =
Convert.ToBase64String(
Encoding.ASCII.GetBytes($"{clientId}:{clientSecret}"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", basicAuthValue);
await GetProductsAsync(client);
static async Task GetProductsAsync(HttpClient client)
{
var json = await client.GetStringAsync(
"https://api.verticalinsure.com/v1/products");
Console.Write(json);
}
Client Id Header
Our quoting API allows requests to include only the x-api-client-id
header. This is the client_id
part of your API credentials. This method ensures that your full API credentials remain secret while utilizing the Quote API from your user interface.
curl -X POST -H "x-api-client-id: $CLIENT_ID" 'https://api.verticalinsure.com/v1/quote/gap-medical'