API

This documentation explains the server API and how to handle completed verifications.

General

Some clients are legally required to hold a copy of their customers' Personal data. In this case, you can retrieve any of the data relative to the Verification of your customers from our API:

  • The Data points required in the Verification (i.e first name, last name, document number, identity score)

  • The Resources submitted by the User (i.e. ID document pictures, selfie videos)

  • Any metadata relative to the Verification (i.e. user agent, timestamp, user references)

We recommend our clients to request & store as few pieces of information as possible about their users on their side. This decreases their data liability to the extent, that they only have to protect the data they truly need. If you only care that a user has been verified or is over a certain age, then you should store this as a boolean (true/false) about them, once we have completed the identity or age verification of that user.

API Key Information

In your previous sections, we have worked with client-side integrations. We used there the publishable API key. Since we are now working in a server-to-server environment, you need to use the secret API key. Please never share this API key, since it gives access to your user data. If you leak this API key, a potential bad actor could retrieve and expose information about the identity verification of your users.

Be very careful with the secret API key. Never share it or send it through unencrypted communication methods!

How to Send a Request

Please don't forget to use your secret API key in the header. The code below shows an example of how to request data from our API. Your own functions should look similar to this:

Javascript
Python
Java
Go
Ruby
PHP
Javascript
/*
Add @passbase/node npm package to your package.json.
Passbase has no dependency but expects node version to be LTS (12.x).
npm install @passbase/node --save
*/
const {PassbaseClient, PassbaseConfiguration} = require("@passbase/node");
async function main() {
const apiKey = "YOUR_SECRET_API_KEY";
// Configure the SDK with your API Secret access key
const config = new PassbaseConfiguration({
apiKey,
});
const client = new PassbaseClient(config);
// Get project settings
const settings = await client.getProjectSettings();
console.log(JSON.stringify(settings, null, 4));
}
main().catch(err => {
console.error(err);
process.exit(1);
});
Python
"""
Add Passbase's SDK package to your requirements.txt.
The SDK should work on both python 2.7 and 3+
pip install passbase_sdk && pip freeze | grep passbase_sdk >> requirements.txt
"""
import passbase
from pprint import pprint
# Configure the SDK with your API Secret access key
configuration = passbase.Configuration()
configuration.api_key["X-API-KEY"] = "YOUR_SECRET_API_YEY"
api_client = passbase.ApiClient(configuration)
api_instance = passbase.ProjectApi(api_client)
try:
# Get project settings
api_response = api_instance.get_settings()
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_settings: %s\n" % e)
Java
/*
Maven users, add this dependency to your project's POM:
<dependency>
<groupId>com.passbase</groupId>
<artifactId>passbase</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
Gradle users, add this dependency to your project's build.gradle:
compile "com.passbase:passbase:0.0.1"
*/
import com.passbase.*;
import com.passbase.api.ProjectApi;
import com.passbase.model.ProjectSettings;
import java.util.List;
import java.util.Map;
public final class App {
public static void main(String[] args) {
// Configure the SDK with your API Secret access key
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setApiKey("YOUR_SECRET_API_KEY");
ProjectApi apiInstance = new ProjectApi(defaultClient);
try {
// Get project settings
ProjectSettings settings = apiInstance.getSettings();
System.out.println(settings);
} catch (ApiException e) {
printError(e);
}
}
private static void printError(ApiException e) {
System.err.println("Exception when calling ProjectApi#getSettings");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
Go
/*
Add Passbase to your dependencies
go get github.com/passbase/passbase-go
*/
package main
import (
"context"
"fmt"
passbase "github.com/passbase/passbase-go"
)
func main() {
// Configure the SDK with your API Secret access key
client := passbase.NewAPIClient(passbase.NewConfiguration())
ctx := context.WithValue(context.Background(), passbase.ContextAPIKey, passbase.APIKey{
Key: "YOUR_SECRET_API_KEY",
})
// Get project settings
settings, _, err := client.ProjectApi.GetSettings(ctx)
if err != nil {
panic(err)
}
fmt.Println("Setting for ", settings.Slug, "->", settings)
}
Ruby
# Add Passbase's SDK gem to your Gemfile.
#
# gem 'passbase', '~> 0.0.1'
require 'passbase'
# Configure the SDK with your API Secret access key
Passbase.configure do |config|
config.api_key['X-API-KEY'] = 'YOUR_SECRET_API_KEY'
end
api_instance = Passbase::ProjectApi.new
begin
# Get project settings
result = api_instance.get_settings
p result
rescue Passbase::ApiError => e
puts "Exception when calling ProjectApi->get_settings: #{e}"
end
PHP
/*
To install the bindings via Composer, add the following to `composer.json`:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/passbase/passbase-php.git"
}
]
}
Then run composer install
*/
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure the SDK with your API Secret access key
$config = Passbase\Configuration::getDefaultConfiguration()->setApiKey('X-API-KEY', 'YOUR_SECRET_API_YEY');
$apiInstance = new Passbase\Api\ProjectApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
try {
$result = $apiInstance->getSettings();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ProjectApi->getSettings: ', $e->getMessage(), PHP_EOL;
}
?>

If your favorite programming language isn't present, you can also check out the full API specification here.