Hyperliquid

Unified API + Hyperliquid Integration Workflow

In the following guide, the integration process for the hyperliquid chain is covered. The Hyperliquid integration aligns with the general Unified API process but with network-specific parameters.

Get an authentication token to start using the Unified API.

Request examples are provided using cURL.

To check the integration guides for other chains, refer to the Networks Supported section.

📘

Key Hyperliquid-specific details

  • chain — always set to hyperliquid for Hyperliquid-related requests.
  • network — environment in which the transaction is processed: testnet or mainnet.
  • stakerAddress0x-prefixed account address initiating staking, unstaking, or withdrawal operations.
  • amount— amount of tokens in HYPE.
  • signature — delegator account signature, required for broadcasting transactions.

Staking Flow

1. Create Delegate Request

This request creates a delegate request that delegates HYPE from the staking balance to the P2P validator. Delegations have a lockup duration of 1 day, which means that only after this period can delegations be partially or fully undelegated.

Send a POST request to /api/v1/unified/staking/stake.

Example request (for testnet network):

curl --request POST \
     --url https://api-test.p2p.org/api/v1/unified/staking/stake \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <token>' \
     --data '{
    "chain": "hyperliquid",
    "network": "testnet",
    "stakerAddress": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad88",
    "amount": 10
}'

Example response:

{
    "error": null,
    "result": {
        "amount": 10,
        "stakerAddress": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad88",
        "unsignedTransactionData": "eyJhY3Rpb24iOnsidHlwZSI6InRva2VuRGVsZWdhdGUiLCJoeXBlcmxpcXVpZENoYWluIjoiVGVzdG5ldCIsInNpZ25hdHVyZUNoYWluSWQiOiIweDY2ZWVlIiwid2VpIjoxMDAwMDAwMCwibm9uY2UiOjE3NTUwOTQ3MTQ1OTMsInZhbGlkYXRvciI6IjB4YTAxMmI5MDQwZDgzYzVjYmFkOWU2ZWE3M2M1MjUwMjdiNzU1ZuU5NiIsImlzVW5kZWxlZ2F0ZSI6ZmFsc2V9LCJub25jZSI6MTc1NTA5NDcxNDU5Mywic2lnbmF0dXJlIjp7fX0=",
        "createdAt": "2025-08-01T00:00:00.000Z"
    }
}

2. Sign and Send Transaction

Use unsignedTransactionData to sign the transaction using the Hyperliquid-specific signing logic.

To broadcast the signed transaction to the Hyperliquid network, send a POST request to /api/v1/unified/transaction/broadcast.

Example request (for testnet network):

curl --request POST \
     --url https://api-test.p2p.org/api/v1/unified/transaction/broadcast \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <token>' \
     --data '{
    "chain": "hyperliquid",
    "network": "testnet",
    "signedTransaction": "eyJhY3Rpb24iOnsidHlwZSI6InRva2VuRGVsZWdhdGUiLCJoeXBlcmxpcXVpZENoYWluIjoiVGVzdG5ldCIsInNpZ25hdHVyZUNoYWluSWQiOiIweDY2ZWVlIiwid2VpIjoxMDAwMDAwMCwibm9uY2UiOjE3NTUwOTQ3MTQ1OTMsInZhbGlkYXRvciI6IjB4YTAxMmI5MDQwZDgzYzVjYmFkOWU2ZWE3M2M1MjUwMjdiNzU1ZuU5NiIsImlzVW5kZWxlZ2F0ZSI6ZmFsc2V9LCJub25jZSI6MTc1NTA5NDcxNDU5Mywic2lnbmF0dXJlIjp7fX0=",
    "stakerAddress": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad88"
    }'

Example response:

{
    "error": null,
    "result": {
        "status": "success"
    }
}

Unstaking Flow

1. Create Undelegate Request

The undelegate request will immediately undelegate the HYPE tokens from being the P2P validator and move to the staking balance.

Send a POST request to /api/v1/unified/staking/unstake

Example request (for testnet network):

curl --request POST \
     --url https://api-test.p2p.org/api/v1/unified/staking/unstake \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <token>' \
     --data '{
    "chain": "hyperliquid",
    "network": "testnet",
    "stakerAddress": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad88",
    "extra":{
        "amount": 10
    }
}'

Example response:

{
    "error": null,
    "result": {
        "unsignedTransactionData": "eyJhY3Rpb24iOnsidHlwZSI6InRva2VuRGVsZWdhdGUiLCJoeXBlcmxpcXVpZENoYWluIjoiVGVzdG5ldCIsInZhbGlkYXRvciI6IjB4YTAxMmI5MDQwZDgzYzVjYmFkOWU2ZWE3M2M1MjUwMjdiNzU1ZjU5NiIsImlzVW5kZWxlZ2F0ZSI6dHJ1ZSwic2lnbmF0dXJlQ2hhaW5JZCI6IjB4NjZlZWUiLCJ3ZWkjOjEwMDAwMDAwLCJub25jZSI6MTc1NDQ3MjU5NDQyMX0sIm5vbmNlIjoxNzU0NDcyNTk0NDIxLCJzaWduYXR1cmUiOnt9fQ==",
        "createdAt": "2025-08-06T09:29:54.168Z",
        "extraData": {
            "amount": 10
        }
    }
}

2. Sign and Send Transaction

Use unsignedTransactionData to sign and send the transaction following the Hyperliquid-specific signing logic.

3. Create Withdrawal Request

📘

Note that it takes 7 days to withdrawal tokens on Hyperliquid network from staking balance to spot balance.

Send a POST request to /api/v1/unified/staking/withdraw.

Example request (for testnet network):

curl --request POST \
     --url https://api-test.p2p.org/api/v1/unified/staking/withdraw \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <token>' \
     --data '{
    "chain": "hyperliquid",
    "network": "testnet",
    "stakerAddress": "0x2588942932015ae61b7e9b77d41f8ed053dde2b341ccaca57bf6a6ecb4fa511a",
    "extra":{
        "amount": 10
    }
}'

Example response:

{
    "error": null,
    "result": {
        "stakerAddress": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad88",
        "unsignedTransactionData": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad8802000000000000000200000000000000000000000000000000000000000000000000000000000000010f64656c65676174696f6e5f706f6f6c0877697468647261770002207a2ddb6af66beb0d9987c6c9010cb9053454f067e16775a8ecf19961195c3d28086300000000000000e80300000000000064000000000000007f06f587970100000200",
        "createdAt": "2025-06-19T10:31:11.615Z",
        "extraData": {
            "amount": 99
        }
    }
}

4. Sign and Send Transaction

Use unsignedTransactionData to sign and send the transaction following the Hyperliquid-specific signing logic.

What's Next?