Qredo API
Create a Portfolio and Wallet
You can also follow this video tutorial:
Overview
This guide explains how to programmatically create a Portfolio and Wallet that can be used for sending transactions with the Qredo API.
Prerequisites
Before you start, take these steps:
To approve transactions programmatically, do one of the following:
To approve with the Signing Agent, associate it you with your API key - see Steps 2–4 in Signing Agent: Get started. Make sure to add the API key to your Transaction Policy.
To approve with the Qredo API, associate your API key with BLS and EC keys. Then add the API key to a Transaction Policy.
In the Qredo Web App, navigate to your Workspace and copy the Workspace ID from the URL:
https://qredo.network/app/workspace/{workspaceID}
Step 1: Create a Portfolio
If you wish to continue in an already existing Portfolio, skip this step. Just go to the Qredo Web App, navigate to Holdings, and copy the Portfolio (account) ID from the end of the URL:
https://qredo.network/app/workspace/{workspaceID}/holdings/account/{accountID}
Please note that in the API account
stands for Portfolio.
To create a Portfolio in your Workspace, call Create a portfolio:
POST https://api-v2.qredo.network/api/v2/workspaces/{workspaceID}/accounts
Query parameters: In the query, replace
{workspaceID}
with your Workspace ID obtained in Step 1.Body parameters: In the query, specify your portfolio name and type:
{ "name": "my-portfolio", "type": "standard" }
The available Portfolio types include:
standard
— A standard Portfolio where you can create Wallets and Vaults.exchange
— An exchange portfolio connected to an exchange through Glass.
Note: If you don't set the type, the endpoint will create a
standard
Portfolio.Authentication: Pass the auth token as
x-token
in the request header.Result: Copy the returned
accountID
.
Step 2: Get a Transaction Policy
To approve transactions programmatically, you need to configure your Transaction Policy according to Prerequisites. If you followed these instructions, you've already obtained your Policy ID, but you can always retrieve it again by following the steps below.
When creating a Wallet, you have to specify the ID of the Transaction Policy that is going to govern it. To get your Policy ID, call List policies:
GET https://api-v2.qredo.network/api/v2/workspaces/{workspaceID}/policies
Query parameters: In the query, replace
{workspaceID}
with your Workspace ID obtained in Step 1.Authentication: Pass the auth token as
x-token
in the request header.Result: The endpoint will return a list of policies. Find the Policy you wish to use and copy its
policyID
.You can identify your Policy by its
name
and"policyType": "transaction"
in the response:{ "actionsGoverned": [], "expression": { "type": 1, "operation": 1, "threshold": 1, "rules": [ { "type": 2, "operation": 3, "threshold": 0, "rules": [], "arguments": { "id": "a.Fpj31XLcApwEfhM6auXt8Xpb7fgtPFmwHyPQLG2Td2yy" }, }, { "type": 2, "operation": 3, "threshold": 0, "rules": [], "arguments": { "id": "m.J7ypd4CFJr6YntophcQryQv2VWonVLHHBfisfBGB7oc7" }, } ], "arguments": {} }, "expressionContentType": "application/json", "name": "my-policy", // the Policy name "policyID": "2SpKjaaX5ieAUDBCtFXBGEcq4JA", // the Policy ID to copy "policyType": "transaction", // the Policy type "systemType": 0 }
Step 3: Generate a Wallet
To generate a Web3 API Wallet, call Create a Wallet in a Portfolio:
POST https://api-v2.qredo.network/api/v2/workspaces/{workspaceID}/accounts/{accountID}/wallets
Query parameters:
- Replace
{workspaceID}
with your Workspace ID from Prerequisites. - Replace
{accountID}
with your Portfolio ID obtained in Step 1.
- Replace
Body parameters:
name
: The Wallet name.connectPlugin
: The Wallet type. To create a Web3 Wallet, set todefi
. Alternatively, usewc
to create a WalletConnect Wallet.policyID
: The Policy ID obtained in Step 2.waitForAddress
: The delay in seconds for getting the response. The MPCs need extra time (usually 4-5 seconds) to compute the vault address. If there is no delay or it's not long enough, theaddress
field will return an empty string. If you set a long enough delay, you'll get the address.
{ "name": "my-wallet", "connectPlugin": "defi", "policyID": "YOUR_POLICY_ID", "waitForAddress": 20 }
Some Wallet types need to be enabled for your Workspace first. Please contact your Qredo representative or email [email protected].
Authentication: Pass the auth token as
x-token
in the request header.Result: Now your wallet is created! Copy the returned
address
.
What's next?
Now you're ready to send transactions with the Qredo API.