# Deleting multiple records

**URL:** <https://community.postman.com/t/deleting-multiple-records/81000>\
**Category:** Help Hub\
**Tags:** variables, request, datafile\
**Created:** [June 10, 2025, 6:43am UTC](https://community.postman.com/t/deleting-multiple-records/81000 "2025-06-10T06:43:33Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![olgakalach](https://avatars.discourse-cdn.com/v4/letter/o/da6949/32.png) [@olgakalach](https://community.postman.com/u/olgakalach)\
**Post date:** [June 10, 2025, 6:43am UTC](https://community.postman.com/t/deleting-multiple-records/81000/1 "2025-06-10T06:43:33Z")

</div>

Sorry if this is a very basic question; I’m very new to APIs. I have an API call that deletes a record, but it only deletes one record at a time, and then I have to manually add the next id. I have a long list of IDs. ☹ How can I loop through the delete routine? Do I do that in Flows? I tried to create a flow, and it works if I add only one id but it doesn’t work for 2 or more ids. Are you able to share a screenshot of how such a flow is supposed to look like? I tried to find a tutorial on how to do it but didn’t manage to.

---

<div class="post-metadata">

**Author:** ![docking-module-expl5](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@docking-module-expl5](https://community.postman.com/u/docking-module-expl5)\
**Post date:** [June 10, 2025, 7:15am UTC](https://community.postman.com/t/deleting-multiple-records/81000/2 "2025-06-10T07:15:30Z")

</div>

i always pass the ids in the string format … while deleting i separate the each ids with that string using the _**( , comma separate)**_ and run the for loop

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/7/c/7c7b42d6f020ce42817226cd60c74c576456f45c.png)

i know it’s not the right way but still work for me

_ **in the code i do this :** _

```auto
     $idString = $request->query('id'); // "1,2,3"

    // Convert comma-separated string to array
    $ids = explode(',', $idString); // ['1', '2', '3']

    // Optionally convert to integers
    $ids = array_map('intval', $ids); // [1, 2, 3]

```

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [June 10, 2025, 7:56am UTC](https://community.postman.com/t/deleting-multiple-records/81000/3 "2025-06-10T07:56:37Z")

</div>

This is entirely dependent on the implementation of that particular API. Not all API are the same and accept a comma separated list of values in a query param.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [June 10, 2025, 8:03am UTC](https://community.postman.com/t/deleting-multiple-records/81000/4 "2025-06-10T08:03:25Z")

</div>

Hey @olgakalach 👋🏻

Welcome to the Postman Community :postman:

It sounds like using a data file and the Collection Runner with help here.

> **[Run collections using imported data | Postman Docs](https://learning.postman.com/docs/collections/running-collections/working-with-data-files/#csv-file-format)**
>
> Postman is a collaboration platform for API development. Postman's features simplify each step of building an API and streamline collaboration so you can create better APIs—faster.

You have a list of IDs already, what format are those in?

If you create a CSV file, add a heading as the _variable_ key, this is referenced in the request, and then place all your IDs under that header.

You can then replace the hardcoded Id in the request with the variable name from the data file `{{csv_heading_name}}`.

Using the Collection Runner, it will iterate through the list one by one and delete the records.

---

<div class="post-metadata">

**Author:** ![olgakalach](https://avatars.discourse-cdn.com/v4/letter/o/da6949/32.png) [@olgakalach](https://community.postman.com/u/olgakalach)\
**Post date:** [June 11, 2025, 6:15am UTC](https://community.postman.com/t/deleting-multiple-records/81000/5 "2025-06-11T06:15:27Z")

</div>

Thanks a lot, Srushti and Danny. My ids look like this: 3aa023a5-9b52-4420-9ba3-68f1d84b16dk. I will give a try to your suggestions over the next few days. I appreciate your help!

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [June 11, 2025, 6:16am UTC](https://community.postman.com/t/deleting-multiple-records/81000/6 "2025-06-11T06:16:39Z")

</div>

What does the full request URL look like?

Or the part of the request that takes the id?

---

<div class="post-metadata">

**Author:** ![olgakalach](https://avatars.discourse-cdn.com/v4/letter/o/da6949/32.png) [@olgakalach](https://community.postman.com/u/olgakalach)\
**Post date:** [June 11, 2025, 6:20am UTC](https://community.postman.com/t/deleting-multiple-records/81000/7 "2025-06-11T06:20:26Z")

</div>

It looks like this: DEL {{baseUrl}}/coursereserves/courselistings/3aa023a5-9b52-4420-9ba3-68f1d84b16dk but that deletes only one record at a time.

---

<div class="post-metadata">

**Author:** ![bpricilla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/bpricilla/32/6511_2.png) [@bpricilla](https://community.postman.com/u/bpricilla)\
**Post date:** [June 11, 2025, 7:06am UTC](https://community.postman.com/t/deleting-multiple-records/81000/8 "2025-06-11T07:06:04Z")

</div>

@olgakalach, Welcome to the Community 🙂

Yes you can try the options suggested above. If you haven’t checked with your developer (if it’s an internal API), ask if there’s any other endpoint for deleting multiple entries. Or if there’s any API documentation, it’s worth checking again 🙂

If you have tried these already, then “Data driven” is the simplest way!

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [June 11, 2025, 10:15am UTC](https://community.postman.com/t/deleting-multiple-records/81000/9 "2025-06-11T10:15:00Z")

</div>

You would have your datafile of `ids` in a csv file:

 ![Screenshot 2025-06-11 at 11.08.52](https://us1.discourse-cdn.com/getpostman/original/3X/a/0/a0336d54c843da951bf77695e5d3e0960b8f568e.png)

You would then have your request but with a variable placeholder in the URL:

 ![Screenshot 2025-06-11 at 11.10.44](https://us1.discourse-cdn.com/getpostman/original/3X/8/6/862c467add383972944f12d5edca84cb708f3cf6.png)

Open the Collection Runner and add the datafile, this will show you a preview:

 ![Screenshot 2025-06-11 at 11.11.45](https://us1.discourse-cdn.com/getpostman/original/3X/2/7/2704fc1c046063f06c0eb282efa9b221676a605e.png)

Then Run the Collection and the request will iterate through the datafile of `ids`

 ![Screenshot 2025-06-11 at 11.12.08](https://us1.discourse-cdn.com/getpostman/original/3X/0/c/0c60f85bd39908f5d1a78af284889359de08bacd.png)

---

<div class="post-metadata">

**Author:** ![olgakalach](https://avatars.discourse-cdn.com/v4/letter/o/da6949/32.png) [@olgakalach](https://community.postman.com/u/olgakalach)\
**Post date:** [June 12, 2025, 5:19am UTC](https://community.postman.com/t/deleting-multiple-records/81000/10 "2025-06-12T05:19:05Z")

</div>

That worked! Thank you so much, Danny!!!

---

<div class="post-metadata">

**Author:** ![docking-module-expl5](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@docking-module-expl5](https://community.postman.com/u/docking-module-expl5)\
**Post date:** [June 12, 2025, 5:33am UTC](https://community.postman.com/t/deleting-multiple-records/81000/11 "2025-06-12T05:33:13Z")

</div>

I learn something new too thank you!! @danny-dainton👍 🤗
