Devflare Docs
Library API Ship & operate

Use when scripts should reuse Devflare’s account, registry, and token helpers instead of reimplementing them

The subpath exposes the same account-aware building blocks the CLI uses for auth, resource inventory, usage and limits, preview registry access, preferences, and managed token workflows.

This page is for Node-side scripts and tooling, not Worker runtime code. Reach for it when a release script, operator utility, or migration helper should reuse Devflare’s Cloudflare-side knowledge instead of rebuilding auth, pagination, account selection, or preview-registry calls from scratch.

Import path
Primary surface
A flat object plus standalone preview-registry helpers and schema exports
Best for
Release scripts, operator tooling, and Node-side automation that should reuse Devflare’s Cloudflare-side rules

Use the library when your script needs Devflare’s control-plane knowledge, not just a shell command

Reach for when a script should authenticate once, resolve an account deliberately, inspect resources, or talk to the preview registry using the same rules Devflare already ships.

If the job is already well-served by , , or another CLI command and the main need is a readable operator workflow, the CLI is usually simpler. The library is for composition.

Good fit

A release script, CI helper, or internal ops tool needs account auth, inventory queries, preview registry reads, or token management as reusable functions.

Usually not the first fit

A human just needs to inspect state once. That is what the CLI pages and built-in help are already for.

Know the main clusters on the public surface

ClusterWhat it helps withExamples
Auth and account identityCheck auth, inspect accounts, and resolve the account you should operate on., ,
Resource inventoryList Workers, D1 databases, KV namespaces, R2 buckets, Vectorize indexes, and related account resources., ,
Usage and limitsRead Devflare-managed operational counters and ceilings that inform remote or preview-heavy workflows.,
Preferences and defaultsRead or update Devflare’s stored global or workspace account preferences., ,
Managed tokens and preview registryCreate or rotate Devflare-managed API tokens, and inspect or update preview-registry records with shared schemas., ,

This is the same mental model as the CLI, just as functions

If a CLI page talks about account preferences, preview registry records, or managed tokens, this subpath is usually where the reusable implementation lives.

A small script can reuse auth and inventory without rebuilding them

  • Keep account choice explicit in scripts that can touch more than one account.
  • Reuse the exported helpers instead of hand-rolling Cloudflare REST calls unless you genuinely need an unsupported endpoint.
  • Prefer returning structured data from your own scripts and let the CLI own human-readable operator output.

List Workers for the primary account

Preview registry helpers and schemas are public by design

Devflare exports preview-registry helpers plus the shared registry schemas and errors so custom tooling can inspect or update preview metadata without guessing the record shape.

That is especially useful for automation that wants to inspect preview URLs, scope metadata, or cleanup state while staying aligned with the same contract the CLI and GitHub actions use.

  • Use schema exports such as when you need to validate preview-registry data in your own tooling.
  • Use , , or the standalone preview-registry exports when you want the same storage contract the CLI already understands.
  • Keep custom preview automation aligned with the docs on preview lifecycle instead of inventing parallel record shapes.

Open the neighboring page when the question is policy or workflow, not raw API reuse

Previous

Control-plane operations

Devflare’s deeper CLI families exist so account selection, live production inspection, Worker renames, token lifecycle, and remote paid-test gates stay documented instead of dissolving into ad-hoc command snippets.

Next

Preview operations

The preview registry is D1-backed, giving Devflare durable records of scope and deployment state for reliable cleanup.