The Staking API's staking proxy flow for Polkadot will walk your application through the process of removing proxy rights which were previously granted.

In the following guide we will illustrate how to remove a proxy account.

# Create New Remove Staking Proxy Flow

To remove a staking proxy, create a new flow with a POST request to `/api.figment.io/flows`.

### Request

- `network_code`\* : `string` Network this flow operates on (ex. `polkadot`).
- `chain_code`\* : `string` Chain this flow operates on (ex. `westend`).
- `operation`\* : `string` The operation to perform (ex. `remove_proxy`).

JSON

```json
{
    "network_code": "polkadot",
    "chain_code": "westend",
    "operation": "remove_proxy"
}
```

### 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_remove_proxy_tx`: Use this action to generate a proxy removal transaction.

- `proxy_account_address` : The address from which you want to remove proxy rights.
    - `proxied_account_address` : The account whose rights were being proxied.
- `data` : `object` Flow & transaction data.

JSON

```json
{
  "id": "b2e0c44a-e1cd-4772-9e71-eaddacc6c7f4",
  "operation": "remove_proxy",
  "state": "initialized",
  "actions": [
    {
      "name": "create_remove_proxy_tx",
      "inputs": [
        {
          "name": "proxy_account_address",
          "display": "Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": null
        },
        {
          "name": "proxied_account_address",
          "display": "Proxied Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": null
        }
      ]
    }
  ],
  "data": {
    "proxy_account_address": null,
    "proxied_account_address": null,
    "remove_proxy_transaction": null
  },
  "network_code": "polkadot",
  "chain_code": "westend",
  "created_at": "2023-02-28T19:31:21.057Z",
  "updated_at": "2023-02-28T19:31:21.057Z"
}
```

# Submit Remove Proxy Data

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

### URL

PUT `https://api.figment.io/flows/[:flow_id]/next`

### Request

- `name`\* : create_remove_proxy_tx
- `inputs`\* : `object`
  - `proxy_account_address`\* : `string` The address to which you want to remove proxy rights.
  - `proxied_account_address`\* : `string` The account whose rights will be proxied.

JSON

```json
{
  "name": "create_remove_proxy_tx",
  "inputs": {
    "proxy_account_address": "5CDAhYcPZEx6sN4oGbQMRFZzo5Eur6NTN4nd85SADgMdnxAS",
    "proxied_account_address": "5FWX3P9gwg4FKAyDHp1UYJp4ZZYPPoQZHfWRcN74HwBgXifh"
  }
}
```

### Response

- `refresh_remove_proxy_tx` : If you need to get a fresh version of the transaction payload (i.e., the nonce has increased).
  - `sign_remove_proxy_tx` : Submit a signed transaction payload or an array of signatures to continue the flow. Refer to the guides Signing Transactions with Figment's npm Package and Signing Transactions with the Fireblocks API for details.
  - `confirm_remove_proxy_tx_by_hash` : Submit a previously completed transaction hash to continue the flow. Refer to the guide Advance Flows Using a Transaction Hash.
- `data` : `object` Flow & transaction data.

JSON

```json
{
  "id": "b2e0c44a-e1cd-4772-9e71-eaddacc6c7f4",
  "operation": "remove_proxy",
  "state": "remove_proxy_tx_signature",
  "actions": [
    {
      "name": "refresh_remove_proxy_tx",
      "inputs": [
        {
          "name": "proxy_account_address",
          "display": "Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5HDojdfR1Vm9dnDYEB4JQyxgcgH3aHHeWgE9jqarBkChULRJ"
        },
        {
          "name": "proxied_account_address",
          "display": "Proxied Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5FNVfA6qhVJBKrG4KCo6CLzvcXVRRdiGpsYHbkzujMUG6JJG"
        }
      ]
    },
    {
      "name": "sign_remove_proxy_tx",
      "inputs": [
        {
          "name": "transaction_payload",
          "display": "Transaction Payload",
          "description": "",
          "type": "signed_transaction",
          "validations": [
            {
              "type": "sign_payload",
              "options": {}
            }
          ],
          "array": false,
          "default_value": null,
          "signers": [
            "5FNVfA6qhVJBKrG4KCo6CLzvcXVRRdiGpsYHbkzujMUG6JJG"
          ],
          "transaction_payload": "0x000c000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00000000000000000000000000000000000000000000000000000000000000000000000000160200e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d02000000001c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004"
        },
        {
          "name": "signatures",
          "display": "Signatures",
          "description": "",
          "type": "array_of_signatures",
          "validations": [],
          "array": true,
          "default_value": null,
          "element_type": "signature_data",
          "signers": [
            "5FNVfA6qhVJBKrG4KCo6CLzvcXVRRdiGpsYHbkzujMUG6JJG"
          ],
          "transaction_payload": "0x000c000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00000000000000000000000000000000000000000000000000000000000000000000000000160200e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d02000000001c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004"
        }
      ]
    },
    {
      "name": "confirm_remove_proxy_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": {
    "proxy_account_address": "5HDojdfR1Vm9dnDYEB4JQyxgcgH3aHHeWgE9jqarBkChULRJ",
    "proxied_account_address": "5FNVfA6qhVJBKrG4KCo6CLzvcXVRRdiGpsYHbkzujMUG6JJG",
    "remove_proxy_transaction": {
      "raw": "0x000c000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00000000000000000000000000000000000000000000000000000000000000000000000000160200e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d02000000001c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x160200e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d0200000000000c00a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": null,
      "hash": null,
      "status": null,
      "error": null,
      "signatures": null,
      "block_time": null,
      "block_number": null,
      "proxy": null
    }
  },
  "network_code": "polkadot",
  "chain_code": "westend",
  "created_at": "2023-02-28T19:31:21.057Z",
  "updated_at": "2023-02-28T19:34:08.157Z"
}

# Submit Signed Remove Proxy Transaction for Broadcast

Before broadcasting the transaction, you must sign the `transaction_payload` you received in the previous step. After signing the transaction, send a `PUT` request to `/flows/[:flow_id]/next` to proceed to the next step.

The Staking API will broadcast the transaction to the Polkadot network.

### Request

- `name*` : `sign_remove_proxy_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.

JSON

```json
{
  "name": "sign_remove_proxy_tx",
  "inputs": {
    "transaction_payload": "0x390284009864ac6455584af3c38540ec03927eca126342d266d3c9b62e44b41844a3166601d67e0f7ef1a1f03976583e67c5bab2784ccaec707b34afe19bef8d9f0ed1a325f1605c3396504080f4346a89cf14df265da1e2adc2ab93c0a40266e83b6faa82000800160200067452e7828dafb80be77c82b33a3781e71de7d04096aad144cfac000a7fd2400200000000"
  }
}
```

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

- `remove_proxy_tx_broadcasting` : Transaction has been broadcast and is waiting for confirmation.
  - `removed` : Transaction has been confirmed and the proxy is revoked.
- `actions` : `array` It includes the `name` & `inputs` of all next possible actions.
- `data` : `object` Flow & transaction data.

JSON

```json
{
  "id": "b2e0c44a-e1cd-4772-9e71-eaddacc6c7f4",
  "operation": "remove_proxy",
  "state": "remove_proxy_tx_broadcasting",
  "actions": [
    {
      "name": "wait",
      "estimated_state_change_at": "2023-02-28T19:40:02.213Z",
      "inputs": []
    }
  ],
  "data": {
    "proxy_account_address": "5HDojdfR1Vm9dnDYEB4JQyxgcgH3aHHeWgE9jqarBkChULRJ",
    "proxied_account_address": "5FNVfA6qhVJBKrG4KCo6CLzvcXVRRdiGpsYHbkzujMUG6JJG",
    "remove_proxy_transaction": {
      "raw": "0x000c000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00000000000000000000000000000000000000000000000000000000000000000000000000160200e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d02000000001c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x160200e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d0200000000000c00a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0x3902840092460dcf0b9ae6cabf654c1b33f02f52934d1ae262f8db733b470b631c587165019495be8ef91400e9e16ff24fba71bf5677b0e1200062e1b716ef3e53b7138612eb004cc118cd58059a61ebbce1172d800f277ee51eead5c7475bae2f8b3dc18a000c00160200e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d0200000000",
      "hash": "0x0a7888b61005924ed9207a99d19e64727480a654c8157ecff200a82e6ab09cd6",
      "status": null,
      "error": null,
      "signatures": [],
      "block_time": null,
      "block_number": 14838578,
      "proxy": null
    }
  },
  "network_code": "polkadot",
  "chain_code": "westend",
  "created_at": "2023-02-28T19:31:21.057Z",
  "updated_at": "2023-02-28T19:39:02.198Z"
}

# Get Remove Staking Proxy Flow Status

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

### URL

`https://api.figment.io/flows/[:flow_id]/`

### Request

- None

### Response

- `remove_proxy_tx_broadcasting` : Broadcasting transaction
  - `removed` : Transaction broadcasted & confirmed
- `actions` : `array` It includes the name & inputs of all next possible actions.
- `data` : `object` Flow & transaction data.

JSON

```json
{
  "id": "90a28f6e-09b4-4fe1-aeb4-c8e3720933ab",
  "operation": "staking",
  "state": "bonding_complete",
  "actions": [
    {
      "name": "create_nomination_tx",
      "inputs": [
        {
          "name": "validator_addresses",
          "display": "Validator Addresses",
          "description": "",
          "type": "array_of_strings",
          "validations": [
            {
              "type": "array",
              "options": {
                "allow_empty": false,
                "allow_duplicates": false
              }
            },
            {
              "type": "length",
              "options": {
                "maximum": 16,
                "message": "Cannot have more than 16 validators"
              }
            }
          ],
          "array": false,
          "default_value": null
        }
      ]
    },
    {
      "name": "create_bond_more_tx",
      "inputs": [
        {
          "name": "amount",
          "display": "Amount",
          "description": "in DOT",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            },
            {
              "type": "numericality",
              "options": {
                "greater_than": 0
              }
            }
          ],
          "array": false,
          "default_value": "1.0"
        }
      ]
    },
    {
      "name": "complete",
      "inputs": []
    },
    {
      "name": "assign_stash_and_controller_account",
      "inputs": [
        {
          "name": "controller_account_address",
          "display": "Controller Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg"
        },
        {
          "name": "controller_proxy_account_address",
          "display": "Controller Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [],
          "array": false,
          "default_value": null
        },
        {
          "name": "stash_account_address",
          "display": "Stash Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t"
        },
        {
          "name": "stash_proxy_account_address",
          "display": "Stash Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [],
          "array": false,
          "default_value": null
        }
      ]
    }
  ],
  "data": {
    "controller_account_address": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg",
    "controller_proxy_account_address": null,
    "stash_account_address": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "stash_proxy_account_address": null,
    "validator_addresses": null,
    "reward_destination": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "amount": "1.0",
    "bonding_transaction": {
      "raw": "0x0000000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00000000000000000000000000000000000000000000000000000000000000000000000000060000246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e679070010a5d4e803ece3c0004ffa0c55acd1bb2ec951f24d6b898fbafee6520dab3022fe12bec7451c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x060000246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e679070010a5d4e803ece3c0004ffa0c55acd1bb2ec951f24d6b898fbafee6520dab3022fe12bec745000000a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0xc1028400ece3c0004ffa0c55acd1bb2ec951f24d6b898fbafee6520dab3022fe12bec745017e6fb8557959f7c8806aee19a18b54f42336f0f7c814514f66d8fa788b32902722ea6dc1bfe66cf6e402b8f139137900e63e20e72951b780abd3a6d80e640f8b000000060000246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e679070010a5d4e803ece3c0004ffa0c55acd1bb2ec951f24d6b898fbafee6520dab3022fe12bec745",
      "hash": "0xed90569932c9897bd0defbf763d8e9ab24fd849f9c627a5a50d6d622b3f37449",
      "status": "confirmed",
      "error": null,
      "signatures": [],
      "block_time": "2023-02-28T18:42:42.254Z",
      "block_number": 14838035,
      "proxy": false
    },
    "nomination_transaction": null,
    "bond_more_transaction": null
  },
  "network_code": "polkadot",
  "chain_code": "westend",
  "created_at": "2023-02-28T17:41:14.880Z",
  "updated_at": "2023-02-28T18:42:42.261Z"
}
```
