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

# Getting Started

> Simplify your work with decentralized assets with DeFi API from P2P.ORG.

<Note>
  This article describes how the DeFi API process works in general. To see detailed guides for a specific protocol, refer to the [Protocols Supported](/docs/defi-api-protocols) section.
</Note>

The DeFi API supports the complete transaction lifecycle, from creation through execution. When a user initiates a deposit action, the API constructs the necessary transaction, awaits user signing, and submits it to the blockchain network.

The API includes the major group of [transaction endpoints](/reference/get-transaction-schema), with the `transactions/steps/craft` method serving as the primary interface for transaction creation—handling approximately 95% of operations. The data part with endpoints for getting details on earnings, positions, and rewards is also provided.

## Action types

Currently, each vault integration supports the following operations:

* `approvePermit2`: Allow the P2P.ORG smart contract to manage tokens by obtaining approval.
* `deposit`: Initiate a deposit transaction to delegate the assets.
* `withdraw`: Withdraw the assets to the wallet.

To start using the DeFi API, [get an authentication token](/docs/authentication).

## General flow

1. Get a schema with the step list.

   To retrieve a schema describing which transactions are required for a specified action, protocol, chain, and strategy, send a GET request to [/api/defi/v1/transactions/schema](/reference/get-transaction-schema).

2. Upon the schema retrieved, construct the required transactions. Depending on the action type and the request data, a schema may include up to 3 transactions.

   To initiate the constructing process, send a POST request to [/api/defi/v1/transactions/steps/craft](/reference/craft-transaction-step). Upon each request, a raw unsigned transaction is generated.

3. Sign each transaction using the [transaction-type-specific libraries](/docs/defi-api-signing-transaction).

4. Check the status of the constructed transaction by using the [/api/defi/v1/transactions/steps/result](/reference/get-step-result) endpoint.

   If the schema contains several transactions, for [intermediate transactions](/docs/defi-api-signing-transaction), you may use a [/api/defi/v1/transactions/steps/status](/reference/get-step-status) endpoint.

5. Broadcast the final transaction to the network by sending a POST request to [/api/defi/v1/transactions/broadcast](/reference/broadcast-transaction).


## Related topics

- [Morpho Integration](/docs/morpho.md)
- [Deposit](/docs/morpho-staking.md)
