# Kibana APM sourcemaps delete all

**URL:** <https://discuss.elastic.co/t/kibana-apm-sourcemaps-delete-all/315681>\
**Category:** APM\
**Tags:** rum\
**Created:** [October 3, 2022, 11:26am UTC](https://discuss.elastic.co/t/kibana-apm-sourcemaps-delete-all/315681 "2022-10-03T11:26:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkf1](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@mkf1](https://discuss.elastic.co/u/mkf1)\
**Post date:** [October 3, 2022, 11:26am UTC](https://discuss.elastic.co/t/kibana-apm-sourcemaps-delete-all/315681/1 "2022-10-03T11:26:01Z")

</div>

Hi,

I have uploaded many sourcemaps to Kibana/APM at /api/apm/sourcemaps.

I know you can delete them using curl like it says here: [RUM source map API | Kibana Guide [8.4] | Elastic](https://www.elastic.co/guide/en/kibana/current/rum-sourcemap-api.html#rum-sourcemap-delete)

But is there anyway to delete all of them at the same time? Complete removal of all sourcemaps

---

<div class="post-metadata">

**Author:** ![Alberto\_Delgado](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alberto_delgado/32/98488_2.png) [@Alberto\_Delgado](https://discuss.elastic.co/u/Alberto_Delgado)\
**Post date:** [October 3, 2022, 2:36pm UTC](https://discuss.elastic.co/t/kibana-apm-sourcemaps-delete-all/315681/2 "2022-10-03T14:36:41Z")

</div>

Hi @mkf1,

Thanks for reaching out!

We don't have an endpoint to remove all sourcemaps at once.

You will need to do it programmatically. For example (node.js script):

```auto
const fs = require('fs')
const { request } = require('undici')

const auth = "ApiKey YOUR_API_KEY_HERE"

function getAllSourceMaps() {
    return request('http://localhost:5601/api/apm/sourcemaps', {
        headers: {
            "kbn-xsrf": true,
            Authorization: auth
        }
    })
    .then(( { body }) => body.json())
}

async function removeAllSourceMaps() {
    const { artifacts: sourceMaps } = await getAllSourceMaps()
    for (const sourceMap of sourceMaps) {
        await request(`http://localhost:5601/api/apm/sourcemaps/${sourceMap.id}`, {
            method: 'DELETE',
            headers: {
                Authorization: auth,
                "kbn-xsrf": true,
                "content-type": "application/json"
            }
        })
    }
}

removeAllSourceMaps()
    .then(() => {
        console.log("All sourcemaps have been removed")
    })
    .catch((err) => {
        console.log("Something went wrong while removing sourcemaps", err)
    })

```

Make sure you use your own [API Key](https://www.elastic.co/guide/en/kibana/master/api-keys.html) and that the endpoint points to your Kibana.

Let me know if this helps you.

Thanks,  
Alberto

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 25, 2022, 3:00am UTC](https://discuss.elastic.co/t/kibana-apm-sourcemaps-delete-all/315681/4 "2022-10-25T03:00:16Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
