Introduction
The /forms and forms/[FORM_ID] endpoints can be used to get forms and form details.
Authentication
See REST API v2 Authentication.
The capability gravityforms_edit_forms is required to use GET requests at this endpoint.
This can be filtered using gform_rest_api_capability_get_forms.
Getting a Form
The /forms and forms/[FORM_ID] endpoints can be used to get forms and form details.
Method
This endpoint accepts GET requests in order to get forms.
Path
/gf/v2/forms
or
/gf/v2/forms/[FORM_ID]
Required Properties
There are no required properties.
When passing no properties to the endpoint /forms a response containing basic details for all forms will be returned. This includes the properties id, title, and entries count.
Optional Properties
The request URL can also include the following parameters.
| Key | Type | Description |
|---|---|---|
| include | array | An array of forms by ID to include in the response. |
Response
Success
A successful response when not specifying specific forms will contain a JSON object keyed by form ID – each with form details.
| Key | Type | Description |
|---|---|---|
| id | string | The form ID. |
| title | string | The form title. |
| entries | string | A count of associated entries. This property is excluded when gform_rest_api_retrieve_form_totals is false. |
A successful response when using the include parameter will contain a JSON object keyed by form ID – each with the Form Object. When hitting a form-specific endpoint the response will contain a JSON object with the Form Object.
| Key | Type | Description |
|---|---|---|
| [form_properties] | Form Object | The queried form. |
Failure
A failed response will provide a JSON string of the error code and message.
| Key | Type | Description |
|---|---|---|
| code | string | Error code.gf_not_found |
| message | string | Human-readable error message. |
| data[status] | integer | HTTP response status code |
Usage
cURL Request
curl "https://rocket.test/wp-json/gf/v2/forms" \
-u 'ck_5f86565df60696c43af25f9194e106800770b8e9:cs_be0190310fefc061c564168670d0a96d68873c29'
Response
{
"30": {
"id": "30",
"title": "API Documentation",
"entries": "1"
},
"31": {
"id": "31",
"title": "Inquiry Form",
"entries": "0"
},
"27": {
"id": "27",
"title": "Stripe 5.0 Testing",
"entries": "13"
}
}
cURL Request
curl "https://rocket.test/wp-json/gf/v2/forms?include[]=31" \
-u 'ck_5f86565df60696c43af25f9194e106800770b8e9:cs_be0190310fefc061c564168670d0a96d68873c29'
Response
{
"31": {
"title": "Inquiry Form",
"fields": [
{
"type": "name",
"id": 1,
"formId": 31,
"label": "Name A",
"adminLabel": "",
"isRequired": false,
"size": "large",
"errorMessage": "",
"visibility": "visible",
"nameFormat": "advanced",
"inputs": [
{
"id": "1.2",
"label": "Prefix",
"name": "",
"autocompleteAttribute": "honorific-prefix",
"choices": [
{
"text": "Dr.",
"value": "Dr."
},
{
"text": "Miss",
"value": "Miss"
},
{
"text": "Mr.",
"value": "Mr."
},
{
"text": "Mrs.",
"value": "Mrs."
},
{
"text": "Ms.",
"value": "Ms."
},
{
"text": "Mx.",
"value": "Mx."
},
{
"text": "Prof.",
"value": "Prof."
},
{
"text": "Rev.",
"value": "Rev."
}
],
"isHidden": true,
"inputType": "radio"
},
{
"id": "1.3",
"label": "First",
"name": "",
"autocompleteAttribute": "given-name"
},
{
"id": "1.4",
"label": "Middle",
"name": "",
"autocompleteAttribute": "additional-name",
"isHidden": true
},
{
"id": "1.6",
"label": "Last",
"name": "",
"autocompleteAttribute": "family-name"
},
{
"id": "1.8",
"label": "Suffix",
"name": "",
"autocompleteAttribute": "honorific-suffix",
"isHidden": true
}
],
"description": "",
"allowsPrepopulate": false,
"inputMask": false,
"inputMaskValue": "",
"inputMaskIsCustom": "",
"maxLength": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "",
"noDuplicates": false,
"defaultValue": "",
"enableAutocomplete": false,
"autocompleteAttribute": "",
"choices": "",
"conditionalLogic": "",
"productField": "",
"layoutGridColumnSpan": "",
"enableEnhancedUI": 0,
"layoutGroupId": "dc68cb94",
"fields": "",
"pageNumber": 1
},
{
"type": "select",
"id": 3,
"formId": 31,
"label": "How did you hear about us?",
"adminLabel": "",
"isRequired": false,
"size": "large",
"errorMessage": "",
"visibility": "visible",
"validateState": true,
"inputs": null,
"choices": [
{
"text": "Online",
"value": "Online",
"isSelected": false,
"price": ""
},
{
"text": "Friend",
"value": "Friend",
"isSelected": false,
"price": ""
},
{
"text": "Newspaper",
"value": "Newspaper",
"isSelected": false,
"price": ""
}
],
"description": "",
"allowsPrepopulate": false,
"inputMask": false,
"inputMaskValue": "",
"inputMaskIsCustom": false,
"maxLength": "",
"inputType": "",
"labelPlacement": "",
"descriptionPlacement": "",
"subLabelPlacement": "",
"placeholder": "",
"cssClass": "",
"inputName": "",
"noDuplicates": false,
"defaultValue": "",
"enableAutocomplete": false,
"autocompleteAttribute": "",
"conditionalLogic": "",
"productField": "",
"layoutGridColumnSpan": "",
"enablePrice": "",
"enableEnhancedUI": 0,
"layoutGroupId": "bc999d5b",
"multipleFiles": false,
"maxFiles": "",
"calculationFormula": "",
"calculationRounding": "",
"enableCalculation": "",
"disableQuantity": false,
"displayAllCategories": false,
"useRichTextEditor": false,
"errors": [],
"fields": "",
"pageNumber": 1
}
],
"version": "2.7.13",
"id": 31,
"markupVersion": 2,
"notifications": [],
"confirmations": {
"64f793366215f": {
"id": "64f793366215f",
"name": "Default Confirmation",
"isDefault": true,
"type": "message",
"message": "Thanks for contacting us! We will get in touch with you shortly.",
"url": "",
"pageId": "",
"queryString": ""
}
},
"nextFieldId": 4,
"is_active": "1",
"date_created": "2023-09-05 20:44:38",
"is_trash": "0"
}
}