New versions of the Qredo API and Signing Agent are now available! To get started, just contact us here.
Qredo Logo

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:

  1. Get an API key.

  2. Get an authentication token.

  3. To approve transactions programmatically, do one of the following:

  4. 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
  1. Query parameters: In the query, replace {workspaceID} with your Workspace ID obtained in Step 1.

  2. 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.

  3. Authentication: Pass the auth token as x-token in the request header.

  4. 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
  1. Query parameters: In the query, replace {workspaceID} with your Workspace ID obtained in Step 1.

  2. Authentication: Pass the auth token as x-token in the request header.

  3. 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
  1. Query parameters:

    • Replace {workspaceID} with your Workspace ID from Prerequisites.
    • Replace {accountID} with your Portfolio ID obtained in Step 1.
  2. Body parameters:

    • name: The Wallet name.
    • connectPlugin: The Wallet type. To create a Web3 Wallet, set to defi. Alternatively, use wc 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, the address 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].

  3. Authentication: Pass the auth token as x-token in the request header.

  4. Result: Now your wallet is created! Copy the returned address.

What's next?

Now you're ready to send transactions with the Qredo API.

Previous
Add the API key to a Transaction Policy