Guides update:
New block here: https://docs.lido.fi/integrations/wallets/
# **API**
Here you can find various Lido APIs which you can integrate in your app or website:
## Lido APR
API provides Ethereum and Lido staking APR, which include:
### **Simple Moving Average Lido APR for 7 last days:**
This APR value is based on Simple Moving Average of APR values over a period of 7 days.
https://eth-api.lido.fi/v1/protocol/steth/apr/sma
Response body:
```typescript=
interface Apr {
// Block timestamp in seconds
// example 1682425475
timeUnix: number;
// APR value
// example 4.86
apr: number;
}
interface Meta {
// Token symbol
symbol: string;
// Token address
address: string;
// Chain id: 1 - mainnet
chainId: number;
}
interface Response {
data: {
// Array of APRs over a period of 7 days
aprs: Apr[],
// Simple Moving Average APR
smaApr: number
};
meta: Meta;
}
// Response example
const resp: Response = {
data: {
aprs: [
{
timeUnix: 1681820735,
apr: 4.86
}
],
smaApr: 4.86
},
meta: {
symbol: "stETH",
address: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
chainId: 1
}
}
}
```
### **Last Lido APR for stETH**
The latest staking APR value. For Lido V2 version, the value is calculated based on [rebase events]( lidofinance/lido-dao@e45c4d6 ).
V2 APR calculation:
```
// Emits when token rebased (total supply and/or total shares were changed)
event TokenRebased(
uint256 indexed reportTimestamp,
uint256 timeElapsed,
uint256 preTotalShares,
uint256 preTotalEther, /* preTotalPooledEther */
uint256 postTotalShares,
uint256 postTotalEther, /* postTotalPooledEther */
uint256 sharesMintedAsFees /* fee part included in `postTotalShares` */
);
preShareRate = preTotalEther * 1e27 / preTotalShares
postShareRate = postTotalEther * 1e27 / postTotalShares
userAPR =
secondsInYear * (
(postShareRate - preShareRate) / preShareRate
) / timeElapsed
```
https://eth-api.lido.fi/v1/protocol/steth/apr/last
Response body:
```typescript=
interface Apr {
// Block timestamp in seconds
// example 1682425475
timeUnix: number;
// APR value
// example 4.86
apr: number;
}
interface Meta {
// Token symbol
symbol: string;
// Token address
address: string;
// Chain id: 1 - mainnet
chainId: number;
}
interface Response {
data: Apr;
meta: Meta;
}
// Response example
const resp = Response = {
data: {
timeUnix: 1681820735,
apr: 4.86
},
meta: {
symbol: "stETH",
address: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
chainId: 1
}
}
}
```