API Reference
These docs are for v1.0. Click to read the latest docs for v2.0.

Withdraw ADA Rewards :

  • Delegator Address: The address to which ADA will be transferred from the Reward Account.
  • Please note the Withdraw Rewards Flow will withdraw the whole amount. Partial withdrawals are not supported.

🚧

Blockfrost Project IDs

Blockfrost Project IDs are a secret. Treat them with caution, following security best practices.

To use Cardano with the Staking API, you must first add a Blockfrost Project ID to your account using the /blockfrost_projects endpoint.

In the following guide we will illustrate how to withdraw ADA rewards accrued in a Reward Account.

Add Blockfrost Project

Add a Blockfrost project ID to your account.

URL

https://cardano-slate.datahub.figment.io/api/v1/blockfrost_projects

Request

  • project_id* : string Your Blockfrost Project ID. Refer to blockfrost.io for more information and to sign up for a Project ID.
  • chain_code* : string The Cardano chain used by this Blockfrost project, acceptable values are either mainnet or preprod.
{
  "project_id": "preprodHnZushwfIxbsl0T6Ut1iLYVuatVeuBgj",
  "chain_code": "preprod"
}

Response

  • id : number The related project ID number given to the submitted credentials by the Staking API
  • chain_code : string The chain code applicable to the Blockfrost Project ID
  • project_id : string Your Blockfrost Project ID
  • object : string "blockfrost_project"
  • created : timestamp A timestamp for when the Blockfrost Project ID was registered with the Staking API.
{
  "id": 7,
  "chain_code": "preprod",
  "project_id": "preprodHnZushwfIxbsl0T6Ut1iLYVuatVeuBgj",
  "object": "blockfrost_project",
  "created": "2023-03-14T23:42:08.574Z"
}

Notes

  • This step must be completed before creating any flows for Cardano.
  • Only one Blockfrost Project ID is required per account.

Get Blockfrost Project

Get a list of Blockfrost project IDs associated with your account.

URL

https://cardano-slate.datahub.figment.io/api/v1/blockfrost_projects

Request

  • None

Response

  • object : "list"
  • url : "/api/v1/blockfrost_projects"
  • data : array
    • id : number - The related project ID number given to the submitted credentials by the Staking API.
    • chain_code : string - The chain code applicable to the Blockfrost Project ID.
    • project_id : string Your Blockfrost Project ID.
    • object : "blockfrost_project"
    • created : timestamp A timestamp for when the Blockfrost Project ID was registered with the Staking API.
{
  "object": "list",
  "url": "/api/v1/blockfrost_projects",
  "data": [
    {
      "id": 9,
      "chain_code": "preprod",
      "project_id": "preprodMnZushwfIxbBl0t6Ut1iLYVuatVeuBqj",
      "object": "blockfrost_project",
      "created": "2023-03-14T23:54:55.369Z"
    }
  ]
}

Delete Blockfrost Project

Delete a Blockfrost Project ID from your account.

URL

https://cardano-slate.datahub.figment.io/api/v1/blockfrost_projects

Request

  • id* : number The id given to your Blockfrost Project ID by the Staking API when it was added to your account.

Response

  • A Status 204 No Content response indicates a successful deletion.

Notes

  • Use a GET request to confirm the id has been removed from the list after deletion.

Create New Withdraw Rewards Flow

To initiate the Withdraw Rewards process, create a new flow with a POST request to /api/v1/flows.

Request

  • flow : object
    • network_code* : string Network this flow operates on (ex. cardano).
    • chain_code* : string Chain this flow operates on (ex. preprod).
    • operation* : string The operation to perform (ex. withdraw_rewards).
{
    "flow": {
        "network_code": "cardano",
        "chain_code": "preprod",
        "operation": "withdraw_rewards",
        "version": "v1"
    }
}

Response

  • id : string ID of the flow.
  • operation : string The Staking API operation being performed by this flow.
  • state : string The current state of the flow.
  • actions : array It includes the name & inputs of all next possible actions.
    • create_withdraw_tx : Use this action to withdraw ADA rewards.
      • delegator_address : The delegator address to which ADA will be transferred from the Reward Account.
  • data : object Flow & transaction data.
{
    "id": "b31a3ccb-24c2-40d6-a89f-bf565b9f918e",
    "operation": "withdraw_rewards",
    "state": "initialized",
    "actions": [
        {
            "name": "create_withdraw_tx",
            "inputs": [
                {
                    "name": "delegator_address",
                    "display": "Delegator Address",
                    "description": "",
                    "type": "string",
                    "validations": [
                        {
                            "type": "presence",
                            "options": {}
                        }
                    ],
                    "array": false,
                    "default_value": null
                }
            ]
        }
    ],
    "data": {
        "delegator_address": null,
        "withdraw_transaction": null
    },
    "network_code": "cardano",
    "chain_code": "preprod",
    "created_at": "2023-09-27T20:03:57.329Z",
    "updated_at": "2023-09-27T20:03:57.329Z"
}

Submit Withdraw Rewards Transaction Data

After collecting the required inputs, send a PUT request to /api/v1/flows/[:flow_id]/next to proceed to the next step.

URL

https://cardano-slate.datahub.figment.io/api/v1/flows/[:flow_id]/next

Request

  • name* : create_withdraw_tx
  • inputs* : object
    • delegator_address\ : The delegator address to which ADA will be transferred from the Reward Account.
{
    "name": "create_withdraw_tx",
    "inputs": {
        "delegator_address": "addr_test1qpxa75v7elylfarzu3xvjncvv6s92eeewly5xhwkphvqvpmh746kg8pa9nrpus3dpg9n3lmywkyvuh5dl54nawl26v6qsu8y24"
    }
}

Response

  • id : string ID of the flow.

  • operation : string The Staking API operation being performed by this flow.

  • state : string The current state of the flow.

  • actions : array It includes the name & inputs of all next possible actions.

  • data : object Flow & transaction data.

{
    "id": "b31a3ccb-24c2-40d6-a89f-bf565b9f918e",
    "operation": "withdraw_rewards",
    "state": "withdraw_tx_signature",
    "actions": [
        {
            "name": "refresh_withdraw_tx",
            "inputs": [
                {
                    "name": "delegator_address",
                    "display": "Delegator Address",
                    "description": "",
                    "type": "string",
                    "validations": [
                        {
                            "type": "presence",
                            "options": {}
                        }
                    ],
                    "array": false,
                    "default_value": "addr_test1qpxa75v7elylfarzu3xvjncvv6s92eeewly5xhwkphvqvpmh746kg8pa9nrpus3dpg9n3lmywkyvuh5dl54nawl26v6qsu8y24"
                }
            ]
        },
        {
            "name": "sign_withdraw_tx",
            "inputs": [
                {
                    "name": "transaction_payload",
                    "display": "Transaction Payload",
                    "description": "",
                    "type": "signed_transaction",
                    "validations": [],
                    "array": false,
                    "default_value": null,
                    "signers": [
                        "addr_test1qpxa75v7elylfarzu3xvjncvv6s92eeewly5xhwkphvqvpmh746kg8pa9nrpus3dpg9n3lmywkyvuh5dl54nawl26v6qsu8y24"
                    ],
                    "transaction_payload": "84a40081825820e8c9425953906d112ab994a26791bab9776a87d03e9b9c9dca574f10b76ef1fb000181825839004ddf519ecfc9f4f462e44cc94f0c66a055673977c9435dd60dd8060777f575641c3d2cc61e422d0a0b38ff647588ce5e8dfd2b3ebbead3341b0000000269b66367021a00029d2d05a1581de077f575641c3d2cc61e422d0a0b38ff647588ce5e8dfd2b3ebbead33400a0f5f6"
                },
                {
                    "name": "signatures",
                    "display": "Signatures",
                    "description": "",
                    "type": "array_of_signatures",
                    "validations": [],
                    "array": true,
                    "default_value": null,
                    "element_type": "signature_data",
                    "signers": [
                        "addr_test1qpxa75v7elylfarzu3xvjncvv6s92eeewly5xhwkphvqvpmh746kg8pa9nrpus3dpg9n3lmywkyvuh5dl54nawl26v6qsu8y24"
                    ],
                    "transaction_payload": "84a40081825820e8c9425953906d112ab994a26791bab9776a87d03e9b9c9dca574f10b76ef1fb000181825839004ddf519ecfc9f4f462e44cc94f0c66a055673977c9435dd60dd8060777f575641c3d2cc61e422d0a0b38ff647588ce5e8dfd2b3ebbead3341b0000000269b66367021a00029d2d05a1581de077f575641c3d2cc61e422d0a0b38ff647588ce5e8dfd2b3ebbead33400a0f5f6",
                    "signing_payload": "77d344828dc3ef6e514c225cb47fb5d7e744185ce89be6ec20c5120adef4e2f8",
                    "inputs": [
                        {
                            "name": "account_address",
                            "display": "Account Address",
                            "description": "",
                            "type": "string",
                            "validations": [
                                {
                                    "type": "presence",
                                    "options": {}
                                }
                            ],
                            "array": false,
                            "default_value": null
                        },
                        {
                            "name": "signature",
                            "display": "Signature",
                            "description": "",
                            "type": "string",
                            "validations": [
                                {
                                    "type": "presence",
                                    "options": {}
                                }
                            ],
                            "array": false,
                            "default_value": null
                        }
                    ]
                }
            ]
        },
        {
            "name": "confirm_withdraw_tx_by_hash",
            "inputs": [
                {
                    "name": "hash",
                    "display": "Hash",
                    "description": "",
                    "type": "string",
                    "validations": [
                        {
                            "type": "presence",
                            "options": {}
                        }
                    ],
                    "array": false,
                    "default_value": null
                },
                {
                    "name": "block_number",
                    "display": "Block Number",
                    "description": "",
                    "type": "integer",
                    "validations": [],
                    "array": false,
                    "default_value": null
                }
            ]
        }
    ],
    "data": {
        "delegator_address": "addr_test1qpxa75v7elylfarzu3xvjncvv6s92eeewly5xhwkphvqvpmh746kg8pa9nrpus3dpg9n3lmywkyvuh5dl54nawl26v6qsu8y24",
        "withdraw_transaction": {
            "raw": "84a40081825820e8c9425953906d112ab994a26791bab9776a87d03e9b9c9dca574f10b76ef1fb000181825839004ddf519ecfc9f4f462e44cc94f0c66a055673977c9435dd60dd8060777f575641c3d2cc61e422d0a0b38ff647588ce5e8dfd2b3ebbead3341b0000000269b66367021a00029d2d05a1581de077f575641c3d2cc61e422d0a0b38ff647588ce5e8dfd2b3ebbead33400a0f5f6",
            "signing_payload": "77d344828dc3ef6e514c225cb47fb5d7e744185ce89be6ec20c5120adef4e2f8",
            "signed": null,
            "hash": "77d344828dc3ef6e514c225cb47fb5d7e744185ce89be6ec20c5120adef4e2f8",
            "status": null,
            "error": null,
            "signatures": null,
            "block_time": null,
            "block_number": null
        }
    },
    "network_code": "cardano",
    "chain_code": "preprod",
    "created_at": "2023-09-27T20:03:57.329Z",
    "updated_at": "2023-09-27T20:04:51.067Z"
}

Submit Signed Withdraw Rewards Transaction for Broadcast

After signing the transaction, send a PUT request to /api/v1/flows/[:flow_id]/next and the Staking API will broadcast the transaction to the network.

URL

https://cardano-slate.datahub.figment.io/api/v1/flows/[:flow_id]/next

Request

  • name* : sign_withdraw_tx
  • inputs* : object
    • transaction_payload* : Signed transaction payload from the previous step's response.
    • signatures : array of object The signatures array can be used instead of sending a transaction payload when the signing keys are kept in a custodial solution, such as Fireblocks. Refer to the guide Signing Transactions with the Fireblocks API for details.
{
  "name": "sign_withdraw_tx",
  "inputs": {
    "transaction_payload": "84a4008182582061a014339ea21bb99c679e690e75e2acade9f06945aa767c7392613c72114f18010181825839004ddf519ecfc9f4f462e44cc94f0c66a055673977c9435dd60dd8060777f575641c3d2cc61e422d0a0b38ff647588ce5e8dfd2b3ebbead3341b0000000269b90094021a00029d2d05a1581de077f575641c3d2cc61e422d0a0b38ff647588ce5e8dfd2b3ebbead33400a1008282582051cca9f323a5d13cdde5f2c34ddba875d54e9b7b02a3c834ef8db12e95e14b7c58405e26fd0f5ba2a1ecfbefb2cb74d7bb3879386cc5615efbf9828206e1a94032a79ca7e17326c256a4cd368584d2febb52473b00106cc1742bdce1a894b7ceef008258201921197af564bbd5eea0e2279e7f2b35cddce384552538b1845381a75081be735840c3e04392309eeb39d76776a2f6d51d637d96012974ff3620dd966994df29e143d2ad7b3ac9ae305701780e908920a3c4152877357d6db1b91e026d03028ca70df5f6"
  }
}

Response

  • id : string ID of the flow.
  • operation : string The Staking API operation being performed by this flow.
  • state : string The current state of the flow.
    • withdraw_tx_broadcasting : Transaction has been broadcast and is waiting for confirmation.
    • completed : Transaction has been confirmed and the withdrawal is complete.
  • actions : array It includes the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
{
  "id": "b31a3ccb-24c2-40d6-a89f-bf565b9f918e",
  "operation": "withdraw_rewards",
  "state": "withdraw_tx_broadcasting",
  "actions": [
    {
      "name": "wait",
      "estimated_state_change_at": "2023-09-27T16:33:28.875Z",
      "inputs": []
    }
  ],
  "data": {
    "delegator_address": "addr_test1qpxa75v7elylfarzu3xvjncvv6s92eeewly5xhwkphvqvpmh746kg8pa9nrpus3dpg9n3lmywkyvuh5dl54nawl26v6qsu8y24",
    "withdraw_transaction": {
      "raw": "84a30081825820701e79cd816d453ac93018e9550b63c52b394808cfaf011f5b0c180793e4f7f70101828258390046f61023e6d49ca151abffb599e884499781d38750e026e4a052da23e3bc1d4228d3b40b729a96d7fce249aee6c0842e6c1ce2d2496b51c71a009896808258390023ef84a0e50d3bd688f837771a87a591c146c7940192d103943420aa322ed8c9523dc2472a6d709a934005543f0834b04318dceabcb332631a3a647c16021a00029075a0f5f6",
      "signing_payload": "2800f50ddc0a4ddf1a50b93015d47d2201926310c29aa7e1645ea429d7ba61cf",
      "signed": "84a30081825820701e79cd816d453ac93018e9550b63c52b394808cfaf011f5b0c180793e4f7f70101828258390046f61023e6d49ca151abffb599e884499781d38750e026e4a052da23e3bc1d4228d3b40b729a96d7fce249aee6c0842e6c1ce2d2496b51c71a009896808258390023ef84a0e50d3bd688f837771a87a591c146c7940192d103943420aa322ed8c9523dc2472a6d709a934005543f0834b04318dceabcb332631a3a647c16021a00029075a10081825820002d9a48169c6d508699b7aaaa360cc38cb1f3b771444451d38cd0f901ac139d5840b37def2a690fbf3f8cd3aadb2d9507d428772e1b2415366761584010bccead1e75369532df49bf265aeac6684fd4decba93eb8f6a87fa98dbdf01bc78b890001f5f6",
      "hash": "2800f50ddc0a4ddf1a50b93015d47d2201926310c29aa7e1645ea429d7ba61cf",
      "status": null,
      "error": null,
      "signatures": [
        {
          "account_address": "addr_test1qq37lp9qu5xnh45glqmhwx585kguz3k8jsqe95grjs6zp23j9mvvj53acfrj5mtsn2f5qp258uyrfvzrrrww409nxf3svhyew8",
          "signature": ""
        }
      ],
      "block_time": null
    }
  },
  "network_code": "cardano",
  "chain_code": "preprod",
  "created_at": "2023-09-27T16:33:28.875Z",
  "updated_at": "2023-09-27T16:55:57.274Z"
}

Get Withdraw Rewards Flow Status

To get the current state of the existing flow, send a GET request to /api/v1/flows/[:flow_id] using the flow ID from the previous step.

URL

https://cardano-slate.datahub.figment.io/api/v1/flows/[:flow_id]

Request

  • None

Response

  • id : string ID of the flow.
  • operation : string The Staking API operation being performed by this flow.
  • state : string The current state of the flow.
    • withdraw_tx_broadcasting — Transaction has been broadcast and is waiting for confirmation.
    • completed : Transaction has been confirmed and the withdrawal is complete.
  • actions : array It includes the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
{
  "id": "b31a3ccb-24c2-40d6-a89f-bf565b9f918e",
  "operation": "withdraw_rewards",
  "state": "completed",
  "actions": [

  ],
  "data": {
    "transactions": [
      {
        "code": "withdraw",
        "amount": null,
        "raw": "84a4008182582061a014339ea21bb99c679e690e75e2acade9f06945aa767c7392613c72114f18010181825839004ddf519ecfc9f4f462e44cc94f0c66a055673977c9435dd60dd8060777f575641c3d2cc61e422d0a0b38ff647588ce5e8dfd2b3ebbead3341b0000000269b90094021a00029d2d05a1581de077f575641c3d2cc61e422d0a0b38ff647588ce5e8dfd2b3ebbead33400a0f5f6",
        "signing_payload": "e8c9425953906d112ab994a26791bab9776a87d03e9b9c9dca574f10b76ef1fb",
        "signed": "84a4008182582061a014339ea21bb99c679e690e75e2acade9f06945aa767c7392613c72114f18010181825839004ddf519ecfc9f4f462e44cc94f0c66a055673977c9435dd60dd8060777f575641c3d2cc61e422d0a0b38ff647588ce5e8dfd2b3ebbead3341b0000000269b90094021a00029d2d05a1581de077f575641c3d2cc61e422d0a0b38ff647588ce5e8dfd2b3ebbead33400a1008282582051cca9f323a5d13cdde5f2c34ddba875d54e9b7b02a3c834ef8db12e95e14b7c58405e26fd0f5ba2a1ecfbefb2cb74d7bb3879386cc5615efbf9828206e1a94032a79ca7e17326c256a4cd368584d2febb52473b00106cc1742bdce1a894b7ceef008258201921197af564bbd5eea0e2279e7f2b35cddce384552538b1845381a75081be735840c3e04392309eeb39d76776a2f6d51d637d96012974ff3620dd966994df29e143d2ad7b3ac9ae305701780e908920a3c4152877357d6db1b91e026d03028ca70df5f6",
        "hash": "e8c9425953906d112ab994a26791bab9776a87d03e9b9c9dca574f10b76ef1fb",
        "status": "confirmed",
        "error": null,
        "signatures": [
          {
            "account_address": "addr_test1qpxa75v7elylfarzu3xvjncvv6s92eeewly5xhwkphvqvpmh746kg8pa9nrpus3dpg9n3lmywkyvuh5dl54nawl26v6qsu8y24",
            "signature": ""
          }
        ],
        "block_time": "2023-09-27T16:55:19.000Z",
        "block_number": null,
        "inputs": {
          "delegator_address": "addr_test1qpxa75v7elylfarzu3xvjncvv6s92eeewly5xhwkphvqvpmh746kg8pa9nrpus3dpg9n3lmywkyvuh5dl54nawl26v6qsu8y24"
        }
      }
    ]
  },
  "network_code": "cardano",
  "chain_code": "preprod",
  "created_at": "2023-09-27T16:33:28.875Z",
  "updated_at": "2023-09-27T16:55:57.274Z"
}