To accommodate a wider range of integrations and use cases, we provide an option to create Sub-Accounts through the API.
Are Sub-Accounts Right for You?
Answering the following question will help you decide if this is the right approach for you:
- Will your Voxpopme account have data from multiple customers?
- If yes, then we recommend to create Sub-Accounts for every single one of your customers. It will give you the greatest amount of freedom and safety, by siloing data and ensuring all your customer data is kept separate, preventing accidental data leaks between all of your customers.
- If no, then you can simply store all of your Projects under a single Account. If your requirements change in the future and you do end up having to create Projects for different customers, we recommend you set up Sub-Accounts for each new customer.
If you end up going the Sub-Account route Your Account becomes Master Account, and your API key becomes the Master API key. Master Account and Master API key should only ever be used for managing Sub-Accounts, and creating Sub-Account API keys. Sub-Accounts cannot become Master accounts. We do not recommend creating Projects on Master Accounts. |
Creating Sub-Accounts
Creating Sub-Accounts is relatively straightforward, simply POST
a x-www-form-urlencoded
company name to https://developer.voxpopme.com/v2/account
like in the snippet below. Inside the header of the request, specify your Master API key and your Master Account ID. This will ensure the newly created Sub-Account is linked to your Master Account correctly.
Sub-Account Company Names Our company names must be unique, so we recommend namespacing your customer company names in a similar fashion to “Your Company Name - Customer Company Name”. |
const companyName = 'VPM - Microsoft'
fetch("https://developer.voxpopme.com/v2/account", {
method: 'POST',
headers: {
'x-api-key': '312ktr43G5BVc2193B14fB21m3J', // Master API Key
'account-id': '149', // Master Acc ID
'Content-Type': 'application/x-www-form-urlencoded'
},
body: `company_name=${companyName}`
});
After making the request, in the response you will get the new Sub-Account’s ID, you will need this to manage this Sub-Account. Don’t worry if you lose it, see GET /v2/accounts
endpoint.
Creating API keys
Each Sub-Account needs to be managed with its own API key.
Send POST
request to https://developer.voxpopme.com/v2/user/api-user
to create a new API key. In the request you will have specify two headers - x-api-key
containing your Master Account ID, and account-id
containing your newly created Sub-Account's ID. This will ensure that the new API key can only manage the single Sub-Account and nothing else.
In the response payload, you will find a JSON object with a single property called api_key
, which will contain the API key that can manage nothing but the Sub-Account you created previously.
fetch('https://developer.voxpopme.com/v2/user/api-user', {
method: 'POST',
headers: {
'x-api-key': '312ktr43G5BVc2193B14fB21m3J', // Master API Key
'account-id': '2001' // New Sub-Account's ID
}
});
Sending the request multiple times will generate multiple API keys. They can be revoked on our portal, or by contacting us.
Comments
0 comments
Article is closed for comments.