Delete Records
Learn to delete Records in a Table with Morph API.
Overview
You can delete one or multiple Records in a Table using Morph API.
You need to define several parameters to build the request to the Delete Record endpoint.
These parameters are:
teamSlug
,databaseId
andtableSlug
as well asAPI Key
.- The
filter
array body parameter.
This guide will focus on explaining how to the define the filter
array body parameter.
The steps to obtain
teamSlug
,databaseId
andtableSlug
as well as theAPI Key
are detailed in the Quickstart.
filter
The filter
array body parameter is your way to select (filter) the records that you wish to delete based on the filtering conditions you define.
Example for this guide
We will see examples to:
- Delete a single Record
- Delete multiple Records
Setup to follow along
Try myself
Want to reproduce the exact same examples from this guide?
Follow the setup below.
There are two cases:
- Case 1: you have followed along the Add a Record with prompt guide and already. have the CRM Example Table.
- Case 2: you do not have the CRM Example Table.
Starting point
You should have the following CRM Example Table as your starting point as viewed from Morph and the Developer Mode.
In Morph:

CRM Example Table starting point for the Delete Records guide as viewed in Morph
In the Developer Mode:

CRM Example Table starting point for the Delete Records guide as viewed in the Developer Mode
Case 1: you already have the CRM Example Table
We are going to use the CRM Example Table in the same status than at the end of the Add a Record with prompt guide as shown here.
Your CRM Example Table has sixteen Records:
- The fifteen Records from the initial CRM Example Table of that Add a Record with prompt as described here.
- Plus the following Record which was added throughout that Add a Record with prompt guide:
company_name | budget | deal_date |
---|---|---|
Morph Inc. | 1000000 | 2021-02-01 |
Add the following five Records to this Table. In this guide, we will practice deleting records with these new records.
company_name | budget | deal_date |
---|---|---|
Dynamic Innovation | 68000 | 2023-04-15 |
Tech Titans | 82000 | 2023-05-20 |
Global Innovators | 55000 | 2023-06-10 |
Innovative Solutions | 72000 | 2023-07-05 |
Future Enterprises | 60000 | 2023-08-18 |
Same data in CSV format:
company_name,budget,deal_date
Dynamic Innovations,68000,2023-04-15
Tech Titans,82000,2023-05-20
Global Innovators,55000,2023-06-10
Innovative Solutions,72000,2023-07-05
Future Enterprises,60000,2023-08-18
To add these records to your CRM Example Table, you have several options:
- In Morph using either one of the three "Create Record" options: Create a Record, Create records with freeform, or Bulk insert. Visit the Help Center if you need guidance.
- Programmatically using Morph API using either one of the endpoints to add a record: Add a Record or Add a Record with prompt.
Case 2: you do not have the CRM Example Table
To create the CRM Example Table, follow the steps described here in the Add a Record with prompt guide. But for the step 3, copy the data below (instead of the data provided in that Add a Record with prompt guide):
company_name,budget,deal_date
ABC Inc.,50000,2023-01-15
XYZ Corp,75000,2023-02-20
Acme Industries,60000,2023-03-10
Global Tech,80000,2023-04-05
Innovate Solutions,45000,2023-05-18
Smith & Co.,70000,2023-06-22
Johnson Enterprises,55000,2023-07-09
Widget World,90000,2023-08-14
Superior Systems,65000,2023-09-27
Peak Performance,85000,2023-10-30
Evergreen Holdings,52000,2023-11-25
Pioneer Partners,72000,2023-12-12
Golden Gate Group,48000,2024-01-08
Blue Sky Inc.,95000,2024-02-17
Star Solutions,60000,2024-03-21
Morph Inc.,1000000,2021-02-01
Dynamic Innovations,68000,2023-04-15
Tech Titans,82000,2023-05-20
Global Innovators,55000,2023-06-10
Innovative Solutions,72000,2023-07-05
Future Enterprises,60000,2023-08-18
Delete a Record
To delete a single Record using Morph API, you call the Delete Record endpoint.
We will make an API request to the Delete Record endpoint for the CRM Example
Table to delete the following Record:
company_name | budget | deal_date |
---|---|---|
Future Enterprises | 60000 | 2023-08-18 |
Build the request
To build the request, you will need the following parameters.
Headers
- authorization header:
x-api-key: {YOUR_API_KEY}
client-type: widget
Content-Type: application/json
How to get my API Key?
Head to Create an API Key.
Path parameters
teamSlug
databaseId
tableSlug
Where can I find my teamSlug, databaseId and tableSlug?
Body parameter
With the filter
parameter, you select the subset (filter) of records that you wish to delete. The filter
is an object Filter Object with its keys being either a RecordFilterConditionAnd or a RecordFilterConditionOr.
{
"filter": {
"and": [
{
"key": "{FIELD TO SELECT THE RECORDS TO DELETE}",
"operator": "{OPERATOR}",
"value": "{VALUE TO SELECT THE RECORDS TO DELETE}"
}
]
}
}
For our example to delete the following Record.
company_name | budget | deal_date |
---|---|---|
Future Enterprises | 60000 | 2023-08-18 |
For this example, we chose to use the company_name
has the Field to apply the filter on. Most often, you might use an Unique Identifier (ID) Field.
{
"filter": {
"and": [
{
"key": "company_name",
"operator": "equal",
"value": "Future Enterprises"
}
]
}
}
Make the API request
cURL
To make the HTTP request directly using cURL:
- Open a Terminal window.
- Replace the following placeholders in the cURL template below with your own values.
- In the URL:
{YOUR_TEAM_SLUG}
{YOUR_DATABASE_ID}
{YOUR_TABLE_SLUG}
- In the headers:
{YOUR_API_KEY}
for thex-api-key
- In the URL:
- Run the command in your Terminal.
Replace the placeholders with your own values
curl --X POST 'https://{YOUR_TEAM_SLUG}.api.morphdb.io/v0/record/{YOUR_DATABASE_ID}/{YOUR_TABLE_SLUG}/delete' \
--header 'Content-Type: application/json' \
--header 'client-type: widget' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"filter": {
"and": [
{
"key": "{FIELD TO SELECT THE RECORDS TO DELETE}",
"operator": "{OPERATOR}",
"value": "{VALUE TO SELECT THE RECORDS TO DELETE}"
}
]
}
}'
In our example:
curl --X POST 'https://acme.api.morphdb.io/v0/record/dw5g1h89-2637-253k-452b-7803j4x7e3vi/crm_example/delete' \
--header 'Content-Type: application/json' \
--header 'client-type: widget' \
--header 'x-api-key: ms5sCDEOVNuIw92MNA3qLKih4xzY25D9PQY6D7Az2' \
--data '{
"filter": {
"and": [
{
"key": "company_name",
"operator": "equal",
"value": "Future Enterprises"
}
]
}
}'
Response
The Record has been deleted from the Table.
You should see the following successful response in your Terminal:
{
"message": "ok"
}
You can view the new status of your Table in Morph and in the Developer Mode.
In Morph:

CRM Example Table after a single Record has been deleted (Morph)
In the Developer Mode:

CRM Example Table after a single Record has been deleted (Developer Mode)
Debugging
Not the expected result?
Try the following debugging steps.
Delete multiple Records
To delete multiple Records at once using Morph API, you call the Delete Record endpoint.
We will make an API request to the Delete Record endpoint for the CRM Example
Table to delete the following Records:
company_name | budget | deal_date |
---|---|---|
Tech Titans | 82000 | 2023-05-20 |
Global Innovators | 55000 | 2023-06-10 |
Innovative Solutions | 72000 | 2023-07-05 |
Build the request
To build the request, you will need the following parameters.
Headers
- authorization header:
x-api-key: {YOUR_API_KEY}
client-type: widget
Content-Type: application/json
How to get my API Key?
Head to Create an API Key.
Path parameters
teamSlug
databaseId
tableSlug
Where can I find my teamSlug, databaseId and tableSlug?
Body parameter
With the filter
parameter, you select the subset (filter) of records that you wish to delete. The filter
is an object Filter Object with its keys being either a RecordFilterConditionAnd or a RecordFilterConditionOr.
For our example, we use the or
operator to filter the multiple Records that you wish to delete:
{
"filter": {
"or": [ // choice of operators: `and`,`or`
{
"key": "{FIELD TO SELECT THE RECORDS TO DELETE}",
"operator": "{OPERATOR}",
"value": "{VALUE TO SELECT THE RECORDS TO DELETE}"
},
// ONE OR MULTIPLE
{
"key": "{FIELD TO SELECT THE RECORDS TO DELETE}",
"operator": "{OPERATOR}",
"value": "{VALUE TO SELECT THE RECORDS TO DELETE}"
},
]
}
}
For our example to delete the following Records:
company_name | budget | deal_date |
---|---|---|
Tech Titans | 82000 | 2023-05-20 |
Global Innovators | 55000 | 2023-06-10 |
Innovative Solutions | 72000 | 2023-07-05 |
For this example, we chose to use the company_name
has the Field to apply the filter on. Most often, you might use an Unique Identifier (ID) Field.
{
"filter": {
"or": [
{
"key": "company_name",
"operator": "equal",
"value": "Innovative Solutions"
},
{
"key": "company_name",
"operator": "equal",
"value": "Global Innovators"
},
{
"key": "company_name",
"operator": "equal",
"value": "Tech Titans"
}
]
}
}
Make the API request
cURL
To make the HTTP request directly using cURL:
- Open a Terminal window.
- Replace the following placeholders in the cURL template below with your own values.
- In the URL:
{YOUR_TEAM_SLUG}
{YOUR_DATABASE_ID}
{YOUR_TABLE_SLUG}
- In the headers:
{YOUR_API_KEY}
for thex-api-key
- In the URL:
- Run the command in your Terminal.
Replace the placeholders with your own values
curl --X POST 'https://{YOUR_TEAM_SLUG}.api.morphdb.io/v0/record/{YOUR_DATABASE_ID}/{YOUR_TABLE_SLUG}/delete' \
--header 'Content-Type: application/json' \
--header 'client-type: widget' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"filter": {
"or": [ // choice of operators: `and`,`or`
{
"key": "{FIELD TO SELECT THE RECORDS TO DELETE}",
"operator": "{OPERATOR}",
"value": "{VALUE TO SELECT THE RECORDS TO DELETE}"
},
// ONE OR MULTIPLE
{
"key": "{FIELD TO SELECT THE RECORDS TO DELETE}",
"operator": "{OPERATOR}",
"value": "{VALUE TO SELECT THE RECORDS TO DELETE}"
},
]
}
}'
In our example (with mock values for Database Id and API Key):
curl --X POST 'https://acme.api.morphdb.io/v0/record/dw5g1h89-2637-253k-452b-7803j4x7e3vi/crm_example/delete' \
--header 'Content-Type: application/json' \
--header 'client-type: widget' \
--header 'x-api-key: ms5sCDEOVNuIw92MNA3qLKih4xzY25D9PQY6D7Az2' \
--data '{
"filter": {
"or": [
{
"key": "company_name",
"operator": "equal",
"value": "Innovative Solutions"
},
{
"key": "company_name",
"operator": "equal",
"value": "Global Innovators"
},
{
"key": "company_name",
"operator": "equal",
"value": "Tech Titans"
}
]
}
}'
Response
The Records have been deleted from the Table.
You should see the following successful response in your Terminal:
{
"message": "ok"
}
You can view the new status of your Table in Morph and in the Developer Mode.
In Morph:

CRM Example Table after multiple Records have been deleted (Morph)
In the Developer Mode:

CRM Example Table after multiple Records have been deleted (Developer Mode)
Debugging
Not the expected result?
Try the following debugging steps.
Updated 2 months ago