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

# Story Protocol

> Unified API + Story Protocol Integration Workflow

In the following guide, the integration process for the `story` chain is covered. The Story Protocol 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 Story-specific details**

  * `chain` — always set to `story` for Story-related requests.
  * `network` — environment in which the transaction is processed: `mainnet` or `aeneid`(testnet).
  * `stakerAddress` — Ethereum account address of the user initiating staking, unstaking or withdrawal operations, which keeps the Story blockchain tokens.
  * `amount` — amount of tokens in IP.
  * `extra.stakingPeriod` — staking period duration.
  * `extra.tokenType`— token source type.
</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 `aeneid` 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": "story",
    "network": "aeneid",
    "stakerAddress": "0x3202B5B0602274197CcB22B8c02CEC9539990c7c",
    "amount": 1024,
    "extra": {
      "stakingPeriod": "FLEXIBLE",
      "gas": {
      	"maxFeePerGas": 10,
      	"maxPriorityFeePerGas": 1,
        "gasLimit": 21000
  		}
    }
  }'
  ```
</CodeGroup>

* `chain` — blockchain network, always set to `story` for Story-related requests.

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

* `stakerAddress` — staking account address receiving the staked tokens.

* `amount`— amount of tokens to stake in IP. Minimum stake amount is **1024 IP**.

* `extra` — additional parameters:

  * `stakingPeriod` — staking period duration:

    * `FLEXIBLE` — no lock-up; funds can be withdrawn at any time.
    * `SHORT` — 90 days of the lock-up period.
    * `MEDIUM` — 360 days of the lock-up period.
    * `LONG` — 540 days of the lock-up period.

  * `gas`— additional parameters for gas management:

    * `maxFeePerGas`— maximum fee per gas (in Gwei).
    * `maxPriorityFeePerGas`— maximum priority fee to incentivize transaction.
    * `gasLimit`— maximum gas units to be consumed.

Example response:

<CodeGroup>
  ```json JSON theme={null}
  {
    "error": null,
    "result": {
      "amount": "1024",
      "stakerAddress": "0x3202B5B0602274197CcB22B8c02CEC9539990c7c",
      "unsignedTransactionData": "0xf86f808504a817c80082520894...",
      "extraData": {
        "stakingPeriod": "FLEXIBLE",
  			"gas": {
          "maxFeePerGas": 10,
          "maxPriorityFeePerGas": 1,
          "gasLimit": 21000
        }
      }
    }
  }
  ```
</CodeGroup>

* `amount` — amount of tokens to stake in IP.

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

* `unsignedTransactionData` — serialized unsigned transaction in the hexadecimal format (RLP-encoded).

* `extraData` — additional transaction details:

  * `stakingPeriod` — staking period duration: `FLEXIBLE`, `SHORT`, `MEDIUM` or `LONG`.

  * `gas`— additional parameters for gas management:

    * `maxFeePerGas`— maximum fee per gas (in Gwei).
    * `maxPriorityFeePerGas`— maximum priority fee to incentivize transaction.
    * `gasLimit`— maximum gas units to be consumed.

### 2. Sign and send transaction

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

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

Example request:

<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": "story",
    "network": "aeneid",
    "signedTransaction": "0xf86f82012a8504a817c80082520894...",
    "stakerAddress": "0x3202B5B0602274197CcB22B8c02CEC9539990c7c"
  }'
  ```
</CodeGroup>

* `chain` — blockchain network.
* `network` — environment in which the transaction is processed.
* `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.
* `stakerAddress` — account address initiating the staking transaction.

Example response:

<CodeGroup>
  ```json JSON theme={null}
  {
      "error": null,
      "result": {
          "extraData": {}
      }
  }
  ```
</CodeGroup>

## Unstaking flow

### 1. Create unstaking request

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

Example request (for`mainnet`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": "story",
    "network": "aeneid",
    "stakerAddress": "0x3202B5B0602274197CcB22B8c02CEC9539990c7c",
    "extra": {
      "amount": "1024",
      "delegationId": 0,
      "gas": {
      	"maxFeePerGas": 10
  		}
    }
  }'
  ```
</CodeGroup>

* `chain` — blockchain network.

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

* `stakerAddress` — staking account address initiated the staking transaction.

* `extra` — additional parameters:

  * `amount`— amount of tokens to unstake in IP.
  * `delegationId`— identifier of the stake, required to perform a unstake.
  * `gas`— additional parameters for gas management:
    * `maxFeePerGas`— maximum fee per gas (in Gwei).

Example response:

<CodeGroup>
  ```json JSON theme={null}
  {
    "error": null,
    "result": {
      "stakerAddress": "0x3202B5B0602274197CcB22B8c02CEC9539990c7c",
      "unsignedTransactionData": "0xf8a9808504a817c800830186a094...",
      "extraData": {}
    }
  }
  ```
</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.
* `extraData` — additional transaction details

### 2. Sign and send transaction

Use `unsignedTransactionData` to [sign and send](/docs/unified-api-signing-transaction) the transaction following the Story-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)
