> ## Documentation Index
> Fetch the complete documentation index at: https://docs.p2p.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Aptos

> Unified API + Aptos Integration Workflow

In the following guide, the integration process for the `aptos` chain is covered. The Aptos integration aligns with the general [Unified API process](/docs/unified-api-getting-started) but with network-specific parameters.

[Get an authentication token](/docs/authentication) to start using the Unified API.

Request examples are provided using [cURL](https://curl.se/).

> To check the integration guides for other chains, refer to the [Networks Supported](/docs/unified-api-networks) section.

<Note>
  **Key Aptos-specific details**

  * `chain` — always set to `aptos` for Aptos-related requests.
  * `network` — environment in which the transaction is processed: `testnet` or `mainnet`.
  * `stakerAddress` — account address initiating staking, unstaking or withdrawal operations.
  * `amount`— amount of tokens in Octas (1 APT = 10⁸ Octas).
  * `extra.gas` — optional settings for gas management.
  * `signature` — delegator account signature, required for broadcasting transactions.
</Note>

## Staking flow

### 1. Create staking request

Send a POST request to [/api/v1/unified/staking/stake](/reference/unified-create-stake-transaction).

Example request (for `testnet` network):

<CodeGroup>
  ```bash bash theme={null}
  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": "aptos",
      "network": "testnet",
      "stakerAddress": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad88",
      "amount": 11,
      "extra":{
          "gas": {
              "unitPrice": 102,
              "maxGasLimit": 1234
          }
      }
  }'
  ```
</CodeGroup>

* `chain` — blockchain network, always set to `aptos` for Aptos-related requests.

* `network` — environment in which the transaction is processed: `mainnet` or `testnet`.

* `stakerAddress` — 0x-prefixed Aptos account address, initiating the staking transaction.

* `amount` — amount of tokens to stake in Octas (1 APT = 10⁸ Octas). Note that minimum staking amount for testing is 11 APT, and on `mainnet`, no less than 1 000 000 APT delegation to the validator is required.

* `extra` — additional parameters:

  * `gas`— additional parameters for gas management:

    * `unitPrice` — price per unit of gas in Octas for processing the Aptos transaction.
    * `maxGasLimit` — maximum gas limit for the transaction.

Example response:

<CodeGroup>
  ```json JSON theme={null}
  {
      "error": null,
      "result": {
          "amount": 1100000000,
          "stakerAddress": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad88",
          "unsignedTransactionData": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad8800000000000000000200000000000000000000000000000000000000000000000000000000000000010f64656c65676174696f6e5f706f6f6c096164645f7374616b650002207a2ddb6af66beb0d9987c6c9010cb9053454f067e16775a8ecf19961195c3d280800ab904100000000400d0300000000006400000000000000bd192087970100000200",
          "createdAt": "2025-06-19T06:38:37.373Z"
      }
  }
  ```
</CodeGroup>

* `amount` — amount of tokens to stake in Octas (1 APT = 10⁸ Octas).
* `stakerAddress` — staking account address receiving the staked tokens.
* `unsignedTransactionData` — unsigned transaction in Base64 or hex-encoded format. Sign the transaction and submit it to the blockchain to perform the called action.
* `createdAt` — timestamp of the transaction in ISO 8601 format.

### 2. Sign and send transaction

Use `unsignedTransactionData` to [sign](/docs/unified-api-signing-transaction) the transaction using the Aptos-specific signing logic.

To broadcast the signed transaction to the Aptos network, send a POST request to [/api/v1/unified/transaction/broadcast](/reference/unified-transaction-send).

Example request (for `testnet` network):

<CodeGroup>
  ```bash bash theme={null}
  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": "aptos",
      "network": "testnet",
      "signedTransaction": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad8800000000000000000200000000000000000000000000000000000000000000000000000000000000010f64656c65676174696f6e5f706f6f6c096164645f7374616b650002207a2ddb6af66beb0d9987c6c9010cb9053454f067e16775a8ecf19961195c3d280800ab904100000000400d0300000000006400000000000000bd192087970100000200",
      "stakerAddress": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad88",
      "extra": {
          "signature": "0x00204a7d68bc540b902995941b77373cd378f39b0e0ebff42566e03774b0ad2285e940cb030ea54fa24986712ffb5c941f3950a2bf1087b2e588c6c3daa08689b5668fbe469a76351101275f694f1ec45cc7d433e103825e55d20ded63cbbcbe344d01"
      }
      }'
  ```
</CodeGroup>

* `chain` — blockchain network.
* `network` — environment in which the transaction is processed.
* `stakerAddress` — account address initiating the staking transaction.
* `signedTransaction` — signed transaction in Base64 encrypted format, which contains all transaction details (e.g., accounts, instructions, and signatures) required to broadcast the transaction to the network.
* `extra`— additional parameters
  * `signature` — delegator signature of the transaction externally produced via the signing code.

Example response:

<CodeGroup>
  ```json JSON theme={null}
  {
      "error": null,
      "result": {
          "status": "pending",
          "extraData": {
              "gas": {
                  "maxGasLimit": 200000,
                  "unitPrice": 100,
                  "used": null
              },
              "createdAt": "2025-06-19T06:56:50.979Z",
              "transactionHash": "0x3051a37fdb7a3e6aa8fc0429d2896dff53c36d6da8144e438aa3ba9d9cb60810",
              "senderAddress": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad88"
          }
      }
  }
  ```
</CodeGroup>

* `status` — transaction status: `pending`, `success`, or `failed`.

* `extraData` — additional transaction details:

  * `gas` — computational effort required to execute the transaction, measured in gas units.

    * `maxGasLimit` — maximum gas limit for the transaction.
    * `unitPrice` — price per unit of gas in Octas for processing the Aptos transaction.
    * `used` — amount of gas spent for the transaction.

  * `createdAt` — timestamp of the transaction in ISO 8601 format.

  * `transactionHash` — hash of the transaction.

  * `senderAddress` — transaction sender address.

## Unstaking flow

### 1. Create unstaking request

Send a POST request to [/api/v1/unified/staking/unstake](/reference/unified-create-unstake-transaction)

Example request (for `testnet` network):

<CodeGroup>
  ```bash bash theme={null}
  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": "aptos",
      "network": "testnet",
      "stakerAddress": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad88",
      "extra":{
          "amount": 1000000000,
          "gas": {
              "unitPrice": 100,
              "maxGasLimit": 1000
          }
      }
  }'
  ```
</CodeGroup>

* `chain` — blockchain network.

* `network` — environment in which the transaction is processed.

* `stakerAddress` — account address initiating the unstaking transaction.

* `extra` — additional parameters:

  * `amount` — amount of tokens to unlock in Octas (1 APT = 10⁸ Octas).

  * `gas` — additional parameters for gas management:

    * `unitPrice` — price per unit of gas in Octas for processing the Aptos transaction.
    * `maxGasLimit` — maximum gas limit for the transaction.

Example response:

<CodeGroup>
  ```json JSON theme={null}
  {
      "error": null,
      "result": {
          "stakerAddress": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad88",
          "unsignedTransactionData": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad8801000000000000000200000000000000000000000000000000000000000000000000000000000000010f64656c65676174696f6e5f706f6f6c06756e6c6f636b0002207a2ddb6af66beb0d9987c6c9010cb9053454f067e16775a8ecf19961195c3d280800ca9a3b00000000e803000000000000640000000000000018e5bf87970100000200",
          "createdAt": "2025-06-19T09:33:09.655Z",
          "extraData": {
              "amount": 1000000000
          }
      }
  }
  ```
</CodeGroup>

* `stakerAddress` — account address initiating the unstaking transaction.
* `unsignedTransactionData` — unsigned transaction in Base64 or hex-encoded format. Sign the transaction and submit it to the blockchain to perform the called action.
* `createdAt` — timestamp of the transaction in ISO 8601 format.
* `extraData` — additional transaction details:
  * `amount` — amount of tokens to unlock in Octas.

### 2. Sign and send transaction

Use `unsignedTransactionData` to [sign and send](/docs/unified-api-signing-transaction) the transaction following the Aptos-specific signing logic.

### 3. Create withdrawal request

<Note>
  Note that it takes up to 30 days to unlock tokens on Aptos network. During this waiting period, unlocked tokens continue earning rewards. Withdrawal is only available after the unlocking period ends.
</Note>

Send a POST request to [/api/v1/unified/staking/withdraw](/reference/unified-create-withdraw-transaction).

Example request (for `testnet` network):

<CodeGroup>
  ```bash bash theme={null}
  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": "aptos",
      "network": "testnet",
      "stakerAddress": "0x2588942932015ae61b7e9b77d41f8ed053dde2b341ccaca57bf6a6ecb4fa511a",
      "extra":{
          "amount": 99,
          "gas": {
              "unitPrice": 100,
              "maxGasLimit": 1000
          }
      }
  }'
  ```
</CodeGroup>

* `chain` — blockchain network.

* `network` — environment in which the transaction is processed.

* `stakerAddress` — account address initiating the withdrawal transaction.

* `extra` — additional parameters:

  * `amount` — amount of tokens to withdraw in Octas.

  * `gas` — additional parameters for gas management:

    * `unitPrice` — price per unit of gas in Octas for processing the Aptos transaction.
    * `maxGasLimit` — maximum gas limit for the transaction.

Example response:

<CodeGroup>
  ```json JSON theme={null}
  {
      "error": null,
      "result": {
          "stakerAddress": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad88",
          "unsignedTransactionData": "0x717b869e7c8d0d29a5065073df84513d373df54ae7ff85775979c9c9f4d2ad8802000000000000000200000000000000000000000000000000000000000000000000000000000000010f64656c65676174696f6e5f706f6f6c0877697468647261770002207a2ddb6af66beb0d9987c6c9010cb9053454f067e16775a8ecf19961195c3d28086300000000000000e80300000000000064000000000000007f06f587970100000200",
          "createdAt": "2025-06-19T10:31:11.615Z",
          "extraData": {
              "amount": 99
          }
      }
  }
  ```
</CodeGroup>

* `stakerAddress` — account address initiating the withdrawal transaction.
* `unsignedTransactionData` — unsigned transaction in Base64 or hex-encoded format. Sign the transaction and submit it to the blockchain to perform the called action.
* `createdAt` — timestamp of the transaction in ISO 8601 format.
* `extraData` — additional transaction details:
  * `amount` — amount of tokens to withdraw in Octas.

### 4. Sign and send transaction

Use `unsignedTransactionData` to [sign and send](/docs/unified-api-signing-transaction) the transaction following the Aptos-specific signing logic.


## Related topics

- [Unified API Reference](/reference/unified-create-stake-transaction.md)
- [Integration Workflow Example](/docs/unified-api-getting-started.md)
- [Networks Supported](/docs/unified-api-networks.md)
