Introduction
The /entries
and /forms/[FORM_ID]/entries
endpoints are used to create entries.
Note: This endpoint is distinctly different from endpoints outlined in Submitting Forms with the REST API v2 which can be used to create entries by sending input values through the complete form submission process.
Authentication
See REST API v2 Authentication.
The capability gravityforms_edit_entries
is required to use POST
requests at these endpoints.
This can be filtered using gform_rest_api_capability_post_entries.
Creating an Entry
The /entries
and /forms/[FORM_ID]/entries
endpoint is used to create a single entry.
Method
These endpoints accept POST
requests in order to create entries.
Path
/gf/v2/entries
or
/gf/v2/forms/[FORM_ID]/entries
Required Properties
The following properties are required when not using the form-specific endpoint.
Key | Type | Description |
---|---|---|
form_id | integer | The Form ID for the entry. |
Optional Properties
The request body can also include the following properties.
Key | Type | Description |
---|---|---|
created_by | integer | The user ID of the entry submitter. |
date_created | string | The date the entry was created, in UTC. |
ip | string | The IP address of the entry creator. |
is_fulfilled | integer | Whether the transaction has been fulfilled, if applicable. |
is_read | integer | Whether the entry has been read. |
is_starred | integer | Whether the entry is starred. |
source_url | string | The URL where the form was embedded. |
status | string | The status of the entry. |
user_agent | string | The user agent string for the browser used to submit the entry. |
Payment Properties
Payment properties only apply when payment fields are present.
Key | Type | Description |
---|---|---|
payment_amount | string | The amount of the payment. |
payment_date | string | The date of the payment. |
payment_method | string | The payment method for the payment. |
payment_status | string | The status of the payment. |
transaction_id | string | The transaction ID for the payment. |
transaction_type | string | The type of transaction. |
Response
Success
A successful response will contain a JSON object of the newly created Entry Object.
Key | Type | Description |
---|---|---|
[entry_property] | mixed | Entry properties of the Entry Object. |
Failure
A failed response will provide a JSON string of the error code and message.
Key | Type | Description |
---|---|---|
code | string | Error code.missing_entry |
message | string | Human-readable error message. |
data[status] | integer | HTTP response status code |
Usage Examples
cURL Request
curl --location --request POST 'https://example.com/wp-json/gf/v2/entries' \
--user 'ck_5f86565df60696c43af25f9194e106800770b8e9:cs_be0190310fefc061c564168670d0a96d68873c29' \
--header 'Content-Type: application/json' \
--data $'{
"3": "[email protected]",
"4": "To the moon!",
"form_id": 30,
"1.6": "Armstrong",
"1.3": "Neil"
}'
Response
{
"form_id": 30,
"1.3": "Neil",
"1.6": "Armstrong",
"3": "[email protected]",
"4": "To the moon!",
"id": 159
}