REST API: form schemas
LocalForm exposes a form's field structure over the WordPress REST API (wp-json/) - useful for building an external form renderer, syncing form definitions into another system, or any integration that needs to know a form's fields without querying the database directly.
The API is not public. Every request must be authenticated as a user who can manage the site.
Authentication
Requests must authenticate as a user with the manage_options capability (an Administrator by default), using WordPress Application Passwords - generated per-user under Users → Profile → Application Passwords.
Application Passwords require HTTPS. On a local/staging site without SSL, set WP_ENVIRONMENT_TYPE to local or development (in wp-config.php, or as an env var) to allow them over plain HTTP.
curl -u "username:xxxx xxxx xxxx xxxx xxxx xxxx" \
https://example.com/wp-json/localform/v1/forms/12/schema
An unauthenticated or unauthorized request gets a 401:
{ "code": "rest_forbidden", "message": "Sorry, you are not allowed to do that.", "data": { "status": 401 } }
Get one form's schema
GET /wp-json/localform/v1/forms/{id}/schema
{
"id": 12,
"title": "Registration",
"description": "Sign up for the event.",
"fields": [
{
"id": "field_1",
"label": "Full name",
"name": "full_name",
"type": "text",
"required": true,
"placeholder": "",
"options": [],
"content": "",
"images": [],
"order": 0
}
]
}
An unknown id returns 404:
{ "code": "localform_not_found", "message": "Form not found.", "data": { "status": 404 } }
Get every form's schema
GET /wp-json/localform/v1/forms/schemas
Returns an array of the same object shape as above, one per form. Accepts limit (default 100) and offset (default 0) query parameters for pagination:
curl -u "username:app-password" \
"https://example.com/wp-json/localform/v1/forms/schemas?limit=20&offset=20"
Field object reference
Every field carries the base keys shown above. Some field types add extra keys - see Field types for what each type renders as:
| Type | Extra keys |
|---|---|
number | min_value, max_value |
rating | rating_min, rating_max, rating_style (numbers or stars) |
date_range | date_range_both_required |
options holds the choices for dropdown, radio, and checkbox fields. content holds the rich text for text_block/section fields, and images holds attachment IDs for image_block fields - these three types are layout-only and never appear in a submission.
With LocalForm Pro active, fields also carry condition and prefill keys (disabled by default) for conditional fields and prefill from URL.