Skip to main content
POST
/
api
/
l2beat
/
projects
/
costs
/l2beat/projects/costs
curl --request POST \
  --url https://api.anysite.io/api/l2beat/projects/costs \
  --header 'Content-Type: application/json' \
  --header 'access-token: <api-key>' \
  --data '
{
  "count": 2,
  "timeout": 300,
  "project": "base",
  "range": "30d"
}
'
[
  {
    "id": "<string>",
    "@type": "L2beatProjectCosts",
    "gas": {
      "@type": "L2beatCostBreakdown",
      "overhead": 123,
      "calldata": 123,
      "compute": 123,
      "blobs": 123,
      "total": 123
    },
    "eth": {
      "@type": "L2beatCostBreakdown",
      "overhead": 123,
      "calldata": 123,
      "compute": 123,
      "blobs": 123,
      "total": 123
    },
    "usd": {
      "@type": "L2beatCostBreakdown",
      "overhead": 123,
      "calldata": 123,
      "compute": 123,
      "blobs": 123,
      "total": 123
    },
    "uops_count": 123,
    "synced_until": 123
  }
]

Authorizations

access-token
string
header
required

API token from the dashboard

Headers

access-token
string
required

Body

application/json
count
integer
required

Max number of projects to return

Required range: x >= 1
timeout
integer
default:300

Max scrapping execution timeout (in seconds)

Required range: 20 <= x <= 1500
project
string | null

Project slug to return costs for a single project; omit for all projects

Example:

"base"

range
enum<string>
default:30d

Time window for the onchain cost aggregation

Available options:
1d,
7d,
30d,
90d,
180d,
1y,
max

Response

Successful Response

id
string
required
@type
string
default:L2beatProjectCosts
gas
object
eth
object
usd
object
uops_count
integer | null
synced_until
integer | null