# Withdraw Transaction

Returns an unsigned transaction to withdraw SOL from a stake account.

## Use cases

a) **Withdrawal of the complete account balance and closure of the account**
- The stake account needs to be deactivated.
- Amount equals the total account balance: `amount = account.lamports`

b) **Withdrawal of only the inactive balance**, i.e., accumulated Jito MV rewards, while keeping the stake account active.
- Amount equals the withdrawable balance: `amount = account.lamports − effective_stake − rent_exempt_reserve`

**Please note that the amount always needs to be smaller or equal to the withdrawable amount.**

## Parameters

- `stake_account` (string, required): The stake account from which to withdraw.
- `recipient_account` (string, required): The account that will receive the withdrawn SOL.
- `amount_sol` (number, required): Amount of SOL to withdraw.
- `network` (string, enum, required): Network for the transaction (options: `mainnet`, `testnet`, `devnet`).
- `nonce_account` (string | null): Pubkey of the on-chain nonce account. Enables offline signing without the 60–90s blockhash expiry.
- `nonce_authority` (string | null): Pubkey of the account authorized to advance the nonce. Defaults to the fee payer if omitted.

## Response

### 201 Withdraw Transaction Created
**Object:**
- `data` (object):
  - `unsigned_transaction_serialized` (string): The unsigned transaction payload serialized in hex format.
  - `unsigned_tx_serialized_hex` (string): The unsigned transaction payload serialized in hex format.
  - `unsigned_tx_serialized_base64` (string): The unsigned transaction payload serialized in base64 format.
  - `signing_payload` (string): The message from the unsigned transaction payload serialized in hex format.
  - `last_valid_block_height` (integer | null): Block height that the transaction payload is valid until (null for durable nonce transactions).
  - `stake_account` (string): Stake Account Pubkey generated for a staking transaction.
  - `network` (string): Network for the transaction.
  - `nonce_value` (string | null): The nonce value used as the transaction's blockhash. Present only when `nonce_account` was provided in the request.
  - `is_durable_nonce` (boolean | null): Indicates that this transaction uses a durable nonce. When true, `last_valid_block_height` will be null.

### 400 Invalid Request

### Example API Request

```bash
curl --request POST \
     --url https://api.figment.io/solana/withdraw \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-api-key: your-api-key-here' \
     --data '{
  "network": "mainnet"
}'
```

### Example Response

```json
{
  "data": {
    "unsigned_transaction_serialized": "0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d845490355ff6299455677fe89a2ed65e74330b9d21200e5d6b66e0959cafda22e7447a11ce519ed8243e85b8aadded47943b6f79235f8beaa1dcd0e7cecdb030200080a5ac99cdc63139ca6cfaa9ebcf2b8e56da99eb01d445c818088976dacd1a356869b8e0bdb0624debb7c1dab0365fae980eb8e612fc6627ac0dd1c693a5015bef600000000000000000000000000000000000000000000000000000000000000000306466fe5211732ffecadba72c39be7bc8ce5bbc5f7126b2c439b3a40000000ddf42a04800a54de2e583f94f17b089725b772d1333526271241532776d2ffc606a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a1d817a502050b680791e6ce6db88e1e5b7150f61fc6790a4eb4d10000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517192c5c51218cc94c3d4af17f58daee089ba1fd44e3dbd98a0000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff4000000cfba7719d3267f0cb2f320ab3ec5a415ba51b8e2067327e593044a360c169c8104020200013400000000c0c62d0000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc0000000000502010874000000005ac99cdc63139ca6cfaa9ebcf2b8e56da99eb01d445c818088976dacd1a356865ac99cdc63139ca6cfaa9ebcf2b8e56da99eb01d445c818088976dacd1a35686000000000000000000000000000000005ac99cdc63139ca6cfaa9ebcf2b8e56da99eb01d445c818088976dacd1a3568603000903204e00000000000005060104070906000402000000",
    "unsigned_tx_serialized_hex": "0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d845490355ff6299455677fe89a2ed65e74330b9d21200e5d6b66e0959cafda22e7447a11ce519ed8243e85b8aadded47943b6f79235f8beaa1dcd0e7cecdb030200080a5ac99cdc63139ca6cfaa9ebcf2b8e56da99eb01d445c818088976dacd1a356869b8e0bdb0624debb7c1dab0365fae980eb8e612fc6627ac0dd1c693a5015bef600000000000000000000000000000000000000000000000000000000000000000306466fe5211732ffecadba72c39be7bc8ce5bbc5f7126b2c439b3a40000000ddf42a04800a54de2e583f94f17b089725b772d1333526271241532776d2ffc606a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a1d817a502050b680791e6ce6db88e1e5b7150f61fc6790a4eb4d10000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517192c5c51218cc94c3d4af17f58daee089ba1fd44e3dbd98a0000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff4000000cfba7719d3267f0cb2f320ab3ec5a415ba51b8e2067327e593044a360c169c8104020200013400000000c0c62d0000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc0000000000502010874000000005ac99cdc63139ca6cfaa9ebcf2b8e56da99eb01d445c818088976dacd1a356865ac99cdc63139ca6cfaa9ebcf2b8e56da99eb01d445c818088976dacd1a35686000000000000000000000000000000005ac99cdc63139ca6cfaa9ebcf2b8e56da99eb01d445c818088976dacd1a3568603000903204e00000000000005060104070906000402000000",
    "unsigned_tx_serialized_base64": "MDIwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw\nMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw\nMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMGQ4NDU0\nOTAzNTVmZjYyOTk0NTU2NzdmZTg5YTJlZDY1ZTc0MzMwYjlkMjEyMDBlNWQ2\nYjY2ZTA5NTljYWZkYTIyZTc0NDdhMTFjZTUxOWVkODI0M2U4NWI4YWFkZGVk\nNDc5NDNiNmY3OTIzNWY4YmVhYTFkY2QwZTdjZWNkYjAzMDIwMDA4MGE1YWM5\nOWNkYzYzMTM5Y2E2Y2ZhYTllYmNmMmI4ZTU2ZGE5OWViMDFkNDQ1YzgxODA4\nODk3NmRhY2QxYTM1Njg2OWI4ZTBiZGIwNjI0ZGViYjdjMWRhYj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MDg3NDAwMDAwMDAwNWFjOTljZGM2MzEzOWNhNmNmYWE5\nZWJjZjJiOGU1NmRhOTllYjAxZDQ0NWM4MTgwODg5NzZkYWNkMWEzNTY4NjVh\nYzk5Y2RjNjMxMzljYTZjZmFhOWViY2YyYjhlNTZkYTk5ZWIwMWQ0NDVjODE4\nMDg4OTc2ZGFjZDFhMzU2ODYwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw\nMDAwMDVhYzk5Y2RjNjMxMzljYTZjZmFhOWViY2YyYjhlNTZkYTk5ZWIwMWQ0\nNDVjODE4MDg4OTc2ZGFjZDFhMzU2ODYwMzAwMDkwMzIwNGUwMDAwMDAwMDAw\nMDAwNTA2MDEwNDA3MDkwNjAwMDQwMjAwMDAwMA==\n",
    "signing_payload": "0200080a5ac99cdc63139ca6cfaa9ebcf2b8e56da99eb01d445c818088976dacd1a356869b8e0bdb0624debb7c1dab0365fae980eb8e612fc6627ac0dd1c693a5015bef600000000000000000000000000000000000000000000000000000000000000000306466fe5211732ffecadba72c39be7bc8ce5bbc5f7126b2c439b3a40000000ddf42a04800a54de2e583f94f17b089725b772d1333526271241532776d2ffc606a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a1d817a502050b680791e6ce6db88e1e5b7150f61fc6790a4eb4d10000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517192c5c51218cc94c3d4af17f58daee089ba1fd44e3dbd98a0000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff4000000cfba7719d3267f0cb2f320ab3ec5a415ba51b8e2067327e593044a360c169c8104020200013400000000c0c62d0000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc0000000000502010874000000005ac99cdc63139ca6cfaa9ebcf2b8e56da99eb01d445c818088976dacd1a356865ac99cdc63139ca6cfaa9ebcf2b8e56da99eb01d445c818088976dacd1a35686000000000000000000000000000000005ac99cdc63139ca6cfaa9ebcf2b8e56da99eb01d445c818088976dacd1a3568603000903204e00000000000005060104070906000402000000",
    "last_valid_block_height": 291621448,
    "stake_account": "tfUTBG4BH5Cg9PdhNHiohL1fjXWkEyi6S9qZsBdT2HLQ",
    "network": "devnet",
    "nonce_value": "GNP8nFAjKFBxL6Bfmti9gBGxCRF7gMaGmEiKfJKpJAaG",
    "is_durable_nonce": true
  }
}
```
