StatikAPI Documentation

Build APIs from your data — without backend complexity.

StatikAPI helps you combine external APIs with your own content, shape outputs, and publish reliable structured endpoints. These docs cover the open source foundation, with guidance for local CLI workflows, Cloudflare deployment, and hosted platform usage.

StatikAPI App

Use the hosted visual workflow when you want managed publishing, private APIs, and automation.

Open StatikAPI App

The open source CLI stays free and self-hostable. StatikAPI App adds hosted workflows, visual editing, automations, analytics, and private API access.

Last updated: May 2026

data(context)

data() is the main function form for route modules.

Use it when:

  • the route payload is computed
  • you need params
  • you want to fetch remote data at build time

Supported forms

StatikAPI accepts either:

js
export default { hello: 'world' };

or:

js
export async function data(context) {
  return { hello: 'world' };
}

It also accepts:

js
export default async function data(context) {
  return { hello: 'world' };
}

What context currently contains

Regular CLI path

For the normal statikapi build / statikapi dev path, context currently includes:

  • params
    • dynamic/catch-all params when applicable
  • __fresh
    • internal dev-only freshness flag during rebuilds

Examples:

  • static route:
    • {}
  • dynamic route /users/1:
    • { params: { id: '1' } }
  • catch-all route /docs/api/intro:
    • { params: { slug: ['api', 'intro'] } }

Cloudflare adapter path

For the Cloudflare adapter, route execution currently receives:

  • params
  • env

where env is the Worker environment/bindings object.

So if you write code that depends on env, that is Cloudflare-specific behavior, not the generic local CLI contract.


Example

js
export async function data({ params }) {
  return {
    id: params.id,
    role: 'member',
  };
}

Rules

data() must return JSON-serializable output.

Allowed:

  • strings
  • booleans
  • finite numbers
  • null
  • plain objects
  • arrays

Rejected:

  • Date
  • BigInt
  • functions
  • class instances
  • circular references

If serialization fails, the route build fails with an explicit error.

Get started

Ready to publish your first API?

Start locally with the CLI or use StatikAPI App when you want managed publishing and automation.

Start building for free View examples