This API is used by various services to serve data. It is a public API intended for all those seeking to integrate Curve data onto their own projects.
Endpoints list and example response can be found by clicking here
- Create a new file under
/pages/api
: the endpoint will be accessible through the same path, e.g./pages/api/hithere
would accessible throughapi.curve.fi/api/hithere
- If this endpoint requires passing any data as a query parameter, name that parameter in the path itself (e.g.
/pages/api/user/[id].js
) - The endpoint script must export a function, wrapped in the utility
fn()
, that returns a json object – that's it - Query params: any query params defined as in (2) are accessible in the first argument passed to
fn
, e.g.fn(({ id }) => ({ message: \
Id passed as argument: ${id}`}))` - Caching: pass an object as second argument to
fn
, and set the cache duration in seconds with themaxAge
property:{ maxAge: 60 }
Run: vercel dev