Transfers

This guide explains how to transfer funds from your wallets to external addresses.


Request withdrawal

POST
/wallets/{wallet_id}/request-withdrawal

Create a new withdrawal request from a wallet. The withdrawal will require approval from authorized users.

Headers

  • Name
    X-Idempotency-Key
    Type
    header
    Recommended
    recommended
    Description

    A UUID that identifies this withdrawal so it is processed only once. If the same key is sent again within 24 hours, the cached response from the original request is returned instead of creating a duplicate withdrawal.

    Tie the key to the withdrawal in your own system: use your internal withdrawal or transfer ID if it is a UUID, otherwise generate a UUID once when you create that record and store it alongside. Send the same key on every retry. Do not generate a new key per attempt, because each new key is treated as a new withdrawal. See Retries and idempotency for when to reuse a key and when to use a new one.

Parameters

  • Name
    asset_id
    Type
    string
    Required
    required
    Description

    The UUID of the asset to withdraw.

  • Name
    amount
    Type
    string
    Required
    required
    Description

    The amount to withdraw in decimal string format.

  • Name
    recipient_address
    Type
    string
    Required
    required
    Description

    The blockchain address to send funds to.

Response

  • Name
    id
    Type
    string
    Description

    The UUID of the withdrawal request.

  • Name
    status
    Type
    string
    Description

    Current status of the withdrawal:

    • PENDING_APPROVAL: Waiting for approvals from authorized users
    • PENDING: Approved and waiting to be processed
    • EXECUTED: Transaction has been sent to the blockchain
    • SUCCESS: Transaction has been confirmed on the blockchain
    • REJECTED: Withdrawal was rejected by an approver
    • FAILED: Transaction failed to execute
  • Name
    wallet_id
    Type
    string
    Description

    The UUID of the source wallet.

  • Name
    asset_id
    Type
    string
    Description

    The UUID of the asset being withdrawn.

  • Name
    amount
    Type
    string
    Description

    The withdrawal amount.

  • Name
    recipient_address
    Type
    string
    Description

    The destination blockchain address.

  • Name
    creator_id
    Type
    string
    Description

    The UUID of the user who created the withdrawal request.

  • Name
    withdrawal_approvals
    Type
    array
    Description

    List of approval statuses from authorized users.

  • Name
    created_at
    Type
    string
    Description

    Timestamp of when the request was created.

  • Name
    updated_at
    Type
    string
    Description

    Timestamp of the last status update.

The withdrawal process follows this flow:

  1. PENDING_APPROVAL → Waiting for required approvals
  2. PENDING → Approved and queued for processing
  3. EXECUTED → Transaction sent to blockchain
  4. SUCCESS → Transaction confirmed

Or if rejected/failed:

  • REJECTED → An approver rejected the withdrawal
  • FAILED → Transaction failed to execute

Request

POST
/wallets/:wallet_id/request-withdrawal
import { FystackSDK, Environment } from "@fystack/sdk"
const apiCredentials = {
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET
}
const sdk = new FystackSDK({
credentials: apiCredentials,
environment: Environment.Sandbox,
logger: true
})
const response = await sdk.requestWithdrawal(
"e0851607-417a-475a-b399-5f3aa262b81d",
{
assetId: "f1be472d-1338-43ff-b547-06faba7ecce7",
amount: "0.001",
recipientAddress: "0xe6EBF81E9C225BbCEa9b5399E0D0d0f29f30f119"
}
)

Response

200
{
  "success": true,
  "message": "success",
  "code": 0,
  "data": {
    "id": "0de79230-a820-4bd4-b020-883d395faa87",
    "wallet_id": "e0851607-417a-475a-b399-5f3aa262b81d",
    "asset_id": "f1be472d-1338-43ff-b547-06faba7ecce7",
    "amount": "1000",
    "recipient_address": "0x7c2BbE2e02af09F1cf9aFd4A79EC201DC841675a",
    "status": "PENDING_APPROVAL",
    "creator_id": "075243c1-962e-4803-83da-d73c78b8b060",
    "withdrawal_approvals": [
      {
        "id": "9a85c312-7d3b-4c6f-9f4e-123456789abc",
        "withdrawal_id": "0de79230-a820-4bd4-b020-883d395faa87",
        "user_id": "075243c1-962e-4803-83da-d73c78b8b060",
        "status": "PENDING",
        "created_at": "2025-08-11T17:37:29.815148+07:00",
        "updated_at": "2025-08-11T17:37:29.815148+07:00"
      },
      {
        "id": "8b74d123-9e5f-4a2d-8c3b-987654321def",
        "withdrawal_id": "0de79230-a820-4bd4-b020-883d395faa87",
        "user_id": "165243c1-962e-4803-83da-d73c78b8b070",
        "status": "APPROVED",
        "created_at": "2025-08-11T17:37:29.815148+07:00",
        "updated_at": "2025-08-11T17:38:15.623147+07:00"
      }
    ],
    "created_at": "2025-08-11T17:37:29.815148+07:00",
    "updated_at": "2025-08-11T17:37:29.815148+07:00"
  }
}

Retries and idempotency

A timeout or network error can leave you unsure whether a withdrawal was created. Retrying with the same X-Idempotency-Key is always safe: one key never creates more than one withdrawal.

When to reuse the key

  • One key per withdrawal: give each withdrawal attempt its own unique key, such as a random UUID.
  • No response: on a timeout or network error, retry with the same key. If the first request went through, you get its result instead of paying twice.
  • Temporary errors: on 409, 429 or 5xx, wait and retry with the same key. See the table below.
  • Replayed responses: Idempotent-Replayed: true in the response means it is the stored response from the first request with this key. The same key returns that same response for 24 hours.

When to use a new key

  • Other client errors: any other 4xx, such as insufficient balance or an invalid address, will fail again if resent unchanged. Fix the cause, then send the request with a new key.
  • Changed request: if you change the amount, address or network, or add funds to the wallet, use a new key.
Response Meaning What to do
No response Timeout or network error Retry with the same key
409 Conflict A request with this key is still being processed Wait, then retry with the same key to get its result
429 Too Many Requests You hit the rate limit Wait until X-Ratelimit-Reset, then retry with the same key
5xx Server Error Temporary server-side problem Retry with backoff, using the same key
Other 4xx The request itself is wrong, such as insufficient balance or an invalid address Fix the cause, then send with a new key

Never switch keys on 409

A 409 means the first request is still running. Retrying with a new key can create a duplicate withdrawal.


Get withdrawal status

GET
/wallets/{wallet_id}/withdrawals/{withdrawal_id}

Get the current status of a withdrawal request.

Response

  • Name
    success
    Type
    boolean
    Description

    Indicates whether the request was successful.

  • Name
    data
    Type
    object
    Description

    Contains the withdrawal details.

  • Name
    id
    Type
    string
    Description

    The UUID of the withdrawal request.

  • Name
    status
    Type
    string
    Description

    Current status of the withdrawal.

  • Name
    amount
    Type
    string
    Description

    The withdrawal amount.

  • Name
    recipient_address
    Type
    string
    Description

    The destination blockchain address.

  • Name
    creator
    Type
    object
    Description

    Information about the user who created the withdrawal.

  • Name
    asset
    Type
    object
    Description

    Details about the asset being withdrawn.

  • Name
    transaction
    Type
    object
    Description

    Complete transaction details once executed.

Request

GET
/wallets/:wallet_id/withdrawals/:withdrawal_id
import { FystackSDK, Environment } from "@fystack/sdk"
const apiCredentials = {
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET
}
const sdk = new FystackSDK({
credentials: apiCredentials,
environment: Environment.Sandbox,
logger: true
})
// Get withdrawal status
const withdrawal = await sdk.getWithdrawalStatus(
"e0851607-417a-475a-b399-5f3aa262b81d",
"4cebc6c3-1e46-4166-ab59-86a59971215f"
)
// Check withdrawal status
if (withdrawal.status === 'SUCCESS') {
console.log('Transaction hash:', withdrawal.transaction.tx_hash)
console.log('Amount:', withdrawal.amount)
console.log('Asset:', withdrawal.asset.symbol)
}
// Check approval status
const approvals = withdrawal.withdrawal_approvals
const pendingApprovals = approvals.filter(a => a.status === 'PENDING')
const approvedCount = approvals.filter(a => a.status === 'APPROVED').length
console.log('Pending approvals:', pendingApprovals.length)
console.log('Approved count:', approvedCount)

Response

200
{
  "success": true,
  "message": "success",
  "code": 0,
  "data": {
    "id": "4cebc6c3-1e46-4166-ab59-86a59971215f",
    "created_at": "2025-07-29T21:44:23.763113+07:00",
    "updated_at": "2025-07-29T21:45:07.204964+07:00",
    "amount": "0.000001622515351558",
    "status": "SUCCESS",
    "recipient_address": "0xf2acfF1D9d576E9b8B7C7d58A449F599A9A54edA",
    "creator_id": "075243c1-962e-4803-83da-d73c78b8b060",
    "creator": {
      "id": "075243c1-962e-4803-83da-d73c78b8b060",
      "username": "Dev team"
    },
    "asset_id": "a469642e-5466-4d69-834d-537f33ee5c81",
    "asset": {
      "id": "a469642e-5466-4d69-834d-537f33ee5c81",
      "name": "Ethereum Sepolia",
      "symbol": "ETH",
      "decimals": 18,
      "logo_url": "https://icons.iconarchive.com/icons/cjdowner/cryptocurrency-flat/512/Ethereum-ETH-icon.png",
      "is_native": true,
      "address_type": "evm",
      "network_id": "23d13c03-1f3c-4e2a-9aef-1771a244b7f6"
    },
    "withdrawal_approvals": [
      {
        "id": "dfa94b32-83f5-4808-8091-9a3c270d4f1d",
        "status": "PENDING",
        "user": {
          "username": "Thi Nguyen",
          "email": "nguyendanganhthi247@gmail.com"
        }
      },
      {
        "id": "776303fd-762e-4593-9f66-93631dd226e0",
        "status": "APPROVED",
        "user": {
          "username": "Dev team",
          "email": "devteam@fystack.io"
        }
      }
    ],
    "transaction": {
      "tx_hash": "0xa1ec8bab32baebad1211e838d655777640e78102b39b008bd00a8b3e5d1f3c00",
      "status": "confirmed",
      "block_number": 8868747,
      "from_address": "0xA793457d84CFD255Ed68295984300C4f799E759F",
      "to_address": "0xf2acfF1D9d576E9b8B7C7d58A449F599A9A54edA",
      "amount": "0.000001622515351558",
      "tx_fee": "0.000001296799854",
      "price_native_token": "3808.475025265875",
      "direction": "out",
      "type": "withdrawal",
      "method": "transfer"
    }
  }
}