Skip to main content

Developer tools

Headless / Astro / Next in Core Forms

Render and submit Core Forms from Astro, Next.js, or any non-WordPress site.

Bundled with Core Forms — the WordPress forms plugin with every premium feature in the box. No add-on tax.

Bundled, no add-on tax Unlimited sites 20% off with code CFLAUNCH

Every form can be exposed via REST so an external site can render it and post submissions. The same validation, captcha, action-loop and payment-redirect machinery runs server-side in WordPress — your headless site just submits JSON.

Single API key per site (under Settings → Headless), per-form opt-in toggle, and three integration modes: a drop-in vanilla JS widget, a native fetch example, and a cURL recipe. The widget fires `cf:mounted`, `cf:submit`, `cf:success` and `cf:error` events on the host element so any framework can hook in.

What you get

How Headless / Astro / Next works in Core Forms

GET form schema

JSON schema includes the rendered HTML and a structured field list for client-side validation.

POST submit endpoint

Drives the same Forms::process() pipeline as on-site submissions — captcha, akismet, actions, payments.

embed.js widget

Drop a <div data-cf-form="…"> + <script src=".../embed.js"> and the form mounts itself.

CORS-friendly

Origin reflected per-request. No credentials required, captcha enforced as the spam stop.

Set it up

Connect Headless / Astro / Next in 3 minutes

  1. 1

    Set the API key

    WP Admin → Core Forms → Settings → Headless → click Generate, save.

  2. 2

    Flip the form toggle

    Form editor → Headless tab → enable. Copy a snippet (widget, fetch, or cURL).

  3. 3

    Paste into your site

    Astro / Next / Vue / Svelte / static HTML — the snippet is framework-agnostic.

Watch

Headless WordPress forms with Core Forms — full walkthrough

Five-minute walkthrough of the headless setup: API key, allowed origins, per-form toggle, and the three integration modes (drop-in widget, native fetch, server-side proxy).

Drop-in vanilla JS embed

<div data-cf-form="contact" data-cf-key="YOUR_SITE_API_KEY"></div>
<script src="https://yoursite.com/wp-json/core-forms/v1/embed.js" defer></script>
Inside Core Forms

See it in WP-Admin

Core Forms global settings — Headless / REST section with the API key field, Generate / Show / Copy controls, and the Allowed origins textarea
Site-wide API key + per-origin CORS allowlist. Settings → Headless.
Per-form Headless tab with the Enable for headless sites toggle, status banner, and three copy-paste snippets — drop-in widget, native fetch, cURL recipe
Per-form toggle and the three integration snippets — each pre-filled with the form's ID + your API key.
Embed widget snippet card showing the data-cf-form / data-cf-key HTML and the embed.js script tag, with a Copy button
The drop-in widget: paste two lines into any HTML page on any origin.
Native fetch snippet card with a JavaScript example calling the cf/v1/forms endpoint, headers including X-Core-Forms-Key, and the _cf_page_url body field
Native fetch path for Astro / Next / Vue / Svelte / React. Note the _cf_page_url field that ports the embed page URL through to [CF_REFERRER_URL].
Keeping the API key private guidance card with copy-paste server-side proxy templates for Cloudflare Workers, Next.js App Router, and Astro server endpoints
Defence-in-depth: server-side proxy templates for Cloudflare Workers, Next.js App Router, and Astro server endpoints.

Bundled with every Core Forms license.

Headless / Astro / Next — and every other integration on this site — is included with your license. Use code CFLAUNCH for 20% off either plan.