Links

Create a linked account

Step 1: Initialising SDK

The best way to interact with our API is to use one of our official SDK. You can find the detailed documentation here:
Javascript
Typescript
# Install via NPM
npm i @cobaltio/cobalt
# Getting Started
const Cobalt = require('@cobaltio/cobalt');
const Client = new Cobalt({
apiKey:"<Your Api Key>"
});
# Install via NPM
npm i @cobaltio/cobalt
#Getting started
import Cobalt from '@cobaltio/cobalt';
const Client:Cobalt = new Cobalt({
apiKey:"<Your Api Key>"
});
You can find your api key from here

Step 2: Creating Linked Account

Whenever a new user or organisation signs up on your platform, use the below call to create a linked account. If there are multiple users in an organisation DO NOT create linked account for all the users. In this case create linked account incase of a new organisation.
Linked account creation should always happen server-side to prevent token leakage.
Javascript
# Create linked account when user signs up
/**
* Create Linked Accounts
* @param {String} account_id expects unique id
* @param {String} embed_id sends an associated embed key
* @returns {Promise<Account>}
*/
const createLinkedAccount = async (account_id, embed_id) => {
return new Promise((resolve, reject) => {
try {
resolve(Client.createLinkedAccount({
linked_account_id: account_id,
}));
} catch (error) {
reject(error);
}
});
};
You will be able to see the accounts created under the linked account section for each new sign up.