Skip to content

Gravity Forms submission bridge

POST
/wp-json/wp2lms/turbo/v1/gravity-forms/submit
curl --request POST \
--url https://example.com/wp-json/wp2lms/turbo/v1/gravity-forms/submit \
--header 'Content-Type: application/json' \
--data '{ "form_id": 3, "input_values": { "input_1": "Ivanov", "input_2": "learner@example.com" } }'

Public REST bridge to GFAPI::submit_form from a Turbo page. PHP collects input_* fields from the body root and/or from input_values (object or JSON string). Files are multipart input_N / input_N[i]. Empty checkbox sub-inputs and booleans are dropped. A positive form_id is required (otherwise 400 invalid_form). Unknown form — 404 not_found. No GFAPI class — 503 unavailable. A wp_rest nonce is required in X-WP-Nonce or _wpnonce (403 invalid_nonce). This is not the heartbeat admin-ajax fallback (data[wp2t]) and does not create a form. Invalid GF fields still return HTTP 200 with is_valid=false and validation_messages. Successful poll submit: pollResults from gf_polls; gpoll HTML is stripped from confirmation. A cookie session is not required.

Media typeapplication/json
object
form_id

Gravity Forms form ID. Must be > 0, otherwise 400 invalid_form. May be sent as JSON, query, or multipart.

integer
input_values

Map of input_N → value. Alternatively the same keys at the body root. A JSON string is also accepted. Keys without the input_ prefix are ignored.

object
key
additional properties
any
key
additional properties
any
Example
{
"form_id": 3,
"input_values": {
"input_1": "Ivanov",
"input_2": "learner@example.com"
}
}

GFAPI::submit_form result, normalized by the bridge: is_valid, validation_messages, confirmation, pollResults, entry_id, user_id.

Media typeapplication/json
object
is_valid

Whether GF validation passed (!empty(result['is_valid'])). false does not change the HTTP code — it stays 200.

boolean
validation_messages

Failed_validation messages keyed by GF field id. Empty object when the form is valid.

object
key
additional properties
string
confirmation

GF confirmation_message (string; may be HTML). gpoll_container markup is stripped when pollResults is present.

string
pollResults

Structured poll results (gf_polls). [] when the add-on is missing, displayResults is off, or there were no poll fields.

Array<object>
object
fieldId

Gravity Forms poll field ID.

integer
label

Poll field label.

string
style

Gf_polls style (form setting, often green).

string
showPercentages

Whether to show percentages (form displayResults setting).

boolean
showCounts

Whether to show absolute counts.

boolean
choices

Poll choices with shares and whether the current entry selected them.

Array<object>
object
label

Poll choice label.

string
ratio

Vote share (0…1) from gpoll_get_results.

number
count

Vote count for the choice.

integer
selected

True if the current entry selected this choice.

boolean
entry_id

GF entry ID. null when no entry was created (often when is_valid=false).

integer
nullable
user_id

Get_current_user_id() at submit time; 0 for a guest (typical public Turbo).

integer
Example
{
"is_valid": true,
"validation_messages": {},
"confirmation": "Thank you, your entry was received.",
"pollResults": [],
"entry_id": 901,
"user_id": 0
}

Invalid_form — form_id ≤ 0. Or a WP_Error from GFAPI::submit_form with status 400 (Gravity Forms code).

Media typeapplication/json
object
code

Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).

string
message

Human-readable error message from PHP / WordPress REST.

string
data

Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.

object
key
additional properties
any
Example
{
"code": "wp2lms_static_builder_busy",
"message": "Build is currently building and cannot be updated.",
"data": {
"status": 409
}
}

Invalid_nonce — missing or invalid wp_rest nonce (X-WP-Nonce header or _wpnonce param).

Media typeapplication/json
object
code

Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).

string
message

Human-readable error message from PHP / WordPress REST.

string
data

Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.

object
key
additional properties
any
Example
{
"code": "wp2lms_static_builder_busy",
"message": "Build is currently building and cannot be updated.",
"data": {
"status": 409
}
}

Not_found — GFAPI::get_form did not return a form array.

Media typeapplication/json
object
code

Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).

string
message

Human-readable error message from PHP / WordPress REST.

string
data

Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.

object
key
additional properties
any
Example
{
"code": "wp2lms_static_builder_busy",
"message": "Build is currently building and cannot be updated.",
"data": {
"status": 409
}
}

Submit_failed — GFAPI::submit_form returned neither an array nor a WP_Error. Or a GF WP_Error without its own status.

Media typeapplication/json
object
code

Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).

string
message

Human-readable error message from PHP / WordPress REST.

string
data

Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.

object
key
additional properties
any
Example
{
"code": "wp2lms_static_builder_busy",
"message": "Build is currently building and cannot be updated.",
"data": {
"status": 409
}
}

Unavailable — GFAPI class is missing (Gravity Forms plugin not active).

Media typeapplication/json
object
code

Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).

string
message

Human-readable error message from PHP / WordPress REST.

string
data

Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.

object
key
additional properties
any
Example
{
"code": "wp2lms_static_builder_busy",
"message": "Build is currently building and cannot be updated.",
"data": {
"status": 409
}
}