Deleting Entries with the REST API v2

Introduction

The /entries/[ENTRY_ID] endpoint can be used to trash or delete entries.

Note: By default, calling a DELETE request on this endpoint sends the specified entry to the trash. If the entry is already in the trash, then repeating this request will not delete the entry permanently but the response code will be 410 (Gone). Use the force parameter to delete the entry permanently.

Authentication

See REST API v2 Authentication.

The capability gravityforms_delete_entries is required to use DELETE requests at this endpoint.
This can be filtered using gform_rest_api_capability_delete_entries.

Deleting an Entry

The /entries/[ENTRY_ID] endpoint is used to delete a single entry.

Method

This endpoint accepts DELETE requests in order to trash (or optionally delete) entries.

Path

/gf/v2/entries/[ENTRY_ID]

Required Properties

There are no required properties.

Optional Properties

The request URL can also include the following parameters.

KeyTypeDescription
forceintegerDefault is 0.
Set to 1 in order to permanently delete an entry.

Response

Success

A successful response when trashing will contain a JSON object with the entry details.

KeyTypeDescription
[entry_property]mixedEntry properties of the Entry Object.

A successful response when using the force parameter to permanently delete will contain a JSON object with the entry details.

KeyTypeDescription
deletedbooleantrue indicating permanent deletion.
previousEntry ObjectThe deleted entry.

Failure

A failed response will provide a JSON string of the error code and message.

KeyTypeDescription
codestringError code.
gf_entry_invalid_id
gf_cannot_delete
gf_already_trashed
messagestringHuman-readable error message.
data[status]integerHTTP response status code

Usage

cURL Request

curl --location --request DELETE 'https://rocket.test/wp-json/gf/v2/entries/160' \
     --user 'ck_5f86565df60696c43af25f9194e106800770b8e9:cs_be0190310fefc061c564168670d0a96d68873c29'

Response

{
  "id": "160",
  "form_id": "30",
  "post_id": null,
  "date_created": "2023-09-01 19:40:02",
  "date_updated": "2023-09-01 19:40:02",
  "is_starred": "0",
  "is_read": "0",
  "ip": "50.104.76.242",
  "source_url": "https:\/\/rocket.test\/wp-json\/gf\/v2\/entries",
  "user_agent": "API",
  "currency": "USD",
  "payment_status": null,
  "payment_date": null,
  "payment_amount": null,
  "payment_method": "",
  "transaction_id": null,
  "is_fulfilled": null,
  "created_by": "4",
  "transaction_type": null,
  "status": "trash",
  "1.3": "Gus",
  "1.6": "Grissom",
  "3": "[email protected]",
  "4": "To the moon!",
  "1.2": "",
  "1.4": "",
  "1.8": ""
}

cURL Request

curl --location --request DELETE 'https://rocket.test/wp-json/gf/v2/entries/162?force=1' \
     --user 'ck_5f86565df60696c43af25f9194e106800770b8e9:cs_be0190310fefc061c564168670d0a96d68873c29'

Response

{
  "deleted": true,
  "previous": {
    "id": "162",
    "form_id": "30",
    "post_id": null,
    "date_created": "2023-09-05 20:02:24",
    "date_updated": "2023-09-05 20:02:24",
    "is_starred": "0",
    "is_read": "0",
    "ip": "184.18.23.234",
    "source_url": "https:\/\/rocket.test\/wp-json\/gf\/v2\/entries",
    "user_agent": "API",
    "currency": "USD",
    "payment_status": null,
    "payment_date": null,
    "payment_amount": null,
    "payment_method": "",
    "transaction_id": null,
    "is_fulfilled": null,
    "created_by": "4",
    "transaction_type": null,
    "status": "active",
    "1.3": "Buzz",
    "1.6": "Aldrin",
    "3": "[email protected]",
    "4": "Magnificent desolation.",
    "1.2": "",
    "1.4": "",
    "1.8": ""
  }
}