Quickstart guide
This guide should give you a quick start for the integration of the Distributor API. We'll use easy to read python code. For HTTP interactions we will use the requests package.
At the end of this guide, you will also find the complete python script for you to copy, paste and try out.
Getting started
Before you get started make sure that you've installed an up-to-date python version. To run the script you will also need the requests package.
First we are going to import the packages that we need and set up some basic variables. The client ID and client secret will be provided to you during the set up of the demo environment.
import binascii
import os
import requests
URL = 'https://demo.cashlink.de/api/external'
CLIENT_ID = '...'
CLIENT_SECRET = '...'Now we write a helper function that follows the OAuth protocol to retrieve an access token that we will use to authenticate the API calls.
def authenticate():
r = requests.post(f'{URL}/oauth/token', data={
'grant_type': 'client_credentials',
'scope': 'investors:write investors:read documents:write',
'client_id': CLIENT_ID,
'client_secret': CLIENT_SECRET
})
assert r.status_code == 200, r.content
return r.json()['access_token']We add an additional helper function that with every call creates a random idempotency key. In your application, you would use an idempotency key that correlates to the internal object on your side.
Create an investor
As we now can access the API we use it to create an investor.
Add identification
Besides personal data, the investor also needs a valid identification to be able to invest.
Add benefiting persons
Because we are creating a legal person investor, we also need to add data about the benefiting persons of the investor account.
Create a wallet
Investors need a wallet to receive and hold crypto securities. In this example, we create a managed wallet for the investor. That means that the private key will remain in secure custody with Cashlink as the crypto custodian.
Full script
Below you find the full script for you to copy, paste and try out.
Last updated
Was this helpful?