Skip to content

Step 6: Perform a withdrawal

With Qredo, a withdrawal transaction means moving assets from a wallet ID to an external wallet address: one that is not on the Qredochain.

To complete this step, you must:

  1. Use the POST /whitelist resource to make a L1 address eligible for withdrawing assets outside the Qredochain.
  2. Use the POST /withdraw resource to submit a withdrawal request (to the whitelisted address) for approval.
  3. Wait for custodial approval to take place.
  4. Use the GET /withdraw resource to verify that the transaction is completed.

1. Whitelist a withdrawal address

This example whitelists a counterparty address that is external to the Qredochain and specifies its asset type. For withdrawals, you must always whitelist the destination external address. Note that you can have a single address whitelisted for more than one fund in a company.

Example request: POST /whitelist

With this request, you pass company_id and the fund_id as URL parameters.

curl -X POST /company/{company_id}/fund/{fund_id}/whitelist

Request body

All described fields are required.

{
  "name": "<memorable name for counterparty address>",
  "asset": "<asset symbol>", 
  "address": "<external counterparty address>"
}

Example whitelist response: POST /whitelist

A successful response returns a HTTP 200 OK confirmation. You can now use the whitelisted address for withdrawals.

2. Submit withdrawal request

Now that you have a whitelisted external wallet, you can submit the withdrawal request.

Use destination wallet L1 address for withdrawals

From a Qredo standpoint, when you withdraw assets to Level 1 blockchain, you will define the a L1 wallet address. To deposit assets from a L1 wallet, you must always identify the deposit wallet using its L1 address.

Example withdrawal request: POST /withdraw

This example submits for approval a withdrawal request to a whitelisted wallet that is outside the Qredochain.

POST /company/{company_id}/withdraw

Request body

All described fields are required.

{
  "wallet_id": "<wallet ID of origin wallet: not the address>",
  "address": "<whitelisted wallet address>",
  "expires": "<Epoch timestamp when withdrawal request expires if not approved>",,
  "benefit_of": "<names of beneficiary: a custom field>",
  "account_no": "<account number: a custom field>",
  "reference": "<reference value: a custom field>",
  "partner_txID": "<a transaction ID: a custom field>",
  "send": {
    "symbol": "<asset symbol (BTC, ETH, etc.)>",
    "amount": "<asset amount (satoshis, gweis, etc.)>"
  }
}

Example withdrawal response: POST /withdraw

A successful response returns a tx_id. You will use this value when you need to view the withdrawal status.

{
  "tx_id": "<withdrawal transaction ID>",
  "status": "new"
}

3. Undergo custodial approval

The custodial approval process is outside the scope of this tutorial. Let's assume the withdrawal request is approved in order for this step to be completed.

4. View withdrawal status

As in a regular case you might not know when the custodial process is complete, you can check the withdrawal status using the GET /withdraw/{tx_id} API resource.

Example request: GET /withdraw/{tx_id}

This example retrieves withdrawal transaction info. With this API resource, you pass company_id and the withdrawal tx_id as URL parameters.

curl -X GET /company/{company_id}/withdraw/{tx_id}

No body parameters are sent with this request.

Example response: GET /withdraw/{tx_id}

The response structure with GET /withdraw/{tx_id} is the same as with GET /transaction/{tx_id}, discussed in Step 5: Perform a transfer. To avoid repetition, we'll not go into further detail.

This was the final step in this walkthrough

This was the final step in this walkthrough tutorial. By now, you should be familiar with all basic concepts of the Partner API and can move on with some of the more complex concepts, like start using the Core Client.


Last update: 2022-11-03